/* Bobert Design System, layer 1: tokens.
 *
 * Rules of this file:
 *  - Components read ROLE tokens only (--color-surface, never a raw hue). A client theme
 *    overrides roles in tokens/themes/<client>.css and touches nothing else.
 *  - Every scale is a short ladder. If a value is not on the ladder, it is a bug or a new token.
 *  - Structure after Open Props (MIT, Adam Argyle): named scales of custom properties and a
 *    shadow scale built from one colour and one strength. Values here are our own; see NOTICES.md.
 *
 * Theme switching: light is the default. Dark applies when the OS asks for it, unless the page
 * says data-theme="light"; data-theme="dark" forces dark. Both directions win over the OS.
 */

:root {
  /* ---------- Colour primitives (themes may replace; components never read these) ---------- */
  --hue-neutral: 255;
  --hue-accent: 264;
  --chroma-neutral: 0.012;

  /* ---------- Colour roles, light ---------- */
  color-scheme: light;
  --color-bg: oklch(0.985 0.004 var(--hue-neutral));          /* the page */
  --color-surface: oklch(1 0 0);                                /* cards, panels, controls at rest */
  --color-surface-raised: oklch(1 0 0);                         /* popovers, toasts, menus */
  --color-surface-sunken: oklch(0.94 var(--chroma-neutral) var(--hue-neutral)); /* tracks, wells, off states */
  --color-surface-hover: oklch(0.955 var(--chroma-neutral) var(--hue-neutral));
  --color-text: oklch(0.22 0.02 var(--hue-neutral));
  --color-text-muted: oklch(0.45 0.02 var(--hue-neutral));
  --color-text-subtle: oklch(0.58 0.015 var(--hue-neutral));
  --color-border: oklch(0.9 var(--chroma-neutral) var(--hue-neutral));
  --color-border-strong: oklch(0.78 0.015 var(--hue-neutral));
  --color-accent: oklch(0.53 0.2 var(--hue-accent));
  --color-accent-hover: oklch(0.48 0.2 var(--hue-accent));
  --color-accent-pressed: oklch(0.44 0.19 var(--hue-accent));
  --color-accent-subtle: oklch(0.95 0.03 var(--hue-accent));
  --color-on-accent: oklch(0.99 0 0);
  --color-focus: oklch(0.6 0.2 var(--hue-accent));
  --color-success: oklch(0.56 0.15 150);
  --color-on-success: oklch(0.99 0 0);
  --color-warning: oklch(0.72 0.15 75);
  --color-danger: oklch(0.55 0.21 25);
  --color-on-danger: oklch(0.99 0 0);
  --color-knob: oklch(1 0 0);                                   /* the moving part of a switch or slider */
  --color-inverse: oklch(0.24 0.02 var(--hue-neutral));         /* tooltip ground */
  --color-on-inverse: oklch(0.97 0.005 var(--hue-neutral));
  --color-scrim: oklch(0.2 0.02 var(--hue-neutral) / 0.4);

  /* One shadow colour and one strength feed the whole shadow scale. */
  --shadow-color: 250 20% 15%;   /* h s l, used as hsl(var(--shadow-color) / a) */
  --shadow-strength: 6%;

  /* ---------- Type ---------- */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  /* Scale: ratio 1.2 (minor third) around a 16px body, rounded to whole pixels. */
  --text-xs: 0.75rem;    /* 12 */
  --text-sm: 0.875rem;   /* 14 */
  --text-md: 1rem;       /* 16 body */
  --text-lg: 1.1875rem;  /* 19 */
  --text-xl: 1.4375rem;  /* 23 */
  --text-2xl: 1.75rem;   /* 28 */
  --text-3xl: 2.0625rem; /* 33 */
  --text-4xl: 2.5rem;    /* 40 */
  --text-5xl: 3rem;      /* 48 */
  --leading-tight: 1.15;   /* display */
  --leading-snug: 1.3;     /* headings, controls */
  --leading-normal: 1.55;  /* body */
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --tracking-tight: -0.02em;  /* large display only */
  --tracking-normal: 0;
  --tracking-wide: 0.04em;    /* small caps labels only */

  /* ---------- Space: a 4px grid, each step roughly 1.5x the last ---------- */
  --space-0: 0;
  --space-px: 1px;
  --space-1: 0.25rem;  /* 4 */
  --space-2: 0.5rem;   /* 8 */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.5rem;   /* 24 */
  --space-6: 2rem;     /* 32 */
  --space-7: 3rem;     /* 48 */
  --space-8: 4rem;     /* 64 */
  --space-9: 6rem;     /* 96 */

  /* ---------- Size: control heights share one ladder so rows line up ---------- */
  --control-sm: 2rem;     /* 32 */
  --control-md: 2.5rem;   /* 40 */
  --control-lg: 3rem;     /* 48 */
  --hit-min: 2.75rem;     /* 44, the minimum touch target */

  /* ---------- Radius: nested corners are concentric (inner = outer - gap) ---------- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 999px;

  /* ---------- Border ---------- */
  --border-width: 1px;
  --focus-width: 2px;
  --focus-offset: 2px;

  /* ---------- Elevation: ONE shadow scale. Higher = closer to the viewer, never a different light. ---------- */
  --shadow-1: 0 1px 2px 0 hsl(var(--shadow-color) / calc(var(--shadow-strength) + 4%));
  --shadow-2:
    0 1px 2px -1px hsl(var(--shadow-color) / calc(var(--shadow-strength) + 4%)),
    0 2px 6px -1px hsl(var(--shadow-color) / calc(var(--shadow-strength) + 2%));
  --shadow-3:
    0 2px 4px -2px hsl(var(--shadow-color) / calc(var(--shadow-strength) + 4%)),
    0 6px 16px -4px hsl(var(--shadow-color) / calc(var(--shadow-strength) + 4%));
  --shadow-4:
    0 4px 8px -4px hsl(var(--shadow-color) / calc(var(--shadow-strength) + 4%)),
    0 14px 32px -8px hsl(var(--shadow-color) / calc(var(--shadow-strength) + 8%));
  --shadow-5:
    0 8px 16px -8px hsl(var(--shadow-color) / calc(var(--shadow-strength) + 6%)),
    0 28px 56px -12px hsl(var(--shadow-color) / calc(var(--shadow-strength) + 12%));
  /* Role names, so components say what a shadow is for, not how big it is. */
  --elevation-control: var(--shadow-1);   /* resting control */
  --elevation-hover: var(--shadow-2);     /* control under a pointer */
  --elevation-knob: var(--shadow-2);      /* switch knob, slider thumb */
  --elevation-popover: var(--shadow-3);   /* tooltip, menu */
  --elevation-toast: var(--shadow-4);
  --elevation-modal: var(--shadow-5);

  /* ---------- Motion ---------- */
  /* --motion-scale multiplies every duration: 1 normal, 0 under reduced motion, 5 for slow-mo. */
  --motion-scale: 1;
  --dur-instant: calc(90ms * var(--motion-scale));   /* colour and opacity feedback on hover */
  --dur-fast: calc(150ms * var(--motion-scale));     /* press, small moves */
  --dur-base: calc(200ms * var(--motion-scale));     /* toggles, selection moves */
  --dur-slow: calc(280ms * var(--motion-scale));     /* larger travel, panels; the UI ceiling is 300ms */
  --dur-exit-factor: 0.75;                           /* exits run at three quarters of their entrance */
  /* Fades are kept under reduced motion: feedback stays, travel goes. */
  --dur-fade: calc(150ms * max(var(--motion-scale), 1));
  --delay-tooltip: 400ms;                            /* first tooltip waits; later ones open instantly */

  /* Easings. ease-out for anything entering or responding to the user; in-out for things moving
     on screen on their own; ease-in only for an exit that leaves for good. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);

  /* Spring presets. JS reads duration + bounce and hands them to Motion's animate()
     ({ type: "spring", visualDuration, bounce }). CSS gets the same spring sampled into linear(),
     paired with the duration it needs to settle. */
  --spring-snappy-duration: 0.2;
  --spring-snappy-bounce: 0.1;
  --spring-smooth-duration: 0.3;
  --spring-smooth-bounce: 0;
  --spring-bouncy-duration: 0.35;
  --spring-bouncy-bounce: 0.4;
  --ease-spring-snappy: linear(0, 0.0326, 0.0894, 0.1715, 0.2524, 0.3454, 0.4259, 0.511, 0.5804, 0.6505, 0.7056, 0.7595, 0.8007, 0.8402, 0.8697, 0.8975, 0.9201, 0.9366, 0.9517, 0.9625, 0.9722, 0.979, 0.985, 0.9891, 0.9927, 0.995, 0.997, 0.9983, 0.9994, 1, 1.0005, 1.0007, 1);
  --dur-spring-snappy: calc(274ms * var(--motion-scale));
  --ease-spring-smooth: linear(0, 0.0348, 0.1069, 0.1972, 0.2934, 0.3879, 0.4762, 0.5562, 0.627, 0.6848, 0.7383, 0.7837, 0.822, 0.8541, 0.8807, 0.9028, 0.9209, 0.9359, 0.9481, 0.958, 0.9661, 0.9727, 0.978, 0.9823, 0.9858, 0.9884, 0.9907, 0.9926, 0.9941, 0.9952, 0.9962, 0.997, 1);
  --dur-spring-smooth: calc(479ms * var(--motion-scale));
  --ease-spring-bouncy: linear(0, 0.0496, 0.1615, 0.3069, 0.4632, 0.6141, 0.749, 0.8618, 0.9539, 1.0174, 1.0593, 1.0832, 1.0926, 1.0914, 1.0831, 1.0706, 1.0563, 1.0418, 1.0285, 1.0171, 1.0079, 1.0009, 0.9961, 0.9931, 0.9916, 0.9913, 0.9919, 0.9929, 0.9942, 0.9955, 0.9968, 0.998, 1);
  --dur-spring-bouncy: calc(675ms * var(--motion-scale));

  /* Interaction constants (Emil Kowalski's numbers, see PRINCIPLES.md). */
  --press-scale: 0.97;   /* :active on anything pressable */
  --enter-scale: 0.96;   /* popovers and tooltips grow from here, never from 0 */
  --lift: -1px;          /* hover raise for raised buttons */
}

