/* Built by kit/build.mjs from kit/src/themes/light.css: edit that, not this. Link it after kit.css. */
/*
 * Tactile UI Kit, Light: daylight and night.
 *
 * The same device, seen in two other lights. Link this after kit.css, and
 * put data-finish="daylight" (data-tone="light") or data-finish="night"
 * (data-tone="dark") on <html> or on any element; setFinish() in
 * kit/finishes.mjs sets both.
 *
 *   daylight  A low sun through a window, from the upper left, on white
 *             stock. Shadows are short and hard-edged, thrown down and to
 *             the right, and the light falls off across the desk. A lamp's
 *             halo is lost in sunlight, so a lit lamp reads as a solid lens;
 *             a reflective LCD is at its best and a VFD at its weakest.
 *   night     The room lamp is off. Nothing lights the panel from outside,
 *             so there is no catch light and no shadow. The printing and the
 *             outline of every control are lit dimly from inside, in a warm,
 *             dim white (--night-lit), the way an instrument panel is lit at
 *             night. Lamps and displays are the brightest things there are,
 *             and their light blooms onto the plate. A reflective LCD would
 *             be blank in the dark, so here it is backlit amber: the one
 *             colour outside a lamp, the VFD and a switch's green "on". Paper
 *             gives off no light, so a slip or a card is grey in the dark.
 *
 * Depth here is the light, so both finishes set the depth tokens (Tactile
 * only: a Quiet region keeps the kit's Quiet hairlines, in this finish's ink).
 *
 * Tokens first: every token aluminium gives, so nothing falls back to it, and
 * the light's own (--li-*), which the rules below draw with. Then the light:
 * the depth tokens, and the parts that paint their light in the rule itself.
 * The light stops at any element with a finish of its own and at a Quiet
 * region.
 */

/* ------------------------------------------------------------------ daylight */

