/* Design system v2.0 — the canonical token block. This file IS the standard.
   Its source is public/tokens.css in chen97/todo: edit it there, never in a copy. Other repos
   copy this file and glass.css as-is with tools/sync-look.sh, some of them public, so keep
   people's names, hostnames and issue keys out of every comment here.
   The skill (`design-system`, references/tokens.md) documents every value below; where the two
   disagree, this file wins and the skill is the defect. Load order: tokens.css, the site's own
   component CSS, glass.css, the site's page CSS. */

:root {
  /* ---- Page and solid surfaces: furthest back to nearest ----
     The page is --bg with the --mesh on top. Cards are --glass over that. The solid steps are
     for what floats (a dialog, a sheet) and for every surface under reduced transparency. */
  --bg: #0b0d18;          /* the page, under the mesh */
  --panel: #161a2e;       /* solid: a dialog, a reward chip, the reduced-transparency card */
  --panel-2: #1d2238;     /* solid: a raised thing on a solid surface */
  --in: rgba(255, 255, 255, .07);           /* an input well, a quiet button, a track, a hover */
  --line: rgba(255, 255, 255, .08);         /* a divider, a quiet border */
  --line-strong: rgba(255, 255, 255, .16);  /* a control's border, a scrollbar thumb */

  /* ---- Glass ---- */
  --glass: rgba(255, 255, 255, .065);       /* a card, a notice, an empty state */
  --glass-2: rgba(255, 255, 255, .1);       /* a raised thing on a card; the pressed segment */
  --glass-line: rgba(255, 255, 255, .1);    /* every glass edge, 1px */
  --glass-shadow: 0 12px 32px -10px rgba(0, 0, 0, .6);
  --bar-glass: rgba(30, 32, 52, .72);       /* what floats and blurs: tab bar, sheet, toast */
  --mesh: radial-gradient(60% 50% at 8% 0%, #19204d 0, transparent 70%),
          radial-gradient(50% 40% at 100% 8%, #2c1636 0, transparent 70%),
          radial-gradient(60% 50% at 40% 100%, #0c2e2c 0, transparent 70%);

  /* ---- Ink ---- */
  --tx: #eef0fa;          /* body and heading */
  --mut: #b4b9d0;         /* secondary: meta, hints, table headers, placeholders */
  --on-accent: #ffffff;   /* ink on --ac-fill and on --grad, both schemes */

  /* ---- The accent: indigo. Interactive emphasis, the current page, "waits / due soon". ----
     Three jobs, three values: a mark (ring, bar, icon), text, and a filled surface. */
  --ac: #8f87ff;          /* marks */
  --ac-tx: #b3adff;       /* text */
  --ac-fill: #5a50ec;     /* a filled surface, white ink */
  --ac-hover: #6a61f0;    /* hover on a filled surface */
  --grad: linear-gradient(135deg, #6a60f0, #4a40dc);       /* the primary button, a done tick */
  --grad-soft: linear-gradient(90deg, #8e85ff, #5a50ec);   /* a progress fill */

  /* ---- Status: what happened to an operation ---- */
  --ok: #5ccb8b;  --ok-tx: #5ccb8b;       /* ran / succeeded / granted */
  --bad: #f07167; --bad-tx: #ffa3b2;      /* failed / late / destructive */

  /* ---- Market direction: which way a quantity moved. Numbers and strokes only. ---- */
  --up: #3fd6bb;   --up-tx: #3fd6bb;
  --down: #ff6b8a; --down-tx: #ff8aa3;   /* text lighter than the mark: 4.42 → 5.39 on a card */
  --neutral: var(--mut); --neutral-tx: var(--mut);

  /* ---- The categorical palette: which group a thing belongs to (todo's categories, a chart's
     series). Never a status, never a direction, never the only channel: a word or a direct
     label beside it always says which. Same values in both schemes. ---- */
  --cat-1: #2fbf86;  /* green  */
  --cat-2: #5b8def;  /* blue   */
  --cat-3: #f2a33a;  /* amber  */
  --cat-4: #ef5d7a;  /* rose   */
  --cat-5: #b06ef0;  /* violet */
  --cat-6: #1fb5c7;  /* cyan   */
  --cat-7: #8a94ad;  /* slate  */
  --cat-8: #e879c6;  /* pink   */

  /* ---- Drawing: aliases, so a drawing moves when its source moves ---- */
  --draw-subject:    var(--tx);
  --draw-support:    #9aa0b8;   /* dark: below --mut, so the two tiers stay 2.28 apart (light: --mut) */
  --draw-ghost:      color-mix(in srgb, var(--tx) 35%, transparent);  /* decorative */
  --draw-grid:       var(--line-strong);                              /* decorative */
  --draw-grid-minor: var(--line);                                     /* decorative */
  --draw-accent:     var(--ac);

  /* ---- Spacing. 2 is the only sub-4 value that exists. ---- */
  --s0: 2px;  --s1: 4px;  --s2: 8px;  --s3: 12px;
  --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;

  /* ---- Radius ---- */
  --r-sm: 7px;      /* something nested inside a control */
  --r: 10px;        /* a control that is not a pill: a tile, a notice's inner well */
  --r-lg: 14px;     /* a segmented control's track, a check row */
  --r-xl: 16px;     /* a tile on a card */
  --r-card: 22px;   /* a glass card */
  --r-full: 999px;  /* buttons, pills, dots, the tab bar's items */

  /* ---- The user text-size factor ---- */
  --t-scale: 1;                                              /* .875 | 1 | 1.125 | 1.25 | 1.5 */
  --t-scale-display: calc(1 + (var(--t-scale) - 1) * 0.5);   /* damped — display type only */

  /* ---- Type: the UI scale ---- */
  --t-micro: calc(10px * var(--t-scale));
  --t-xs: calc(11px * var(--t-scale));
  --t-sm: calc(12px * var(--t-scale));
  --t-md: calc(12.5px * var(--t-scale));
  --t-base: calc(13.5px * var(--t-scale));
  --t-lg: calc(15px * var(--t-scale));
  --t-xl: calc(17px * var(--t-scale));

  /* ---- Type: the display scale ---- */
  --t-2xl: calc(20px * var(--t-scale-display));
  --t-3xl: calc(26px * var(--t-scale-display));
  --t-4xl: calc(32px * var(--t-scale-display));  /* the large title */
  --t-5xl: calc(40px * var(--t-scale-display));
  --t-6xl: calc(48px * var(--t-scale-display));
  --t-7xl: calc(60px * var(--t-scale-display));
  --t-8xl: calc(72px * var(--t-scale-display));

  /* ---- Control size ---- */
  --ctl-h: calc(30px * var(--t-scale));
  --ctl-w-icon: calc(30px * var(--t-scale));

  /* ---- Type faces. CJK after Latin, before the generic. Do not reorder. ---- */
  --f-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "PingFang SC", "Noto Sans SC", sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  /* ---- Motion ---- */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --d-fast: 160ms;  --d-quick: 200ms;  --d-enter: 250ms;  --d-slow: 320ms;

  /* ---- Elevation ---- */
  --shadow-1: 0 12px 32px -10px rgba(0, 0, 0, .6);
  --shadow-2: 0 2px 4px rgba(0,0,0,.32), 0 12px 32px -14px rgba(0,0,0,.55);
  --shadow-3: 0 24px 64px -24px rgba(0,0,0,.6), 0 1px 2px rgba(0,0,0,.28);
  --scrim: rgba(0, 0, 0, .5);

  --measure: 68ch;
  --screen: 1080px;

  color-scheme: dark light;
}

/* Light: when the device asks for light and no theme button holds dark, or when one holds light. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef0f7; --panel: #fbfbfe; --panel-2: #f4f5fb;
    --in: rgba(19, 22, 40, .06); --line: rgba(19, 22, 40, .08); --line-strong: rgba(19, 22, 40, .16);
    --glass: rgba(255, 255, 255, .62); --glass-2: rgba(255, 255, 255, .8); --glass-line: rgba(255, 255, 255, .85);
    --glass-shadow: 0 1px 1px rgba(20, 30, 70, .04), 0 12px 32px -10px rgba(40, 50, 120, .18);
    --bar-glass: rgba(255, 255, 255, .6);
    --mesh: radial-gradient(60% 50% at 8% 0%, #dbe2ff 0, transparent 70%),
            radial-gradient(50% 40% at 100% 8%, #fbe0ef 0, transparent 70%),
            radial-gradient(60% 50% at 40% 100%, #d9f2ea 0, transparent 70%);
    --tx: #131628; --mut: #4f556c; --on-accent: #ffffff; --draw-support: var(--mut);
    --ac: #5145e5; --ac-tx: #4b3fe0; --ac-fill: #5145e5; --ac-hover: #4136cf;
    --grad: linear-gradient(135deg, #5f53ec, #4a3edf);
    --grad-soft: linear-gradient(90deg, #7b6ff7, #5145e5);
    --ok: #1f9254; --ok-tx: #0e7a46; --bad: #c8382c; --bad-tx: #b01c37;
    --up: #0d9488; --up-tx: #0f766e; --down: #e11d48; --down-tx: #be123c;
    --shadow-1: 0 1px 1px rgba(20, 30, 70, .04), 0 12px 32px -10px rgba(40, 50, 120, .18);
    --shadow-2: 0 2px 4px rgba(16,24,40,.08), 0 12px 32px -14px rgba(16,24,40,.18);
    --shadow-3: 0 24px 64px -24px rgba(16,24,40,.28), 0 1px 2px rgba(16,24,40,.06);
    --scrim: rgba(20, 22, 50, .25);
  }
}
:root[data-theme="light"] {
  --bg: #eef0f7; --panel: #fbfbfe; --panel-2: #f4f5fb;
  --in: rgba(19, 22, 40, .06); --line: rgba(19, 22, 40, .08); --line-strong: rgba(19, 22, 40, .16);
  --glass: rgba(255, 255, 255, .62); --glass-2: rgba(255, 255, 255, .8); --glass-line: rgba(255, 255, 255, .85);
  --glass-shadow: 0 1px 1px rgba(20, 30, 70, .04), 0 12px 32px -10px rgba(40, 50, 120, .18);
  --bar-glass: rgba(255, 255, 255, .6);
  --mesh: radial-gradient(60% 50% at 8% 0%, #dbe2ff 0, transparent 70%),
          radial-gradient(50% 40% at 100% 8%, #fbe0ef 0, transparent 70%),
          radial-gradient(60% 50% at 40% 100%, #d9f2ea 0, transparent 70%);
  --tx: #131628; --mut: #4f556c; --on-accent: #ffffff; --draw-support: var(--mut);
  --ac: #5145e5; --ac-tx: #4b3fe0; --ac-fill: #5145e5; --ac-hover: #4136cf;
  --grad: linear-gradient(135deg, #5f53ec, #4a3edf);
  --grad-soft: linear-gradient(90deg, #7b6ff7, #5145e5);
  --ok: #1f9254; --ok-tx: #0e7a46; --bad: #c8382c; --bad-tx: #b01c37;
  --up: #0d9488; --up-tx: #0f766e; --down: #e11d48; --down-tx: #be123c;
  --shadow-1: 0 1px 1px rgba(20, 30, 70, .04), 0 12px 32px -10px rgba(40, 50, 120, .18);
  --shadow-2: 0 2px 4px rgba(16,24,40,.08), 0 12px 32px -14px rgba(16,24,40,.18);
  --shadow-3: 0 24px 64px -24px rgba(16,24,40,.28), 0 1px 2px rgba(16,24,40,.06);
  --scrim: rgba(20, 22, 50, .25);
}
/* Native controls, scrollbars and an <img> SVG follow the page's chosen scheme, not the device's. */
:root[data-theme="dark"]  { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

/* Reduced transparency: solid surfaces and no mesh. glass.css also removes every blur. */
@media (prefers-reduced-transparency: reduce) {
  :root, :root[data-theme] { --glass: var(--panel); --glass-2: var(--panel-2); --bar-glass: var(--panel); --mesh: none; }
}