/* ---------- Dark: OS preference, unless the page forces light ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: oklch(0.17 0.012 var(--hue-neutral));
    --color-surface: oklch(0.215 0.014 var(--hue-neutral));
    --color-surface-raised: oklch(0.255 0.015 var(--hue-neutral));
    --color-surface-sunken: oklch(0.3 0.016 var(--hue-neutral));
    --color-surface-hover: oklch(0.27 0.016 var(--hue-neutral));
    --color-text: oklch(0.95 0.006 var(--hue-neutral));
    --color-text-muted: oklch(0.76 0.014 var(--hue-neutral));
    --color-text-subtle: oklch(0.64 0.014 var(--hue-neutral));
    --color-border: oklch(0.32 0.014 var(--hue-neutral));
    --color-border-strong: oklch(0.44 0.016 var(--hue-neutral));
    --color-accent: oklch(0.68 0.16 var(--hue-accent));
    --color-accent-hover: oklch(0.73 0.15 var(--hue-accent));
    --color-accent-pressed: oklch(0.63 0.16 var(--hue-accent));
    --color-accent-subtle: oklch(0.3 0.06 var(--hue-accent));
    --color-on-accent: oklch(0.16 0.02 var(--hue-accent));
    --color-focus: oklch(0.74 0.15 var(--hue-accent));
    --color-success: oklch(0.7 0.15 150);
    --color-on-success: oklch(0.16 0.03 150);
    --color-warning: oklch(0.8 0.14 75);
    --color-danger: oklch(0.68 0.18 25);
    --color-on-danger: oklch(0.16 0.03 25);
    --color-knob: oklch(0.98 0.004 var(--hue-neutral));
    --color-inverse: oklch(0.93 0.008 var(--hue-neutral));
    --color-on-inverse: oklch(0.2 0.015 var(--hue-neutral));
    --color-scrim: oklch(0 0 0 / 0.55);
    --shadow-color: 250 30% 3%;
    --shadow-strength: 30%;
  }
}

/* ---------- Dark: forced by the page ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: oklch(0.17 0.012 var(--hue-neutral));
  --color-surface: oklch(0.215 0.014 var(--hue-neutral));
  --color-surface-raised: oklch(0.255 0.015 var(--hue-neutral));
  --color-surface-sunken: oklch(0.3 0.016 var(--hue-neutral));
  --color-surface-hover: oklch(0.27 0.016 var(--hue-neutral));
  --color-text: oklch(0.95 0.006 var(--hue-neutral));
  --color-text-muted: oklch(0.76 0.014 var(--hue-neutral));
  --color-text-subtle: oklch(0.64 0.014 var(--hue-neutral));
  --color-border: oklch(0.32 0.014 var(--hue-neutral));
  --color-border-strong: oklch(0.44 0.016 var(--hue-neutral));
  --color-accent: oklch(0.68 0.16 var(--hue-accent));
  --color-accent-hover: oklch(0.73 0.15 var(--hue-accent));
  --color-accent-pressed: oklch(0.63 0.16 var(--hue-accent));
  --color-accent-subtle: oklch(0.3 0.06 var(--hue-accent));
  --color-on-accent: oklch(0.16 0.02 var(--hue-accent));
  --color-focus: oklch(0.74 0.15 var(--hue-accent));
  --color-success: oklch(0.7 0.15 150);
  --color-on-success: oklch(0.16 0.03 150);
  --color-warning: oklch(0.8 0.14 75);
  --color-danger: oklch(0.68 0.18 25);
  --color-on-danger: oklch(0.16 0.03 25);
  --color-knob: oklch(0.98 0.004 var(--hue-neutral));
  --color-inverse: oklch(0.93 0.008 var(--hue-neutral));
  --color-on-inverse: oklch(0.2 0.015 var(--hue-neutral));
  --color-scrim: oklch(0 0 0 / 0.55);
  --shadow-color: 250 30% 3%;
  --shadow-strength: 30%;
}

/* ---------- Reduced motion: every duration collapses; fades survive ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --motion-scale: 0; }
}

/* ---------- Base: the minimum every surface needs ---------- */
.bds-base,
.bds-base body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

/* A focus ring every component shares. Keyboard only: pointer clicks do not paint it. */
.bds-focus-ring:focus-visible,
.bds-focus-ring-within:has(:focus-visible) {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}

.bds-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* Segmented control. Anatomy: well (the sunken container), items (real radio inputs), pill (the
 * raised surface marking the choice). The pill's two edges are separate springs: the leading edge
 * leaves first, the trailing edge follows, so the pill stretches by growing its width as it travels.
 * Markup:
 *   <div class="bds-segmented" role="radiogroup" aria-label="Range">
 *     <span class="bds-segmented__pill" aria-hidden="true"></span>
 *     <label class="bds-segmented__item"><input type="radio" name="range" value="d" checked><span>Day</span></label>
 *     <label class="bds-segmented__item"><input type="radio" name="range" value="w"><span>Week</span></label>
 *   </div>
 */
.bds-segmented {
  --seg-h: var(--control-md);
  --seg-pad: 3px;                       /* well padding; the pill radius is the well radius minus this */
  --seg-radius: var(--radius-md);
  --seg-font: var(--text-sm);
  --seg-lead-duration: 0.22;            /* leading edge spring (s) */
  --seg-lead-bounce: 0.15;
  --seg-trail-duration: 0.32;           /* trailing edge spring (s): slower, so the pill stretches */
  --seg-trail-bounce: 0.1;

  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;               /* equal segments read as equal choices */
  height: var(--seg-h);
  padding: var(--seg-pad);
  border-radius: var(--seg-radius);
  background: var(--color-surface-sunken);
  isolation: isolate;
}

.bds-segmented__pill {
  position: absolute;
  top: var(--seg-pad);
  bottom: var(--seg-pad);
  left: 0;
  width: 0;
  border-radius: calc(var(--seg-radius) - var(--seg-pad)); /* concentric corners */
  background: var(--color-surface);
  box-shadow: var(--elevation-control), 0 0 0 0.5px var(--color-border);
  z-index: -1;
  opacity: 0;
}
.bds-segmented.is-ready .bds-segmented__pill { opacity: 1; }

.bds-segmented__item {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0 var(--space-4);
  border-radius: calc(var(--seg-radius) - var(--seg-pad));
  color: var(--color-text-muted);
  font-size: var(--seg-font);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-instant) var(--ease-out);
}
.bds-segmented__item input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: inherit;
}
.bds-segmented__item span { transition: scale var(--dur-fast) var(--ease-out); }
@media (hover: hover) { .bds-segmented__item:hover { color: var(--color-text); } }
.bds-segmented__item:active span { scale: var(--press-scale); }
.bds-segmented__item:has(input:checked) { color: var(--color-text); }
.bds-segmented__item:has(input:focus-visible) {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: 0;
}

/* Before the script measures (or without it): the chosen item carries its own surface. */
.bds-segmented:not(.is-ready) .bds-segmented__item:has(input:checked) {
  background: var(--color-surface);
  box-shadow: var(--elevation-control);
}

@media (prefers-reduced-motion: reduce) {
  .bds-segmented__item:active span { scale: 1; }
}

/* Pill tabs: navigation tabs with a sliding pill. A variant of the segmented control (same physics: one pill whose
 * two edges ride two springs), with what navigation needs and a segmented control must not have: links or tabs
 * instead of radios, items sized to their content, icons, an icons-only mode where the current item opens its
 * label, and a glass skin. Source: Glassy Navigation tabs V7.
 * Anatomy: bar (the well), pill (the raised surface behind the current item), items (icon and label).
 * Markup, as site navigation (links, aria-current):
 *   <nav class="bds-pilltabs" aria-label="Sections">
 *     <span class="bds-pilltabs__pill" aria-hidden="true"></span>
 *     <a class="bds-pilltabs__item" href="#home" aria-current="page"><svg class="bds-pilltabs__icon" viewBox="0 0 20 20" aria-hidden="true">...</svg><span class="bds-pilltabs__label"><span>Home</span></span></a>
 *     <a class="bds-pilltabs__item" href="#discover"><svg class="bds-pilltabs__icon" ...></svg><span class="bds-pilltabs__label"><span>Discover</span></span></a>
 *   </nav>
 * As tabs over panels: <div class="bds-pilltabs" role="tablist" aria-label="..."> with
 *   <button class="bds-pilltabs__item" role="tab" aria-selected="true" aria-controls="p1">...</button>
 * Options: data-collapse (inactive items show their icon only; the current one opens its label), data-glass.
 */
.bds-pilltabs {
  /* Tunable. Every value here is a knob in the playground. */
  --pt-h: var(--control-md);
  --pt-pad: 4px;                          /* well padding; the pill radius is concentric with the well */
  --pt-gap: 2px;
  --pt-font: var(--text-sm);
  --pt-blur: 16px;                        /* glass only */
  --pt-lead-duration: 0.22;               /* leading edge spring (s) */
  --pt-lead-bounce: 0.15;
  --pt-trail-duration: 0.32;              /* trailing edge spring (s): slower, so the pill stretches */
  --pt-trail-bounce: 0.1;
  --pt-label-dur: var(--dur-slow);        /* icons-only mode: how fast a label opens and closes */

  position: relative;
  display: inline-flex; align-items: stretch; gap: var(--pt-gap);
  height: var(--pt-h); padding: var(--pt-pad); box-sizing: border-box;
  border-radius: var(--radius-full);
  background: var(--color-surface-sunken);
  isolation: isolate;
}
.bds-pilltabs[data-glass] {
  background: color-mix(in oklab, var(--color-surface) 45%, transparent);
  box-shadow: inset 0 0 0 var(--border-width) color-mix(in oklab, var(--color-text) 14%, transparent), var(--elevation-popover);
  backdrop-filter: blur(var(--pt-blur)) saturate(1.4); -webkit-backdrop-filter: blur(var(--pt-blur)) saturate(1.4);
}
.bds-pilltabs__pill {
  position: absolute; z-index: -1; top: var(--pt-pad); bottom: var(--pt-pad); left: 0; width: 0;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  box-shadow: var(--elevation-control), 0 0 0 0.5px var(--color-border);
  opacity: 0;
}
.bds-pilltabs[data-glass] .bds-pilltabs__pill { background: color-mix(in oklab, var(--color-surface) 92%, transparent); box-shadow: var(--elevation-hover), inset 0 1px 0 color-mix(in oklab, white 40%, transparent); }
.bds-pilltabs.is-ready .bds-pilltabs__pill { opacity: 1; }

.bds-pilltabs__item {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-full); background: none;
  color: var(--color-text-muted); font: inherit; font-size: var(--pt-font); font-weight: var(--weight-medium); line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-instant) var(--ease-out);
}
.bds-pilltabs__icon { width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: scale var(--dur-fast) var(--ease-out); }
/* The label opens by growing its column (0fr to 1fr): width, never scaleX. */
.bds-pilltabs__label { display: grid; grid-template-columns: 1fr; transition: grid-template-columns var(--pt-label-dur) var(--ease-out), opacity var(--pt-label-dur) var(--ease-out), margin var(--pt-label-dur) var(--ease-out); margin-left: var(--space-2); }
.bds-pilltabs__label > span { overflow: hidden; min-width: 0; }
.bds-pilltabs__item:not(:has(.bds-pilltabs__icon)) .bds-pilltabs__label { margin-left: 0; }
@media (hover: hover) { .bds-pilltabs__item:hover { color: var(--color-text); } }
.bds-pilltabs__item:active .bds-pilltabs__icon, .bds-pilltabs__item:active .bds-pilltabs__label { scale: var(--press-scale); }
.bds-pilltabs__item:is([aria-current="page"], [aria-current="true"], [aria-selected="true"]) { color: var(--color-text); }
.bds-pilltabs__item:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: 0; }

