/* Fonts — bundled, never fetched.
 *
 * Fraunces and Inter, both SIL OFL, both variable so one file covers the whole
 * weight range. Served from /fonts, so the playa box renders identically with
 * the network unplugged — a Google Fonts <link> here would silently fall back
 * to Georgia in the desert, which is the one place it matters.
 *
 * Regenerate by pulling the css2 API with a modern user-agent and copying the
 * unicode-ranges; see src/public/fonts/README.md.
 */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/fraunces-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


/* Design tokens — extracted from the Claude Design project.
 *
 * This is the only file that may contain a raw colour value. Screens reference
 * tokens (05_CONVENTIONS.md guardrail 10). Sun and night are variable swaps on
 * a single root attribute, never duplicated stylesheets.
 *
 * Territory colours are ALSO rows in the `territory` table so an admin can
 * retheme without a code change. The seed writes these same values. The token
 * wins and the API value is the CSS fallback — `var(--t-<key>, <api hex>)` —
 * because the database row holds the sun-mode hex and knows nothing about night
 * mode. See 04_DESIGN_HANDOFF.md.
 */

:root {
  /* --- surfaces & text ------------------------------------------------- */
  --bg: #F7F3EA;
  --card: #EBE3D2;
  --panel: #FFFDF8;
  --ink: #1F1B14;
  --soft: #544C3E;
  --line: #CBBFA8;
  --on: #FFFFFF;

  /* --- territory identities (primary + tint) ---------------------------- */
  --t-tea: #3F5E2E;     --t-tea-t: #D3E0C0;
  --t-prem: #B06A93;    --t-prem-t: #E9CCDD;
  --t-pn: #B4813F;      --t-pn-t: #EDD9BB;
  --t-lk: #D97C7C;      --t-lk-t: #F2C4C4;
  --t-mayor: #4E88C4;   --t-mayor-t: #BCD3EC;
  --t-strike: #77588F;  --t-strike-t: #D4C7E0;
  --t-build: #9A6F2F;   --t-build-t: #E3D0AE;

  /* --- text that sits ON a territory colour -----------------------------
   * A filled seat is the territory's primary colour with the camper's name on
   * top, so the name's colour has to be chosen per territory, not assumed.
   * White on Love Kitchen coral is 2.95:1 — unreadable in the sun this app
   * exists to work in. Measured contrast against each primary, picking the
   * better of --on and --ink:
   *
   *   tea 7.36  strike 5.87  build 4.48   -> white
   *   lk  5.82  pn     5.02  mayor 4.61  prem 4.35  -> ink
   *
   * Keep these in step with the primaries above; `npm run check` verifies the
   * pairing still clears 4.3:1 and will fail if a re-theme breaks it. */
  --t-tea-fg: var(--on);
  --t-prem-fg: var(--ink);
  --t-pn-fg: var(--ink);
  --t-lk-fg: var(--ink);
  --t-mayor-fg: var(--ink);
  --t-strike-fg: var(--on);
  --t-build-fg: var(--on);

  /* --- the territory colour used AS TEXT on its own tint ------------------
   * The other direction: a territory name or column head written in the
   * territory's colour on its tint. At full strength that is 1.89:1 for Love
   * Kitchen — unreadable, and worst exactly where the app is supposed to be
   * best. These are the same hues scaled toward black until they clear 4.5:1,
   * so the colour still reads as that territory:
   *
   *   prem 2.65 -> 4.58   pn 2.48 -> 4.58   lk 1.89 -> 4.53
   *   mayor 2.42 -> 4.59  strike 3.65 -> 4.53  build 2.96 -> 4.54
   *
   * Teahouse already cleared it and is untouched. Night mode needs none of
   * this — light hue on a dark tint is 4.92:1 at worst — so there the deep
   * variant is simply the primary. */
  --t-tea-deep: var(--t-tea);
  --t-prem-deep: #7D4B68;
  --t-pn-deep: #7C592B;
  --t-lk-deep: #804949;
  --t-mayor-deep: #345B83;
  --t-strike-deep: #664C7B;
  --t-build-deep: #755424;

  /* --- functional states ------------------------------------------------ */
  /* `gap` is the one alarming colour we allow: it is the single most
   * operationally important signal on playa. Everything else stays warm. */
  --gap: #AE2417;       --gap-bg: #FAD9D2;
  --live: #2C6E36;      --live-bg: #D7EBD7;
  /* Darkened from the design's #A0700A, which is 3.53:1 on its own background.
   * This is the "up next, in 12 minutes" colour — a countdown you misread is a
   * shift you miss. Same hue, 4.53:1. Night mode is already 7.15:1. */
  --soon: #8A6009;      --soon-bg: #F6E6C3;

  /* --- typography -------------------------------------------------------
   * Fraunces and Inter are bundled at the top of this file. The fallbacks stay
   * because a font file can fail to load and Georgia is a decent stand-in. */
  --font-display: Fraunces, Georgia, 'Times New Roman', serif;
  --font-ui: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;

  --size-display: clamp(25px, 3vw, 34px);
  --size-h1: clamp(24px, 2.8vw, 32px);
  --size-h2: 21px;
  --size-body: 16px;     /* never smaller on mobile — dusty eyes need it */
  --size-small: 14px;
  --size-micro: 12px;
  --size-kicker: 11px;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --track-kicker: 0.16em;

  /* --- space, shape, elevation ------------------------------------------ */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 22px;
  --space-6: 32px;

  --radius-card: 10px;
  --radius-control: 8px;
  --radius-slot: 6px;
  --radius-pill: 999px;

  /* One elevation level only; the rest is flat. */
  --shadow-raised: 0 6px 24px rgba(28, 26, 22, 0.30);

  --tap-min: 48px;       /* conditions-first floor, not a suggestion */
  --breakpoint-phone: 768px;
}

