/* ============================================================
   Responsive overrides — mobile, tablet
   ============================================================ */

@media (max-width: 1100px) {
    .header-inner { gap: .8rem; }
    .nav a { padding: .5rem .7rem; font-size: .88rem; }
    .blog-layout { grid-template-columns: 240px 1fr; gap: 1.8rem; }
    .contact-layout { grid-template-columns: 320px 1fr; }
    .dashboard-grid { grid-template-columns: 230px 1fr; }
    .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1.5fr; gap: 2rem; }
}

@media (max-width: 900px) {
    /* Mobile header: only logo + toggle. Everything else lives in the slide-down menu. */
    .nav { display: none; }
    .header-actions { display: none; }
    .mobile-toggle { display: inline-flex; }
    .mobile-toggle.is-open .material-symbols-outlined { transform: rotate(90deg); }
    .brand__text { font-size: .95rem; max-width: 200px; }
    .brand img { height: var(--logo-height-mobile); }

    .nav.is-open {
        display: flex;
        position: fixed;
        inset: 78px 0 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg);
        padding: 1.4rem 1.5rem 2rem;
        gap: .25rem;
        border-top: 1px solid var(--border);
        overflow-y: auto;
        z-index: 1100;                /* above the header so it sits on top */
        box-shadow: 0 30px 80px rgba(0,0,0,.35);
        animation: slideDown .28s ease;
    }
    .nav.is-open a {
        padding: 1rem;
        border-radius: 14px;
        font-size: 1.05rem;
        font-weight: 500;
        display: flex; align-items: center; gap: .8rem;
    }
    .nav.is-open a.active {
        background: var(--accent-soft);
        color: var(--accent);
    }

    /* Mobile menu controls block (lang switcher + theme + register CTA) */
    .nav__mobile-controls {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        margin-top: 1.2rem;
        padding-top: 1.4rem;
        border-top: 1px dashed var(--border);
    }
    .nav__mobile-label {
        display: block;
        font-size: .72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .14em;
        color: var(--text-soft);
        margin-bottom: .6rem;
    }
    .nav__mobile-flags {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: .45rem;
    }
    .nav__flag {
        display: inline-flex; align-items: center; gap: .35rem;
        padding: .55rem .65rem !important;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        font-size: .82rem !important;
        justify-content: center;
        color: var(--text);
    }
    .nav__flag img { width: 18px; height: 13px; border-radius: 2px; }
    .nav__flag.is-active {
        background: var(--accent-soft);
        border-color: var(--accent);
        color: var(--accent);
        font-weight: 600;
    }
    .nav__mobile-theme {
        display: flex; align-items: center; gap: .8rem;
        width: 100%;
        padding: .9rem 1rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        color: var(--text);
        font-weight: 500;
        cursor: pointer;
        font-family: inherit;
        font-size: 1rem;
    }
    .nav__mobile-theme .material-symbols-outlined { color: var(--accent); }
    .nav__mobile-cta {
        justify-content: center;
        font-size: 1rem !important;
        background: var(--accent) !important;
        color: #fff !important;
        margin-top: .3rem;
    }

    /* Hero adapts on mobile so stats card never overlaps the CTA buttons. */
    .hero {
        min-height: auto;
        padding: 8.5rem 1.1rem 4rem;
    }
    .hero__inner { max-width: 100%; }
    /* Grid-stacking on .hero-rotator handles vertical sizing; no min-height needed */
    .hero__sub { font-size: .98rem; max-width: 92%; margin-inline: auto; }
    .hero__stats {
        margin-top: 2.2rem;
        padding: 1.1rem;
        gap: .7rem;
    }
    .hero__stats { grid-template-columns: repeat(2, 1fr); }
    .hero__stat-value { font-size: 1.5rem; }
    .hero__scroll { display: none; }

    .home-section,
    .blog-layout,
    .contact-layout,
    .dashboard-grid,
    .auth-shell { grid-template-columns: 1fr; }

    .auth-art-side { min-height: 240px; padding: 3rem 2rem; order: -1; }
    .auth-orbit { width: 180px; height: 180px; margin-bottom: 1.6rem; }
    .auth-form-side { padding: 3rem 1.5rem; }

    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-grid > :first-child { grid-column: 1 / -1; }

    .blog-sidebar { position: static; }
    .dash-side { position: static; }

    .blog-grid { grid-template-columns: 1fr; }

    /* (hero overrides above already cover stats) */

    .form-row { grid-template-columns: 1fr; }

    .results-meta { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
    .container { padding: 0 1.1rem; }
    section { padding: 4rem 0; }
    .lang-current span { display: none; }
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    .footer-foot { flex-direction: column; text-align: center; }
    .btn { padding: .8rem 1.4rem; font-size: .9rem; }
    h1 { font-size: 2.3rem; }
    .hero-phrase { font-size: 1.95rem; line-height: 1.18; }
    .hero__stats { grid-template-columns: 1fr; padding: .9rem; gap: .55rem; }
    .hero__stats .hero__stat { display: flex; align-items: baseline; justify-content: space-between; padding: .4rem .6rem; background: rgba(255,255,255,.05); border-radius: 10px; }
    .hero__stats .hero__stat-value { font-size: 1.2rem; }
    .hero__stats .hero__stat-label { font-size: .72rem; }
    .hero__sub { font-size: .98rem; }
    .brand__text { max-width: 160px; font-size: .88rem; }
    .blog-grid { grid-template-columns: 1fr; }
    .results-meta { grid-template-columns: 1fr; }
    #results-chart { height: 280px; }
    .course-card__foot { flex-direction: column; align-items: flex-start; gap: .8rem; }
    .nav__mobile-flags { grid-template-columns: repeat(2, 1fr); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
