/* ==========================================================================
   Brand surface — the palette, the shared form controls and the shared chrome
   treatment, loaded ahead of home.css / auth.css / dashboard.css / event.css /
   guest.css by those controllers' pageStyles. app.css alone still dresses
   anything that doesn't opt in.

   This file exists so the dressed pages can't drift apart. The palette started
   out declared inside home.css; the moment a second page wanted the same night
   field, keeping a copy in each file guaranteed that a tweak to one would
   eventually not reach the other. The same later happened to the field styling
   in auth.css.

   Nothing here paints anything on its own — the tokens are inert until a page
   uses them, and the blocks below only match pages that opt in by carrying the
   matching wrapper class.
   ========================================================================== */

/* Tokens sit on :root rather than on the page wrapper: the header and footer
   are siblings of <main>, so a token declared on .home or .auth would not
   inherit down to them and every colour in the chrome block below would
   resolve to nothing. They're namespaced --h-* and used by no other page, so
   living at the root costs nothing. */
:root {
    /* Night field: the landing page's hero/showcase/closer bands, and the
       auth pages' brand panel. */
    --h-night: #17121e;
    --h-night-2: #221a2d;
    /* Masthead tone — the header and the top edge of whatever sits beneath it
       share this exactly, so the two meet with no seam and the chrome reads as
       part of the page rather than a bar bolted above it. */
    --h-night-3: #1d1626;
    --h-cream: #f7f1ec;
    --h-dim: #a99bb2;

    /* Daylight field: the landing page's explanatory bands, and the auth
       pages' form column. */
    --h-paper: #fbf7f4;
    --h-ink: #201a29;
    --h-muted: #6f6577;

    /* The two answers. Saturated versions of the app's girl/boy tokens —
       --color-girl is too pale to hold up against the night field. */
    --h-blush: #f2789f;
    --h-sky: #58a7e8;
    /* Lighter blush for a :hover background under dark-ink text (below) —
       was a literal duplicated in .btn-primary:hover until app.css's
       generic .btn/.share-btn-primary needed the same treatment. */
    --h-blush-hover: #f58fae;
    /* --h-blush itself fails as TEXT on light backgrounds (~2.6:1 on white,
       ~2.9:1 on paper — see the landing-page eyebrow note below). This is
       the same hue (340°) darkened until it clears 4.5:1 on both --h-paper
       and white, for links/small print that need to read as "the app's
       pink" without being a background. */
    --h-blush-text: #cd144f;

    /* Four stops walking blush -> sky, one per landing-page step marker, so
       the timeline itself shows the guess resolving into an answer. */
    --h-step-1: #f2789f;
    --h-step-2: #c98bb8;
    --h-step-3: #8f9cd6;
    --h-step-4: #58a7e8;

    /* The recurring structural device: the two answers a reveal can have,
       used as the accent under a heading and as a connector. */
    --h-seam: linear-gradient(90deg, var(--h-blush), var(--h-sky));
    /* Same two stops scratch-card.js paints into the canvas, so the foil on a
       static card and the foil on a live one are the same material. */
    --h-foil: linear-gradient(135deg, #d8d8de, #a8a8b2);

    --h-display: 'Rubik', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --h-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Shared layout and interaction scale. Page styles consume these tokens
       while retaining their existing structures and scratch-card geometry. */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --content-workspace: 55rem;
    --content-home: 70rem;
    --content-gutter: clamp(1rem, 3vw, 1.5rem);
    --radius-control: 12px;
    --radius-panel: 20px;
    --radius-pill: 999px;
    --elevation-panel: 0 8px 24px rgba(32, 26, 41, 0.08);
    --elevation-floating: 0 18px 48px rgba(32, 26, 41, 0.16);
    --focus-color: #256fa9;
    --focus-ring: 0 0 0 3px rgba(37, 111, 169, 0.25);

    /* Gameplay fills stay deliberately pale. These darker companions are for
       result text on white/paper and clear WCAG AA at normal text sizes. */
    --outcome-girl-text: #c72f68;
    --outcome-boy-text: #256fa9;
}

/* --------------------------------------------------------------------------
   Form controls — the field treatment shared by every dressed page that has
   a form. It lived in auth.css until the event pages wanted the same look;
   three copies of it would have drifted, which is the same reason the palette
   above is here. Pages still own their own layout (auth's submit button is
   full-width, the event pages' is not) — only the material is shared.
   -------------------------------------------------------------------------- */

:is(.auth, .event-page) label {
    margin: 1.15rem 0 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--h-muted);
}

