/* ordermetrics design tokens. The reference is output/program/design/system/tokens.css. */

:root {
  color-scheme: dark;

  /* ---- Colour: the room (plum darks, OKLCH hue 352) ---------------------------------- */
  --shadow:      #17090F;  /* the edges of the room, fog                                   */
  --ground:      #26141C;  /* After-hours: the unlit table and the page ground             */
  --table:       #332028;  /* Tabletop: raised sheets, controls, popovers                  */
  --lit:         #442E37;  /* the ground under a lamp; the lightest surface text sits on   */
  --lit-2:       #523B44;  /* hover and pressed, never under muted text                    */

  /* ---- Colour: paper (type) ---------------------------------------------------------- */
  --paper:       #F4ECDD;  /* primary type, figures                                        */
  --paper-2:     #CFC1B6;  /* secondary type, labels                                       */
  --paper-3:     #B3A29E;  /* muted type, axis ticks (4.5:1 or better up to --lit)         */
  --paper-4:     #8D7B7D;  /* non-text only: disabled marks, unlit rings                   */
  --rule:        rgba(244, 236, 221, .10);  /* hairlines                                   */
  --rule-strong: rgba(244, 236, 221, .20);  /* control outlines, axis baseline             */

  /* ---- Colour: light and state ------------------------------------------------------- */
  --lamp:        #F6D183;  /* Lamp: light itself, as a fill                                */
  --verdigris:   #8AD6BC;  /* gains and additions (always with a sign or an arrow)         */
  --ember:       #F58E6A;  /* losses, stale data, needs attention (always icon + words)    */
  --ember-deep:  #E2684A;  /* ember as a mark fill                                         */
  --mark:        #A9C8B2;  /* the logo's own colour (mark.svg); the brand mark only (DS1)   */
  --lamp-wash:   rgba(246, 209, 131, .10);
  --ember-wash:  rgba(245, 142, 106, .12);

  /* ---- Colour: data ------------------------------------------------------------------ */
  /* Channel identity. Validated with dataviz validate_palette.js, dark mode, all pairs,
     on --table: CVD worst 10.0, normal-vision worst 20.0, all >= 3:1.                      */
  --series-1:    #439CCC;  /* Sea   (Meta Ads)                                             */
  --series-2:    #929C3D;  /* Moss  (Google Ads)                                           */
  --series-3:    #C95A8B;  /* Rose  (TikTok Ads)                                           */
  --series-quiet:#9A858E;  /* de-emphasis: context series, deductions in the waterfall     */
  --chart-grid:  rgba(244, 236, 221, .08);
  --chart-axis:  rgba(244, 236, 221, .22);

  /* ---- Type -------------------------------------------------------------------------- */
  /* Voice: sentences that explain. Instruments: labels and controls. Figures: every reading. */
  --font-voice:   "Iowan Old Style", Charter, Palatino, Georgia, serif;
  --font-ui:      "Avenir Next", Avenir, "Helvetica Neue", system-ui, sans-serif;
  --font-figure:  "Avenir Next Condensed", "Avenir Next", "Helvetica Neue", system-ui, sans-serif;

  --text-tick:     12px;   /* axis ticks and the smallest captions; nothing goes lower      */
  --text-small:    13px;   /* secondary labels, table meta                                 */
  --text-ui:       14px;   /* controls, labels, navigation                                 */
  --text-body:     16px;   /* running text                                                 */
  --text-voice:    17px;   /* the period sentence, findings                                */
  --text-lead:     21px;
  --text-title:    30px;
  --figure-small:  17px;   /* figures in table columns                                     */
  --figure-row:    20px;
  --figure-medium: 24px;   /* readings                                                     */
  --figure-lead:   40px;   /* the lead reading on the dashboard; one per view              */

  --leading-ui:    1.35;
  --leading-voice: 1.48;
  --weight-regular: 400;
  --weight-medium:  500;
  --weight-strong:  600;

  /* ---- Space (4px base) -------------------------------------------------------------- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;
  --gutter: 16px;          /* window edge to the tray and the dock                         */

  /* ---- Radii: differ by kind of thing ------------------------------------------------ */
  --radius-mark:    4px;   /* data ends of bars                                            */
  --radius-control: 8px;   /* things you press                                             */
  --radius-sheet:   14px;  /* things that hold content: the tray, cards, the brief         */
  --radius-pill:    999px; /* switches, counts, segmented bars                             */

  /* ---- Elevation: in the dark, things rise by catching light ------------------------- */
  --raise-1: inset 0 1px 0 rgba(244, 236, 221, .07), 0 1px 2px rgba(23, 9, 15, .5);
  --raise-2: inset 0 1px 0 rgba(244, 236, 221, .09), 0 14px 36px -10px rgba(23, 9, 15, .75);
  --glow-lamp:  0 0 0 1px rgba(246, 209, 131, .55), 0 0 26px rgba(246, 209, 131, .20);
  --focus-ring: 0 0 0 2px var(--ground), 0 0 0 4px var(--lamp);

  /* ---- The world (handed to the WebGL scene as uniforms) ----------------------------- */
  --world-ground:     var(--ground);
  --world-fog:        var(--shadow);
  --world-lamp-light: #FFD696;                    /* about 2700 K; pools peak at 30 to 50%  */
  --world-grid:       rgba(244, 236, 221, .09);   /* drawn only where light falls           */
  --world-thread:     rgba(244, 236, 221, .16);   /* Night shift's resting lineage          */
  --world-thread-lit: var(--lamp);

  /* ---- Motion ------------------------------------------------------------------------ */
  --dur-quick: 120ms;      /* hover, press                                                 */
  --dur-move:  240ms;      /* opening, expanding, swapping                                 */
  --dur-lamp:  620ms;      /* a lamp warming up or dimming                                 */
  --dur-trace: 900ms;      /* a thread being drawn to its sources                          */
  --ease-out:  cubic-bezier(.2, .8, .2, 1);
  --ease-lamp: cubic-bezier(.3, 0, .1, 1);

  /* ==== Additions for home v2 (both themes define every one of these) ================= */
  --paper-rgb:   244, 236, 221;  /* for washes: rgba(var(--paper-rgb), .06)                */
  --shade-rgb:   23, 9, 15;      /* for fog and cast shadow                                */
  --on-lamp:     #17090F;        /* text on a Lamp fill                                    */
  --lamp-ink:    #F6D183;        /* Lamp as a line, a ring or a word: threads being traced,
                                    focus, the open state. At night this is the lamp itself */
  --lamp-mark:   #F6D183;        /* Lamp as a chart mark: the series the chart is about    */
  --lamp-band:   rgba(246, 209, 131, .14);  /* the soft band under a traced thread: glow   */
  --lamp-pool:   #FFDCA4;        /* centre of the pool under a lit source                  */

  /* D77: threads between a component and its sources stay quiet at rest (16%),
     recede to 10%, and light on hover.                                                    */
  --thread:          rgba(244, 236, 221, .16); /* D77: quiet at rest */
  --thread-receded:  rgba(244, 236, 221, .10);
  --thread-lit:      var(--lamp-ink);

  /* attention tags: ember-tinted paper stock, the Workbench hang tag in this palette      */
  --tag-stock:   #F3C2A6;
  --tag-ink:     #2B1210;        /* 10.9:1 on the stock                                    */
  --tag-mark:    #8C2B10;        /*  5.3:1 on the stock                                    */
  --tag-string:  rgba(244, 236, 221, .6);
  --tag-shadow:  drop-shadow(0 1px 1px rgba(23, 9, 15, .6)) drop-shadow(0 6px 10px rgba(23, 9, 15, .45));

  /* source objects (the sprites are the product's own 3D objects, colours untouched)      */
  --obj-rest:    saturate(.92) brightness(.9);
  --obj-lit:     saturate(1.04) brightness(1.06);
  --obj-stale:   saturate(.5) brightness(.6);
  --obj-receded: saturate(.78) brightness(.7);
  --receded:     .32;            /* how far an unrelated card sinks into the ground        */
  --sheet-alpha: 94%;            /* sheets over the world let a little of it through       */

  /* ==================================================================================
     SYSTEM ADDITIONS (dark). Nothing above this line differs from design/home-v2/tokens.css.
     ================================================================================== */

  /* ---- Data: identity. Four hues, fixed order, never cycled; a fifth series is "Other".
     Validated with the dataviz validate_palette.js, dark, ALL pairs, on --table and --ground:
     CVD worst 10.0, normal-vision worst 17.3, all >= 3:1 (palette-validation.txt, section 1). */
  --series-4:      #835ED8;  /* Iris. Slots 1 to 3 (Sea, Moss, Rose) are above, unchanged.
                                The services named beside them there (Meta Ads, Google Ads,
                                TikTok Ads) are the mockup's sample business, not a binding:
                                a slot goes to whichever entity a business connects first
                                (DESIGN.md, D21)                                              */
  --series-other:  var(--series-quiet);  /* always labelled "Other", always last, and only ever
                                            next to Iris: it is under the floor of 15 against Sea,
                                            Moss and Rose in normal vision (D21)                 */

  /* ---- Data: role fills. Emphasis is one Lamp series with everything else quiet. Lamp never
     joins a categorical set (in Day it sits 2.4 from Moss under colour-vision simulation).     */
  --mark-emphasis: var(--lamp-mark);
  --mark-context:  var(--series-quiet);
  --mark-total:    var(--paper-2);       /* running totals in a waterfall                        */
  --mark-gain:     var(--verdigris);     /* added, above the baseline: always with + or an arrow */
  --mark-loss:     var(--ember-deep);    /* taken below zero, lost: always with a minus sign     */
  --estimate-alpha: .38;                 /* "pale": the estimated part of any mark. Under 3:1 on
                                            purpose (palette-validation.txt, section 6): legal only
                                            with "≈" on the figure and the words. A label on a
                                            pale cell is always --paper (4.7:1 or better)        */
  --partial-stroke: 1.5px;               /* "open": a period still arriving, outline only        */

  /* ---- Data: the chart language (om-ledqy, 23 Nov 2026). Marks as material: totals are warm
     metal (a vertical gradient, light at the top, with a one-pixel highlight edge), the result
     of a figure is the Lamp itself and the brightest thing on its card (with the faintest glow),
     steps down are recessed plum that deepens as it falls, a step up is verdigris, a total below
     zero is ember metal. Every figure type reads these; none names the waterfall.              */
  --chart-total-top:     #D2BA8F;  /* a total, a landing: brass                                  */
  --chart-total-base:    #9A7C50;
  --chart-result-top:    #FFE6AE;  /* the figure's result: Lamp metal                           */
  --chart-result-base:   #E0AE55;
  --chart-result-glow:   rgba(246, 209, 131, .42);
  --chart-step-down:     #A88C97;  /* the first step down; later steps deepen toward             */
  --chart-step-down-deep:#7A5C6A;  /* the deepest (non-text marks: a figure is always printed)   */
  --chart-step-up-top:   #A6E6CF;  /* a step up: verdigris                                       */
  --chart-step-up-base:  #5FAE94;
  --chart-loss-top:      #F9A688;  /* a total below zero: ember metal                            */
  --chart-loss-base:     #CF5D3C;
  --chart-loss-glow:     rgba(245, 142, 106, .34);
  --chart-edge-light:    rgba(255, 246, 226, .62);  /* the highlight edge on a metal mark          */
  --chart-edge-shade:    rgba(23, 9, 15, .5);       /* the recess edge on a step down              */
  --chart-connector:     rgba(244, 236, 221, .26);  /* the hairline from a step to the next        */
  --chart-ground:        rgba(244, 236, 221, .05);  /* the whisper of the canvas's grid in a plot  */
  --chart-zero:          var(--paper-4);            /* a step of nothing: a short tick, intended   */
  --chart-slot:          var(--paper-4);            /* a step not known yet: a dashed outline      */
  --chart-result-ink:    var(--lamp-ink);           /* the result's figure                         */
  --chart-loss-ink:      var(--ember);              /* a result below zero, with its minus         */
  --chart-estimate-fill: .5;     /* an estimated mark's body under its stripes                          */
  --chart-hatch-depth:   0;      /* the stripes' colour, from the mark's top (0) to its base (1)        */
  --chart-hatch-gap: 4.5px;      /* the estimate's stripes: one every this much, at 45 degrees     */
  --chart-hatch-width: 1.5px;
  --chart-recede: .45;           /* the other marks while one is under the pointer                 */
  --chart-lift: 1.16;            /* the mark under the pointer brightens by this                   */
  --chart-glow: 9px;             /* the result's glow, blur radius                                 */
  --chart-total-figure: 14px;    /* a total's figure, in --font-figure, a weight up                */
  --chart-settle-ms: 460ms;      /* the first draw's settle, every mark in, at most                */
  --chart-settle-step: 170ms;    /* one row's settle; rows follow in sequence                      */
  /* om-nzbgl (23 Nov 2026): the same language carried to every other figure: lines, columns, rankings, heat cells,
     sparklines and the bars inside tables. The series palette is ordered: a figure's first series that names no
     platform is the theme's gold, the second the teal, then the quieter brass and plum. A platform's series keeps its
     own identity (--series-1 to --series-4) wherever it stands for that platform.                                  */
  --chart-series-1:  var(--lamp-mark);        /* gold: the series the figure is about                         */
  --chart-series-2:  var(--verdigris);        /* teal                                                         */
  --chart-series-3:  var(--chart-total-base); /* brass, quieter                                               */
  --chart-series-4:  var(--chart-step-down);  /* plum, quieter                                                */
  --chart-line: 2px;             /* a series' line                                                         */
  --chart-line-quiet: 1.5px;     /* a line behind another (an earlier period), or a margin over bars       */
  --chart-area: .24;             /* the area under a line, at the line; it fades to nothing at the floor   */
  --chart-dot: 3px;              /* the end dot's radius: the last point, where the eye lands              */
  --chart-dot-ring: 1.5px;       /* the ring of surface round the end dot, lifting it off its line          */
  --chart-dash: 3px;             /* the "so far" tail and an estimated stretch of line: a dash, ...        */
  --chart-dash-gap: 3px;         /* ... and its gap                                                        */
  --chart-hatch-quiet: .55;      /* the estimate's stripes where they are not the waterfall's steps (a     */
                                 /* total, the result, a column, a table bar): quieter                     */
  --chart-sheen: rgba(255, 246, 226, .13);   /* light along the top of a heat cell or a table bar          */
  --chart-recede-cell: .62;      /* the other heat cells while one is under the pointer (figures stay read) */

  /* ---- Data: magnitude. One hue, five steps, more is lighter at night ("magnitude is light").
     Every step is >= 2:1 on --table, so an empty cell is --seq-none, never the palest step.    */
  --seq-1: #72613E;  --seq-2: #947D4E;  --seq-3: #B79B5F;  --seq-4: #D7B672;  --seq-5: #F6D183;
  --seq-ink-1: var(--paper);  --seq-ink-2: var(--on-lamp);  --seq-ink-3: var(--on-lamp);
  --seq-ink-4: var(--on-lamp); --seq-ink-5: var(--on-lamp);   /* cell labels, 4.9:1 or better     */
  --seq-b-1: #346A88; --seq-b-2: #3983AB; --seq-b-3: #439CCC; --seq-b-4: #63B5E4; --seq-b-5: #89CEF7;
                                         /* Sea, only when two magnitudes share a view           */
  --seq-none: rgba(244, 236, 221, .05);  /* nothing here, or not yet observable                  */

  /* ---- Data: polarity. Loss, nothing, gain. The arms match in lightness step for step (OKLCH L
     .600 and .749 on both), so a gain and a loss of one size weigh the same; they are told apart
     by hue. Worst pair across the arms under colour-vision simulation 8.9; the two steps of an
     arm 14.8 or more apart (palette-validation.txt, section 3). Cells still print the sign.    */
  --div-loss-2: #F58E6A;  --div-loss-1: #C45E3D;  --div-mid: #56434B;
  --div-gain-1: #508E7E;  --div-gain-2: #75BFAB;

  /* ---- State ----------------------------------------------------------------------- */
  --status-good:      var(--verdigris);
  --status-attention: var(--ember);
  --tag-stock-strong: #F58E6A;   /* a tag for something broken (failed, signed out): Ember itself,
                                    in both themes. Ink 7.5:1                                    */
  --on-ember:      #17090F;      /* figures on an Ember fill: the alert count                    */
  --lamp-edge:     rgba(246, 209, 131, .4);    /* the outline of the chosen item in a group      */
  --wash-hover:    rgba(244, 236, 221, .07);
  --wash-press:    rgba(244, 236, 221, .10);
  --wash-row:      rgba(244, 236, 221, .055);  /* a table row under the pointer                  */
  --selection:     rgba(246, 209, 131, .30);   /* behind selected text, which is set in --paper:
                                                  Lamp, as for any chosen item. 5.5:1 or better  */
  --well:          rgba(244, 236, 221, .035);  /* a panel inside a sheet (the full dashboard)    */
  --skeleton:      rgba(244, 236, 221, .08);   /* where a figure or mark will be                 */
  --held-alpha:    .7;           /* a render held while its replacement is computed, after
                                    --dur-hold. Figures stay 6:1 or better, ticks 3.2:1 or better   */
  --scrim:         rgba(23, 9, 15, .55);       /* only behind a confirmation, the one modal      */

  /* ---- Type: steps the mockups set as literals, folded into the scale ------------------ */
  --text-note:     15px;   /* findings inside a card, the Ask line, the workspace name           */
  --text-display:  44px;   /* first run only                                                     */
  --figure-dense:  14px;   /* figures in a card's table                                          */
  --figure-answer: 64px;   /* the reading on a component page; one per page                      */
  --leading-tight: 1.15;
  --tracking-figure:   .005em;
  --tracking-wordmark: -.02em;

  /* ---- Density ------------------------------------------------------------------------ */
  --row-dense:  22px;      /* a table inside a canvas card                                       */
  --row:        26px;      /* tables beside a chart                                              */
  --row-roomy:  32px;      /* the records behind a number                                        */
  --control-s:  26px;      /* chips, sort, in-table actions                                      */
  --control-m:  30px;      /* the date control, segmented switches                               */
  --control-l:  34px;      /* page actions                                                       */
  --control-xl: 48px;      /* the Ask field when open                                            */
  --control-dock: 32px;    /* a button inside a 40 px footer group, as in the approved mockup    */
  --hit-min:    24px;      /* nothing you can press is smaller (the pointer is a mouse)          */
  --icon:       16px;
  --icon-s:     13px;

  /* ---- Radii for things inside things ------------------------------------------------- */
  --radius-inner: 6px;     /* inside a control: a key cap, a segment                             */
  --radius-well:  10px;    /* a panel inside a sheet; the tab under the tray                     */
  --radius-dock:  12px;    /* a group of controls in the dock                                    */

  /* ---- Elevation ---------------------------------------------------------------------- */
  --sheet-edge: inset 0 0 0 1px var(--rule);          /* every sheet at night carries a hairline */
  --raise-3: var(--raise-2), 0 30px 60px -20px rgba(23, 9, 15, .55), inset 0 0 0 1px var(--rule-strong);
                                                      /* a card floating over the canvas         */

  /* ---- The frame (measured from the approved mockup at 1440 x 900) ---------------------- */
  --frame-top:          12px;   /* window edge to the tray, full screen                          */
  --frame-top-windowed: 28px;   /* the same in a window: the traffic lights float in this margin */
  --frame-bottom:       12px;
  --tray-height:        104px;
  --tray-alpha:         92%;
  --line-gap:           8px;    /* tray to the quiet line                                        */
  --line-height:        32px;
  --dock-height:        40px;
  --dock-near:          20px;   /* how far above the footer row the pointer counts as near       */
  --footer-rest:        .35;   /* D73: footer groups stay visible and clickable at rest */
  --dock-alpha:         74%;
  --card-width:         392px;  /* a card over the canvas (the brief)                            */
  --card-width-wide:    560px;  /* the welcome and a connect card                                */
  --ask-width:          560px;  /* Ask when open; it grows upward to at most 60% of the window   */
  --card-fold-width:    200px;  /* a folded card on a crowded canvas (D12): 200 x 56             */
  --card-fold-height:   56px;
  --card-min-width:     268px;  /* a card on the canvas, by hand (D49): 268 x 150 at the least,   */
  --card-min-height:    150px;  /* 560 x 420 at the most; left alone it is 268 to 320 wide        */
  --card-auto-max:      320px;
  --card-max-width:     560px;
  --card-max-height:    420px;
  --card-head:          34px;   /* a card's title row: the part that moves it                    */
  --card-corner:        16px;   /* the lower right corner: the part that resizes it              */
  --drag-threshold:     4px;    /* a press becomes a drag after this much travel                 */
  --nudge:              12px;   /* one step of a move or a resize from the keyboard              */
  --clear-gap:          8px;    /* the clear area starts this far under the quiet line (D50)     */
  --menu-width:         232px;  /* a right-click menu: rows of --control-s, radius --radius-control */
  --port-size:          5px;    /* the dot where a tie meets a card or a ring                    */
  --bead-size:          5px;    /* the bead on a lit path, and a pulse                           */
  --panel-width:        440px;  /* a panel against the right edge                                */
  --page-measure:       720px;  /* the longest line of running text: about 85 characters          */

  /* ---- Layers (one stacking context: the window) ---------------------------------------- */
  --z-world: 0;  --z-source: 1;  --z-card: 2;  --z-tag: 3;
  --z-frame: 5;  /* tray, dock, a page */       --z-line: 6;
  --z-float: 7;  /* cards over the canvas, panels */
  --z-trace: 8;  /* a lit path crosses everything it joins */
  --z-ask:   9;  --z-tip: 20;  --z-toast: 21;

  /* ---- Motion ------------------------------------------------------------------------- */
  --dur-intent: 80ms;      /* the pointer must rest this long before the footer reveals or a
                              path lights (the engine waits 95 ms today)                         */
  --dur-linger: 400ms;     /* the dock stays this long after the pointer leaves                  */
  --dur-release: 240ms;    /* a lit path holds this long after the pointer leaves it, so crossing
                              from a card to its source never drops it (230 ms today)            */
  --dur-hold:   300ms;     /* a render waits this long at full strength before it is shown as held */
  --dur-toast:  5000ms;    /* a toast stays this long, and for as long as the pointer is on it   */
  --dur-fly:    420ms;     /* the camera travelling to a subject                                 */
  --dur-count:  600ms;     /* a figure counting to its value: first look and recalculation only  */
  --dur-bead:   3200ms;    /* one trip of the bead along a lit path                              */
  --stagger:    80ms;      /* between things that arrive in sequence                             */

  /* ---- The world: what the 3D layer reads besides --world-*, --thread* and --obj-* ---------- */
  --world-ambient:     .15;      /* room light, as a share of full                               */
  --world-pool-rest:   .36;      /* a connected source's pool                                    */
  --world-pool-lit:    1;        /* a source in the lit path                                     */
  --world-pool-stale:  .34;      /* in --world-pool-ember                                        */
  --world-pool-receded: .2;
  --world-pool-lit-scale: 1.22;  /* a lit source's pool grows to this, as in the mockup          */
  --world-pool-ember:  #F58E6A;
  --world-ring-lit:    var(--lamp-ink);
  --world-ring-stale:  var(--ember);
  --world-cast:        rgba(23, 9, 15, .5);    /* the shadow a card or object casts              */
  --world-label:       var(--paper);
  --world-label-2:     var(--paper-2);
  --world-label-receded: .62;    /* a receded source's label: name 6.4:1, second line 4.6:1      */
  --world-grid-alpha:  .09;      /* the strength of the grid; its colour is --paper              */
  --thread-alpha:          .16;  /* WebGL takes no alpha from a colour: there a tie is --paper   */
  --thread-receded-alpha:  .10;  /* at this opacity, which equals --thread and --thread-receded  */
  --thread-width:      1.25px;
  --thread-width-lit:  1.75px;
  --thread-band-width: 8px;
  /* --thread is the tie between a component and a source. --world-thread (above, fainter) is
     kept for the optional source-to-source flow view only.                                     */

  /* The theme hook (dist/theme.js, dist/world/canvas-theme.js) reads these 19 keys and
     --om-theme-color from <html>. A key left undefined falls back, on its own and silently, to
     today's green, so every one is defined here; the var() ones follow the theme, and the
     light block restates only the literal.
     - backdrop, ground and link keys go through THREE.Color, which drops alpha: they are opaque.
       ground-line is the grid's ink at full strength; the shader supplies the strength
       (--world-grid-alpha; a fixed .16 today). The link keys colour source-to-source lines:
       accent in a lit path, muted when stepped back (--world-thread composited on the ground).
     - label keys are drawn on the 2D layer and keep alpha. No plate, no stroke, no leader: a
       source's name stands under its object without a box.
     Ties, pools, ambient light and object treatments are not behind the hook yet (its light and
     instrument groups are reserved): W2-world brings them in from --thread*, --world-* and --obj-*. */
  --om-theme-color:               var(--shadow);
  --om-canvas-backdrop:           var(--world-fog);
  --om-canvas-backdrop-clear:     var(--world-fog);
  --om-canvas-backdrop-scene:     var(--world-fog);
  --om-canvas-ground-middle:      var(--world-ground);
  --om-canvas-ground-edge:        var(--world-fog);
  --om-canvas-ground-line:        var(--paper);
  --om-canvas-link-accent:        var(--lamp-ink);
  --om-canvas-link-muted:         #47373B;
  --om-canvas-label-leader:       transparent;
  --om-canvas-label-plate:        transparent;
  --om-canvas-label-plate-active: transparent;
  --om-canvas-label-plate-stroke: transparent;
  --om-canvas-label-kicker:       var(--paper-3);
  --om-canvas-label-name:         var(--world-label);
  --om-canvas-label-metric:       var(--world-label-2);
  --om-canvas-label-badge:        var(--ember);
  --om-canvas-label-badge-text:   var(--on-ember);
  --om-canvas-label-info:         var(--paper-3);
  --om-canvas-label-info-text:    var(--paper-2);
}

