/* Only authored token source. Palette values feed purpose-based roles. */
/* Shipped in a cascade layer: unlayered host CSS wins without !important. */
@layer ds.tokens, ds.base, ds.components;
@layer ds.tokens {
:root {
  color-scheme: light dark;
  --ds-neutral-0: #ffffff;
  --ds-neutral-1000: #000000;
  --ds-brand-primary: #1d4ed8;
  --ds-brand-primary-dark: #91b4ff;
  --ds-brand-secondary: #6d42b0;
  --ds-brand-secondary-dark: #c8acf4;
  --ds-space-1: 0.25rem;
  --ds-space-2: 0.5rem;
  --ds-space-3: 0.75rem;
  --ds-space-4: 1.25rem;
  --ds-space-5: 2rem;
  --ds-radius: 0.75rem;
  --ds-radius-control: 0.5rem;
  --ds-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ds-type-control-size: 1rem;
  --ds-type-control-weight: 600;
  /* Medium field labels and disclosure summaries stay quieter than action labels. */
  --ds-type-label-weight: 500;
  /* Running text: no short last line. balance evens every line, for products of short copy. */
  --ds-type-wrap: pretty;
  --ds-control-min-size: 2.75rem;
  /* Dense tool controls through comfortable page actions. Content may grow. */
  --ds-control-size-2xs: 1.5rem;
  --ds-control-size-xs: 1.75rem;
  --ds-control-size-s: 2rem;
  --ds-control-size-l: 3.5rem;
  --ds-type-control-xs: .75rem;
  --ds-type-control-small: .875rem;
  --ds-type-control-large: 1.125rem;
  --ds-icon-size-s: 1rem;
  --ds-icon-size-m: 1.25rem;
  --ds-icon-size-l: 1.5rem;
  /* Native checkboxes and radios (products use 16–20px). */
  --ds-choice-size: 1.125rem;
  --ds-control-gap-small: .375rem;
  --ds-spinner-stroke: 2px;
  --ds-focus-width: 3px;
  --ds-focus-offset: 3px;
  /* PowerLocal's state timing: feedback has no travel or bounce. */
  --ds-motion-duration-state: 200ms;
  --ds-motion-duration-spin: 900ms;
  /* visp-sibe's hover delay; keyboard focus uses a quarter. Not motion, so reduced motion keeps it.
     Override globally here or on :root, or per element/region with data-ds-tooltip-delay. */
  --ds-tooltip-delay: 400ms;
  --ds-motion-ease-standard: cubic-bezier(.2, .7, .2, 1);
  --ds-reveal-radius: 10rem;
  --ds-reveal-strength: 10%;
  --ds-reveal-allowed: 1;
  --ds-contrast-amount: 0%;
  --ds-contrast-edge: 0px;
}
/* CSS resolves aliases where they are declared. Rebind them at an explicit local
   styling boundary so inherited product primitives feed this region's roles. */
:root,
[data-ds-scope] {
  --ds-space-field-gap: var(--ds-space-2);
  --ds-space-field-gap-compact: var(--ds-space-1);
  --ds-space-related-gap: var(--ds-space-3);
  --ds-space-group-gap: var(--ds-space-4);
  --ds-space-section-gap: var(--ds-space-5);
  --ds-space-inset: var(--ds-space-4);
  --ds-space-inset-compact: var(--ds-space-3);
  --ds-type-summary-weight: var(--ds-type-label-weight);
  --ds-control-size-m: var(--ds-control-min-size);
  /* Controls share one size, type and shape until a product sets one apart: PowerLocal's buttons are
     smaller than its inputs, and each has its own corner. */
  --ds-control-size-field: var(--ds-control-size-m);
  --ds-type-button-size: var(--ds-type-control-size);
  --ds-type-button-small: var(--ds-type-control-small);
  --ds-space-button-inset: var(--ds-space-4);
  --ds-radius-button: var(--ds-radius-control);
  --ds-radius-field: var(--ds-radius-control);
  --ds-radius-well: var(--ds-radius-control);
  /* A checkbox stays a square with soft corners: a rounder product sets it, or the box reads as a radio. */
  --ds-radius-choice: calc(var(--ds-radius-control) * .625);
  /* A chip inside a field: a product with pills sets it, or the chip is rounder or squarer than its neighbours. */
  --ds-radius-chip: var(--ds-radius-control);
}
[data-ds-theme="light"] { color-scheme: light; }
[data-ds-theme="dark"] { color-scheme: dark; }

/* Contrast is independent of light/dark and inherits through nested themes. */
@media (prefers-contrast: more) {
  :root { --ds-contrast-amount: 100%; --ds-contrast-edge: 1px; --ds-reveal-allowed: 0; }
}
[data-ds-contrast="standard"] { --ds-contrast-amount: 0%; --ds-contrast-edge: 0px; --ds-reveal-allowed: 1; }
[data-ds-contrast="more"] { --ds-contrast-amount: 100%; --ds-contrast-edge: 1px; --ds-reveal-allowed: 0; }

/* Tooltip delay presets (visp-sibe's), on a button or any region such as a collapsed nav. */
[data-ds-tooltip-delay="instant"] { --ds-tooltip-delay: 0ms; }
[data-ds-tooltip-delay="fast"] { --ds-tooltip-delay: 120ms; }
[data-ds-tooltip-delay="normal"] { --ds-tooltip-delay: 400ms; }
[data-ds-tooltip-delay="slow"] { --ds-tooltip-delay: 700ms; }

/* Recompute colour and contrast-dependent roles at styling/theme boundaries. */
:root,
[data-ds-scope],
[data-ds-theme],
[data-ds-contrast] {
  /* A restrained primary tint in perceptual space, recomputed for each theme scope.
     Keep black/white anchors exact; products can still override any semantic role. */
  --ds-neutral-50: color-mix(in oklab, #f6f7f9, var(--ds-color-primary) 3%);
  --ds-neutral-100: color-mix(in oklab, #f3f4f6, var(--ds-color-primary) 3%);
  --ds-neutral-300: color-mix(in oklab, #b9bec8, var(--ds-color-primary) 4%);
  --ds-neutral-500: color-mix(in oklab, #858992, var(--ds-color-primary) 4%);
  --ds-neutral-600: color-mix(in oklab, #5e626b, var(--ds-color-primary) 4%);
  --ds-neutral-800: color-mix(in oklab, #22252b, var(--ds-color-primary) 3%);
  --ds-neutral-900: color-mix(in oklab, #202226, var(--ds-color-primary) 3%);
  --ds-neutral-950: color-mix(in oklab, #17191d, var(--ds-color-primary) 3%);
  --ds-color-canvas: color-mix(in srgb, light-dark(var(--ds-neutral-50), var(--ds-neutral-950)), light-dark(var(--ds-neutral-0), var(--ds-neutral-1000)) var(--ds-contrast-amount));
  --ds-color-surface: color-mix(in srgb, light-dark(color-mix(in oklab, var(--ds-neutral-0), var(--ds-color-primary) 1.5%), var(--ds-neutral-800)), light-dark(var(--ds-neutral-0), var(--ds-neutral-1000)) var(--ds-contrast-amount));
  --ds-color-text: color-mix(in srgb, light-dark(var(--ds-neutral-900), var(--ds-neutral-100)), light-dark(var(--ds-neutral-1000), var(--ds-neutral-0)) var(--ds-contrast-amount));
  /* One product text mapping feeds the hierarchy; any tier can still be overridden. */
  --ds-color-text-strong: var(--ds-color-text);
  --ds-color-text-body: color-mix(in srgb, var(--ds-color-text-strong) calc(94% + var(--ds-contrast-amount) * .06), var(--ds-color-surface));
  --ds-color-text-label: color-mix(in srgb, var(--ds-color-text-strong) calc(82% + var(--ds-contrast-amount) * .18), var(--ds-color-surface));
  --ds-color-text-muted: color-mix(in srgb, light-dark(var(--ds-neutral-600), var(--ds-neutral-300)), light-dark(var(--ds-neutral-1000), var(--ds-neutral-0)) var(--ds-contrast-amount));
  /* Example text in empty fields. Higher contrast lifts muted text to full text, so the placeholder
     stays a step lighter (about 9:1) and an empty field never reads as filled. */
  --ds-color-placeholder: color-mix(in srgb, var(--ds-color-text-muted), var(--ds-color-surface) calc(3% + var(--ds-contrast-amount) * .25));
  --ds-color-border: color-mix(in srgb, var(--ds-neutral-500), var(--ds-color-text) var(--ds-contrast-amount));
  /* Decorative hairlines; higher contrast raises them to about 4:1 so list rows stay separable. */
  --ds-color-divider: color-mix(in srgb, var(--ds-color-text) calc(15% + var(--ds-contrast-amount) * .35), var(--ds-color-surface));
  /* A card's edge. A product that separates cards by surface alone keeps it for higher contrast. */
  --ds-color-card-edge: var(--ds-color-divider);
  --ds-color-primary: light-dark(var(--ds-brand-primary), var(--ds-brand-primary-dark));
  --ds-color-on-primary: light-dark(var(--ds-neutral-0), var(--ds-neutral-950));
  /* What IS on (checked, selected, pressed, links, progress), apart from primary, what to DO. One colour
     by default; a product with two sets state, and text and tint follow unless it sets those too. Solid
     state sits under a glyph or as a graphic (3:1); behind words it is the tint with state-text. */
  --ds-color-state: var(--ds-color-primary);
  --ds-color-on-state: var(--ds-color-on-primary);
  --ds-color-state-text: var(--ds-color-state);
  --ds-color-state-tint: color-mix(in srgb, var(--ds-color-state) 12%, var(--ds-color-surface));
  --ds-color-secondary: light-dark(var(--ds-brand-secondary), var(--ds-brand-secondary-dark));
  --ds-color-focus: light-dark(var(--ds-brand-primary), var(--ds-brand-primary-dark));
  --ds-color-success: light-dark(#236b42, #88d7a5);
  --ds-color-warning: light-dark(#875000, #f1c375);
  --ds-color-danger: light-dark(#b52636, #ff9ba6);
  /* The filled act. Follows danger until a product fills with a colour too light for danger's words. */
  --ds-color-danger-fill: var(--ds-color-danger);
  --ds-color-on-danger: light-dark(var(--ds-neutral-0), var(--ds-neutral-1000));
  --ds-color-info: light-dark(#1d5b9f, #99c9f6);
  --ds-color-action-hover: color-mix(in srgb, var(--ds-color-primary), var(--ds-color-on-primary) 8%);
  --ds-color-action-pressed: color-mix(in srgb, var(--ds-color-primary), light-dark(var(--ds-neutral-1000), var(--ds-neutral-0)) 16%);
  /* A quiet fill for a neutral control: the soft button, the segmented well. A veil of the text colour,
     so it reads on any surface. Decoration: the control's words carry the contrast. */
  --ds-color-soft: color-mix(in srgb, var(--ds-color-text) 7%, transparent);
  /* The default button's rest. A product whose outlined button is hollow sets it to transparent. */
  --ds-color-button-fill: var(--ds-color-surface);
  /* What a field is filled with. A product that fills fields grey sets it. */
  --ds-color-field: var(--ds-color-surface);
  --ds-color-neutral-hover: color-mix(in srgb, var(--ds-color-surface), var(--ds-color-text) 6%);
  /* A chip inside a field has to read as a shape, not as typed words. */
  --ds-color-chip: var(--ds-color-neutral-hover);
  /* The lines inside a panel, between its head, body and foot, and the rim of what floats over a page. */
  --ds-color-hairline: var(--ds-color-divider);
  --ds-color-rim: color-mix(in srgb, var(--ds-color-text) calc(9% + var(--ds-contrast-amount) * .91), transparent);
  --ds-color-neutral-pressed: color-mix(in srgb, var(--ds-color-surface), var(--ds-color-text) 12%);
  /* Transparent (tertiary) controls sit on any background, so their feedback is a text-coloured veil. */
  --ds-color-ghost-hover: color-mix(in srgb, var(--ds-color-text) 8%, transparent);
  --ds-color-ghost-pressed: color-mix(in srgb, var(--ds-color-text) 14%, transparent);
  --ds-color-disabled-surface: color-mix(in srgb, var(--ds-color-surface), var(--ds-color-text) 5%);
  --ds-color-disabled-text: var(--ds-color-text-muted);
  --ds-color-reveal: light-dark(var(--ds-neutral-0), var(--ds-neutral-1000));
  --ds-control-border-width: calc(1px + var(--ds-contrast-edge));
  /* Tinted contact and ambient layers, rather than one grey blur. Edges remain structural.
     Decoration fades away in higher contrast; forced colours use the system's boundaries. */
  --ds-color-shadow: color-mix(in oklab, var(--ds-neutral-1000), var(--ds-color-primary) 15%);
  --ds-shadow-raised: 0 .0625rem .125rem color-mix(in srgb, var(--ds-color-shadow) calc(10% - var(--ds-contrast-amount) * .1), transparent), 0 .125rem .375rem color-mix(in srgb, var(--ds-color-shadow) calc(6% - var(--ds-contrast-amount) * .06), transparent);
  --ds-shadow-popup: 0 .0625rem .125rem color-mix(in srgb, var(--ds-color-shadow) calc(8% - var(--ds-contrast-amount) * .08), transparent), 0 .375rem 1rem color-mix(in srgb, var(--ds-color-shadow) calc(8% - var(--ds-contrast-amount) * .08), transparent), 0 1rem 2.5rem color-mix(in srgb, var(--ds-color-shadow) calc(6% - var(--ds-contrast-amount) * .06), transparent);
}
@media (prefers-reduced-motion: reduce) {
  :root { --ds-motion-duration-state: 0ms; }
}
}

/* A shared component's own display (inline-flex, grid) must not beat the hidden attribute: author CSS
   outranks the browser's [hidden] rule. Same layer as the components and more specific than their
   :where() selectors; hidden="until-found" keeps its own behaviour. */
@layer ds.components {
  :where([class^="ds-"], [class*=" ds-"])[hidden]:not([hidden="until-found"]) { display: none; }
}

/* Visually hidden, still read: a table's action column header, a label a sighted reader gets from the
   layout. Here because every page loads this file. It leaves the layout, so a hidden label inside a
   scrolling container needs that container positioned (position: relative), or it is placed against
   the page and can widen it. In ds.components: a host rule on the same element beats it. */
@layer ds.components {
  :where(.ds-visually-hidden) { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
}
