/* ---------------------------------------------------------------------------
 * WeGoPlace on NeedWright's design system: tokens.
 *
 * The ONE place a raw colour may be written for anything built on public/ds
 * (scripts/ds_theme_check.mjs refuses one anywhere else under public/ds). The
 * values are NeedWright's own (its design-system branch, app/ds/tokens.css),
 * copied, not invented: graphite neutrals on a pure black canvas in the dark,
 * its paper in the light. White ink is the only emphasis; colour is for state
 * and always travels with a word or an icon. The brief:
 * 16-wegoplace/docs/briefs/design-system.md; the living spec is /design.
 *
 * WHERE THEY APPLY. Inside a `.ds` root only. The app's screens move onto the
 * system one flow at a time, and until a flow moves, its screens keep the old
 * tokens of styles.css, some of which share a name with these (--ink-2,
 * --ink-3). So these are set on `.ds`, never on :root: a flow that has moved
 * puts `.ds` on its root and everything under it reads these; nothing else
 * changes. Light or dark follows the family the shell sets on <html> before
 * first paint (data-lum, for every theme and for none); `data-ds-theme` on a
 * `.ds` element forces one (the /design page draws both).
 * ------------------------------------------------------------------------- */

/* Three faces, three roles, never swapped:
 *   Bricolage Grotesque  headings and the one big number on a screen; weights 400–500
 *   Instrument Sans      everything read or tapped
 *   Geist Mono           money, times and codes; tabular figures
 * Self-hosted, latin, the fontsource builds (SIL OFL, licences beside the files). */
@font-face {
  font-family: "Instrument Sans";
  src: url("/vendor/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  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: "Geist Mono";
  src: url("/vendor/fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  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;
}
/* The same file styles.css loads for the app's headings since v116; declared here too so a page on the system alone
   (the /design page, and each screen as it moves) needs nothing of styles.css. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/vendor/fonts/bricolage-grotesque-latin-opsz-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  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;
}

.ds {
  --type-ui: "Instrument Sans", ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --type-head: "Bricolage Grotesque", "Instrument Sans", ui-sans-serif, -apple-system, sans-serif;
  --type-mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  /* One scale: 12 / 14 / 16 / 20 / 28, and one large number. */
  --size-12: 12px;
  --size-14: 14px;
  --size-16: 16px;
  --size-18: 18px;      /* NeedWright's lead size, kept for its rules */
  --size-20: 20px;
  --size-24: 24px;      /* likewise */
  --size-28: 28px;
  --size-number: 52px;
  --track-head: -0.02em;
  --track-number: -0.03em;

  /* Five radii, each tied to a size of thing. */
  --radius-8: 8px;      /* tags, 24px controls, menu items */
  --radius-12: 12px;    /* every 28–32px control */
  --radius-16: 16px;    /* rows, banners, empty states, popovers, 44px controls */
  --radius-24: 24px;    /* sheets, dialogs, cards with a picture */
  --radius-full: 999px; /* pills, switches, avatars */

  --control-24: 24px;
  --control-28: 28px;
  --control-32: 32px;
  --control-44: 44px;   /* where a thumb lands */

  /* Motion: three lengths and two curves. Every move says what happened. */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.3, 1.4, 0.5, 1);
  --dur-150: 150ms;
  --dur-200: 200ms;
  --dur-320: 320ms;
  --tip-delay: 350ms;
  /* Icon hover motion (icons.css): a hover-intent wait, then the motion at this multiple of its length. */
  --icon-wait: 400ms;
  --icon-pace: 1.7;

  --page-width: 640px;
  --page-width-wide: 1180px;
}

/* ---------- light: the system's paper ---------- */
.ds,
.ds[data-ds-theme="light"] {
  color-scheme: light;
  --gray-1: #f6f5f2;
  --gray-2: #efeeea;
  --gray-3: #e7e5e0;
  --gray-4: #dedcd6;
  --gray-5: #d3d1ca;
  --gray-6: #c6c3bb;
  --gray-7: #b3b0a7;
  --gray-8: #99968d;
  --gray-9: #7c7970;
  --gray-10: #6a675f;
  --gray-11: #57544d;
  --gray-12: #1b1a17;

  --canvas: #fdfdfc;
  --chrome: #f6f5f2;
  --well: #f6f5f2;
  --code: #f3f2ee;
  --fill: rgba(250, 249, 246, 0.94);
  --fill-hover: rgba(236, 234, 229, 0.96);
  --fill-active: rgba(226, 224, 218, 0.96);

  --hair: rgba(38, 33, 20, 0.08);
  --edge: rgba(38, 33, 20, 0.14);
  --edge-strong: rgba(38, 33, 20, 0.26);

  --ink-1: #1b1a17;
  --ink-2: #57544d;
  --ink-3: #7c7970;
  --ink-4: #99968d;

  --solid: #141412;
  --solid-hover: #34332f;
  --on-solid: #fbfaf7;
  --ring: rgba(20, 20, 18, 0.5);
  --ring-soft: rgba(20, 20, 18, 0.1);
  --selection: rgba(20, 20, 18, 0.12);
  --glow: rgba(255, 255, 255, 0.95);
  --glow-soft: rgba(255, 255, 255, 0.7);

  --positive: #0e7a4c;
  --positive-bg: rgba(16, 160, 96, 0.12);
  --positive-edge: rgba(16, 150, 90, 0.3);
  --warning: #8a5a00;
  --warning-bg: rgba(250, 160, 0, 0.16);
  --warning-edge: rgba(200, 130, 0, 0.34);
  --negative: #c1272f;
  --negative-bg: rgba(230, 30, 50, 0.1);
  --negative-edge: rgba(210, 30, 50, 0.3);
  --info: #1d5fd0;
  --info-bg: rgba(0, 110, 255, 0.1);
  --info-edge: rgba(0, 100, 240, 0.3);

  --backdrop: rgba(20, 18, 14, 0.36);
  --shadow-pop: 0 16px 40px -14px rgba(40, 32, 16, 0.22), 0 2px 8px rgba(40, 32, 16, 0.08);
}