:is(.auth, .event-page) input[type="text"],
:is(.auth, .event-page) input[type="email"],
:is(.auth, .event-page) input[type="password"],
:is(.auth, .event-page) input[type="date"],
:is(.auth, .event-page) input[type="time"],
:is(.auth, .event-page) select {
    padding: 0.8rem 0.95rem;
    border: 1px solid rgba(32, 26, 41, 0.14);
    min-height: 2.75rem;
    border-radius: var(--radius-control);
    font-family: var(--h-body);
    font-size: 1rem;
    color: var(--h-ink);
    background: #fff;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

:is(.auth, .event-page) input:focus,
:is(.auth, .event-page) select:focus {
    outline: none;
    border-color: var(--h-blush);
    box-shadow: var(--focus-ring);
}

/* Dark ink on blush, not white — white on #f2789f is about 2.6:1 and fails
   contrast, while the ink pairing clears 8:1. */
:is(.auth, .event-page, .dashboard) .btn-primary {
    background: var(--h-blush);
    color: var(--h-night);
    font-family: var(--h-body);
    font-weight: 600;
    transition: background-color 160ms ease, transform 160ms ease;
}

:is(.auth, .event-page, .dashboard) .btn-primary:hover {
    background: var(--h-blush-hover);
    transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
    :is(.auth, .event-page) input,
    :is(.auth, .event-page) select,
    :is(.auth, .event-page, .dashboard) .btn-primary {
        transition: none;
    }

    :is(.auth, .event-page, .dashboard) .btn-primary:hover {
        transform: none;
    }
}

/* Dashboard and both event-management routes use Home's night field as the
   workspace shell. Task content remains on paper in each page stylesheet. */
body:has(:is(.dashboard, .event-page)) {
    background:
        radial-gradient(58% 52% at 88% 6%, rgba(88, 167, 232, 0.18), transparent 62%),
        radial-gradient(58% 52% at 6% 94%, rgba(242, 120, 159, 0.18), transparent 62%),
        linear-gradient(168deg, var(--h-night-2), var(--h-night) 70%);
    background-attachment: fixed;
}

/* --------------------------------------------------------------------------
   Shared chrome — app.css dresses the header and footer for the logged-in
   app, where they sit on paper. On a dressed page they'd be a white bar hard
   against a dark field, so they take the night treatment instead and the page
   starts and ends in one piece.

   The opted-in pages are listed once in the :is() below: public landing,
   auth and guest pages, plus the complete logged-in workspace (dashboard,
   create and manage/edit). All now share one stable chrome treatment.
   -------------------------------------------------------------------------- */

body:has(:is(.home, .auth, .guest, .dashboard, .event-page)) .site-header {
    background: var(--h-night-3);
    border-bottom: none;
}

/* Home's content bands are 1120px wide, so its masthead and footer align to
   those same edges. App workspaces retain the 880px container everywhere
   else. */
body:has(.home) :is(.site-header-inner, .site-footer .container) {
    max-width: var(--content-home);
}

/* .site-nav > a, not .site-nav a: the language dropdown's options
   (.lang-switcher-option) are also <a> descendants of .site-nav, nested
   inside .lang-switcher's details/div, but they must stay on app.css's
   paper popup surface (see the comment below) — a bare descendant
   selector here painted them cream too, making them nearly invisible
   against their own light background. */
body:has(:is(.home, .auth, .guest, .dashboard, .event-page)) :is(.brand, .site-nav > a, .link-button) {
    color: var(--h-cream);
    text-decoration: none;
}

body:has(:is(.home, .auth, .guest, .dashboard, .event-page)) .site-nav > a:is(:hover, :focus-visible) {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}

body:has(:is(.home, .auth, .guest, .dashboard, .event-page)) .lang-switcher-trigger {
    background: rgba(247, 241, 236, 0.08);
    border-color: rgba(247, 241, 236, 0.22);
    color: var(--h-cream);
}

/* The dropdown itself stays on its app.css paper surface — it's a menu, not
   part of the page's field — but its caret is drawn from --color-muted, which
   disappears against the darkened trigger. */
body:has(:is(.home, .auth, .guest, .dashboard, .event-page)) .lang-switcher-trigger::after {
    border-right-color: var(--h-dim);
    border-bottom-color: var(--h-dim);
}

body:has(:is(.home, .auth, .guest, .dashboard, .event-page)) .site-footer {
    background: var(--h-night);
    color: var(--h-dim);
    padding: 2.5rem 0 3rem;
}