.bds-pilltabs[data-collapse] .bds-pilltabs__item { padding: 0 calc((var(--pt-h) - 2 * var(--pt-pad) - 1rem) / 2); }
.bds-pilltabs[data-collapse] .bds-pilltabs__item:not([aria-current="page"], [aria-current="true"], [aria-selected="true"]) .bds-pilltabs__label { grid-template-columns: 0fr; opacity: 0; margin-left: 0; }
.bds-pilltabs.is-measuring .bds-pilltabs__label { transition: none !important; }

/* Before the script measures (or without it): the current item carries its own surface. */
.bds-pilltabs:not(.is-ready) .bds-pilltabs__item:is([aria-current="page"], [aria-current="true"], [aria-selected="true"]) { background: var(--color-surface); box-shadow: var(--elevation-control); }

@media (prefers-reduced-motion: reduce) {
  .bds-pilltabs__label { transition: opacity var(--dur-fade) linear; }
  .bds-pilltabs__item:active .bds-pilltabs__icon, .bds-pilltabs__item:active .bds-pilltabs__label { scale: 1; }
}

/* Carousel: a 3D coverflow with a glass control pill, and a zoom-open viewer. Anatomy: stage (perspective),
 * slides (the centre at full size, neighbours at ±1 and ±2 smaller, turned on Y and dimmed), the pill
 * (previous, count, next) and the viewer (a modal that zooms out of the centre slide and back into it).
 * Sources: Glassy Carousel V2 (the look), the sneaker-wall zoom (open from the item); the same model as the
 * Library's lightbox (library/lightbox.js), extracted here as a component.
 * Markup:
 *   <section class="bds-carousel" aria-roledescription="carousel" aria-label="Films">
 *     <div class="bds-carousel__stage">
 *       <figure class="bds-carousel__slide">
 *         <button class="bds-carousel__media" type="button" aria-label="Open Interstellar"><img src="a.jpg" alt=""></button>
 *         <figcaption class="bds-carousel__cap"><strong>Interstellar</strong><span>2014</span></figcaption>
 *       </figure>
 *       ...
 *     </div>
 *     <div class="bds-carousel__pill">
 *       <button class="bds-carousel__btn" type="button" data-carousel-prev aria-label="Previous slide">...</button>
 *       <span class="bds-carousel__count"></span>
 *       <button class="bds-carousel__btn" type="button" data-carousel-next aria-label="Next slide">...</button>
 *     </div>
 *   </section>
 * carousel.js sets data-off (-3..3) on every slide, labels them "2 of 6, Interstellar", and opens the viewer.
 * data-viewer="off" keeps the media inert (a plain carousel).
 */
.bds-carousel {
  /* Tunable. Every value here is a knob in the playground. */
  --car-w: 14rem;                 /* centre slide width */
  --car-ratio: 3 / 4;
  --car-spread: 62%;              /* how far the ±1 neighbours sit from the centre, as a share of a slide */
  --car-spread-2: 108%;
  --car-scale-1: 0.82;
  --car-scale-2: 0.68;
  --car-angle: 18deg;             /* neighbours turn toward the centre by this much */
  --car-perspective: 1200px;
  --car-dim: 0.55;                /* opacity of the ±1 neighbours (±2 get half of it) */
  --car-dur: var(--dur-slow);
  --car-ease: var(--ease-out);
  --car-radius: var(--radius-lg);

  position: relative;
  display: grid; justify-items: center; gap: var(--space-4);
  width: 100%;
  color: var(--color-text);
}
.bds-carousel__stage {
  position: relative; width: 100%;
  display: grid; justify-items: center;   /* every slide shares one cell: the stage is as tall as a slide */
  perspective: var(--car-perspective); perspective-origin: 50% 50%;
  touch-action: pan-y;
  outline: none;
}
.bds-carousel__slide {
  grid-area: 1 / 1; margin: 0;
  width: var(--car-w);
  display: grid; gap: var(--space-2);
  transform-style: preserve-3d;
  transition: transform var(--car-dur) var(--car-ease), opacity var(--car-dur) var(--car-ease), filter var(--car-dur) var(--car-ease);
}
.bds-carousel__media {
  position: relative; display: block; width: 100%; aspect-ratio: var(--car-ratio); padding: 0; overflow: hidden;
  border: var(--border-width) solid color-mix(in oklab, var(--color-text) 12%, transparent); border-radius: var(--car-radius);
  background: var(--color-surface-sunken); color: inherit; font: inherit; cursor: zoom-in;
  box-shadow: var(--elevation-toast);
}
.bds-carousel__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bds-carousel__media:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.bds-carousel__cap { display: grid; gap: 2px; padding: 0 var(--space-1); font-size: var(--text-sm); transition: opacity var(--dur-fast) var(--ease-out); }
.bds-carousel__cap span { color: var(--color-text-muted); font-size: var(--text-xs); }

.bds-carousel__slide[data-off="0"] { z-index: 3; }
.bds-carousel__slide[data-off="-1"] { z-index: 2; transform: translateX(calc(var(--car-spread) * -1)) scale(var(--car-scale-1)) rotateY(var(--car-angle)); opacity: var(--car-dim); filter: brightness(0.8); }
.bds-carousel__slide[data-off="1"] { z-index: 2; transform: translateX(var(--car-spread)) scale(var(--car-scale-1)) rotateY(calc(var(--car-angle) * -1)); opacity: var(--car-dim); filter: brightness(0.8); }
.bds-carousel__slide[data-off="-2"] { z-index: 1; transform: translateX(calc(var(--car-spread-2) * -1)) scale(var(--car-scale-2)) rotateY(var(--car-angle)); opacity: calc(var(--car-dim) / 2); filter: brightness(0.7); }
.bds-carousel__slide[data-off="2"] { z-index: 1; transform: translateX(var(--car-spread-2)) scale(var(--car-scale-2)) rotateY(calc(var(--car-angle) * -1)); opacity: calc(var(--car-dim) / 2); filter: brightness(0.7); }
.bds-carousel__slide[data-off="-3"] { transform: translateX(-140%) scale(0.6); opacity: 0; visibility: hidden; }
.bds-carousel__slide[data-off="3"] { transform: translateX(140%) scale(0.6); opacity: 0; visibility: hidden; }
.bds-carousel__slide:not([data-off="0"]) .bds-carousel__cap { opacity: 0; }
.bds-carousel__slide:not([data-off="0"]) .bds-carousel__media { cursor: pointer; }

/* The pill: glass over whatever sits behind it. */
.bds-carousel__pill, .bds-carousel-viewer__pill {
  display: flex; align-items: center; gap: var(--space-1); max-width: 100%; padding: var(--space-1);
  border: var(--border-width) solid color-mix(in oklab, var(--color-text) 14%, transparent); border-radius: var(--radius-full);
  background: color-mix(in oklab, var(--color-surface-raised) 70%, transparent);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: var(--elevation-popover);
}
.bds-carousel__count { min-width: 0; padding: 0 var(--space-2); font-family: var(--font-mono); font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bds-carousel__btn {
  display: grid; place-items: center; flex: none; width: 2.25rem; height: 2.25rem; padding: 0;
  border: 0; border-radius: var(--radius-full); background: transparent; color: var(--color-text); cursor: pointer;
  transition: background-color var(--dur-instant) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.bds-carousel__btn svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .bds-carousel__btn:hover:not(:disabled) { background: color-mix(in oklab, var(--color-text) 10%, transparent); } }
.bds-carousel__btn:active { transform: scale(var(--press-scale)); }
.bds-carousel__btn:disabled { opacity: 0.35; cursor: default; }
.bds-carousel__btn:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: 0; }

/* The viewer: a modal that grows out of the centre slide (FLIP) and returns into it. */
.bds-carousel-viewer { position: fixed; inset: 0; z-index: 70; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: var(--space-4); padding: var(--space-6) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom, 0px)); color: var(--color-text); }
.bds-carousel-viewer__scrim { position: absolute; inset: 0; z-index: -1; background: color-mix(in oklab, var(--color-bg) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.bds-carousel-viewer__media { position: relative; justify-self: center; align-self: center; height: 100%; max-height: 100%; max-width: 100%; aspect-ratio: var(--car-ratio, 3 / 4); overflow: hidden; border-radius: var(--radius-xl); box-shadow: var(--elevation-modal); background: var(--color-surface-sunken); }
.bds-carousel-viewer__media > * { width: 100%; height: 100%; }
.bds-carousel-viewer__media img { display: block; object-fit: cover; }
.bds-carousel-viewer__pill { justify-self: center; }

@media (prefers-reduced-motion: reduce) {
  .bds-carousel__slide { transform: none !important; filter: none; transition: opacity var(--dur-fade) linear; }
  .bds-carousel__slide:not([data-off="0"]) { opacity: 0; visibility: hidden; }
  .bds-carousel__btn:active { transform: none; }
}
.bds-carousel[data-flat] .bds-carousel__slide { transform: none !important; filter: none; transition: opacity var(--dur-fade) linear; }
.bds-carousel[data-flat] .bds-carousel__slide:not([data-off="0"]) { opacity: 0; visibility: hidden; }

/* Accordion. Anatomy: item, trigger (a real button inside a heading), chevron, panel.
 * The panel animates its real height with the grid 0fr to 1fr technique: no measuring, no
 * max-height guesses, works with content of any size and in every current browser.
 * Markup:
 *   <div class="bds-accordion" data-single>
 *     <div class="bds-accordion__item">
 *       <h3 class="bds-accordion__heading">
 *         <button class="bds-accordion__trigger" type="button" id="q1-t" aria-expanded="false" aria-controls="q1">
 *           <span>Question</span><svg class="bds-accordion__chevron" viewBox="0 0 16 16" aria-hidden="true"><path d="M4 6l4 4 4-4"/></svg>
 *         </button>
 *       </h3>
 *       <div class="bds-accordion__panel" id="q1" role="region" aria-labelledby="q1-t" inert>
 *         <div class="bds-accordion__inner"><div class="bds-accordion__content">Answer</div></div>
 *       </div>
 *     </div>
 *   </div>
 */
.bds-accordion {
  --acc-duration: var(--dur-slow);      /* opening; closing runs at --dur-exit-factor of it */
  --acc-ease: var(--ease-out);
  --acc-shift: 6px;                     /* content drops in by this much while it fades in */
  --acc-pad-y: var(--space-4);
  display: grid;
  border-top: var(--border-width) solid var(--color-border);
}
.bds-accordion__item { border-bottom: var(--border-width) solid var(--color-border); }
.bds-accordion__heading { margin: 0; font: inherit; }

.bds-accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  padding: var(--acc-pad-y) var(--space-1);
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-weight: var(--weight-medium);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-instant) var(--ease-out);
}
@media (hover: hover) { .bds-accordion__trigger:hover { color: var(--color-accent); } }
.bds-accordion__trigger:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: 0; }

.bds-accordion__chevron {
  flex: none;
  width: 1rem; height: 1rem;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  color: var(--color-text-subtle);
  transition: rotate calc(var(--acc-duration) * var(--dur-exit-factor)) var(--acc-ease);
}
.bds-accordion__trigger[aria-expanded="true"] .bds-accordion__chevron { rotate: 180deg; transition-duration: var(--acc-duration); }