/* ======================================================================================
   Light: the same table by day. Structure, type, spacing and radii are untouched.
   Text contrast (WCAG) on paper and on the desk: ink 16.9 and 12.8; second step 8.8 and
   6.6; third step 6.8 and 5.1; Lamp ink 6.8 and 5.1; verdigris 6.3 and 4.8; ember 6.7 and 5.0.
   ====================================================================================== */
:root[data-theme="light"] {
  color-scheme: light;

  --shadow:      #D2C7C9;  /* the rim of the desk                                          */
  --ground:      #E2DADB;  /* the desk: plum-grey, the page and world ground               */
  --table:       #F6F2ED;  /* paper: sheets, controls, popovers (softened 20 Nov, the owner: 'too bright'; was #FCFBF9) */
  --lit:         #EDE8E5;  /* wells and hover on paper                                     */
  --lit-2:       #E4DEDD;  /* pressed                                                      */

  --paper:       #26141C;  /* ink: the night's ground becomes the day's type               */
  --paper-2:     #57434B;
  --paper-3:     #675459;
  --paper-4:     #94858A;  /* non-text only                                                */
  --rule:        rgba(38, 20, 28, .12);
  --rule-strong: rgba(38, 20, 28, .26);

  --lamp:        #F6D183;  /* still Lamp, used only as a fill: highlighter, primary action */
  --verdigris:   #146A52;
  --ember:       #A03615;
  --ember-deep:  #D05A34;
  --mark:        #3F6E55;
  --lamp-wash:   rgba(246, 209, 131, .36);
  --ember-wash:  rgba(208, 90, 52, .13);

  /* Channel identity, light steps of the same three hues. Validated with dataviz
     validate_palette.js, light mode, all pairs, on --table and on --ground:
     CVD worst 9.7, normal-vision worst 20.4, all >= 3:1.                                   */
  --series-1:    #2F7DB0;  /* Sea   (Meta Ads)                                             */
  --series-2:    #77821F;  /* Moss  (Google Ads)                                           */
  --series-3:    #B5417A;  /* Rose  (TikTok Ads)                                           */
  --series-quiet:#8E8086;  /* 3.6:1 on paper                                               */
  --chart-grid:  rgba(38, 20, 28, .08);
  --chart-axis:  rgba(38, 20, 28, .30);

  /* paper lies on the desk: a hairline edge and a soft plum shadow                        */
  --raise-1: 0 0 0 1px rgba(38, 20, 28, .08), 0 1px 2px rgba(38, 20, 28, .10);
  --raise-2: 0 0 0 1px rgba(38, 20, 28, .08), 0 2px 3px rgba(38, 20, 28, .07), 0 18px 36px -16px rgba(38, 20, 28, .36);
  --glow-lamp:  0 0 0 1.5px var(--lamp-ink), 0 0 0 6px rgba(246, 209, 131, .75);
  --focus-ring: 0 0 0 2px var(--table), 0 0 0 4px var(--lamp-ink);

  --world-ground:     #E7E0E1;                    /* the middle of the desk, in full daylight */
  --world-fog:        var(--shadow);
  --world-lamp-light: #FFFFFF;                    /* daylight: pools only lift the desk a little */
  --world-grid:       rgba(38, 20, 28, .07);      /* drawn everywhere                       */
  --world-thread:     rgba(38, 20, 28, .30);
  --world-thread-lit: var(--lamp-ink);

  --paper-rgb:   38, 20, 28;
  --shade-rgb:   38, 20, 28;
  --on-lamp:     #17090F;
  --lamp-ink:    #7F4E08;        /* amber ink: 6.8:1 on paper, 5.1:1 on the desk           */
  --lamp-mark:   #B87F12;        /* 3.3:1 on paper, for 2px lines and bar fills            */
  --lamp-band:   rgba(246, 209, 131, .82);  /* highlighter                                 */
  --lamp-pool:   #F6D183;

  --thread:          rgba(38, 20, 28, .16);   /* D77: matching Day strength */
  --thread-receded:  rgba(38, 20, 28, .10);
  --thread-lit:      var(--lamp-ink);

  --tag-stock:   #EFB393;
  --tag-ink:     #2B1210;        /* 9.6:1 on the stock                                     */
  --tag-mark:    #8C2B10;        /* 4.7:1 on the stock                                     */
  --tag-string:  rgba(38, 20, 28, .55);
  --tag-shadow:  drop-shadow(0 1px 1px rgba(38, 20, 28, .28)) drop-shadow(0 5px 8px rgba(38, 20, 28, .18));

  --obj-rest:    none;
  --obj-lit:     saturate(1.05);
  --obj-stale:   saturate(.3) opacity(.72);
  --obj-receded: saturate(.72) opacity(.74);
  --receded:     .3;
  --sheet-alpha: 97%;

  /* ==================================================================================
     SYSTEM ADDITIONS (light). Nothing above this line differs from design/home-v2/tokens.css.
     Type, density, radii, the frame, layers and motion are the same in both themes and are
     inherited from :root; only what changes with the light is restated here.
     ================================================================================== */

  /* Identity. Validated light, ALL pairs, on --table and --ground: CVD worst 9.7,
     normal-vision worst 18.8, all >= 3:1 (palette-validation.txt, section 1).                  */
  --series-4:      #6233AB;  /* Iris */
  --mark-context:  #8A819B;              /* by day the context mark is its own step: the quiet grey
                                            sits at the Lamp mark's lightness (13.2 apart in normal
                                            vision, under the floor of 15). This one is 16.2 apart,
                                            16.2 under simulation, 3.6:1 on paper. --series-quiet
                                            (Other) stays as approved                            */
  --mark-loss:     var(--ember);         /* by day the deep step sits 3.2 from the Lamp mark
                                            under colour-vision simulation, so loss marks take
                                            the text step: 15.6 from the Lamp mark              */

  /* The chart language by day: metal is darker at its foot, as on paper under a window; the
     result is amber (the Lamp mark's own step), steps down are dusk plum, the glow is a shadow
     of colour rather than light.                                                               */
  --chart-total-top:     #D6BF94;
  --chart-total-base:    #A98B59;
  --chart-result-top:    #E9B65A;
  --chart-result-base:   #B47A0E;
  --chart-result-glow:   rgba(184, 127, 18, .30);
  --chart-step-down:     #AE9AA3;
  --chart-step-down-deep:#80676F;
  --chart-step-up-top:   #55AE91;
  --chart-step-up-base:  #146A52;
  --chart-loss-top:      #EB7C55;
  --chart-loss-base:     #A03615;
  --chart-loss-glow:     rgba(160, 54, 21, .24);
  --chart-edge-light:    rgba(255, 255, 255, .7);
  --chart-edge-shade:    rgba(38, 20, 28, .26);
  --chart-connector:     rgba(38, 20, 28, .3);
  --chart-ground:        rgba(38, 20, 28, .055);
  --chart-estimate-fill: .62;
  --chart-hatch-depth:   1;      /* by day the stripes are the mark's darker foot                       */
  --chart-series-4:  var(--chart-step-down-deep);  /* by day the lighter plum is too faint for a line          */
  --chart-area: .18;
  --chart-sheen: rgba(255, 255, 255, .32);

  /* Magnitude: more is darker by day. Every step >= 2:1 on paper.                             */
  --seq-1: #D1A662;  --seq-2: #C38F38;  --seq-3: #B27916;  --seq-4: #9A620A;  --seq-5: #7F4E08;
  --seq-ink-1: var(--paper);  --seq-ink-2: var(--paper);  --seq-ink-3: var(--paper);
  --seq-ink-4: var(--table);  --seq-ink-5: var(--table);      /* cell labels, 4.7:1 or better     */
  --seq-b-1: #80B1D6; --seq-b-2: #5A99C7; --seq-b-3: #2F7DB0; --seq-b-4: #1F6694; --seq-b-5: #115279;
  --seq-none: rgba(38, 20, 28, .05);

  /* Polarity: arms matched in lightness (L .65 and .48 on both); worst pair across the arms
     9.1 under simulation; every step 3:1 or better on paper but the midpoint. The first loss
     step is Ember's own hue at the arm's lightness with Ember's strength (C .18), not a muted
     clay: it was #D17054, 2.3 from the terracotta #D97757 that generated pages wear, and is
     now 5.4 from it. It sits 1.9 from the Lamp mark under simulation, so this scale never
     shares a plot with a Lamp mark.                                                           */
  --div-loss-2: #A03615;  --div-loss-1: #E75D35;  --div-mid: #D8D0D2;
  --div-gain-1: #5F9D8D;  --div-gain-2: #146A52;

  --tag-stock-strong: #F58E6A;   /* Ember itself, the night's value: ink 7.5:1, 8.5 from the day's
                                    stock, 7.7 from #D97757 (it was #E8825F, 3.9 from it)        */
  --on-ember:      #FFFFFF;
  --lamp-edge:     rgba(127, 78, 8, .4);
  --wash-hover:    rgba(38, 20, 28, .06);
  --wash-press:    rgba(38, 20, 28, .09);
  --wash-row:      rgba(38, 20, 28, .045);
  --selection:     rgba(246, 209, 131, .62);   /* a highlighter by day: ink on it 12.2:1 or better */
  --well:          rgba(38, 20, 28, .03);
  --skeleton:      rgba(38, 20, 28, .08);
  --scrim:         rgba(38, 20, 28, .30);

  --sheet-edge: 0 0 0 0 transparent;     /* by day the hairline is already part of --raise-*     */
  --raise-3: var(--raise-2), 0 30px 60px -24px rgba(38, 20, 28, .34);
  --dock-alpha:  88%;

  --world-ambient:     .85;
  --world-pool-rest:   .36;
  --world-pool-lit:    1;
  --world-pool-stale:  .34;
  --world-pool-receded: .2;
  --world-pool-ember:  #F58E6A;
  --world-cast:        rgba(38, 20, 28, .15);
  --world-label-receded: .72;    /* name 5.4:1 or better, second line 3.2:1 or better, to the rim  */
  --world-grid-alpha:  .07;
  --thread-alpha:          .16;
  --thread-receded-alpha:  .10;
  --om-canvas-link-muted:  #ADA3A6;      /* the one hook key that is a literal; the rest follow     */
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-quick: .01ms;
    --dur-move:  .01ms;
    --dur-lamp:  .01ms;
    --dur-trace: .01ms;
  }
}