[data-finish="daylight"] {
  color-scheme: light;
  /* The sun's own drawing: a key's cap and the edge round it, a switch's grip and its slot, a knob, a part's thrown shadow. */
  --li-cap: inset 0 1px 0 rgb(255 255 255 / 0.2), 0 2px 0 #000, 3px 4px 0 0 rgb(92 76 50 / 0.3), 5px 6px 2px 0 rgb(92 76 50 / 0.12);
  --li-cap-down: inset 3px 4px 0 rgb(0 0 0 / 0.4);
  --li-grip: inset 0 1px 0 #fff, 0 0 0 1px rgb(92 76 50 / 0.32), 2px 3px 0 0 rgb(92 76 50 / 0.2);
  --li-on: inset 3px 4px 0 rgb(0 0 0 / 0.16), inset 0 0 0 1px rgb(0 0 0 / 0.3);
  --li-knob: 0 0 0 1px rgb(92 76 50 / 0.75), 6px 8px 0 -2px rgb(92 76 50 / 0.2), 9px 12px 4px -2px rgb(92 76 50 / 0.1);
  --li-drop: drop-shadow(2px 3px 0 rgb(92 76 50 / 0.3));
  --li-drop-far: drop-shadow(4px 6px 0 rgb(92 76 50 / 0.22));
  /* The window: a pool of light on the desk under a window at the upper left, falling off to the desk itself before the
     screen's lower and right edges and never darker than it, so nothing on the desk reads worse than the desk's own contrast. */
  --li-window: radial-gradient(120% 90% at 0 0, #f7f3ea, #ebe6da 70%);
  --tui-red-ink: oklch(from var(--tui-red) 0.4678 calc(c * 0.8130) calc(h - 0.05));
  --tui-desk: var(--tn-desk, #ebe6da); --tn-desk: color-mix(in oklab, #ebe6da, oklch(from #ebe6da l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));          /* the desk by the window */
  --tui-face: var(--tn-face, #fbfaf6); --tn-face: color-mix(in oklab, #fbfaf6, oklch(from #fbfaf6 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));          /* white stock, in sunlight */
  --tui-face-hi: var(--tn-face-hi, #ffffff); --tn-face-hi: color-mix(in oklab, #ffffff, oklch(from #ffffff l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-face-lo: var(--tn-face-lo, #ebe7dd); --tn-face-lo: color-mix(in oklab, #ebe7dd, oklch(from #ebe7dd l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-tactile-well: var(--tn-tactile-well, #f2efe7); --tn-tactile-well: color-mix(in oklab, #f2efe7, oklch(from #f2efe7 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-skirt: var(--tn-skirt, #cbc3b2); --tn-skirt: color-mix(in oklab, #cbc3b2, oklch(from #cbc3b2 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-ink: var(--tn-ink, #1b1a17); --tn-ink: color-mix(in oklab, #1b1a17, oklch(from #1b1a17 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-ink-2: var(--tn-ink-2, #4b4840); --tn-ink-2: color-mix(in oklab, #4b4840, oklch(from #4b4840 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-ink-3: var(--tn-ink-3, #67635a); --tn-ink-3: color-mix(in oklab, #67635a, oklch(from #67635a l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-rule: var(--tn-rule, rgb(27 26 23 / 0.12)); --tn-rule: color-mix(in oklab, rgb(27 26 23 / 0.12), oklch(from rgb(27 26 23 / 0.12) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-cap: #1d1c19;
  --tui-cap-hi: #33312c;
  --tui-cap-skirt: #000;
  --tui-cap-ink: #fbfaf6;
  --tui-hl: #ffffff;
  --tui-sh: 92 76 50;           /* sun shadow, warmed by the light the desk throws back */
  --tui-sh-a: 0.28;
  --tui-tactile-grain: 0.12;
  --tui-focus: var(--tb-edge, #1b1a17);
  --tui-cap-hl: rgb(255 255 255 / 0.2);
  --tui-rocker-hi: #ffffff; --tui-rocker-mid: #f1eee7; --tui-rocker-lo: #ddd8cc; --tui-rocker-sunk: #cbc5b8; --tui-rocker-wall: #a39c8e;
  --tui-rocker-mark: #1b1a17; --tui-rocker-bezel: linear-gradient(#141311, #262420);
  --tui-knob-hi: #ffffff; --tui-knob-mid: #e6e3db; --tui-knob-lo: #aaa597;
  --tui-knob-cap-shadow: inset 0 1px 1px #fff, inset 0 -1px 2px rgb(92 76 50 / 0.3), 1px 2px 0 rgb(92 76 50 / 0.3);
  --tui-cloth: #2b2a27;
  --tui-backdrop: rgb(40 34 24 / 0.35);
  --tui-tactile-well-fill: none;
  --tui-lcd: #c5cab4;           /* a reflective LCD in sunlight: its best */
  --tui-lcd-ink: #121810;
  /* A lamp in sunlight: no halo, a coloured lens with a rim. */
  --tui-glow: 0 0 0 1px rgb(0 0 0 / 0.28), inset 0 -1px 1.5px rgb(0 0 0 / 0.25);
  --tui-quiet-well: var(--tn-quiet-well, #f3f0e9); --tn-quiet-well: color-mix(in oklab, #f3f0e9, oklch(from #f3f0e9 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-key: var(--tn-quiet-key, #ffffff); --tn-quiet-key: color-mix(in oklab, #ffffff, oklch(from #ffffff l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-key-hover: var(--tn-quiet-key-hover, #fdfcf9); --tn-quiet-key-hover: color-mix(in oklab, #fdfcf9, oklch(from #fdfcf9 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-key-down: var(--tn-quiet-key-down, #f3f0ea); --tn-quiet-key-down: color-mix(in oklab, #f3f0ea, oklch(from #f3f0ea l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-line: var(--tn-quiet-line, rgb(27 26 23 / 0.14)); --tn-quiet-line: color-mix(in oklab, rgb(27 26 23 / 0.14), oklch(from rgb(27 26 23 / 0.14) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-line-2: var(--tn-quiet-line-2, rgb(27 26 23 / 0.24)); --tn-quiet-line-2: color-mix(in oklab, rgb(27 26 23 / 0.24), oklch(from rgb(27 26 23 / 0.24) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-edge: var(--tn-quiet-edge, rgb(27 26 23 / 0.5)); --tn-quiet-edge: color-mix(in oklab, rgb(27 26 23 / 0.5), oklch(from rgb(27 26 23 / 0.5) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-hl: #ffffff;
  --tui-quiet-whisper: 2px 3px 0 rgb(92 76 50 / 0.12);
  --tui-quiet-shade: rgb(92 76 50 / 0.16);
  --tui-quiet-cap-hover: #2e2d29; --tui-quiet-cap-down: #0f0e0c; --tui-quiet-cap-ring: rgb(0 0 0 / 0.5); --tui-quiet-cap-hl: rgb(255 255 255 / 0.18);
  /* An object drawn in this finish (its plate, the material in shadow, mid tone, lit, hotspot, the room in it, frame, edge; shadow alpha; 1 for matte; its markings, and how much they and its edges glow): bead-blasted aluminium. */
  --tui-obj-plate: #c9cac5; --tui-obj-dark: #6f747b; --tui-obj-body: #aeb4bb; --tui-obj-lite: #ffffff; --tui-obj-spec: #ffffff;
  --tui-obj-env: #dde4ec; --tui-obj-frame: #bfc0bb; --tui-obj-edge: #f6f7f8; --tui-obj-shadow: 0.34; --tui-obj-matte: 0;
  --tui-obj-mark: #1b1a17; --tui-obj-glow: 0;
}

/* ------------------------------------------------------------------ night */

[data-finish="night"] {
  color-scheme: dark;
  --night-lit: 214 207 194;     /* the panel lighting: a warm, dim white behind the printing */
  /* The panel light's own drawing: the lit cap and its edge, a grip, an "on" slot, a knob. Nothing throws a shadow. */
  --li-cap: 0 0 0 1px rgb(214 207 194 / 0.5), 0 0 18px 2px rgb(214 207 194 / 0.12);
  --li-cap-down: inset 0 0 0 1px rgb(214 207 194 / 0.6), inset 0 0 10px rgb(0 0 0 / 0.25);
  --li-grip: 0 0 0 1px rgb(214 207 194 / 0.5);
  --li-on: inset 0 0 0 1px color-mix(in oklab, var(--tui-green) 70%, transparent), 0 0 14px 1px color-mix(in oklab, var(--tui-green) 45%, transparent), 0 0 40px 8px color-mix(in oklab, var(--tui-green) 12%, transparent);
  --li-knob: 0 0 0 1px rgb(214 207 194 / 0.5);
  --li-drop: none;
  --li-drop-far: none;
  --tui-red-ink: oklch(from var(--tui-red) 0.7318 calc(c * 0.8331) calc(h - 1.33));
  --tui-desk: var(--tn-desk, #040404); --tn-desk: color-mix(in oklab, #040404, oklch(from #040404 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));          /* the room, dark */
  --tui-face: var(--tn-face, #080808); --tn-face: color-mix(in oklab, #080808, oklch(from #080808 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-face-hi: var(--tn-face-hi, #121212); --tn-face-hi: color-mix(in oklab, #121212, oklch(from #121212 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-face-lo: var(--tn-face-lo, #060606); --tn-face-lo: color-mix(in oklab, #060606, oklch(from #060606 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-tactile-well: var(--tn-tactile-well, #030303); --tn-tactile-well: color-mix(in oklab, #030303, oklch(from #030303 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-skirt: var(--tn-skirt, #000); --tn-skirt: color-mix(in oklab, #000, oklch(from #000 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-ink: var(--tn-ink, #d6cfc2); --tn-ink: color-mix(in oklab, #d6cfc2, oklch(from #d6cfc2 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));           /* the panel light itself */
  --tui-ink-2: var(--tn-ink-2, #8f8b83); --tn-ink-2: color-mix(in oklab, #8f8b83, oklch(from #8f8b83 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-ink-3: var(--tn-ink-3, #7e7a73); --tn-ink-3: color-mix(in oklab, #7e7a73, oklch(from #7e7a73 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-rule: var(--tn-rule, rgb(214 207 194 / 0.1)); --tn-rule: color-mix(in oklab, rgb(214 207 194 / 0.1), oklch(from rgb(214 207 194 / 0.1) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-cap: #d0cabe;           /* the one action is the one lit cap */
  --tui-cap-hi: #ddd8cd;
  --tui-cap-skirt: #6b675f;
  --tui-cap-ink: #0e0e0e;
  --tui-hl: rgb(255 255 255 / 0.04);
  --tui-sh: 0 0 0;
  --tui-sh-a: 0.6;
  --tui-tactile-grain: 0;
  --tui-focus: var(--tb-edge, #d6cfc2);
  --tui-cap-hl: rgb(255 255 255 / 0.5);
  --tui-rocker-hi: #2a2a2b; --tui-rocker-mid: #1c1c1d; --tui-rocker-lo: #141415; --tui-rocker-sunk: #0d0d0e; --tui-rocker-wall: #050505;
  --tui-rocker-mark: #d6cfc2; --tui-rocker-bezel: linear-gradient(#000, #030303);
  --tui-knob-hi: #343436; --tui-knob-mid: #121213; --tui-knob-lo: #060606;
  --tui-knob-cap-shadow: inset 0 1px 0.5px rgb(255 255 255 / 0.08), 0 1px 2px #000;
  --tui-cloth: #0c0c0d;
  --tui-backdrop: rgb(0 0 0 / 0.75);
  --tui-tactile-well-fill: none;
  /* A reflective LCD is blank in the dark: at night it is backlit, warm. */
  --tui-lcd: #c28d3e;
  --tui-lcd-ink: #241604;
  /* At night the eye is open wide and a lamp blooms: its light reaches the plate. */
  --tui-glow: 0 0 0 1px rgb(0 0 0 / 0.3), 0 0 5px 1px color-mix(in oklab, currentColor 85%, transparent), 0 0 20px 5px color-mix(in oklab, currentColor 34%, transparent), 0 0 64px 22px color-mix(in oklab, currentColor 16%, transparent);
  /* Paper gives off no light: in the dark a slip is grey, its print still black (6:1 and 4.6:1). */
  --tui-paper: #948f84; --tui-paper-hi: #9f9a8f; --tui-paper-ink: #0f0e0c; --tui-paper-ink-2: #1f1d1a;
  /* A screw in the dark: only its rim and its slot catch the panel light. */
  --tui-screw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Ccircle cx='5' cy='5' r='4.1' fill='%230d0d0d' stroke='%23d6cfc2' stroke-opacity='.3' stroke-width='.6'/%3E%3Cpath d='M2.6 6.2 7.4 3.8' stroke='%23d6cfc2' stroke-opacity='.35' stroke-width='.8'/%3E%3C/svg%3E");
  --tui-quiet-well: var(--tn-quiet-well, #050505); --tn-quiet-well: color-mix(in oklab, #050505, oklch(from #050505 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-key: var(--tn-quiet-key, #101010); --tn-quiet-key: color-mix(in oklab, #101010, oklch(from #101010 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-key-hover: var(--tn-quiet-key-hover, #151515); --tn-quiet-key-hover: color-mix(in oklab, #151515, oklch(from #151515 l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-key-down: var(--tn-quiet-key-down, #0b0b0b); --tn-quiet-key-down: color-mix(in oklab, #0b0b0b, oklch(from #0b0b0b l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-line: var(--tn-quiet-line, rgb(214 207 194 / 0.3)); --tn-quiet-line: color-mix(in oklab, rgb(214 207 194 / 0.3), oklch(from rgb(214 207 194 / 0.3) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p)); --tui-quiet-line-2: var(--tn-quiet-line-2, rgb(214 207 194 / 0.42)); --tn-quiet-line-2: color-mix(in oklab, rgb(214 207 194 / 0.42), oklch(from rgb(214 207 194 / 0.42) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-edge: var(--tn-quiet-edge, rgb(214 207 194 / 0.5)); --tn-quiet-edge: color-mix(in oklab, rgb(214 207 194 / 0.5), oklch(from rgb(214 207 194 / 0.5) l calc(sqrt(l) * 0.065) var(--tui-tone)) var(--tn-p));
  --tui-quiet-hl: rgb(255 255 255 / 0.03);
  --tui-quiet-whisper: 0 0 0 transparent;
  --tui-quiet-shade: rgb(0 0 0 / 0.6);
  --tui-quiet-cap-hover: #dcd6cb; --tui-quiet-cap-down: #b8b2a7; --tui-quiet-cap-ring: rgb(0 0 0 / 0.6); --tui-quiet-cap-hl: rgb(255 255 255 / 0.5);
  /* The lit cloth (cloth-selector.css) in the dark: unlit, the cloth is black and its pressed words take the panel light. */
  --lc-cloth: #141415;
  --lc-deboss: #8f8b83;
  --lc-shine: transparent; --lc-lip: transparent;
  /* An object drawn in this finish (its plate, the material in shadow, mid tone, lit, hotspot, the room in it, frame, edge; shadow alpha; 1 for matte; its markings, and how much they and its edges glow): the room lamp off: dim warm metal, no hard hotspot, edges and markings lit from inside. */
  --tui-obj-plate: #040404; --tui-obj-dark: #030303; --tui-obj-body: #4d4840; --tui-obj-lite: #a89f8c; --tui-obj-spec: #d6cfc2;
  --tui-obj-env: #736b5d; --tui-obj-frame: #0a0a0a; --tui-obj-edge: #6b655a; --tui-obj-shadow: 0.2; --tui-obj-matte: 0;
  --tui-obj-mark: #d6cfc2; --tui-obj-glow: 0.6;
}

/* ------------------------------------------------------------------ one device, two lights */

@scope ([data-finish="daylight"]:not([data-volume="quiet"]), [data-finish="night"]:not([data-volume="quiet"])) to (:scope [data-finish], [data-volume="quiet"]) {
  /* The contrast key, a switch, a knob: each light's own drawing of them (--li-*). */
  .tui-key--primary { box-shadow: var(--li-cap); }
  .tui-key--primary:is(:active, [aria-pressed="true"], [aria-expanded="true"], .is-down) { box-shadow: var(--li-cap-down); }
  .tui-switch::after { box-shadow: var(--li-grip); }
  .tui-switch:checked { box-shadow: var(--li-on); }
  :is(tui-knob .tui-knob__body, .tui-setup-dial__skirt) { box-shadow: var(--li-knob); }
  /* What stands off a surface on its own shape throws the light's shadow: in the sun a hard one, at night none. */
  :is(.tui-recorder__rig, .tui-setup-dial__grip) { filter: var(--li-drop); }
  tui-recorder[data-lifted] .tui-recorder__rig { filter: var(--li-drop-far); }
}

/* ------------------------------------------------------------------ daylight */

@scope ([data-finish="daylight"]:not([data-volume="quiet"])) to (:scope [data-finish], [data-volume="quiet"]) {
  /* The sun's shadows: crisp, short, thrown down and to the right; a recess shaded hard under its upper left wall. A Tactile region inside takes them too. */
  :scope, [data-volume="tactile"] {
    --tui-depth-plate: inset 0 1px 0 #fff, 0 0 0 1px rgb(92 76 50 / 0.16), 7px 9px 0 -3px rgb(92 76 50 / 0.1), 10px 13px 4px -5px rgb(92 76 50 / 0.08);
    --tui-depth-key: inset 0 1px 0 #fff, 0 0 0 1px rgb(92 76 50 / 0.62), 0 2px 0 #cbc3b2, 3px 4px 0 0 rgb(92 76 50 / 0.24), 5px 6px 2px 0 rgb(92 76 50 / 0.1);
    --tui-depth-key-hover: inset 0 1px 0 #fff, 0 0 0 1px rgb(92 76 50 / 0.42), 0 2px 0 #cbc3b2, 3px 4px 0 0 rgb(92 76 50 / 0.26), 5px 6px 2px 0 rgb(92 76 50 / 0.12);
    --tui-depth-pressed: inset 3px 4px 0 rgb(92 76 50 / 0.2), inset 0 0 0 1px rgb(92 76 50 / 0.62);
    --tui-depth-well: inset 3px 4px 0 rgb(92 76 50 / 0.13), inset 0 0 0 1px rgb(92 76 50 / 0.72), 0 1px 0 #fff;
    --tui-depth-shade: inset 2px 3px 0 rgb(92 76 50 / 0.13);
    --tui-depth-float: inset 0 1px 0 #fff, 0 0 0 1px rgb(92 76 50 / 0.2), 12px 16px 3px -4px rgb(92 76 50 / 0.14);
  }
  /* The window: light falls off across the desk, the way a room is lit by one. It stays with the screen as the page scrolls over it. */
  :scope:root::before { content: ''; position: fixed; inset: 0; z-index: -1; background: var(--li-window); pointer-events: none; }
  .tui-panel::before { background: var(--tui-noise), linear-gradient(118deg, rgb(255 255 255 / 0.5), transparent 50%); }

  /* A lamp in sunlight: no halo, a solid coloured lens with the sun in it. The lamps set into other parts too. */
  .tui-lamp:is([data-on], .is-on) { background: radial-gradient(circle at 34% 30%, #fff 0 16%, transparent 34%), var(--c); }
  .tui-seg input:checked + span::before { background: radial-gradient(circle at 34% 30%, #fff 0 18%, transparent 36%), var(--tui-amber); box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25); }
  .tui-side a[aria-current="page"]::after, .tui-icon-rail__item:is([aria-current="page"], .is-current)::before, .tui-page-loupe__marks a[aria-current]::after,
  .tui-drawer-index__card[aria-selected="true"]::after, :is([role="treeitem"][aria-selected="true"] > .tui-file-tree__row, .tui-file-tree__row.is-down) > .tui-lamp {
    background: radial-gradient(circle at 34% 30%, #fff 0 18%, transparent 36%), var(--tui-green);
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25);
  }
  .tui-avatar > .tui-lamp:is([data-on], .is-on) { box-shadow: 0 0 0 max(1.5px, calc(var(--size) * 0.04)) var(--tui-face-hi), 0 0 0 max(2.5px, calc(var(--size) * 0.06)) rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.8)); }
  /* A VFD in sunlight: the glow is washed out. */
  .tui-vfd { text-shadow: 0 0 2px color-mix(in oklab, var(--tui-vfd) 40%, transparent); }
  /* Check keys stand on the sun's short shadow, and sink into it when checked. */
  :is(.tui-check, .tui-radio):not(:checked) { box-shadow: inset 0 1px 0 #fff, 0 0 0 1px rgb(92 76 50 / 0.6), 2px 3px 0 0 rgb(92 76 50 / 0.2); }
  :is(.tui-check, .tui-radio):checked { box-shadow: inset 3px 4px 0 rgb(92 76 50 / 0.2), inset 0 0 0 1px rgb(92 76 50 / 0.66); }
}

/* ------------------------------------------------------------------ night */

@scope ([data-finish="night"]:not([data-volume="quiet"])) to (:scope [data-finish], [data-volume="quiet"]) {
  /* Lit edges: every control's outline is a line of the panel light, dim; no shadow anywhere. */
  :scope, [data-volume="tactile"] {
    --tui-depth-plate: 0 0 0 1px rgb(214 207 194 / 0.07);
    --tui-depth-key: 0 0 0 1px rgb(214 207 194 / 0.5), 0 0 7px rgb(214 207 194 / 0.07);
    --tui-depth-key-hover: 0 0 0 1px rgb(214 207 194 / 0.6);
    --tui-depth-pressed: inset 0 0 0 1px rgb(214 207 194 / 0.6), inset 0 0 12px rgb(214 207 194 / 0.08);
    --tui-depth-well: inset 0 0 0 1px rgb(214 207 194 / 0.5), 0 0 7px rgb(214 207 194 / 0.06);
    --tui-depth-shade: none;
    --tui-depth-float: 0 0 0 1px rgb(214 207 194 / 0.35);
    --tui-depth-cap: linear-gradient(var(--tui-face-hi), var(--tui-face-hi));
  }
  /* The printing is lit from behind: it glows a little, as lit legends do. What is printed on a lit cap, on paper or on a display does not. */
  :scope { text-shadow: 0 0 10px rgb(214 207 194 / 0.28); }
  :is(.tui-key--primary, .tui-tag--solid, .tui-lcd, .tui-chat__msg[data-from="assistant"], .tui-ticket-toast, .tui-drawer-index__holder, .tui-drawer-index__card,
    .tui-drawer-index__tab, .tui-drop-zone__sheet, .tui-log-pad__text, .tui-page-wheel__window, tui-film-strip, .tui-film-strip, .tui-tooltip), [data-tip]::after { text-shadow: none; }

  /* A latched key lights its legend, as a lit push-button does (the lit cap keeps its dark one). */
  .tui-key:not(.tui-key--primary)[aria-pressed="true"] { color: #fff; text-shadow: 0 0 8px rgb(214 207 194 / 0.7); }
  /* An unlit lamp: its lens catches the panel light at the rim, so an "off" still shows. */
  .tui-lamp:not([data-on], .is-on) { box-shadow: inset 0 0 0 1px rgb(214 207 194 / 0.26); }
  .tui-avatar > .tui-lamp:not([data-on], .is-on) { box-shadow: 0 0 0 max(1.5px, calc(var(--size) * 0.04)) var(--tui-face-hi), 0 0 0 max(2.5px, calc(var(--size) * 0.06)) rgb(var(--tui-sh) / calc(var(--tui-sh-a) * 0.8)), inset 0 0 0 1px rgb(214 207 194 / 0.26); }
  :is(.tui-heatmap__lamp, .tui-heatmap__lamp.is-empty, .tui-heatmap__key-lamp) { box-shadow: inset 0 0 0 0.75px rgb(214 207 194 / 0.24); }
  /* Lamps set into other parts bloom as the lamps do. */
  .tui-seg input:checked + span::before { box-shadow: 0 0 5px 1px color-mix(in oklab, var(--tui-amber) 80%, transparent), 0 0 16px 4px color-mix(in oklab, var(--tui-amber) 26%, transparent); }
  .tui-side a[aria-current="page"]::after, .tui-icon-rail__item:is([aria-current="page"], .is-current)::before, .tui-page-loupe__marks a[aria-current]::after,
  .tui-drawer-index__card[aria-selected="true"]::after, :is([role="treeitem"][aria-selected="true"] > .tui-file-tree__row, .tui-file-tree__row.is-down) > .tui-lamp {
    box-shadow: 0 0 5px 1px color-mix(in oklab, var(--tui-green) 80%, transparent), 0 0 16px 4px color-mix(in oklab, var(--tui-green) 26%, transparent);
  }
  :is(.tui-ring__lamp, .tui-ring__dot)::after { box-shadow: 0 0 5px 1px color-mix(in oklab, var(--c) 70%, transparent), 0 0 12px 2px color-mix(in oklab, var(--c) 25%, transparent); }

  /* The knob and the setup dial: black, their ridges barely there, the edge and the pointer lit. */
  tui-knob .tui-knob__sheen { background: none; }
  tui-knob .tui-knob__knurl { background: repeating-conic-gradient(from 0deg, rgb(255 255 255 / 0.05) 0 3deg, transparent 3deg 6deg); }
  tui-knob .tui-knob__mark::after, .tui-setup-dial__bar::after { box-shadow: 0 0 6px rgb(214 207 194 / 0.8); }
  .tui-setup-dial__skirt { background: repeating-conic-gradient(from var(--sd-turn), rgb(255 255 255 / 0.05) 0 3deg, transparent 3deg 7.5deg), var(--tui-knob-mid); }
  .tui-setup-dial__bar { background: var(--tui-knob-mid); box-shadow: inset 0 0 0 1px rgb(214 207 194 / 0.35); }
  /* The rocker: two flat halves, the pressed one darker, parted by a line of the panel light; its marks lit. */
  .tui-rocker::before {
    box-shadow: none;
    background:
      linear-gradient(var(--mark), var(--mark)) calc(25% - 0.75px) 48.5% / 2px 9px no-repeat,
      radial-gradient(circle, transparent 2.7px, var(--mark-sunk) 2.9px 4px, transparent 4.2px) calc(75% - 0.75px) 51.5% / 11px 11px no-repeat,
      linear-gradient(rgb(214 207 194 / 0.3), rgb(214 207 194 / 0.3)) 50% 0 / 1px 100% no-repeat,
      linear-gradient(90deg, var(--cap-mid) 50%, var(--cap-sunk) 50%);
  }
  .tui-rocker:checked::before {
    background:
      linear-gradient(var(--mark-sunk), var(--mark-sunk)) calc(25% + 0.75px) 51.5% / 2px 8px no-repeat,
      radial-gradient(circle, transparent 3px, var(--mark) 3.2px 4.4px, transparent 4.6px) calc(75% + 0.75px) 48.5% / 12px 12px no-repeat,
      linear-gradient(rgb(214 207 194 / 0.3), rgb(214 207 194 / 0.3)) 50% 0 / 1px 100% no-repeat,
      linear-gradient(90deg, var(--cap-sunk) 50%, var(--cap-mid) 50%);
  }
  /* A shape cut into a tray's floor shows only where its lower lip catches the panel light. */
  .tui-empty-tray__shape::before { background: rgb(214 207 194 / 0.32); }
  /* A grille's holes catch the panel light at their lips, faintly. */
  .tui-grille { background: radial-gradient(circle, #000 1.1px, rgb(214 207 194 / 0.12) 1.5px, transparent 1.9px) 0 0 / 7px 7px, var(--tui-face-lo); }

  /* Displays light the plate around them, and no room light glares on their glass. */
  .tui-vfd { box-shadow: inset 0 0 0 1px rgb(214 207 194 / 0.12), 0 0 46px 6px color-mix(in oklab, var(--tui-vfd) 11%, transparent); text-shadow: 0 0 7px color-mix(in oklab, var(--tui-vfd) 70%, transparent), 0 0 22px color-mix(in oklab, var(--tui-vfd) 30%, transparent); }
  .tui-lcd { background: var(--tui-lcd); box-shadow: inset 0 0 6px rgb(0 0 0 / 0.35), 0 0 34px 5px color-mix(in oklab, var(--tui-lcd) 26%, transparent); }
  .tui-glass { background: repeating-linear-gradient(0deg, rgb(255 255 255 / 0.018) 0 1px, transparent 1px 3px), var(--tui-vfd-bg); }
  :is(.tui-ledbars__window, .tui-matrix__window, .tui-commit__matrix)::after, :is(.tui-heatmap__lamp, .tui-heatmap__key-lamp)::before, :is(.tui-gauge__glass, .tui-gauge__shadow, .tui-ring__sheen) { display: none; }
  .tui-gauge__face { background: #0a0a0a; }
  .tui-ladder { box-shadow: inset 0 0 0 1px rgb(214 207 194 / 0.2), 0 0 28px 2px color-mix(in oklab, var(--tui-green) 12%, transparent); }
  .tui-ladder::after { filter: drop-shadow(0 0 4px rgb(255 255 255 / 0.25)) drop-shadow(0 0 10px color-mix(in oklab, var(--tui-green) 50%, transparent)); }
  .tui-progress::after { background: var(--tui-ink); box-shadow: 0 0 10px rgb(214 207 194 / 0.5); }
  /* Near its limit the log pad's counter is a lamp, not the backlight: it blooms. */
  .tui-log-pad__meter[data-state="warn"] { box-shadow: inset 0 0 6px rgb(0 0 0 / 0.3), 0 0 10px 2px color-mix(in oklab, var(--tui-amber) 70%, transparent), 0 0 34px 6px color-mix(in oklab, var(--tui-amber) 30%, transparent); }

  /* Paper in the dark: grey stock, no sheen to see, but its fibres and pinholes stay. */
  .tui-recorder__paper::before { display: none; }
  /* Its light fibres would read as hairs on grey stock: the dark slip keeps the pinholes and the mottle. */
  .tui-chat__msg[data-from="assistant"] { --slip-fx: var(--slip-pin), var(--slip-mottle); }
  .tui-chat__msg[data-from="assistant"]::before {
    background:
      repeating-linear-gradient(0deg, rgb(0 0 0 / 0.014) 0 1px, transparent 1px 5px),
      repeating-linear-gradient(90deg, rgb(0 0 0 / 0.02) 0 1px, transparent 1px 4px),
      var(--slip-fx),
      linear-gradient(var(--tui-paper-hi), var(--tui-paper));
  }
  /* The print's paler patches would be paler than grey paper: in the dark it reads as solid ink. */
  .tui-chat__msg[data-from="assistant"] .tui-chat__body > p:not(.tui-chat__stopped) { background: none; -webkit-text-fill-color: currentColor; }
  /* The sources plate's count, on the grey paper, in the paper's full ink: the second ink falls just short of 4.5:1 there. */
  .tui-chat__msg .tui-sources__head > .tui-label { color: var(--tui-paper-ink); }
  .tui-drawer-index__pull::after { box-shadow: none; }
  /* A divider's pressboard, a shade under the cards in the dark, so the words on its tab still read. */
  .tui-drawer-index { --di-press: color-mix(in oklab, var(--tui-paper) 90%, var(--tui-paper-ink)); }
  /* A film frame is lit from behind, so it keeps its light. */
  :is(tui-film-strip, .tui-film-strip) { --tui-paper: #efece3; --tui-paper-hi: #f6f4ed; --tui-paper-ink: #24241f; --tui-paper-ink-2: #56554d; }
}
/* A band in another finish inside the night keeps its own printing: the glow stops at its edge (and not inside it). */
@scope ([data-finish="night"]:not([data-volume="quiet"])) to (:scope [data-finish] [data-finish], [data-volume="quiet"]) {
  [data-finish]:not([data-finish="night"]) { text-shadow: none; }
}