/* ---------- dark: void ---------- */
:where(:root[data-lum="dark"]) .ds,
:root.ds:where([data-lum="dark"]),
.ds[data-ds-theme="dark"] {
  color-scheme: dark;
  --gray-1: #151513;
  --gray-2: #1b1a18;
  --gray-3: #23221f;
  --gray-4: #2b2a26;
  --gray-5: #35342f;
  --gray-6: #3e3c37;
  --gray-7: #46443f;
  --gray-8: #56544d;
  --gray-9: #75726a;
  --gray-10: #8e8b83;
  --gray-11: #a7a49c;
  --gray-12: #f1efea;

  --canvas: #000000;
  --chrome: #0b0b0a;
  --well: #151513;
  --code: #0d0d0c;
  --fill: rgba(30, 29, 26, 0.88);
  --fill-hover: rgba(46, 44, 40, 0.92);
  --fill-active: rgba(60, 58, 53, 0.92);

  --hair: rgba(234, 228, 214, 0.09);
  --edge: rgba(234, 228, 214, 0.14);
  --edge-strong: rgba(234, 228, 214, 0.26);

  --ink-1: #f1efea;
  --ink-2: #a7a49c;
  --ink-3: #75726a;
  --ink-4: #56544d;

  --solid: #f7f6f2;
  --solid-hover: #dedcd6;
  --on-solid: #0b0b0a;
  --ring: rgba(247, 246, 242, 0.6);
  --ring-soft: rgba(247, 246, 242, 0.12);
  --selection: rgba(247, 246, 242, 0.18);
  --glow: rgba(255, 250, 240, 0.5);
  --glow-soft: rgba(255, 250, 240, 0.06);

  --positive: #52e3a4;
  --positive-bg: rgba(40, 230, 150, 0.12);
  --positive-edge: rgba(50, 240, 160, 0.26);
  --warning: #ffc934;
  --warning-bg: rgba(250, 140, 0, 0.14);
  --warning-edge: rgba(253, 150, 0, 0.28);
  --negative: #ff9592;
  --negative-bg: rgba(255, 30, 60, 0.16);
  --negative-edge: rgba(255, 40, 70, 0.3);
  --info: #7ab8ff;
  --info-bg: rgba(0, 120, 255, 0.2);
  --info-edge: rgba(0, 130, 255, 0.38);

  --backdrop: rgba(0, 0, 0, 0.62);
  --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, 0.72), 0 2px 8px rgba(0, 0, 0, 0.4);
}
/* Specificity does the forcing: `.ds[data-ds-theme]` (an attribute and a class) outranks the family's rules above,
   whose :where() carries none, so a forced theme wins inside a page of the other family. */

/* THE LOGO'S OWN COLOURS (art/make_logo.py draws public/img/wordmark.svg and mark.svg with these): the paper version in
   the light, void's in the dark, never the accent. On :root (the names are the logo's alone), so every page that loads
   these tokens draws the wordmark right, on the system or not. The gap that lifts a hiker off a letter is the page's
   ground: the app's own (--ground) where styles.css sets it, the system's canvas inside .ds. */
:root { --logo-ground: var(--ground, #FBF3E4); --logo-letter: #1B2748; --logo-figure: #F2702A; --logo-shade: #C4521A; --logo-pack: #1FA89A; --logo-rope: #B88A4A; }
:root[data-lum="dark"] { --logo-ground: var(--ground, #000000); --logo-letter: #f1efea; --logo-figure: #FF8A3D; --logo-shade: #D2611B; --logo-pack: #35C9B8; --logo-rope: #F2C27A; }
.ds { --logo-ground: var(--canvas); }