.bds-accordion__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows calc(var(--acc-duration) * var(--dur-exit-factor)) var(--acc-ease);
}
.bds-accordion__inner { min-height: 0; overflow: hidden; }
.bds-accordion__content {
  padding: 0 var(--space-1) var(--acc-pad-y);
  color: var(--color-text-muted);
  opacity: 0;
  transform: translateY(calc(var(--acc-shift) * -1));
  transition: opacity var(--dur-fade) var(--ease-out), transform calc(var(--acc-duration) * var(--dur-exit-factor)) var(--acc-ease);
}

.bds-accordion__item:has(> .bds-accordion__heading [aria-expanded="true"]) .bds-accordion__panel {
  grid-template-rows: 1fr;
  transition-duration: var(--acc-duration);
}
.bds-accordion__item:has(> .bds-accordion__heading [aria-expanded="true"]) .bds-accordion__content {
  opacity: 1;
  transform: none;
  transition-duration: var(--dur-fade), var(--acc-duration);
  transition-delay: calc(var(--acc-duration) * 0.15), 0s; /* the room opens, then the content arrives */
}

@media (prefers-reduced-motion: reduce) {
  .bds-accordion__content { transform: none; }
  .bds-accordion__chevron { transition: none; }
}

/* Tooltip. Anatomy: trigger (any focusable element), tooltip (a short label on the inverse ground).
 * A tooltip adds a hint; it never holds the only name of a control. Icon buttons still need
 * aria-label. Markup:
 *   <button class="bds-button" data-tooltip="Copy link" aria-label="Copy link">...</button>
 * Settings are read from the trigger (or any ancestor): --tt-delay, --tt-skip, --tt-offset,
 * --tt-duration, --tt-from-scale, data-tooltip-placement="top | bottom".
 */
:root {
  --tt-delay: var(--delay-tooltip);   /* the first tooltip waits, so passing the pointer over is quiet */
  --tt-skip: 300ms;                   /* within this long after one closes, the next opens at once */
  --tt-offset: 8px;
  --tt-duration: var(--dur-fast);
  --tt-from-scale: var(--enter-scale);
  --tt-shift: 4px;                    /* starts this far toward its trigger */
}

.bds-tooltip {
  position: fixed;
  top: 0; left: 0;
  z-index: 1100;
  max-width: 16rem;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-inverse);
  color: var(--color-on-inverse);
  box-shadow: var(--elevation-popover);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  pointer-events: auto;               /* hoverable, so the pointer can move onto it (WCAG 1.4.13) */
  opacity: 0;
  transform: translateY(var(--_from-y, 0)) scale(var(--tt-from-scale));
  transform-origin: var(--_origin, 50% 100%);
  transition:
    opacity calc(var(--tt-duration) * var(--dur-exit-factor)) var(--ease-out),
    transform calc(var(--tt-duration) * var(--dur-exit-factor)) var(--ease-out);
}
.bds-tooltip[data-side="top"] { --_from-y: var(--tt-shift); --_origin: 50% 100%; }
.bds-tooltip[data-side="bottom"] { --_from-y: calc(var(--tt-shift) * -1); --_origin: 50% 0%; }
.bds-tooltip[data-open] {
  opacity: 1;
  transform: none;
  transition-duration: var(--tt-duration);
}
/* Opened while another was just open: no animation at all, it is the same thought continuing. */
.bds-tooltip[data-instant] { transition: none; }

@media (prefers-reduced-motion: reduce) {
  .bds-tooltip { transform: none; transition: opacity var(--dur-fade) linear; }
}

/* Toast. Anatomy: toaster (the fixed live region), toast (surface), icon, title, description,
 * action, dismiss. Newest sits in front; older toasts tuck behind it, each one a step smaller and
 * a peek higher. Hover or focus the stack to fan it out. Swipe a toast sideways to dismiss it.
 */
.bds-toaster {
  --toast-width: 22rem;
  --toast-gap: var(--space-3);       /* space between toasts when fanned out */
  --toast-peek: 10px;                /* how much of each tucked toast shows */
  --toast-scale-step: 0.05;          /* each tucked toast is this much smaller */
  --toast-duration: var(--dur-slow); /* movement in the stack */
  --toast-edge: var(--space-5);      /* distance from the viewport edge */
  --toast-visible: 3;                /* toasts shown in the stack; older ones wait hidden */
  --toast-life: 4s;                  /* time on screen; paused while hovered or focused */

  position: fixed;
  z-index: 1000;
  bottom: var(--toast-edge);
  right: var(--toast-edge);
  width: min(var(--toast-width), calc(100vw - 2 * var(--toast-edge)));
  margin: 0; padding: 0;
  list-style: none;
  pointer-events: none;
}
.bds-toaster[data-position="bottom-left"] { right: auto; left: var(--toast-edge); }
.bds-toaster[data-position="bottom-center"] { right: auto; left: 50%; translate: -50% 0; }

/* The toaster's hover area grows to cover the fanned-out stack, so the pointer can travel up it. */
.bds-toaster::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--stack-h, 0px); pointer-events: auto; }

.bds-toast {
  --y: 100%;
  --s: 1;
  --x: 0px;
  position: absolute;
  right: 0; bottom: 0; left: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-raised);
  color: var(--color-text);
  box-shadow: var(--elevation-toast);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  pointer-events: auto;
  touch-action: pan-y;
  transform-origin: 50% 0;
  transform: translate(var(--x), var(--y)) scale(var(--s));
  opacity: 0;
  transition:
    transform var(--toast-duration) var(--ease-out),
    opacity var(--dur-fade) var(--ease-out),
    height var(--toast-duration) var(--ease-out);
}
.bds-toast[data-mounted] { opacity: 1; }
.bds-toast[data-hidden] { opacity: 0; pointer-events: none; }
.bds-toast[data-removing] {
  opacity: 0;
  transition-duration: calc(var(--toast-duration) * var(--dur-exit-factor)), var(--dur-fade), 0s;
}
.bds-toast[data-swiping] { transition: none; }

/* Tucked: every toast takes the front toast's height and hides its content. */
.bds-toaster:not([data-expanded]) .bds-toast:not([data-front]) { height: var(--front-h); overflow: hidden; }
.bds-toast > * { transition: opacity var(--dur-fade) var(--ease-out); }
.bds-toaster:not([data-expanded]) .bds-toast:not([data-front]) > * { opacity: 0; }

.bds-toast__icon { width: 1.25rem; height: 1.25rem; margin-top: 1px; grid-row: span 2; }
.bds-toast__icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bds-toast[data-tone="success"] .bds-toast__icon { color: var(--color-success); }
.bds-toast[data-tone="danger"] .bds-toast__icon { color: var(--color-danger); }
.bds-toast[data-tone="info"] .bds-toast__icon { color: var(--color-accent); }
.bds-toast:not(:has(.bds-toast__icon)) { grid-template-columns: 1fr auto; }

.bds-toast__title { margin: 0; font-weight: var(--weight-semibold); }
.bds-toast__description { margin: 0; color: var(--color-text-muted); grid-column: -3 / -2; }
.bds-toast:not(:has(.bds-toast__icon)) .bds-toast__description { grid-column: 1; }
.bds-toast__actions { grid-column: -3 / -2; display: flex; gap: var(--space-2); margin-top: var(--space-2); }

.bds-toast__dismiss {
  grid-column: -2; grid-row: 1;
  display: grid; place-items: center;
  width: 1.75rem; height: 1.75rem; margin: calc(var(--space-1) * -1) calc(var(--space-1) * -1) 0 0;
  border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--color-text-subtle);
  cursor: pointer;
  transition: background-color var(--dur-instant) var(--ease-out), color var(--dur-instant) var(--ease-out);
}
.bds-toast__dismiss svg { width: 0.875rem; height: 0.875rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
@media (hover: hover) { .bds-toast__dismiss:hover { background: var(--color-surface-hover); color: var(--color-text); } }
.bds-toast__dismiss:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: 0; }

@media (prefers-reduced-motion: reduce) {
  /* No travel: toasts appear in place and fade. The stack does not fan, it lists. */
  .bds-toast { transition: opacity var(--dur-fade) linear; }
}

/* Button. Anatomy: container (shape, fill, elevation), label, status layer (spinner, check).
 * Label and status share one grid cell, so a state change never changes the button's width.
 * Variants: data-variant="primary | secondary | ghost | danger". Sizes: data-size="sm | md | lg".
 * States: data-state="idle | loading | success" (set by button.js, BDS.button.run).
 */
.bds-button {
  --btn-h: var(--control-md);
  --btn-px: var(--space-4);
  --btn-gap: var(--space-2);
  --btn-radius: var(--radius-md);
  --btn-font: var(--text-sm);
  --btn-press: var(--press-scale);
  --btn-lift: var(--lift);
  --btn-duration: var(--dur-fast);
  --btn-bg: var(--color-accent);
  --btn-bg-hover: var(--color-accent-hover);
  --btn-bg-active: var(--color-accent-pressed);
  --btn-fg: var(--color-on-accent);
  --btn-border: transparent;
  --btn-shadow: var(--elevation-control);
  --btn-shadow-hover: var(--elevation-hover);

  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: var(--btn-h);
  height: var(--btn-h);
  padding: 0 var(--btn-px);
  border: var(--border-width) solid var(--btn-border);
  border-radius: var(--btn-radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--btn-shadow);
  font: inherit;
  font-size: var(--btn-font);
  font-weight: var(--weight-medium);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--btn-duration) var(--ease-out),
    background-color var(--dur-instant) var(--ease-out),
    box-shadow var(--btn-duration) var(--ease-out),
    color var(--dur-instant) var(--ease-out);
}
.bds-button > * { grid-area: 1 / 1; }

.bds-button__label {
  display: inline-flex;
  align-items: center;
  gap: var(--btn-gap);
  transition: opacity var(--dur-fade) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.bds-button svg { width: 1em; height: 1em; flex: none; }

/* Variants */
.bds-button[data-variant="secondary"] {
  --btn-bg: var(--color-surface);
  --btn-bg-hover: var(--color-surface-hover);
  --btn-bg-active: var(--color-surface-sunken);
  --btn-fg: var(--color-text);
  --btn-border: var(--color-border);
}
.bds-button[data-variant="ghost"] {
  --btn-bg: transparent;
  --btn-bg-hover: var(--color-surface-hover);
  --btn-bg-active: var(--color-surface-sunken);
  --btn-fg: var(--color-text);
  --btn-shadow: none;
  --btn-shadow-hover: none;
  --btn-lift: 0px;
}
.bds-button[data-variant="danger"] {
  --btn-bg: var(--color-danger);
  --btn-bg-hover: color-mix(in oklab, var(--color-danger), black 10%);
  --btn-bg-active: color-mix(in oklab, var(--color-danger), black 18%);
  --btn-fg: var(--color-on-danger);
}

/* Sizes: heights come from the shared control ladder so buttons line up with inputs. */
.bds-button[data-size="sm"] { --btn-h: var(--control-sm); --btn-px: var(--space-3); --btn-radius: var(--radius-sm); --btn-font: var(--text-sm); --btn-gap: var(--space-1); }
.bds-button[data-size="lg"] { --btn-h: var(--control-lg); --btn-px: var(--space-5); --btn-radius: var(--radius-lg); --btn-font: var(--text-md); }

/* Hover: lighter fill, one step up the shadow scale, a 1px lift. Pointer devices only. */
@media (hover: hover) {
  .bds-button:hover:not(:disabled, [aria-disabled="true"]) {
    background: var(--btn-bg-hover);
    box-shadow: var(--btn-shadow-hover);
    transform: translateY(var(--btn-lift));
  }
}
/* Press: shrink to 0.97, drop back to rest elevation. Fast in, so it answers the finger. */
.bds-button:active:not(:disabled, [aria-disabled="true"]) {
  background: var(--btn-bg-active);
  box-shadow: var(--btn-shadow);
  transform: scale(var(--btn-press));
  transition-duration: calc(var(--btn-duration) * 0.6);
}
.bds-button:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}
.bds-button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

