/* ============================================================
   shared/chrome.css — chrome rules shared by play and admin pages.
   ============================================================
   Loaded BEFORE the page-specific style.css / admin.css so the
   cascade lets pages override anything page-specific.

   Quiz pages have their own .quiz-* prefixed chrome and do NOT
   load this file.

   Play and admin chrome are now visually identical except admin
   overrides --header-accent to a danger-red shade — producing a
   red strip under the purple header (and on the hamburger
   dropdown) instead of the play-side green. That single CSS var
   is the only intentional visual difference between the two.

   What's here:
     - Site-wide design tokens (--primary-purple, accents, etc.)
     - Sticky-footer flex layout (body / main)
     - .site-header bar — background, sticky, accent border
     - Header content layout (.container, logo, divider, title,
       spacer)
     - Nav links — works for both play (.nav-links) and admin
       (.admin-nav). Active state uses the green pill on both.
     - Theme switch (full set, unified sizing)
     - Hamburger button + open-X transforms + narrow-viewport
       trigger + dropdown panel
     - Footer base
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
    --primary-purple: #4a148c;
    --accent-green:   #00873c;
    --accent-teal:    #0097a7;
    --accent-magenta: #c2185b;

    /* Strip under the header bar. Play uses green; admin overrides
       to a danger-red shade in admin.css's :root. */
    --header-accent:  var(--accent-green);

    --bg-light:       #f5f3f8;
    --text-dark:      #1a1a2e;
    --text-muted:     #5a5470;
    --border-soft:    #e0d8f0;
    --radius:         12px;
    --radius-sm:      6px;
}

/* ── Sticky-footer flex column ──────────────────────────────── */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main { flex: 1; }

/* ── Site header ────────────────────────────────────────────── */
.site-header {
    background: var(--primary-purple);
    border-bottom: 3px solid var(--header-accent);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 8px;
    padding-bottom: 8px;
    flex-wrap: wrap;
}

.nav-logo {
    height: 44px;
    width: auto;
    flex-shrink: 0;
}

.header-divider {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.header-title {
    font-family: 'Montserrat', system-ui, sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: white;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.3px;
}

.header-spacer { flex: 1; }

/* ── Nav links ──────────────────────────────────────────────────
   Selector intentionally covers both:
     - play markup:  <ul class="nav-links">  <li><a>...
     - admin markup: <nav class="admin-nav"> <a>...
   list-style is harmless on the <nav>; padding/margin reset is
   meaningful for the <ul>. */
.nav-links,
.admin-nav {
    list-style: none;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
}

.nav-links a,
.admin-nav a {
    text-decoration: none;
    color: rgba(255,255,255,0.82);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 20px;
    transition: background 0.18s, color 0.18s;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.nav-links a:hover,
.admin-nav a:hover {
    background: rgba(255,255,255,0.12);
    color: white;
}

/* Active item gets the green pill on BOTH play and admin. */
.nav-links a.active,
.admin-nav a.active {
    background: var(--accent-green);
    color: white;
}

/* ── Theme switch ──────────────────────────────────────────── */
.theme-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}
.theme-switch input { display: none; }
.switch-icon { font-size: 0.9rem; line-height: 1; }
.switch-track {
    width: 38px;
    height: 22px;
    background: rgba(255,255,255,0.25);
    border-radius: 11px;
    position: relative;
    transition: background 0.25s;
    flex-shrink: 0;
}
.switch-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s;
}
.theme-switch input:checked ~ .switch-track {
    background: rgba(255,255,255,0.4);
}
.theme-switch input:checked ~ .switch-track .switch-knob {
    transform: translateX(16px);
}

/* ── Hamburger nav button ──────────────────────────────────── */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    margin-left: auto;
}
.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: transform 0.22s, opacity 0.22s;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* ── Narrow viewport: hamburger appears, nav becomes dropdown ── */
@media (max-width: 900px) {
    .nav-hamburger { display: flex; }
    .header-spacer { display: none; }

    /* Dropdown panel for the hamburger menu. The id selector covers
       both <ul id="nav-links"> (play) and <nav id="nav-links">
       (admin). The accent strip uses --header-accent so admin gets
       the red treatment automatically. */
    #nav-links {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        background: var(--primary-purple);
        border-top: 2px solid var(--header-accent);
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
        padding: 8px 12px 12px;
        flex-direction: column;
        gap: 4px;
        min-width: 180px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.3);
        z-index: 200;
    }
    #nav-links.open { display: flex; }
    #nav-links a    { display: block; width: 100%; border-radius: 6px; }
    #nav-links li   { width: 100%; }

    /* Header layout when collapsed */
    .site-header { position: sticky; top: 0; }
    .site-header .container { position: relative; flex-wrap: nowrap; }

    /* Theme switch stays visible to the right of the hamburger */
    .theme-switch  { order: 2; margin-left: 8px; }
    .nav-hamburger { order: 1; }
}

/* ── Footer base ───────────────────────────────────────────── */
footer {
    text-align: center;
    padding: 10px 15px;
    font-size: 0.82rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-soft);
    flex-shrink: 0;
}
