/* ==========================================================================
   Site header + navigation — acorns-style mega-menu
   Mobile-first: off-canvas drawer < 1500px, horizontal bar >= 1500px
   ========================================================================== */

/* --- Top announcement bar --- */
.topbar {
    background: var(--brand);
    color: rgba(255,255,255,0.92);
    font-size: var(--fs-300);
    font-weight: 500;
}
.topbar__inner {
    display: flex; align-items: center; justify-content: center;
    gap: var(--sp-4); padding-block: var(--sp-2); text-align: center;
}
.topbar a { color: var(--orange-300); text-decoration: none; font-weight: 700; }
.topbar a:hover { text-decoration: underline; }

/* --- Header shell --- */
.site-header {
    position: sticky; top: 0; z-index: var(--z-header);
    background: rgba(255,255,255,0.94);
    backdrop-filter: saturate(150%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--sp-4); min-height: 84px;
}

/* --- Logo --- */
.brand-logo { display: inline-flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.brand-logo img {
    height: 88px; width: auto; max-width: 200px;
    object-fit: contain; image-rendering: -webkit-optimize-contrast;
}
@media (max-width: 575.98px) {
    .header-inner { min-height: 72px; }
    .brand-logo img { height: 56px; }
}
@media (max-width: 380px) {
    .brand-logo img { height: 48px; }
}

/* --- Nav toggle (hamburger) --- */
.nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--tap-min); height: var(--tap-min);
    border-radius: var(--r-sm); color: var(--brand); flex-shrink: 0;
}
.nav-toggle:hover { background: var(--green-050); }
.nav-toggle svg { width: 28px; height: 28px; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

/* --- Nav links --- */
.nav-list { list-style: none; padding: 0; margin: 0; }
.nav-link {
    display: flex; align-items: center; gap: 4px;
    min-height: var(--tap-min);
    padding: var(--sp-3) var(--sp-3);
    color: var(--ink); text-decoration: none;
    font-weight: 600; font-size: var(--fs-400);
    border-radius: var(--r-sm);
    background: none; border: none; cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--brand); }
.nav-caret { width: 16px; height: 16px; flex-shrink: 0; transition: transform var(--dur-fast) var(--ease); }

/* ==========================================================================
   MOBILE / TABLET / SMALLER DESKTOP (< 1500px): off-canvas drawer
   ========================================================================== */
@media (max-width: 1499.98px) {
    .primary-nav {
        position: fixed;
        top: 0; right: 0; bottom: 0;
        height: 100vh;
        height: 100dvh;
        width: min(88vw, 380px);
        background: #fff; box-shadow: var(--shadow-lg);
        transform: translateX(100%);
        transition: transform var(--dur-mid) var(--ease-out);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: var(--sp-5) var(--sp-4) var(--sp-8);
        z-index: var(--z-overlay);
        display: flex; flex-direction: column; gap: var(--sp-1);
    }
    .primary-nav.is-open { transform: translateX(0); }
    .nav-list { display: flex; flex-direction: column; gap: 2px; }
    .nav-link { font-size: var(--fs-500); border-bottom: 1px solid var(--border); border-radius: 0; justify-content: space-between; width: 100%; }

    /* Mega becomes an accordion */
    .mega { display: none; padding: var(--sp-2) 0 var(--sp-3) var(--sp-3); }
    .has-mega.is-expanded .mega { display: block; }
    .has-mega.is-expanded .nav-caret { transform: rotate(180deg); }
    .mega__inner { display: flex; flex-direction: column; gap: 0; }
    .mega__item {
        display: flex; flex-direction: column; padding: var(--sp-3);
        text-decoration: none; border-radius: var(--r-sm);
        border-bottom: 1px solid var(--border);
    }
    .mega__item:hover { background: var(--green-050); }
    .mega__title { font-weight: 600; color: var(--ink); }
    .mega__desc { font-size: var(--fs-300); color: var(--text-muted); }

    .nav-backdrop {
        position: fixed; inset: 0; background: rgba(7,84,43,0.45);
        opacity: 0; visibility: hidden;
        transition: opacity var(--dur-mid) var(--ease);
        z-index: var(--z-overlay);
    }
    .nav-backdrop.is-open { opacity: 1; visibility: visible; }

    /* Translate sits in the drawer, full-width */
    .nav-extras { width: 100%; margin-top: var(--sp-4); }
    .translate-toggle { width: 100%; justify-content: center; border: 1px solid var(--border); }
    .lang-menu { position: static; box-shadow: none; width: 100%; }
}

