/* ============================================================
 * TT-001-A — shared site nav component
 * Depends ONLY on web/static/css/globals.css tokens (--primary-color,
 * --accent-primary, --border-color, --primary-light, --bg-polar,
 * --text-color, --font-heebo, --font-ibm). Do NOT reference Tailwind,
 * custom.css, main.css, or style.css from this file -- consumer pages
 * load wildly different stacks (see tt-001-initial-path-audit.md,
 * inspection note 3) and this component must render correctly on all
 * of them, including pages that load none of those at all.
 *
 * TT-001-E bugfix round: all rem units converted to px (at the POC's
 * 16px base) -- consumer roots disagree (html font-size is 20px on
 * home/blog/base-family, 16px on shop/game), so rem sizing rendered
 * the same drawer 25% larger on some pages. px pins the approved POC
 * look everywhere. Link rules also carry explicit border/decoration/
 * line-height resets: blog's stylesheet stack styles bare `a` with
 * dotted border-bottoms and tall line-heights that leaked in.
 *
 * Visual reference: scratch/new_nav/ (approved POC pages, 2026-07-18).
 * ============================================================ */

/* ── Trigger: "MENU" label + hamburger, unconditional X-morph ──────────── */
.nav-trigger-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    /* Only the trigger (+ breadcrumbs) sits above the open panel by default.
       Overridable per-page (e.g. the book reader's chrome already sits at
       z 2500-4000 -- see books/reader.css) via these custom properties;
       defaults below reproduce the original hardcoded 80/90/110 exactly. */
    z-index: var(--site-nav-z-trigger, 110);
}
.nav-trigger-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .05em;
    line-height: 1.3;
    color: #182538;
    text-transform: uppercase;
    margin-bottom: 2px;
    font-family: var(--font-ibm);
    transition: color .3s;
}
.nav-trigger {
    width: 40px;
    height: 34px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
}
.nav-trigger span {
    display: block;
    width: 34px;
    height: 4px;
    background: #182538;
    border-radius: 2px;
    transition: transform .3s, opacity .3s, background .3s;
}
.nav-trigger.active span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-trigger.active span:nth-child(2) { opacity: 0; }
.nav-trigger.active span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* On-dark variant (e.g. book reader): light bars/label on a dark page,
   flipping dark once the white panel is open underneath them. */
.site-nav-header-left.site-nav--on-dark .nav-trigger-label { color: var(--primary-light); }
.site-nav-header-left.site-nav--on-dark .nav-trigger span { background: var(--primary-light); }
.site-nav-header-left.site-nav--on-dark .nav-trigger.active span { background: #182538; }
.site-nav-header-left.site-nav--on-dark .nav-trigger-wrap.open .nav-trigger-label { color: #182538; }

/* ── Scrim over the uncovered half of the viewport ──────────────────────── */
.nav-scrim {
    position: fixed;
    inset: 0;
    background: rgba(12, 58, 40, .25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
    z-index: var(--site-nav-z-scrim, 80);
}
.nav-scrim.show { opacity: 1; pointer-events: auto; }

/* ── Panel: half-screen drawer, slides in from the left ─────────────────── */
.nav-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 50vw;
    background: #fff;
    z-index: var(--site-nav-z-panel, 90);
    border-right: 1px solid var(--border-color);
    box-shadow: 8px 0 32px rgba(12, 58, 40, .14);
    padding: 88px 48px 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    font-family: var(--font-heebo);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    transform: translateX(-102%);
    transition: transform .3s ease;
}
.nav-panel.show { transform: translateX(0); }
.nav-panel ul { list-style: none; }
.nav-panel li { margin: 0; padding: 0; border: none; }

/* Quick tier -- grid: Home alone on top, then Shop|Games / Freebies|Blog.
   Row-gap intentionally close to column-gap -- a much smaller row-gap (the
   original 6px) reads as a cramped list despite the wide column-gap,
   since each row's own line-height/padding already separates it from its
   neighbor horizontally but not vertically. */
.nav-quick {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 32px;
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
    padding: 0;
}
.nav-quick li.span-all { grid-column: 1 / -1; }
.nav-quick a {
    display: block;
    text-decoration: none;
    border-bottom: none;
    color: var(--primary-color);
    font-family: var(--font-ibm);
    font-weight: 600;
    font-size: 32px;
    line-height: 1.25;
    padding: 8px 0;
}
.nav-quick a:hover,
.nav-quick a.active {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: none;
}

/* "More" toggle */
.nav-more-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    font-family: var(--font-ibm);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.25;
    opacity: .75;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 32px auto 0;
}
.nav-more-toggle:hover { color: var(--accent-primary); opacity: 1; }
.nav-more-toggle .chev { transition: transform .25s; display: inline-block; }
.nav-more-toggle.open .chev { transform: rotate(180deg); }

/* "More" tier -- 3 columns desktop: Create own | Ready-made | About */
.nav-more {
    display: none;
    margin: 24px auto 0;
    max-width: 640px;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 40px;
}
.nav-more.open { display: grid; }
.nav-more .group { break-inside: avoid; }
.nav-more .group-label {
    font-family: var(--font-ibm);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--primary-color);
    opacity: .6;
    margin: 0 0 8px;
}
.nav-more ul { list-style: none; padding: 0; margin: 0; }
.nav-more a {
    text-decoration: none;
    border-bottom: none;
    color: var(--text-color);
    display: block;
    padding: 5px 0;
    font-size: 15px;
    line-height: 1.45;
}
.nav-more a:hover { color: var(--accent-primary); text-decoration: none; border-bottom: none; }
.nav-more a.active { color: var(--accent-primary); font-weight: 700; }