/* ---------- Loading and success ---------- */
.bds-button__status { position: relative; width: 1.15em; height: 1.15em; pointer-events: none; }
.bds-button__status > svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  opacity: 0;
  transform: translateY(4px) scale(0.9); /* enters from just below, never from scale(0) */
  transition: opacity var(--dur-fade) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.bds-button__spinner { animation: bds-spin calc(700ms * max(var(--motion-scale), 1)) linear infinite; animation-play-state: paused; }
.bds-button__spinner circle { stroke-dasharray: 40 100; opacity: 0.9; }
.bds-button__check path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset var(--btn-check-duration, var(--dur-slow)) var(--ease-out) calc(var(--dur-fast) * 0.5); }

.bds-button[data-state="loading"], .bds-button[data-state="success"] { cursor: default; }
.bds-button[data-state="loading"] .bds-button__label,
.bds-button[data-state="success"] .bds-button__label { opacity: 0; transform: translateY(-4px); }
.bds-button[data-state="loading"] .bds-button__spinner { opacity: 1; transform: none; animation-play-state: running; }
.bds-button[data-state="success"] {
  --btn-bg: var(--color-success); --btn-bg-hover: var(--color-success); --btn-bg-active: var(--color-success);
  --btn-fg: var(--color-on-success); --btn-border: transparent;
}
.bds-button[data-state="success"] .bds-button__check { opacity: 1; transform: none; }
.bds-button[data-state="success"] .bds-button__check path { stroke-dashoffset: 0; }

@keyframes bds-spin { to { transform: rotate(360deg); } }
@keyframes bds-pulse { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .bds-button, .bds-button:hover, .bds-button:active { transform: none !important; }
  .bds-button__label, .bds-button__status > svg { transform: none !important; }
  /* A spinner that does not spin still has to say "working": it breathes instead. */
  .bds-button__spinner { animation: bds-pulse 1.2s ease-in-out infinite; animation-play-state: paused; }
  .bds-button__check path { transition: none; }
}


.iso{
  --anatomy-page:#0b0b0b;--anatomy-card:#131313;--anatomy-text:#a3a3a3;--anatomy-strong:#e6e6e6;--anatomy-muted:#6e6e6e;
  --anatomy-paper:#131313;--anatomy-face:#1b1b1b;--anatomy-top:#1c1c1c;
  --anatomy-shade-0:#0f0f0f;--anatomy-shade-1:#121212;--anatomy-shade-2:#151515;--anatomy-shade-3:#181818;
  --anatomy-lit-top:#262626;--anatomy-lit-shade:#1d1d1d;
  --anatomy-hi:#d4d4d4;--anatomy-mid:#6a6a6a;--anatomy-lo:#3e3e3e;--anatomy-faint:#2a2a2a;--anatomy-lit:#ffffff;
  --anatomy-halo:#050505;--anatomy-halo-opacity:.9;--anatomy-dot:#e6e6e6;
  --anatomy-red:#ff6b6b;--anatomy-green:#6be0a0;--anatomy-blue:#6b9bff;
  --anatomy-weight:.6px;--anatomy-ease:cubic-bezier(.32,.72,0,1);
  --anatomy-mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  --anatomy-lift:inset 0 1px 0 0 #ffffff0a,inset 0 0 0 1px #ffffff06,0 0 0 1px #00000026,0 1px 1px -.5px #00000014,0 3px 3px -1.5px #00000014,0 6px 6px -3px #00000014,0 12px 12px -6px #00000014;
}
.iso[data-theme="light"]{
  --anatomy-page:#f2f2ef;--anatomy-card:#fbfbfa;--anatomy-text:#57575a;--anatomy-strong:#18181a;--anatomy-muted:#8c8c90;
  --anatomy-paper:#fbfbfa;--anatomy-face:#ffffff;--anatomy-top:#ffffff;
  --anatomy-shade-0:#dcdcd9;--anatomy-shade-1:#e5e5e2;--anatomy-shade-2:#ededea;--anatomy-shade-3:#f4f4f1;
  --anatomy-lit-top:#ffffff;--anatomy-lit-shade:#eeeeeb;
  --anatomy-hi:#26262a;--anatomy-mid:#8a8a8f;--anatomy-lo:#b4b4b8;--anatomy-faint:#d4d4d6;--anatomy-lit:#000000;
  --anatomy-halo:#8a8a80;--anatomy-halo-opacity:.32;--anatomy-dot:#3a3a3e;
  --anatomy-red:#e5484d;--anatomy-green:#30a46c;--anatomy-blue:#3e63dd;
  --anatomy-lift:inset 0 1px 0 0 #ffffff,0 0 0 1px #0000000f,0 1px 1px -.5px #0000000a,0 3px 3px -1.5px #0000000a,0 6px 6px -3px #0000000a,0 12px 12px -6px #0000000a;
}
.iso-svg{display:block;width:100%;height:auto;overflow:visible}
.iso-svg path,.iso-svg circle{vector-effect:non-scaling-stroke}
.iso-fill{fill:var(--anatomy-paper);stroke:none}
.iso-solid[data-lit]>.iso-fill{fill:var(--anatomy-face)}
.iso-shade,.iso-top{stroke:none}
.iso-shade[data-shade="0"]{fill:var(--anatomy-shade-0)}
.iso-shade[data-shade="1"]{fill:var(--anatomy-shade-1)}
.iso-shade[data-shade="2"]{fill:var(--anatomy-shade-2)}
.iso-shade[data-shade="3"]{fill:var(--anatomy-shade-3)}
.iso-top{fill:var(--anatomy-top)}
.iso-solid[data-lit]>.iso-top{fill:var(--anatomy-lit-top)}
.iso-solid[data-lit]>.iso-shade{fill:var(--anatomy-lit-shade)}
.iso-solid[data-seamless]>.iso-shade,.iso-solid[data-seamless]>.iso-top{stroke-width:.4;stroke-linejoin:round}
.iso-solid[data-seamless]>.iso-shade[data-shade="0"]{stroke:var(--anatomy-shade-0)}
.iso-solid[data-seamless]>.iso-shade[data-shade="1"]{stroke:var(--anatomy-shade-1)}
.iso-solid[data-seamless]>.iso-shade[data-shade="2"]{stroke:var(--anatomy-shade-2)}
.iso-solid[data-seamless]>.iso-shade[data-shade="3"]{stroke:var(--anatomy-shade-3)}
.iso-solid[data-seamless]>.iso-top{stroke:var(--anatomy-top)}
.iso-solid[data-seamless][data-lit]>.iso-top{stroke:var(--anatomy-lit-top)}
.iso-solid[data-seamless][data-lit]>.iso-shade{stroke:var(--anatomy-lit-shade)}
.iso-solid[data-lit]>.iso-edge{stroke:var(--anatomy-lit)}
.iso-halo{fill:var(--anatomy-halo);stroke:none;filter:blur(9px);opacity:var(--anatomy-halo-opacity);transform:translateY(3px)}
.iso-line{fill:none;stroke:var(--anatomy-lo);stroke-width:var(--anatomy-weight);stroke-linecap:round;stroke-linejoin:round}
.iso-line[data-tone="hi"]{stroke:var(--anatomy-hi)}
.iso-line[data-tone="mid"]{stroke:var(--anatomy-mid)}
.iso-line[data-tone="lo"]{stroke:var(--anatomy-lo)}
.iso-line[data-tone="faint"]{stroke:var(--anatomy-faint)}
.iso-line[data-tone="lit"]{stroke:var(--anatomy-lit)}
.iso-line[data-tone="red"]{stroke:var(--anatomy-red)}
.iso-line[data-tone="green"]{stroke:var(--anatomy-green)}
.iso-line[data-tone="blue"]{stroke:var(--anatomy-blue)}
.iso-line[data-dotted]{stroke-dasharray:.01 3.5;stroke-width:1}
.iso-line[data-dashed]{stroke-dasharray:3 3}
.iso-line[data-flow]{stroke-dasharray:2 6}
.iso-wire-end{fill:var(--anatomy-paper);stroke:var(--anatomy-lo);stroke-width:var(--anatomy-weight)}
.iso-wire[data-tone="hi"] .iso-wire-end{stroke:var(--anatomy-hi)}
.iso-wire[data-tone="mid"] .iso-wire-end{stroke:var(--anatomy-mid)}
.iso-wire[data-tone="faint"] .iso-wire-end{stroke:var(--anatomy-faint)}
.iso-wire[data-tone="lit"] .iso-wire-end{stroke:var(--anatomy-lit)}
.iso-dots circle{fill:var(--anatomy-dot);stroke:none;opacity:.32}
.iso-dots[data-tone="hi"] circle{opacity:.85}
.iso-dots[data-tone="mid"] circle{opacity:.45}
.iso-dots[data-tone="lo"] circle{opacity:.22}
.iso-dots[data-tone="faint"] circle{opacity:.12}
.iso-face-text{fill:var(--anatomy-mid);font-family:var(--anatomy-mono);letter-spacing:.04em}
.iso-face-text[data-tone="hi"]{fill:var(--anatomy-hi)}
.iso-face-text[data-tone="lo"]{fill:var(--anatomy-lo)}
.iso-face-text[data-tone="faint"]{fill:var(--anatomy-faint)}
.tb-body{fill:var(--anatomy-shade-2);stroke:none}
.tb-shine{fill:var(--anatomy-top);stroke:none}
.tb-shade{fill:var(--anatomy-shade-0);stroke:none}
.tb-ring{fill:none;stroke:var(--anatomy-lo);stroke-width:.45;stroke-linecap:butt;stroke-linejoin:round}
.tb-ring[data-tone="mid"]{stroke:var(--anatomy-mid)}
.tb-ring[data-tone="faint"]{stroke:var(--anatomy-faint)}
.tb-ring[data-tone="hi"]{stroke:var(--anatomy-hi)}
@keyframes iso-flow{to{stroke-dashoffset:-32}}
@keyframes iso-pulse{0%,100%{opacity:.18}12%{opacity:1}40%{opacity:.18}}
.iso-line[data-flow]{animation:iso-flow 1600ms linear infinite}
.iso-dots circle[data-pulse]{animation:iso-pulse 1600ms steps(1,end) infinite;animation-delay:var(--pulse-at,0ms)}
.iso-figure{margin:32px 0 36px}
.iso-plate{position:relative;padding:52px 24px;border-radius:0;background:var(--anatomy-card);box-shadow:0 0 0 1px var(--anatomy-mid);--anatomy-paper:var(--anatomy-card)}
.iso-plate-corners{position:absolute;inset:18px 20px;pointer-events:none}
.iso-plate-corner{position:absolute;color:var(--anatomy-muted);font-family:var(--anatomy-mono);font-size:10.5px;line-height:1;letter-spacing:.04em;white-space:nowrap}
.iso-plate-corner[data-corner="fig"]{top:0;left:0;color:var(--anatomy-text)}
.iso-plate-corner[data-corner="title"]{top:0;right:0;text-transform:uppercase;letter-spacing:.1em}
.iso-plate-corner[data-corner="hint"]{bottom:0;left:0;text-transform:uppercase;letter-spacing:.1em}
.iso-plate-corner[data-corner="readout"]{right:0;bottom:0;color:var(--anatomy-text);font-variant-numeric:tabular-nums}
.iso-plate .iso-svg{margin:0 auto}
.iso-legend{display:grid;gap:8px;margin-top:12px;color:var(--anatomy-muted);font-size:13px;line-height:1.55}
.iso-keys{display:flex;flex-wrap:wrap;gap:6px 18px}
.iso-key{display:inline-flex;align-items:center;gap:7px}
.iso-swatch{width:16px;height:10px;flex:none;overflow:visible}
.iso-swatch path{fill:none;stroke:var(--anatomy-hi);stroke-width:1;vector-effect:non-scaling-stroke;stroke-linejoin:round;stroke-linecap:round}
.iso-swatch[data-mark="raised"] path,.iso-swatch[data-mark="flat"] path{stroke:var(--anatomy-mid)}
.iso-swatch[data-mark="lit"] path{stroke:var(--anatomy-lit)}
.iso-swatch[data-mark="dim"] path{stroke:var(--anatomy-lo)}
.iso-swatch[data-mark="dotted"] path{stroke-dasharray:.01 3;stroke-width:1.4}
.iso-swatch[data-mark="dashed"] path{stroke-dasharray:3 2.5}
.iso-swatch[data-mark="red"] path{stroke:var(--anatomy-red)}
.iso-swatch[data-mark="green"] path{stroke:var(--anatomy-green)}
.iso-swatch[data-mark="blue"] path{stroke:var(--anatomy-blue)}
.iso-swatch-crease{stroke:var(--anatomy-lo)!important}
@media (max-width:560px){.iso-plate{padding:48px 12px 70px}.iso-plate-corner[data-corner="hint"]{bottom:18px}}
@media (prefers-reduced-motion:reduce){.iso-line[data-flow],.iso-dots circle[data-pulse]{animation:none}}