/* ==========================================================================
   DESKTOP (>= 1500px): horizontal bar + mega dropdown
   ========================================================================== */
@media (min-width: 1500px) {
    .nav-toggle, .nav-backdrop { display: none; }

    /* Header breaks out of the 1200px container so it uses the full viewport. */
    .site-header .container {
        max-width: none;
        padding-inline: clamp(1rem, 2vw, 2rem);
    }

    .header-inner { gap: var(--sp-4); flex-wrap: nowrap; justify-content: flex-start; }

    .primary-nav {
        display: flex; align-items: center;
        flex: 1 1 auto; min-width: 0;
        gap: var(--sp-3);
    }

    /* Menu starts right after the logo — does NOT grow to fill space */
    .nav-list {
        display: flex; align-items: center;
        gap: 2px;
        flex: 0 1 auto;
        flex-wrap: nowrap;
        min-width: 0;
    }
    .nav-link { padding: var(--sp-3) var(--sp-2); font-size: 0.9rem; }

    /* Translate pinned to the far right */
    .nav-extras { margin-left: auto; flex-shrink: 0; }

    .has-mega { position: relative; }

    /* The mega panel — aligns under its trigger */
    .mega {
        position: absolute; top: calc(100% + 2px); left: 0;
        transform: translateY(8px);
        min-width: 460px;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: var(--r-lg);
        box-shadow: var(--shadow-lg);
        padding: var(--sp-3);
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
        z-index: 50;
    }
    .has-mega:hover .mega,
    .has-mega:focus-within .mega,
    .has-mega .nav-link--trigger[aria-expanded="true"] + .mega {
        opacity: 1; visibility: visible; pointer-events: auto;
        transform: translateY(0);
    }
    .has-mega:hover .nav-caret,
    .has-mega:focus-within .nav-caret { transform: rotate(180deg); }

    .has-mega--wide .mega { min-width: 520px; }

    /* The last two dropdowns open rightward so they don't spill off-screen */
    .nav-list > .has-mega:nth-last-child(-n+2) .mega { left: auto; right: 0; }

    .mega__inner {
        display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
    }
    .mega__item {
        display: flex; flex-direction: column; gap: 2px;
        padding: var(--sp-3) var(--sp-4);
        text-decoration: none; border-radius: var(--r-md);
        transition: background var(--dur-fast) var(--ease);
    }
    .mega__item:hover { background: var(--green-050); }
    .mega__title { font-weight: 700; color: var(--ink); font-size: var(--fs-400); }
    .mega__item:hover .mega__title { color: var(--brand); }
    .mega__desc { font-size: var(--fs-300); color: var(--text-muted); }
}

/* Narrow desktops (1500–1700px): shrink logo + text so nothing clips */
@media (min-width: 1500px) and (max-width: 1700px) {
    .brand-logo img { height: 64px; }
    .nav-link { font-size: 0.85rem; }
}

/* ==========================================================================
   Translate — globe + flag dropdown
   ========================================================================== */
.nav-extras { position: relative; display: inline-flex; align-items: center; }
.translate-toggle {
    display: inline-flex; align-items: center; gap: 2px;
    background: none; border: none; cursor: pointer;
    color: var(--ink); padding: var(--sp-2);
    border-radius: var(--r-sm); min-height: var(--tap-min);
}
.translate-toggle:hover { color: var(--brand); background: var(--green-050); }
.translate-toggle:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.translate-toggle .nav-caret { width: 14px; height: 14px; }

.lang-menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    padding: var(--sp-2); z-index: 60; min-width: 180px;
    display: flex; flex-direction: column; gap: 2px;
}
.lang-menu.is-hidden { display: none; }
.lang-menu__item {
    display: flex; align-items: center; gap: var(--sp-3);
    width: 100%; padding: var(--sp-2) var(--sp-3);
    background: none; border: none; cursor: pointer;
    border-radius: var(--r-sm); font-size: var(--fs-400);
    font-weight: 600; color: var(--ink); text-align: left;
}
.lang-menu__item:hover { background: var(--green-050); color: var(--brand); }
.lang-menu__flag { width: 24px; height: 16px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }

/* Tame GTranslate's injected banner / body offset */
.goog-te-banner-frame, .skiptranslate.goog-te-banner-frame { display: none !important; }
body { top: 0 !important; }
