/* ============================================
   HEADER / NAVIGATION
   Architectural grid — structural dividers,
   pure white, black type, construction rigidity
   ============================================ */
.header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-fixed);
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    transition: transform 0.35s var(--ease-out-expo),
                background 0.35s ease,
                box-shadow 0.35s ease;
}

/* Thin architectural accent line at very top — only visible on white state */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #000000;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.header--scrolled::before,
.header--subpage::before,
.header:has(.nav__item--mega.is-active)::before {
    opacity: 1;
}

/* Fixed white bar — only shown when scrolling up */
.header--scrolled {
    position: fixed;
    background: #FFFFFF;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-bottom: none;
}

/* Sub-page default */
.header--subpage {
    background: #FFFFFF;
    border-bottom: none;
}

.header--hidden {
    transform: translateY(-100%);
    pointer-events: none;
}

/* Suppress transitions when snapping position silently */
.header--instant {
    transition: none !important;
}

/* White background when a mega menu is open */
.header:has(.nav__item--mega.is-active) {
    background: #FFFFFF;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-bottom: none;
    transition: background 0.1s ease, box-shadow 0.1s ease;
}


/* ---- INNER CONTAINER ----
   CSS Grid with three columns and an explicit row height so child
   percentage heights (like the logo diamond's `height: 80%`) resolve
   correctly. Grid resolves identically in every browser — no flex
   auto-margin interpretation differences across Safari / Chrome. */
.header__inner {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-rows: 76px;
    align-items: stretch;
    gap: 0;
    max-width: 1750px;
    margin: 0 auto;
    padding: 0;
}

.header__actions {
    justify-self: end;
}

@media (min-width: 480px) {
    .header__inner { grid-template-rows: 84px; }
}

@media (min-width: 1024px) {
    .header__inner { grid-template-rows: 96px; }
}

@media (min-width: 1400px) {
    .header__inner { grid-template-rows: 104px; }
}


/* ---- LOGO: Icon + Text ---- */
.header__logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    z-index: 10;
    flex-shrink: 0;
    padding: 0 1.25rem;
    transition: opacity var(--duration-fast) var(--ease-out);
}