.slurry,.slurry-ink{--anatomy-paper:#2d5aa3;--anatomy-face:#3566b3;--anatomy-top:#5f88cc;--anatomy-shade-0:#1d498b;--anatomy-shade-1:#244f94;--anatomy-shade-2:#2a579d;--anatomy-shade-3:#3060a8;--anatomy-hi:#14233f;--anatomy-mid:#1d498b;--anatomy-lo:#1d498b;--anatomy-faint:#1d498b}
.slurry-ink{fill:#5f88cc;stroke:none}
.iso[data-theme="dark"] .slurry,.iso[data-theme="dark"] .slurry-ink{--anatomy-paper:#1d3f75;--anatomy-face:#22477f;--anatomy-top:#3d68ad;--anatomy-shade-0:#142f5a;--anatomy-shade-1:#183567;--anatomy-shade-2:#1b3b72;--anatomy-shade-3:#1f427c;--anatomy-hi:#9fbbe8;--anatomy-mid:#5f88cc;--anatomy-lo:#3d68ad;--anatomy-faint:#2d5aa3}
.iso[data-theme="dark"] .slurry-ink{fill:#3d68ad}
.iso-plate [data-mark="blue"]{--anatomy-blue:#1d498b}
.void-shade{fill:#5b6170;opacity:.45;stroke:none}
.iso[data-theme="dark"] .void-shade{fill:#000;opacity:.5}
.iso-stage{cursor:pointer;touch-action:none;outline:none}
.iso-stage:focus-visible{box-shadow:0 0 0 2px #1d498b;border-radius:8px}


/* SAVE theme over the Bobert design tokens: navy is the accent, red stays the action button only. */
:root{--color-accent:#1d498b;--color-accent-hover:#173d75;--color-accent-pressed:#123262;--color-on-accent:#fff;--color-focus:#1d498b;
  --font-sans:"Public Sans",system-ui,-apple-system,"Segoe UI",sans-serif;--radius-md:4px;--radius-sm:3px;--radius-lg:6px}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--color-accent:#8fb1e6;--color-accent-hover:#a6c2ec;--color-accent-pressed:#7aa0dc;--color-on-accent:#0d1830;--color-focus:#8fb1e6}}
:root[data-theme="dark"]{--color-accent:#8fb1e6;--color-accent-hover:#a6c2ec;--color-accent-pressed:#7aa0dc;--color-on-accent:#0d1830;--color-focus:#8fb1e6}


/* Layout: a field report. One measured column, a horizontal level line with ticks as the running rule,
   photographs carry the proof, navy is ink, red is only the action button. */
:root{
  --ground:#e9eaec;      /* poured concrete, cool */
  --slab:#f6f6f5;        /* panels: a fresh-cut face */
  --ink:#14233f;         /* logo navy, deepened for text */
  --navy:#1d498b;        /* sampled from the badge */
  --steel:#9aa0aa;       /* the badge's silver bar */
  --muted:#535b69;
  --rule:#c3c7ce;
  --red:#e61d30;         /* sampled; the action button and nothing else */
  --red-ink:#ffffff;
  --pill:#fff3c4; --pill-ink:#5a4400;
  --display:"Barlow Semi Condensed","Barlow","Arial Narrow",system-ui,sans-serif;
  --label:"Barlow Condensed","Arial Narrow",system-ui,sans-serif;
  --body:"Public Sans",system-ui,-apple-system,"Segoe UI",sans-serif;
  --measure:64ch;
  --wrap:1180px;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme:dark;
    --ground:#11151c; --slab:#1a1f28; --ink:#e4e8ef; --navy:#8fb1e6; --steel:#6c7380;
    --muted:#a7afbd; --rule:#333b48; --pill:#3d3310; --pill-ink:#f5df8a;
  }
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --ground:#11151c; --slab:#1a1f28; --ink:#e4e8ef; --navy:#8fb1e6; --steel:#6c7380;
  --muted:#a7afbd; --rule:#333b48; --pill:#3d3310; --pill-ink:#f5df8a;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}*{transition:none!important;animation:none!important}}
body{margin:0;background:var(--ground);color:var(--ink);font:400 18px/1.6 var(--body);
  padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));}
img{max-width:100%;display:block}
a{color:var(--navy);text-underline-offset:3px}
a:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{outline:3px solid var(--navy);outline-offset:3px}
h1,h2,h3{font-family:var(--display);line-height:1.05;text-wrap:balance;margin:0;letter-spacing:-.005em}
h1{font-size:clamp(2.4rem,5.4vw,4.1rem);font-weight:700}
h2{font-size:clamp(1.8rem,3.4vw,2.6rem);font-weight:700}
h3{font-size:1.35rem;font-weight:600}
p{margin:0;max-width:var(--measure)}
.wrap{max-width:var(--wrap);margin-inline:auto}
.eyebrow{font:600 .95rem/1 var(--label);letter-spacing:.14em;text-transform:uppercase;color:var(--navy);display:flex;align-items:center;gap:.6rem}
.eyebrow b{font-variant-numeric:tabular-nums;color:var(--muted);font-weight:600}
.lede{font-size:1.18rem;color:var(--muted)}
.stack{display:flex;flex-direction:column;gap:1.1rem}
section{padding-block:clamp(48px,7vw,88px)}

/* the mock band */
.mockbar{position:sticky;top:env(safe-area-inset-top,0px);z-index:20;margin-inline:calc(-1 * max(16px,env(safe-area-inset-left,0px)));
  padding:.45rem max(16px,env(safe-area-inset-left,0px));background:var(--ink);color:var(--ground);
  font:500 .85rem/1.3 var(--label);letter-spacing:.06em;display:flex;gap:1rem;align-items:center;justify-content:space-between;flex-wrap:wrap}
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:21;background:var(--ink)}
.mockbar button{font:600 .8rem/1 var(--label);letter-spacing:.08em;text-transform:uppercase;background:transparent;color:inherit;border:1px solid currentColor;border-radius:3px;padding:.4rem .7rem;cursor:pointer}
.pill{display:inline-block;font:600 .72rem/1.2 var(--label);letter-spacing:.06em;text-transform:uppercase;background:var(--pill);color:var(--pill-ink);
  padding:.18rem .45rem;border-radius:2px;vertical-align:.15em;margin-left:.35rem;white-space:nowrap}
body.clean .pill{display:none}

/* header */
.top{display:flex;align-items:center;justify-content:space-between;gap:1.5rem;padding-block:18px;flex-wrap:wrap}
.brand{display:flex;align-items:center;gap:.7rem;text-decoration:none;color:var(--ink)}
.brand img{width:56px;height:auto}
.brand span{font:600 .8rem/1.2 var(--label);letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
nav ul{list-style:none;margin:0;padding:0;display:flex;flex-wrap:wrap;gap:.2rem 1.3rem}
nav a{font:600 1.02rem/1 var(--label);letter-spacing:.04em;color:var(--ink);text-decoration:none;padding-block:.5rem;display:inline-block}
nav a:hover{color:var(--navy);text-decoration:underline}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;font:700 1.08rem/1 var(--label);letter-spacing:.06em;text-transform:uppercase;
  text-decoration:none;padding:1rem 1.4rem;border-radius:3px;border:2px solid transparent;cursor:pointer}
.btn-go{background:var(--red);color:var(--red-ink)}
.btn-go:hover{filter:brightness(.92)}
.btn-line{border-color:var(--ink);color:var(--ink);background:transparent}
.btn-line:hover{background:var(--slab)}
.top .btn{padding:.75rem 1rem;font-size:.95rem}
.phone{font:700 1.1rem/1 var(--label);letter-spacing:.04em;color:var(--ink);text-decoration:none;font-variant-numeric:tabular-nums}

/* the level line: the site's one graphic */
.level{position:relative;height:22px;margin-block:8px}
.level::before{content:"";position:absolute;left:0;right:0;top:10px;height:2px;background:var(--ink)}
.level::after{content:"";position:absolute;left:0;right:0;top:4px;height:14px;
  background:repeating-linear-gradient(90deg,var(--ink) 0 1px,transparent 1px 24px),repeating-linear-gradient(90deg,var(--ink) 0 2px,transparent 2px 120px);
  background-size:auto 7px,auto 14px;background-repeat:repeat-x;background-position:0 4px,0 0;opacity:.55}
.level .bubble{position:absolute;left:50%;top:2px;transform:translateX(-50%);width:64px;height:18px;border:2px solid var(--ink);border-radius:9px;background:var(--ground)}
.level .bubble::after{content:"";position:absolute;left:50%;top:3px;width:18px;height:8px;margin-left:-9px;border-radius:4px;background:var(--navy)}
.dim{font:600 .9rem/1 var(--label);letter-spacing:.06em;color:var(--navy);font-variant-numeric:tabular-nums;white-space:nowrap}

/* before / after slider */
.ba{position:relative;overflow:hidden;border-radius:2px;background:var(--slab);aspect-ratio:2/1;max-width:100%;user-select:none;touch-action:pan-y}
.ba img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.ba .after{clip-path:inset(0 0 0 var(--x,50%))}
.ba .handle{position:absolute;top:0;bottom:0;left:var(--x,50%);width:2px;background:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.25)}
.ba .handle::after{content:"";position:absolute;top:50%;left:50%;width:38px;height:38px;margin:-19px 0 0 -19px;border-radius:50%;background:#fff;
  box-shadow:0 1px 6px rgba(0,0,0,.35);background-image:linear-gradient(90deg,transparent 11px,#14233f 11px 13px,transparent 13px 25px,#14233f 25px 27px,transparent 27px)}
.ba input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:ew-resize;margin:0}
.ba .tag{position:absolute;top:10px;font:700 .75rem/1 var(--label);letter-spacing:.14em;text-transform:uppercase;background:rgba(20,35,63,.82);color:#fff;padding:.4rem .55rem;border-radius:2px}
.ba .tag.l{left:10px}.ba .tag.r{right:10px}
figure{margin:0}
figcaption{display:flex;flex-wrap:wrap;gap:.2rem .9rem;align-items:baseline;margin-top:.6rem;font:500 .95rem/1.35 var(--label);letter-spacing:.03em;color:var(--muted)}
figcaption strong{color:var(--ink);font-weight:700;letter-spacing:.06em;text-transform:uppercase}

/* tables */
.tbl-wrap{overflow-x:auto;border-top:2px solid var(--ink)}
table{border-collapse:collapse;width:100%;min-width:620px;font-variant-numeric:tabular-nums}
th,td{text-align:left;vertical-align:top;padding:.95rem .9rem .95rem 0;border-bottom:1px solid var(--rule)}
thead th{font:700 .9rem/1.2 var(--label);letter-spacing:.12em;text-transform:uppercase;color:var(--muted);padding-top:.8rem}
tbody th{font:600 1.05rem/1.3 var(--label);letter-spacing:.03em;width:22%}
td.lift{color:var(--ink);font-weight:600}
td small,.src{display:block;font-size:.8rem;color:var(--muted);font-weight:400;margin-top:.25rem}
sup a{font:600 .72rem var(--label);text-decoration:none}

/* reviews, panels */
.panel{background:var(--slab);border-top:2px solid var(--ink);padding:clamp(20px,3vw,32px)}
blockquote{margin:0;font:500 clamp(1.3rem,2.4vw,1.7rem)/1.35 var(--display);max-width:40ch}
blockquote footer{margin-top:.8rem;font:600 .95rem/1 var(--label);letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.stars{color:var(--navy);letter-spacing:.15em;font-size:1.1rem}

/* form */
form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px}
label{display:flex;flex-direction:column;gap:.35rem;font:600 .95rem/1.2 var(--label);letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
input,select,textarea{font:400 1rem/1.4 var(--body);color:var(--ink);background:var(--ground);border:1px solid var(--steel);border-radius:2px;padding:.75rem .8rem;width:100%}
.full{grid-column:1/-1}
.consent{flex-direction:row;align-items:flex-start;gap:.7rem;text-transform:none;letter-spacing:0;font:400 .88rem/1.45 var(--body);color:var(--muted)}
.consent input{width:auto;margin-top:.2rem}
.formnote{font-size:.85rem;color:var(--muted)}

/* footer */
footer.site{border-top:2px solid var(--ink);padding-block:40px 56px;display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:28px;font-size:.95rem;color:var(--muted)}
footer.site h3{font-size:1rem;font-family:var(--label);letter-spacing:.1em;text-transform:uppercase;color:var(--ink);margin-bottom:.6rem}
footer.site ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.35rem}
footer.site a{color:var(--muted)}

/* mobile call bar */
.callbar{display:none}
@media (max-width:720px){
  body{font-size:17px}
  nav{display:none}
  .top .btn{display:none}
  form{grid-template-columns:1fr}
  .callbar{display:grid;grid-template-columns:1fr 1.4fr;gap:8px;position:fixed;left:0;right:0;bottom:0;z-index:30;background:var(--ink);
    padding:10px max(12px,env(safe-area-inset-right,0px)) calc(10px + env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px))}
  .callbar a{padding:.8rem .5rem;font-size:.95rem}
  .callbar .btn-line{border-color:var(--ground);color:var(--ground)}
  footer.site{padding-bottom:110px}
}

/* home only */
.hero{display:grid;grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);gap:clamp(24px,4vw,56px);align-items:center;padding-block:clamp(28px,5vw,64px) 28px}
.hero .ctas{display:flex;flex-wrap:wrap;gap:12px;align-items:center}
.anchor{font:600 1.05rem/1.3 var(--label);letter-spacing:.04em;color:var(--muted)}
.anchor b{color:var(--ink);font-size:1.25rem;font-variant-numeric:tabular-nums}
.facts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;padding-block:6px 4px}
.facts div{font:600 1rem/1.25 var(--label);letter-spacing:.04em;color:var(--muted)}
.facts b{display:block;font:700 1.6rem/1.1 var(--display);color:var(--ink);font-variant-numeric:tabular-nums}
.split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.5fr);gap:clamp(24px,4vw,56px);align-items:start}
.sc{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr);gap:24px;align-items:start}
.q{display:grid;grid-template-columns:2rem minmax(0,1fr) auto;gap:.4rem 1rem;align-items:center;padding-block:.85rem;border-bottom:1px solid var(--rule)}
.q .n{font:700 1.3rem/1 var(--display);color:var(--navy);font-variant-numeric:tabular-nums}
.verdict{position:sticky;top:64px}
.verdict .stamp{font:700 .85rem/1 var(--label);letter-spacing:.18em;text-transform:uppercase;color:var(--navy)}
.verdict h3{font-size:1.8rem;margin-block:.4rem .6rem}
.proof{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:22px}
.proof img{aspect-ratio:1/1;object-fit:cover;width:100%;border-radius:2px}
.reviews{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:24px;align-items:end;margin-top:36px}
.count{font:700 clamp(3rem,7vw,5rem)/.9 var(--display);font-variant-numeric:tabular-nums}
.how{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:clamp(24px,4vw,56px);align-items:center}
.xsec{width:100%;height:auto;max-width:100%}
.xsec text{font-family:var(--label);font-weight:600;font-size:15px;letter-spacing:.04em;fill:var(--ink)}
.xsec .muted{fill:var(--muted)}
.steps{list-style:none;margin:0;padding:0;counter-reset:s;display:flex;flex-direction:column;gap:1rem}
.steps li{counter-increment:s;display:grid;grid-template-columns:2.2rem minmax(0,1fr);gap:.8rem}
.steps li::before{content:counter(s);font:700 1.6rem/1 var(--display);color:var(--navy)}
.psi{font:600 clamp(1.25rem,2.2vw,1.55rem)/1.3 var(--display);border-left:3px solid var(--navy);padding-left:1rem}
.surfaces{display:flex;flex-wrap:wrap;gap:0;border-top:2px solid var(--ink)}
.surfaces a{flex:1 1 180px;display:flex;flex-direction:column;gap:.3rem;padding:1.1rem 1rem 1.1rem 0;border-bottom:1px solid var(--rule);text-decoration:none;color:var(--ink)}
.surfaces a b{font:700 1.4rem/1 var(--display)}
.surfaces a span{font:500 .95rem/1.2 var(--label);letter-spacing:.04em;color:var(--navy)}
.surfaces a:hover b{text-decoration:underline}
.b2b{background:#14233f;color:#eef0f3;margin-inline:calc(-1 * max(16px,env(safe-area-inset-left,0px)));padding-inline:max(16px,env(safe-area-inset-left,0px))}
.b2b .inner{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(0,1fr);gap:32px;align-items:end}
.b2b .eyebrow{color:#a9b8d4}
.b2b p{color:#c9d0dc}
.b2b .btn-line{border-color:#eef0f3;color:#eef0f3}
.b2b .btn-line:hover{background:transparent;text-decoration:underline}
.where{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);gap:clamp(24px,4vw,56px);align-items:start}
.towns{columns:2;column-gap:24px;list-style:none;padding:0;margin:.4rem 0 0;font:500 1.05rem/1.9 var(--label);letter-spacing:.03em}
.towns a{color:var(--ink);text-decoration:none}.towns a:hover{color:var(--navy);text-decoration:underline}
@media (max-width:900px){
  .hero,.split,.sc,.how,.where,.reviews,.b2b .inner{grid-template-columns:1fr}
  .facts{grid-template-columns:repeat(2,minmax(0,1fr))}
  .proof{grid-template-columns:repeat(2,minmax(0,1fr))}
  .verdict{position:static}
}


/* round 2: finish, motion, tactile controls. Depth only on things you press; content stays flat. */
.btn{transition:transform var(--dur-fast,.12s) var(--ease-out,ease),box-shadow var(--dur-fast,.12s),filter .12s,background-color .12s}
.btn-go{box-shadow:inset 0 1px 0 rgba(255,255,255,.28),inset 0 -2px 0 rgba(0,0,0,.18),0 1px 2px rgba(20,35,63,.25),0 4px 10px -4px rgba(230,29,48,.55)}
.btn-go:hover{filter:none;background:#d41a2c;transform:translateY(-1px);box-shadow:inset 0 1px 0 rgba(255,255,255,.28),inset 0 -2px 0 rgba(0,0,0,.18),0 2px 4px rgba(20,35,63,.25),0 8px 18px -6px rgba(230,29,48,.6)}
.btn-go:active{transform:translateY(1px);box-shadow:inset 0 2px 4px rgba(0,0,0,.25)}
.btn-line{box-shadow:inset 0 -2px 0 rgba(20,35,63,.12)}
.btn-line:active{transform:translateY(1px);box-shadow:inset 0 2px 3px rgba(20,35,63,.18)}
.bds-button.btn{height:auto;--btn-bg:var(--red);--btn-bg-hover:#d41a2c;--btn-bg-active:#c01828;--btn-fg:#fff;border-radius:3px}
/* mega menu */
.mm-bar{align-items:center}
.mm{position:static}
.top{position:relative}
.mm-btn,.mm-link{font:600 1.02rem/1 var(--label);letter-spacing:.04em;color:var(--ink);background:none;border:0;padding:.55rem .1rem;cursor:pointer;display:inline-flex;align-items:center;gap:.3rem;text-decoration:none;border-bottom:2px solid transparent;transition:border-color .15s,color .15s}
.mm-btn svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.6;transition:transform .2s var(--ease-out,ease)}
.mm-btn[aria-expanded="true"] svg{transform:rotate(180deg)}
.mm-btn:hover,.mm-link:hover,.mm-btn[aria-expanded="true"]{color:var(--navy);border-bottom-color:var(--navy);text-decoration:none}
.mm-panel{position:absolute;left:0;right:0;top:100%;z-index:15;background:var(--slab);border-top:2px solid var(--ink);box-shadow:0 18px 40px -18px rgba(20,35,63,.35);padding:22px clamp(16px,3vw,32px) 26px}
.mm-panel:not([hidden]){animation:mmIn .18s var(--ease-out,ease)}
@keyframes mmIn{from{opacity:0;transform:translateY(-6px)}}
.mm-inner{display:grid;grid-template-columns:minmax(0,14rem) minmax(0,1fr);gap:28px}
.mm-lead{font:600 1.35rem/1.15 var(--display);color:var(--ink)}
.mm-panel ul{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:4px 18px}
.mm-panel a{display:flex;flex-direction:column;gap:.15rem;padding:.6rem .7rem;margin-inline:-.7rem;border-radius:3px;text-decoration:none;color:var(--ink);transition:background-color .12s}
.mm-panel a b{font:700 1.08rem/1.15 var(--display)}
.mm-panel a span{font:500 .9rem/1.2 var(--label);letter-spacing:.03em;color:var(--muted)}
.mm-panel a:hover{background:var(--ground)}
.mm-panel a:hover b{color:var(--navy)}
/* source tooltips */
.cite{font:700 .68rem/1 var(--label);min-width:1.25rem;height:1.25rem;padding:0 .3rem;margin-left:.3rem;border-radius:999px;border:1px solid var(--steel);background:var(--ground);color:var(--navy);cursor:help;vertical-align:.25em;transition:background-color .12s,border-color .12s}
.cite:hover{background:var(--navy);border-color:var(--navy);color:#fff}
.split .bds-segmented{align-self:flex-start;max-width:100%}
.price{transition:opacity .15s}
tbody tr{transition:background-color .12s}
tbody tr:hover{background:color-mix(in oklab,var(--slab),transparent 20%)}
td.lift{position:relative;padding-left:.9rem}
td.lift::before{content:"";position:absolute;left:0;top:.95rem;bottom:.95rem;width:3px;background:var(--navy);border-radius:2px}
/* self-check */
.q{grid-template-columns:2rem minmax(0,1fr) auto}
.q .bds-segmented{--seg-h:36px;font-size:.9rem}
@media (max-width:720px){.q{grid-template-columns:2rem minmax(0,1fr)}.q .bds-segmented{grid-column:2;justify-self:start;max-width:100%}}
.verdict{border-top-width:4px;box-shadow:0 1px 0 rgba(20,35,63,.06),0 14px 34px -22px rgba(20,35,63,.45);transition:border-color .25s}
.verdict[data-state="lift"]{border-top-color:var(--navy)}
.verdict[data-state="replace"],.verdict[data-state="cause"]{border-top-color:var(--steel)}
.verdict .stamp{display:flex;justify-content:space-between;gap:1rem}
.verdict .level .bubble::after{transition:left .5s var(--ease-out,cubic-bezier(.2,.8,.2,1))}
.verdict[data-state="replace"] .level .bubble::after{left:16%}
.verdict[data-state="cause"] .level .bubble::after{left:30%}
.verdict[data-state="open"] .level .bubble::after{left:72%}
/* proof */
.proof-tabs{margin-bottom:18px;max-width:100%;overflow-x:auto}
#work{overflow-x:clip}
.proof-tabs .bds-pilltabs__item{flex:none}
.proof-car{--car-w:min(540px,84vw);--car-ratio:3/2;--car-spread:70%;--car-spread-2:120%}
.proof-car img{width:100%;height:100%;object-fit:cover}
.proof-car .bds-carousel__media::before,.proof-car .bds-carousel__media::after{position:absolute;top:8px;z-index:1;font:700 .7rem/1 var(--label);letter-spacing:.14em;text-transform:uppercase;background:rgba(20,35,63,.82);color:#fff;padding:.35rem .5rem;border-radius:2px;pointer-events:none}
.proof-car .bds-carousel__media::before{content:"Before";left:8px}.proof-car .bds-carousel__media::after{content:"After";left:calc(50% + 8px)}
.bds-segmented__item{font:600 .85rem/1 var(--label);letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.proof-note{margin-top:10px;font:500 .95rem/1.3 var(--label);letter-spacing:.03em;color:var(--muted)}
/* before / after handle: the one tactile thing in a photo */
.ba .handle::after{background-color:#fff;box-shadow:inset 0 1px 0 #fff,inset 0 -2px 3px rgba(20,35,63,.18),0 2px 8px rgba(0,0,0,.35);transition:transform .15s}
.ba:hover .handle::after{transform:scale(1.08)}
.ba:active .handle::after{transform:scale(.96)}
/* surfaces and proof hover */
.surfaces a{transition:background-color .15s,padding-left .2s var(--ease-out,ease)}
.surfaces a:hover{background:var(--slab);padding-left:.7rem}
.surfaces a:hover b{text-decoration:none;color:var(--navy)}
/* Fig 1 in the how section */
.how{grid-template-columns:minmax(0,1.35fr) minmax(0,1fr)}
.fig-slot .iso{background:transparent}
.fig-slot .iso-plate{margin:0;max-width:100%}
@media (max-width:900px){.mm-inner{grid-template-columns:1fr}.how{grid-template-columns:1fr}}
@media (prefers-reduced-motion:reduce){.btn:hover,.btn:active{transform:none}}
/* phone menu: below 720 px the bar folds into a Menu button; the mega panels open inline */
.menu-btn{display:none}
@media (max-width:720px){
  .menu-btn{display:inline-flex;align-items:center;gap:.55rem;font:600 1rem/1 var(--label);letter-spacing:.06em;text-transform:uppercase;color:var(--ink);background:var(--ground);border:2px solid var(--ink);border-radius:3px;padding:.6rem .8rem;cursor:pointer;
    box-shadow:inset 0 -2px 0 rgba(20,35,63,.12);transition:transform .12s,background-color .12s}
  .menu-btn:active{transform:translateY(1px);box-shadow:inset 0 2px 3px rgba(20,35,63,.18)}
  .menu-ico{display:grid;gap:4px;width:18px}
  .menu-ico i{display:block;height:2px;background:currentColor;border-radius:1px;transition:transform .2s var(--ease-out,ease),opacity .15s}
  .menu-btn[aria-expanded="true"]{background:var(--ink);color:var(--ground)}
  .menu-btn[aria-expanded="true"] .menu-ico i:nth-child(1){transform:translateY(6px) rotate(45deg)}
  .menu-btn[aria-expanded="true"] .menu-ico i:nth-child(2){opacity:0}
  .menu-btn[aria-expanded="true"] .menu-ico i:nth-child(3){transform:translateY(-6px) rotate(-45deg)}
  .top.nav-open nav{display:block;position:absolute;left:calc(-1 * max(16px,env(safe-area-inset-left,0px)));right:calc(-1 * max(16px,env(safe-area-inset-right,0px)));top:100%;z-index:25;background:var(--slab);border-top:2px solid var(--ink);border-bottom:2px solid var(--ink);
    box-shadow:0 18px 40px -18px rgba(20,35,63,.45);padding:6px max(16px,env(safe-area-inset-right,0px)) 14px max(16px,env(safe-area-inset-left,0px));max-height:calc(100dvh - 270px);overflow-y:auto;overscroll-behavior:contain;animation:mmIn .18s var(--ease-out,ease)}
  .top.nav-open .mm-bar{flex-direction:column;align-items:stretch;gap:0}
  .top.nav-open .mm-bar>li{border-bottom:1px solid color-mix(in oklab,var(--steel),transparent 55%)}
  .top.nav-open .mm-bar>li:last-child{border-bottom:0}
  .top.nav-open .mm-btn,.top.nav-open .mm-link{width:100%;justify-content:space-between;padding:.95rem 0;font-size:1.1rem;border-bottom:0}
  .top.nav-open .mm-panel{position:static;box-shadow:none;border-top:0;background:transparent;padding:0 0 .7rem;animation:none}
  .top.nav-open .mm-lead{display:none}
  .top.nav-open .mm-panel ul{grid-template-columns:1fr;gap:0}
  .top.nav-open .mm-panel a{margin-inline:0;padding:.55rem .7rem;border-left:3px solid var(--navy);border-radius:0 3px 3px 0;margin-bottom:4px}
}
@media (prefers-reduced-motion:reduce){.menu-ico i,.top.nav-open nav{transition:none;animation:none}}


/* service template, round 7 */
.crumbs{display:flex;flex-wrap:wrap;gap:.5rem;align-items:baseline;font:500 .95rem/1.2 var(--label);letter-spacing:.04em;color:var(--muted);padding-top:18px}
.crumbs a{font:inherit;letter-spacing:inherit;padding:0;display:inline;color:var(--muted)}
.crumbs span[aria-hidden]{color:var(--rule)}
.pair{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin:0}
.pair div{position:relative;aspect-ratio:4/5;overflow:hidden;background:var(--slab);border-radius:2px}
.pair img{width:100%;height:100%;object-fit:cover;display:block}
.pair .tag{position:absolute;top:10px;left:10px;font:700 .75rem/1 var(--label);letter-spacing:.14em;text-transform:uppercase;background:rgba(20,35,63,.82);color:#fff;padding:.4rem .55rem;border-radius:2px}
figure.shot figcaption{display:flex;flex-wrap:wrap;gap:.3rem .9rem;margin-top:.7rem;font:500 .95rem/1.3 var(--label);letter-spacing:.04em;color:var(--muted)}
figure.shot figcaption strong{color:var(--ink)}
.fixes{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
.fix{background:var(--slab);border-top:2px solid var(--ink);padding:18px 18px 20px;display:flex;flex-direction:column;gap:.7rem}
.fix svg{width:100%;height:auto;max-height:96px}
.fix svg .g{fill:none;stroke:var(--steel);stroke-width:1.5;stroke-dasharray:3 3}
.fix svg .s{fill:var(--ground);stroke:var(--ink);stroke-width:2}
.fix svg .d{fill:none;stroke:var(--navy);stroke-width:1.5}
.fix svg text{font:600 15px var(--label);fill:var(--navy);letter-spacing:.04em}
.fix h3{font:700 1.3rem/1.1 var(--display);margin:0}
.fix p{margin:0}
.dv-car{--car-w:min(440px,80vw);--car-ratio:1/1}
.dv-car .bds-carousel__media::before,.dv-car .bds-carousel__media::after{content:none!important;display:none!important}
.replace{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:clamp(24px,4vw,56px);align-items:start}
.replace ol{margin:0;padding-left:1.3rem;display:flex;flex-direction:column;gap:.6rem}
.season{font:600 1.05rem/1.4 var(--label);letter-spacing:.03em;color:var(--navy)}
@media (max-width:900px){.fixes{grid-template-columns:1fr 1fr}.replace{grid-template-columns:1fr}}
@media (max-width:560px){.fixes{grid-template-columns:1fr}}