/* The system additions that are durations follow the same rule. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-intent: .01ms;
    --dur-fly:    .01ms;
    --dur-count:  .01ms;
    --dur-bead:   0s;        /* no bead: the lit path is still, and still lit                   */
    --stagger:    0ms;
  }
}

/* More contrast when the Mac asks for it: firmer hairlines and ties, muted text one step up. */
@media (prefers-contrast: more) {
  :root {
    --rule:        rgba(244, 236, 221, .22);
    --rule-strong: rgba(244, 236, 221, .42);
    --paper-3:     #CFC1B6;
    --thread:          rgba(244, 236, 221, .62);
    --thread-receded:  rgba(244, 236, 221, .42);
    --thread-alpha: .62;  --thread-receded-alpha: .42;
    --chart-grid:  rgba(244, 236, 221, .16);
    --chart-axis:  rgba(244, 236, 221, .40);
  }
  :root[data-theme="light"] {
    --rule:        rgba(38, 20, 28, .26);
    --rule-strong: rgba(38, 20, 28, .48);
    --paper-3:     #57434B;
    --thread:          rgba(38, 20, 28, .70);
    --thread-receded:  rgba(38, 20, 28, .48);
    --thread-alpha: .70;  --thread-receded-alpha: .48;
    --chart-grid:  rgba(38, 20, 28, .16);
    --chart-axis:  rgba(38, 20, 28, .46);
  }
}

/* W1 additions */
:root {
  /* D70 overlay geometry and timing; paint follows the theme's paper-4. */
  --scrollbar-size: 5px;
  --scrollbar-min-thumb: 20px;
  --scrollbar-inset: 2px;
  --scrollbar-linger: 600ms;
  --scrollbar-fade: 150ms;
  --panel-width-wide: 640px;
  --ask-field-width: 214px;
  --detail-canvas-strip: 96px; /* D72: the dimmed canvas beside a detail panel */
  --panel-width-detail: 100vw;
}
