/* civsg design tokens.
   World: a lit cut-paper diorama of Singapore on a gallery table, one warm lamp at the top left.
   The canvas art reads the same values from site/js/art/palette.js; keep the two in step.
   Fonts are loaded by the page (see site/fonts.txt for the <link> and the reasons). */

:root {
  color-scheme: light;

  /* ---- Type ---------------------------------------------------------------------- */
  --font-display: "Bricolage Grotesque", "Avenir Next Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: var(--font-ui);            /* always with font-variant-numeric: tabular-nums */
  --num: tabular-nums lining-nums;

  --text-12: 0.75rem;    /* floor: nothing in the UI is smaller */
  --text-13: 0.8125rem;
  --text-14: 0.875rem;
  --text-16: 1rem;
  --text-18: 1.125rem;
  --text-20: 1.25rem;
  --text-24: 1.5rem;
  --text-32: 2rem;
  --text-44: 2.75rem;
  --text-64: 4rem;
  --leading-tight: 1.1;
  --leading-ui: 1.35;
  --leading-body: 1.5;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semi: 600;
  --weight-bold: 700;
  --weight-display: 750;   /* Bricolage is variable 200-800 */
  --tracking-caps: 0.08em;

  /* ---- Spacing: 4 px grid ---------------------------------------------------------- */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px;
  --gutter: 16px;          /* phone side gutter */
  --tap: 44px;             /* minimum tap target */

  /* ---- Radii (nested radius = outer - padding) ------------------------------------ */
  --r-1: 4px;  --r-2: 8px;  --r-3: 12px; --r-4: 16px; --r-pill: 999px;

  /* ---- Elevation: paper sheets lifted under one top-left lamp ---------------------- */
  --shadow-ink: 34 30 52;  /* cool violet-brown: a warm lamp throws cool shadows */
  --e-0: none;
  --e-1: 1px 1px 0 rgb(var(--shadow-ink) / 0.18), 2px 3px 4px rgb(var(--shadow-ink) / 0.14);
  --e-2: 1px 2px 0 rgb(var(--shadow-ink) / 0.16), 4px 6px 10px rgb(var(--shadow-ink) / 0.18);
  --e-3: 1px 2px 0 rgb(var(--shadow-ink) / 0.14), 8px 12px 24px rgb(var(--shadow-ink) / 0.22);
  --e-4: 2px 3px 0 rgb(var(--shadow-ink) / 0.12), 14px 22px 44px rgb(var(--shadow-ink) / 0.28);

  /* ---- Motion ---------------------------------------------------------------------- */
  --d-feedback: 150ms;     /* 120-180 */
  --d-feedback-min: 120ms;
  --d-feedback-max: 180ms;
  --d-menu: 190ms;         /* 160-220 */
  --d-menu-min: 160ms;
  --d-menu-max: 220ms;
  --d-enter: 400ms;        /* 300-500 */
  --d-enter-min: 300ms;
  --d-enter-max: 500ms;
  --d-story: 900ms;        /* only for storytelling moments (assembly, lens ripple) */
  --ease-out: cubic-bezier(0.22, 0.8, 0.24, 1);       /* arrivals decelerate */
  --ease-in-out: cubic-bezier(0.62, 0.02, 0.32, 1);   /* travel */
  --ease-paper: cubic-bezier(0.3, 1.32, 0.5, 1);      /* small paper pieces only: slight overshoot */

  /* ---- The room: gallery table and lamp -------------------------------------------- */
  --table: #2b2520;        /* walnut gallery table under the model */
  --table-2: #3a322b;
  --lamp: #ffe1a6;         /* warm lamp, top left */
  --lamp-glow: rgb(255 214 140 / 0.22);
  --grain-alpha: 0.07;

  /* ---- Sea: layered paper, darkest farthest out ------------------------------------ */
  --sea-abyss: #1c4352;
  --sea-deep: #24596a;
  --sea-mid: #31727f;
  --sea-shallow: #5b9e9c;
  --sea-shoal: #8cc3b6;
  --sea-foam: #e9f0e4;

  /* ---- Land paper per terrain ------------------------------------------------------ */
  --t-reclaimed: #dbc9a0;
  --t-beach: #efdcac;
  --t-mangrove: #556f3c;
  --t-mangrove-mud: #7d7250;
  --t-rainforest: #2e5b39;
  --t-rainforest-2: #3f7445;
  --t-park: #74a556;
  --t-park-2: #8dbb67;
  --t-reservoir: #2f7db1;
  --t-reservoir-gloss: #9fd3ef;
  --t-hill: #5c8a48;
  --t-hill-2: #7aa35b;
  --t-heartland: #e4dccb;
  --t-city: #c7c8c6;
  --t-shophouse: #e7cfae;
  --t-industry: #bcb08f;
  --t-port: #aaa69c;
  --t-airfield: #a3b47d;
  --t-restricted: #d0cfc2;
  --t-farmland: #a9b85c;

  /* ---- Building paper -------------------------------------------------------------- */
  --b-hdb: #f3eee2;
  --b-hdb-accent-1: #d8664a;   /* HDB repaint accent bands */
  --b-hdb-accent-2: #3f8fa6;
  --b-hdb-accent-3: #e0a83a;
  --b-glass: #8fb2c8;
  --b-glass-2: #5f88a3;
  --b-roof-tile: #b9553a;
  --b-steel: #6f7880;
  --b-window-day: #6a8496;
  --b-window-lit: #ffd27a;

  /* ---- UI chrome: paper cards on the walnut table ---------------------------------- */
  --paper: #f7f2e8;
  --paper-2: #efe7d8;
  --paper-3: #e4d9c5;
  --ink: #1e2228;
  --ink-2: #4a4f57;
  --ink-3: #6c7179;        /* still >= 4.5:1 on --paper */
  --hairline: rgb(30 34 40 / 0.14);
  --accent: #c8402a;       /* vermilion cut paper: selection, the one call to action */
  --accent-ink: #ffffff;
  --focus: #1b6fd1;
  --live: #2fa36b;         /* the live-data dot, only while live data is showing */
  --warn: #b7791f;
  --bad: #b3261e;

  /* ---- LTA rail line colours (official) -------------------------------------------- */
  --line-ns: #d42e12;
  --line-ew: #009645;
  --line-ne: #9900aa;
  --line-cc: #fa9e0d;
  --line-dt: #005ec4;
  --line-te: #9d5b25;
  --line-lrt: #748477;
  --line-jr: #0099aa;
  --line-cr: #97c616;

  /* ---- Yield colours (icons and lens accents) -------------------------------------- */
  --y-population: #3c4a5c;
  --y-food: #6f9a2e;
  --y-production: #b4532a;
  --y-gold: #c89211;
  --y-science: #2f78b7;
  --y-culture: #8a3f9e;
  --y-faith: #c9a227;
  --y-housing: #d8664a;
}