@media (min-width: 480px) {
    .header__logo {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .header__logo {
        gap: var(--space-3);
        padding: 0 2rem;
    }
}

@media (min-width: 1400px) {
    .header__logo {
        gap: var(--space-4);
        padding: 0 2.5rem;
    }
}

.header__logo:hover {
    opacity: 0.7;
}

.header__logo-diamond {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80%;
    aspect-ratio: 9 / 10;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 90 100'%3E%3Cpolygon points='45,2 88,50 45,98 2,50' fill='none' stroke='%23FF3B30' stroke-width='5' stroke-linejoin='miter'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
}

.header__logo-icon {
    width: 80%;
    height: 80%;
    object-fit: contain;
    filter: brightness(0);
    transition: filter 0.3s ease;
}

.header__logo-text {
    position: relative;
    font-family: var(--font-body);
    font-weight: 900;
    font-size: clamp(1.6rem, 2.2vw, 2.25rem);
    color: #000000;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    -webkit-text-stroke: 0.5px #000000;
}

/* "USA" suffix tucked into the bottom-right of the wordmark.
   Hidden by default; revealed on the USA page via .header--usa. */
.header__logo-region {
    display: none;
    position: absolute;
    right: -0.45em;
    bottom: -0.25em;
    transform: translateX(100%);
    font-size: 0.42em;
    font-weight: 800;
    letter-spacing: 0.1em;
    line-height: 1;
    color: #000;
    -webkit-text-stroke: 0;
    padding: 0.25em 0.45em;
    border: 1px solid currentColor;
    border-radius: 2px;
}

.header--usa .header__logo-region {
    display: inline-block;
}

/* Mobile: the absolute-positioned badge sits to the right of the wordmark
   and pushes off the right edge of the page on narrow viewports. Inline
   it instead — it flows naturally after "N.SANI" and shrinks to fit. */
@media (max-width: 768px) {
    .header--usa .header__logo-region {
        position: static;
        right: auto;
        bottom: auto;
        transform: none;
        margin-left: 0.45em;
        font-size: 0.48em;
        vertical-align: middle;
    }
}

/* ---- USA flag-color nav link (test treatment) ---- */
.nav__link--usa {
    display: inline-flex;
    align-items: center;
    gap: 0.04em;
    letter-spacing: 0;
    font-weight: 900;
    font-size: 1.45em;
}

.nav__usa-flag {
    width: 1.6em;
    height: auto;
    margin-right: 0.4em;
    border-radius: 1.5px;
    box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.nav__usa-letter {
    font-weight: 900;
}

.nav__usa-letter--r,
.nav__usa-letter--b,
.nav__usa-letter--k { color: #000000; }

/* Default: white over hero. Override below on solid-white header states. */
.header .nav__usa-letter { color: #FFFFFF; }

.header--scrolled  .nav__usa-letter,
.header--subpage   .nav__usa-letter,
.header--menu-open .nav__usa-letter,
.header:has(.nav__item--mega.is-active) .nav__usa-letter { color: #000000; }


/* ---- DESKTOP NAV ----
   Progressive header collapse (hide order as screen shrinks):
     ≥1560px  — lang + CTAs + nav visible
     ≥1360px  — CTAs + nav visible (lang hidden)
     ≥1100px  — nav visible (lang + CTAs hidden)
     <1100px  — logo + hamburger only
*/
.header__nav {
    display: none;
}

@media (min-width: 1100px) {
    .header__nav {
        display: flex;
        align-items: center;
        position: static;
        align-self: stretch;
        /* Nav takes natural content width and sits immediately to the right
           of the logo. The actions container hugs the right edge via its
           existing `margin-left: auto` — that's what absorbs the empty space,
           not a `flex: 1` on the nav stretching it across the viewport. */
        flex: 0 0 auto;
        padding: 0;
    }
}

.nav__list {
    display: flex;
    align-items: center;
    gap: 0;
    pointer-events: auto;
}

.nav__item {
    position: relative;
}

/* Vertical dividers between each nav item */
.nav__item + .nav__item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 22px;
    background: rgba(0, 0, 0, 0.12);
}

/* Reset button defaults so <button> and <a> render identically */
button.nav__link {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: none;
    margin: 0;
    cursor: pointer;
}

.nav__link {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    color: #000000;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    -webkit-text-stroke: 0.5px currentColor;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: opacity var(--duration-base) var(--ease-out);
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
}

@media (min-width: 1400px) {
    .nav__link {
        font-size: 14px;
        padding: 12px 20px;
    }
}

.nav__link:hover {
    opacity: 0.4;
}

.nav__chevron {
    display: none;
}


/* ---- HEADER ACTIONS ---- */
.header__actions {
    display: flex;
    align-items: center;
    gap: 0;
    z-index: 10;
    margin-left: auto;
    flex-shrink: 0;
    /* Vertical divider on the left — structural column */
    border-left: 1px solid rgba(0, 0, 0, 0.12);
}

/* CTA buttons */
.header__cta {
    display: none;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    -webkit-text-stroke: 0.5px currentColor;
    color: #000000;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0;
    padding: 0 clamp(1.25rem, 1.6vw, 2rem);
    height: 100%;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    transition: color var(--duration-base) var(--ease-out),
                background var(--duration-base) var(--ease-out);
    box-shadow: none;
}

@media (min-width: 1400px) {
    .header__cta {
        font-size: 12px;
        padding: 0 2.25rem;
    }
}

.header__cta:hover {
    background: #000000;
    color: #FFFFFF;
    box-shadow: none;
}

.header__cta::before {
    display: none;
}

.header__cta-text {
    position: relative;
    z-index: 1;
}

.header__cta-icon {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    transition: transform var(--duration-base) var(--ease-out);
}

.header__cta:hover .header__cta-icon {
    transform: translateX(3px);
}

@media (min-width: 1360px) {
    .header__cta {
        display: inline-flex;
    }
}

/* Outline variant */
.header__cta--outline {
    background: transparent;
    color: #000000;
    border: none;
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: none;
}

.header__cta--outline:hover {
    background: #000000;
    color: #FFFFFF;
    box-shadow: none;
}


/* ---- LANGUAGE TOGGLE (EN/FR) ----
   Hidden by default; only shown on wide viewports (≥1560px) where
   there's room alongside the nav and both CTAs. A second copy lives
   inside the fullscreen mobile menu (.fs-menu__lang) so the toggle
   remains accessible at every width. */
.header__lang {
    display: none;
    align-items: center;
    height: 100%;
    padding: 0 clamp(0.75rem, 1.2vw, 1.25rem);
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    flex-shrink: 0;
}

@media (min-width: 1560px) {
    .header__inner .header__lang {
        display: inline-flex;
    }
}

.header__lang-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 3px;
    background: #EAEAEA;
    border-radius: 999px;
    z-index: 1;
}

.header__lang-indicator {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: #000000;
    border-radius: 999px;
    transition: transform 520ms cubic-bezier(0.4, 0, 0.1, 1);
    z-index: 0;
}

.header__lang-toggle[data-lang="fr"] .header__lang-indicator {
    transform: translateX(100%);
}

.header__lang-btn {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 100%;
    padding: 0 12px;
    background: transparent;
    border: 0;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    /* Fully opaque dark text — was rgba(0,0,0,0.55) which read as
       faded/transparent next to the white active label. The visual
       hierarchy is preserved by the indicator pill (white text on
       dark indicator vs. dark text on light surface). */
    color: var(--color-text-primary, #32302F);
    cursor: pointer;
    transition: color 260ms var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

/* Invisible hit-area extension — makes the tap target ~44px tall
   without changing the pill's visual size. */
.header__lang-btn::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -14px;
    bottom: -14px;
}

.header__lang-btn.is-active {
    color: #FFFFFF;
}

.header__lang-btn:hover:not(.is-active) {
    /* Already fully opaque at rest; hover is a no-op for color now.
       Kept the rule with the same color value as a self-documenting
       hook in case future hover state (e.g. underline) is added. */
    color: var(--color-text-primary, #32302F);
}

/* ---- HAMBURGER ----
   Plain block button (no display:flex — avoids the iOS WebKit bug where
   flex children inside <button> don't render). Single Unicode glyph
   centered with text-align + line-height. Works in every engine. */
.mobile-menu-toggle {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    border: 0;
    display: block;
    width: 68px;
    height: 76px;
    line-height: 76px;
    text-align: center;
    z-index: 110;
    padding: 0;
    margin: 0;
    color: #000000;
    cursor: pointer;
}

.header--menu-open .mobile-menu-toggle {
    z-index: calc(var(--z-modal) + 10);
}

@media (min-width: 480px) {
    .mobile-menu-toggle { width: 72px; height: 84px; line-height: 84px; }
}

@media (min-width: 1024px) {
    .mobile-menu-toggle { width: 80px; height: 96px; line-height: 96px; }
}

@media (min-width: 1400px) {
    .mobile-menu-toggle { height: 104px; line-height: 104px; }
}

.mobile-menu-toggle__glyph {
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
    color: inherit;
    vertical-align: middle;
}

/* When the fullscreen menu is open, swap ☰ for ✕ via ::before overlay. */
.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle__glyph {
    font-size: 0;
}
.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle__glyph::before {
    content: "✕";
    font-size: 26px;
}


/* ---- HEADER STATE WHEN FULLSCREEN MENU IS OPEN ---- */
/* Hide desktop nav links and CTA buttons when overlay is showing */
.header--menu-open .header__nav,
.header--menu-open .header__cta {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* White background so header blends with the white center column */
.header--menu-open,
.header--menu-open.header--scrolled,
.header--menu-open.header--subpage {
    background: #FFFFFF !important;
    box-shadow: none !important;
    border-bottom-color: transparent !important;
}

/* Keep header visible (not hidden off-screen) while menu is open */
.header--menu-open.header--hidden {
    transform: none !important;
    pointer-events: auto !important;
}


/* ---- FULL-SCREEN MOBILE NAV ---- */
.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    pointer-events: none;
    overflow: hidden;
}

.mobile-nav--open {
    pointer-events: auto;
}

.mobile-nav__bg {
    position: absolute;
    inset: 0;
    background: var(--color-navy-deep);
    opacity: 0;
    transition: opacity var(--duration-slow) var(--ease-out);
}

.mobile-nav--open .mobile-nav__bg {
    opacity: 1;
}

.mobile-nav__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    padding: 80px var(--container-padding) var(--space-8);
}

@media (min-width: 480px) {
    .mobile-nav__content {
        padding: 100px var(--container-padding) var(--space-10);
    }
}

.mobile-nav__list {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-2);
}

.mobile-nav__item {
    overflow: hidden;
}

.mobile-nav__link {
    display: flex;
    align-items: baseline;
    gap: var(--space-4);
    padding: var(--space-3) 0;
    opacity: 0;
    transform: translateY(100%);
    transition: transform 0.6s var(--ease-out-expo),
                opacity 0.6s var(--ease-out-expo),
                color var(--duration-fast) var(--ease-out);
}

.mobile-nav--open .mobile-nav__link {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays */
.mobile-nav__item:nth-child(1) .mobile-nav__link { transition-delay: 0.15s; }
.mobile-nav__item:nth-child(2) .mobile-nav__link { transition-delay: 0.22s; }
.mobile-nav__item:nth-child(3) .mobile-nav__link { transition-delay: 0.29s; }
.mobile-nav__item:nth-child(4) .mobile-nav__link { transition-delay: 0.36s; }
.mobile-nav__item:nth-child(5) .mobile-nav__link { transition-delay: 0.43s; }

.mobile-nav__link:hover {
    color: var(--color-pure-white);
}

.mobile-nav__index {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    color: var(--color-pure-white);
    letter-spacing: var(--tracking-wider);
    min-width: 28px;
    padding-top: 0.3em;
}

.mobile-nav__label {
    font-family: var(--font-body);
    font-size: clamp(2rem, 8vw, 3.5rem);
    font-weight: var(--font-medium);
    color: var(--color-pure-white);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    transition: color var(--duration-fast) var(--ease-out);
}

.mobile-nav__link:hover .mobile-nav__label {
    color: var(--color-pure-white);
}

.mobile-nav__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: var(--space-8);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s var(--ease-out) 0.55s,
                transform 0.5s var(--ease-out) 0.55s;
}

.mobile-nav--open .mobile-nav__footer {
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav__info {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.mobile-nav__info a {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.5);
    transition: color var(--duration-fast) var(--ease-out);
}

.mobile-nav__info a:hover {
    color: var(--color-pure-white);
}

.mobile-nav__social {
    display: flex;
    gap: var(--space-4);
}

.mobile-nav__social a {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.4);
    transition: color var(--duration-fast) var(--ease-out),
                transform var(--duration-fast) var(--ease-out);
}

.mobile-nav__social a:hover {
    color: var(--color-pure-white);
    transform: translateY(-2px);
}