/* Drawer footer -- logo, pinned to the bottom, links to Home */
.nav-panel-footer {
    margin-top: auto;
    padding-top: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}
/* TT-001-F: equal flex side slots + mirrored alignment keep the logo
   optically centered whatever the label widths ("Sign in" vs "My account").
   Deliberately quieter than the quick tier -- text links, no button chrome. */
.nav-auth-link {
    flex: 1;
    font-family: var(--font-ibm);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: none;
    padding: 12px 4px; /* tap target */
    white-space: nowrap;
}
.nav-auth-left  { text-align: right; }
.nav-auth-right { text-align: left; }
.nav-auth-link:hover { color: var(--accent-primary); text-decoration: none; border-bottom: none; }
.nav-drawer-logo-link {
    display: block;
    text-decoration: none;
    border-bottom: none;
}
.nav-drawer-logo {
    width: 88px;
    height: auto;
    display: block;
}

/* ── Breadcrumbs (desktop only; immersive pages omit them entirely) ────── */
.site-nav-header-left {
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    z-index: var(--site-nav-z-trigger, 110);
}
.site-nav-breadcrumbs {
    font-size: 17px;
    line-height: 1.4;
    /* Nudge down so the text baseline sits on the hamburger's middle bar --
       the MENU label above the button shifts the flex-center upward. */
    position: relative;
    top: 7px;
    font-family: var(--font-heebo);
    white-space: nowrap;
}
.site-nav-breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: none;
}
.site-nav-breadcrumbs a:hover { color: var(--accent-primary); text-decoration: none; }
.site-nav-breadcrumbs .sep { opacity: .5; margin: 0 4px; }
.site-nav-breadcrumbs .ellipsis { opacity: .5; cursor: default; }
.site-nav-breadcrumbs .current,
.site-nav-breadcrumbs a.trunc {
    display: inline-block;
    max-width: min(20ch, 28vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}
.site-nav-breadcrumbs .current { font-weight: 600; color: var(--primary-color); }

/* ── Sitewide footer ─────────────────────────────────────────────────────── */
/* Mounted OUTSIDE the boxed wrap (bug round 2): a full-viewport band
   mirroring the full-width top header; no margin -- it sits snug under
   the content box. */
.linguwhee-footer {
    background: var(--bg-polar);
    border-top: 1px solid var(--border-color);
}
/* TT-001-E bugfix: inner tracks the page's 1440px boxed content (was 1000px,
   which read as oversized side margins inside the box). */
.linguwhee-footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 40px 24px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    font-family: var(--font-heebo);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
}
.linguwhee-footer h2 {
    font-family: var(--font-ibm);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--primary-color);
    opacity: .7;
    margin: 0 0 11px;
}
.linguwhee-footer p { font-size: 14px; line-height: 1.6; margin: 0; }
.linguwhee-footer a { color: var(--primary-color); text-decoration: none; border-bottom: none; }
.linguwhee-footer a:hover { color: var(--accent-primary); text-decoration: none; }
.linguwhee-footer ul { list-style: none; font-size: 14px; padding: 0; margin: 0; }
.linguwhee-footer li { padding: 3px 0; }
/* "Find us" hugs the band's right edge (owner callout, bug round 2) */
.linguwhee-footer-findus { justify-self: end; text-align: right; }
.linguwhee-footer-copyright {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border-color);
    padding-top: 19px;
    font-size: 12px;
    opacity: .65;
}
.linguwhee-footer-admin-link { color: var(--primary-color); font-weight: 600; opacity: 1; }

/* ── Mobile: panel full-width, quick grid + More stack, breadcrumbs hidden ── */
@media (max-width: 768px) {
    .site-nav-breadcrumbs { display: none; }
    .nav-panel {
        width: 100vw;
        border-right: none;
        padding: 80px 24px 32px;
    }
    .nav-quick { grid-template-columns: 1fr; gap: 14px; }
    .nav-quick a { font-size: 26px; padding: 7px 0; }
    .nav-more { grid-template-columns: 1fr; gap: 19px; text-align: center; }
    .nav-drawer-logo { width: 56px; }
    /* TT-001-F: stack -- logo stays the top anchor, links beneath, >=44px taps */
    .nav-panel-footer { flex-direction: column; gap: 4px; padding-top: 32px; }
    .nav-drawer-logo-link { order: -1; margin-bottom: 12px; }
    .nav-auth-left, .nav-auth-right { text-align: center; }
    .nav-auth-link { flex: 0 0 auto; padding: 11px 16px; }
}

@media (max-width: 640px) {
    .linguwhee-footer-inner { grid-template-columns: 1fr; gap: 24px; }
    /* single column: right alignment reads as detached -- back to left */
    .linguwhee-footer-findus { justify-self: stretch; text-align: left; }
}