/* ---- Night mode: dark paper, the lamp off, windows lit by real population density --- */
:root[data-theme="night"],
:root[data-map="night"] {
  --table: #0f0d0c;
  --table-2: #1a1714;
  --lamp: #8fa6d6;
  --lamp-glow: rgb(120 150 220 / 0.14);
  --sea-abyss: #08131b;
  --sea-deep: #0c1b25;
  --sea-mid: #102532;
  --sea-shallow: #183443;
  --sea-shoal: #22465a;
  --sea-foam: #3d5b6e;
}

/* UI chrome follows the viewer's preference; the map's night mode is its own toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #1d1b18;
    --paper-2: #26231f;
    --paper-3: #322e29;
    --ink: #f1ebdf;
    --ink-2: #c9c1b3;
    --ink-3: #a39b8e;
    --hairline: rgb(241 235 223 / 0.14);
    --accent: #ec6a50;
    --accent-ink: #1a0f0b;
    --focus: #7ab3ff;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1d1b18;
  --paper-2: #26231f;
  --paper-3: #322e29;
  --ink: #f1ebdf;
  --ink-2: #c9c1b3;
  --ink-3: #a39b8e;
  --hairline: rgb(241 235 223 / 0.14);
  --accent: #ec6a50;
  --accent-ink: #1a0f0b;
  --focus: #7ab3ff;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --d-feedback: 0ms; --d-menu: 0ms; --d-enter: 0ms; --d-story: 0ms;
  }
}