/* Territory aliases keyed the way the database keys them, so a component can
 * do `var(--t-${territory.key})` straight from the API. Night mode only has to
 * override the short names above; these follow automatically. */
:root {
  --t-teahouse: var(--t-tea);          --t-teahouse-t: var(--t-tea-t);
  --t-palenque: var(--t-pn);           --t-palenque-t: var(--t-pn-t);
  --t-love_kitchen: var(--t-lk);       --t-love_kitchen-t: var(--t-lk-t);

  --t-teahouse-fg: var(--t-tea-fg);
  --t-palenque-fg: var(--t-pn-fg);
  --t-love_kitchen-fg: var(--t-lk-fg);

  --t-teahouse-deep: var(--t-tea-deep);
  --t-palenque-deep: var(--t-pn-deep);
  --t-love_kitchen-deep: var(--t-lk-deep);
}

/* --- night mode ---------------------------------------------------------
 * Warm dark (#1C1A16, never pure black) with the territory hues desaturated so
 * they don't glare at 3am. */
[data-theme='night'] {
  --bg: #1C1A16;
  --card: #26231C;
  --panel: #221F19;
  --ink: #F2ECDF;
  --soft: #A69C89;
  --line: #3B3529;
  --on: #17150F;

  --t-tea: #83A76B;     --t-tea-t: #28321F;
  --t-prem: #C88FAE;    --t-prem-t: #332129;
  --t-pn: #D2A468;      --t-pn-t: #33291C;
  --t-lk: #E0A0A0;      --t-lk-t: #33221F;
  --t-mayor: #7FB0DE;   --t-mayor-t: #1E2833;
  --t-strike: #A08BB4;  --t-strike-t: #2A2331;
  --t-build: #C09755;   --t-build-t: #332818;

  /* Every night primary is a light desaturated hue, so the near-black --on
   * wins across the board — 5.95:1 at worst (strike), 8.44:1 at best (lk). */
  --t-tea-fg: var(--on);
  --t-prem-fg: var(--on);
  --t-pn-fg: var(--on);
  --t-lk-fg: var(--on);
  --t-mayor-fg: var(--on);
  --t-strike-fg: var(--on);
  --t-build-fg: var(--on);

  --t-tea-deep: var(--t-tea);       --t-prem-deep: var(--t-prem);
  --t-pn-deep: var(--t-pn);         --t-lk-deep: var(--t-lk);
  --t-mayor-deep: var(--t-mayor);   --t-strike-deep: var(--t-strike);
  --t-build-deep: var(--t-build);

  --gap: #E4756A;       --gap-bg: #39211E;
  --live: #7FBE89;      --live-bg: #1F2C21;
  --soon: #D9AE4A;      --soon-bg: #302614;
}

/* Follow the system only when the camper has not chosen for themselves.
 * During the burn the app overrides this from playa daylight instead. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='sun']):not([data-theme='night']) {
    --bg: #1C1A16;
    --card: #26231C;
    --panel: #221F19;
    --ink: #F2ECDF;
    --soft: #A69C89;
    --line: #3B3529;
    --on: #17150F;

    --t-tea: #83A76B;     --t-tea-t: #28321F;
    --t-prem: #C88FAE;    --t-prem-t: #332129;
    --t-pn: #D2A468;      --t-pn-t: #33291C;
    --t-lk: #E0A0A0;      --t-lk-t: #33221F;
    --t-mayor: #7FB0DE;   --t-mayor-t: #1E2833;
    --t-strike: #A08BB4;  --t-strike-t: #2A2331;
    --t-build: #C09755;   --t-build-t: #332818;

    --t-tea-fg: var(--on);   --t-prem-fg: var(--on);
    --t-pn-fg: var(--on);    --t-lk-fg: var(--on);
    --t-mayor-fg: var(--on); --t-strike-fg: var(--on);
    --t-build-fg: var(--on);

    --t-tea-deep: var(--t-tea);       --t-prem-deep: var(--t-prem);
    --t-pn-deep: var(--t-pn);         --t-lk-deep: var(--t-lk);
    --t-mayor-deep: var(--t-mayor);   --t-strike-deep: var(--t-strike);
    --t-build-deep: var(--t-build);

    --gap: #E4756A;       --gap-bg: #39211E;
    --live: #7FBE89;      --live-bg: #1F2C21;
    --soon: #D9AE4A;      --soon-bg: #302614;
  }
}

/* --- motion -------------------------------------------------------------
 * Deliberate and minimal; over-animation reads as generic and costs battery. */
@keyframes wash { from { opacity: 0.15; transform: scale(0.985); } to { opacity: 1; transform: scale(1); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
