/* === Mobile-friendly defaults === */
html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: #111;
}

img,
video {
    max-width: 100%;
    height: auto;
}

button,
a {
    touch-action: manipulation;
}

/* Header/Footer wrap on small screens */
header,
footer {
    flex-wrap: wrap;
    gap: 10px;
}

/* Bigger tap targets for nav */
nav a {
    display: inline-block;
    margin: 6px 8px;
    /* replaces 0 10px */
    padding: 8px 10px;
    /* NEW: larger tap target */
    text-decoration: none;
    color: #333;
    border-radius: 6px;
}

/* === Index page layout === */
main {
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 30px;
}

.card {
    border: 1px solid #ccc;
    padding: 15px;
    background: #fff;
}

button {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
}

.features {
    margin: 30px auto 10px;
    max-width: 1000px;
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
    padding: 0 16px;
}

.features,
.info-section {
    justify-items: center;
    text-align: center;
}

.feature-box {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);

    /* NEW: keep cards centered and not full-width */
    inline-size: min(100%, 360px);
    /* max width ~360px but responsive */
    justify-self: center;
    /* center each card in its grid cell */
}

.feature-box img,
.feature-emoji {
    grid-area: icon;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    font-size: 28px;
    border-radius: 8px;
}

.feature-box h3 {
    grid-area: title;
    margin: 0;
    font-size: 18px;
}

.feature-box p {
    grid-area: text;
    margin: 4px 0 8px;
    color: #444;
}

.feature-box a {
    grid-area: link;
    text-decoration: none;
    font-weight: 600;
}

.info-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 1000px;
    margin: 50px auto;
    padding: 0 16px;
}

.info-box {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .05);
    text-align: left;
}

.info-box h3 {
    margin-top: 0;
}

.info-box a {
    color: #000;
    text-decoration: none;
    font-weight: 600;
}

.info-box a:hover {
    text-decoration: underline;
}

.info-image {
    width: 120px;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

/* === Responsive breakpoints === */
@media (min-width: 600px) {
    .features {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .features {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .card-container {
        flex-direction: row;
        justify-content: center;
    }
}

@media (min-width: 768px) {
    .info-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small phones: tighter paddings */
@media (max-width: 480px) {

    header,
    footer {
        padding: 10px 12px;
    }

    nav a {
        margin: 4px 6px;
        padding: 8px 8px;
        font-size: 15px;
    }
}


header,
footer {
    background: #eee;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav a {
    margin: 0 10px;
    text-decoration: none;
    color: #333;
}

footer {
    font-size: 12px;
    justify-content: center;
}

.apps-dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .15);
    width: 280px;
    padding: 15px;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    z-index: 1000;
}

.app-item {
    text-align: center;
    font-size: 13px;
}

.app-item img {
    width: 40px;
    height: 40px;
    margin-bottom: 5px;
}

.lang-selector {
    display: inline-block;
    margin-right: 10px;
    text-align: right;
    position: relative;
}

.lang-icon {
    background: #eee;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
}

.lang-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
    width: 70px;
    z-index: 1000;
}

.lang-menu li {
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
}

.lang-menu li:hover {
    background: #f0f0f0;
}

nav a.active img {
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, .3));
}

/* === Courses page (mobile-first) === */
.courses-container {
    margin: 20px auto;
    max-width: 1100px;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr;
    /* 1 column on phones */
    gap: 16px;
    justify-items: center;
    /* center cards in each cell */
}

.course-card {
    inline-size: min(100%, 340px);
    /* centered, not full-width */
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

.course-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.course-content {
    padding: 15px;
}

.course-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 10px;
}

.course-meta {
    font-size: 14px;
    color: #555;
    margin-bottom: 15px;
}

.course-content button {
    background: #000;
    color: #fff;
    border: none;
    padding: 10px;
    width: 100%;
    cursor: pointer;
    font-weight: bold;
}

.course-content button:hover {
    background: #333;
}

/* Breakpoints: 2 cols on tablets, 3 on desktop */
@media (min-width: 600px) {
    .courses-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .courses-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}