/*
 * normal is dead: Design Tokens
 * Single source of truth for color, type, and grid system.
 */

:root {
  /* ─── 12-color palette (Rosy Blush set) ─── */
  --c-cream:   #FCF0DD;   /* Creamsicle Dream: frame chrome */
  --c-sky:     #D7FFE9;   /* Minty Frost */
  --c-mustard: #EEBE55;   /* Sunlit Amber */
  --c-teal:    #96AA9F;   /* Sage Stone */
  --c-lav:     #9DA7EA;   /* Misty Mauve */
  --c-moss:    #1C423E;   /* Forest Shadow */
  --c-peach:   #F4B6C3;   /* Rosy Blush */
  --c-brick:   #EC5E52;   /* Scarlet Ember */
  --c-earth:   #530E36;   /* Midnight Plum */
  --c-lavlt:   #DEDDFC;   /* Ethereal Lavender */
  --c-copper:  #974320;   /* Rustic Copper */
  --c-indigo:  #383154;   /* Twilight Indigo */

  /* ─── Semantic tokens ─── */
  --bg:        var(--c-cream);
  --ink:       #1A1A1A;
  --ink-soft:  #5B5B5B;
  --link:      var(--c-lav);
  --link-hover:var(--c-peach);
  --accent:    var(--c-peach);
  --accent-fg: var(--c-earth);

  /* ─── Status palette ───
   * `--<name>`     inline text colour for status messages
   * `--<name>-rgb` space-separated channels for rgb()/alpha use
   * `--<name>-fg`  readable foreground when `--<name>` is a solid fill
   * all pairs target WCAG AA: verified by scripts/check-contrast.ts */
  --success:     #2F6B36;   --success-rgb: 47 107 54;   --success-fg: #FCF0DD;
  --error:       #BE3B27;   --error-rgb:   190 59 39;   --error-fg:   #FCF0DD;
  --warn:        #8A5A0C;   --warn-rgb:    138 90 12;   --warn-fg:    #FCF0DD;
  --info:        #383154;   --info-rgb:    56 49 84;    --info-fg:    #FCF0DD;

  /* ─── Radius scale ─── */
  --r-button:  9999px;   /* pills, cta */
  --r-card:    16px;     /* cards, panels, modals */
  --r-input:   12px;     /* text fields, selects */
  --r-menu:    8px;      /* dropdowns, popovers */
  --r-control: 6px;      /* chips, small toggles, swatches */

  /* ─── Grid system ─── */
  --cols: 32;
  --rows: 20;
  --cell-w: calc(100vw / 32);
  --cell-h: calc(100vh / 20);
  --cell:   min(var(--cell-w), var(--cell-h));

  --bar-rows: 2;
  --rail-cols: 3;
  --bar-h:  calc(var(--cell-h) * var(--bar-rows));
  --rail-w: calc(var(--cell-w) * var(--rail-cols));

  /* ─── Typography ─── */
  --font-display: "All Round Gothic", "General Sans",
                  ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body:    "General Sans",
                  ui-sans-serif, system-ui, -apple-system, sans-serif;

  --fw-thin:    200;
  --fw-medium:  500;
  --fw-bold:    700;
  /* italic-bold sits alongside fw-bold; use `font-style: italic` */

  /* ─── Motion ─── */
  --ease-out:    cubic-bezier(.16,1,.3,1);
  --ease-in-out: cubic-bezier(.4,0,.2,1);
  --t-fast:   .2s;
  --t-base:   .35s;
  --t-slow:   .9s;

  /* light is the default scheme */
  color-scheme: light;
}

/* ─── Dark theme ───
 * The 12 brand colors (--c-*) never change: they ARE the brand.
 * Only the semantic surface tokens flip. Apply with
 *   <html data-theme="dark">
 * or rely on the prefers-color-scheme block below. */
[data-theme="dark"] {
  --bg:        #14101A;   /* deep plum-black ground */
  --ink:       #F2ECDD;
  --ink-soft:  #A99FB0;
  --link:      var(--c-lav);
  --link-hover:var(--c-peach);
  --accent:    var(--c-peach);
  --accent-fg: #14101A;

  /* status stays legible on the dark ground */
  --success:     #6FBF7B;   --success-rgb: 111 191 123;  --success-fg: #14101A;
  --error:       #F08A7C;   --error-rgb:   240 138 124;  --error-fg:   #14101A;
  --warn:        #E0AE4E;   --warn-rgb:    224 174 78;   --warn-fg:    #14101A;
  --info:        #B7BEF0;   --info-rgb:    183 190 240;  --info-fg:    #14101A;

  color-scheme: dark;
}

/* auto dark when the visitor has no explicit theme set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #14101A;
    --ink:       #F2ECDD;
    --ink-soft:  #A99FB0;
    --accent-fg: #14101A;
    --success:   #6FBF7B;   --success-rgb: 111 191 123;  --success-fg: #14101A;
    --error:     #F08A7C;   --error-rgb:   240 138 124;  --error-fg:   #14101A;
    --warn:      #E0AE4E;   --warn-rgb:    224 174 78;   --warn-fg:    #14101A;
    --info:      #B7BEF0;   --info-rgb:    183 190 240;  --info-fg:    #14101A;
    color-scheme: dark;
  }
}
