/* GaTi UI — reference component classes for HTML. Reads variables from gati.css only; no raw sizes or colours here. */
.gati-root { background: var(--bg-base); color: var(--text-primary); font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); font-weight: var(--type-body-weight); }
.gati-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.gati-stack { display: flex; flex-direction: column; gap: var(--space-2); }

/* Module / track accent: sets --accent and --accent-soft together */
.gati-accent-1 { --accent: var(--viz-1); --accent-soft: var(--viz-1-soft); }
.gati-accent-2 { --accent: var(--viz-2); --accent-soft: var(--viz-2-soft); }
.gati-accent-3 { --accent: var(--viz-3); --accent-soft: var(--viz-3-soft); }
.gati-accent-4 { --accent: var(--viz-4); --accent-soft: var(--viz-4-soft); }
.gati-accent-5 { --accent: var(--viz-5); --accent-soft: var(--viz-5-soft); }
.gati-accent-6 { --accent: var(--viz-6); --accent-soft: var(--viz-6-soft); }

/* Panel */
.gati-panel { --panel-bg: var(--bg-panel); --panel-border: var(--border-subtle); --panel-radius: var(--radius-md); --panel-pad: var(--space-4);
  background: var(--panel-bg); border: var(--hairline) solid var(--panel-border); border-radius: var(--panel-radius); padding: var(--panel-pad); }
.gati-mod-dot { display: inline-block; width: var(--dot-md); height: var(--dot-md); margin-inline-end: var(--space-2); border-radius: var(--radius-pill); background: var(--accent, var(--control-fill)); vertical-align: middle; position: relative; top: calc(var(--hairline) * -1); }
.gati-panel-header { font-family: var(--font-serif); font-size: var(--type-panel-header-size); line-height: var(--type-panel-header-line); font-weight: var(--type-panel-header-weight); margin: 0 0 var(--space-3); }
.gati-elevated { background: var(--bg-elevated); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-popover); }

/* List item (track, preset, file). Selected: accent tint + accent bar when the item has a colour, bg-selected otherwise */
.gati-item { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-3); border-radius: var(--radius-sm); font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); cursor: default; }
.gati-item:hover { background: var(--bg-panel); }
.gati-item::before { content: ""; flex: none; width: var(--dot-md); height: var(--dot-md); border-radius: var(--radius-pill); background: var(--accent, transparent); }
.gati-item[aria-selected="true"] { background: var(--accent-soft, var(--bg-selected)); box-shadow: inset var(--bar-x, var(--focus-width)) 0 0 var(--accent, var(--text-primary)); }

/* Text */
.gati-caption { font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); font-weight: var(--type-caption-weight); color: var(--text-muted); }
.gati-readout { font-family: var(--font-mono); font-size: var(--type-readout-size); line-height: var(--type-readout-line); font-weight: var(--type-readout-weight); font-variant-numeric: tabular-nums; }
.gati-readout-lg { font-family: var(--font-mono); font-size: var(--type-readout-lg-size); line-height: var(--type-readout-lg-line); font-weight: var(--type-readout-lg-weight); font-variant-numeric: tabular-nums; }

/* Focus (keyboard only) */
.gati-btn:focus-visible, .gati-input:focus-visible, .gati-toggle:focus-visible, .gati-knob:focus-visible, .gati-fader:focus-visible, .gati-item:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }

/* Button. Component tokens (--btn-*) live on the element; variants and sizes change only these, never the properties. */
.gati-btn { --btn-h: var(--control-md); --btn-px: var(--space-3); --btn-radius: var(--radius-sm);
  --btn-size: var(--type-label-size); --btn-line: var(--type-label-line); --btn-weight: var(--type-label-weight); --btn-tracking: var(--type-label-tracking);
  --btn-bg: transparent; --btn-bg-hover: var(--bg-panel); --btn-bg-active: var(--bg-pressed); --btn-fg: var(--text-primary); --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--btn-h); padding: 0 var(--btn-px); border-radius: var(--btn-radius);
  text-decoration: none; font-family: var(--font-sans); font-size: var(--btn-size); line-height: var(--btn-line); font-weight: var(--btn-weight); letter-spacing: var(--btn-tracking); cursor: pointer; transition: background-color var(--dur-fast) ease-out;
  background: var(--btn-bg); color: var(--btn-fg); border: var(--hairline) solid var(--btn-border); }
.gati-btn:hover { background: var(--btn-bg-hover); }
.gati-btn:active { background: var(--btn-bg-active); }
.gati-btn--primary { --btn-bg: var(--action-primary); --btn-bg-hover: var(--action-primary-hover); --btn-bg-active: var(--action-primary-pressed); --btn-fg: var(--on-action-primary); --btn-border: transparent; }
.gati-btn--danger { --btn-bg: var(--action-danger); --btn-bg-hover: var(--action-danger-hover); --btn-bg-active: var(--action-danger-pressed); --btn-fg: var(--on-action-danger); --btn-border: transparent; }
.gati-btn--ghost { --btn-border: transparent; }
.gati-btn--link { --btn-h: auto; --btn-px: 0; --btn-bg-hover: transparent; --btn-bg-active: transparent; --btn-fg: var(--text-link); --btn-border: transparent; min-height: var(--control-sm); }
.gati-btn--link:hover { text-decoration: underline; }
.gati-btn svg { flex: none; width: var(--icon-sm); height: var(--icon-sm); stroke: currentColor; fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.gati-btn--sm { --btn-h: var(--control-sm); --btn-px: var(--space-2); --btn-size: var(--type-caption-size); --btn-line: var(--type-caption-line); --btn-weight: var(--type-label-weight); --btn-tracking: var(--type-caption-tracking); }
.gati-btn--lg { --btn-h: var(--control-lg); --btn-px: var(--space-4); }
/* xl = hero call-to-action on web pages. The pill shape is allowed here and nowhere else. */
.gati-btn--xl { --btn-h: var(--control-xl); --btn-px: var(--space-6); --btn-size: var(--type-label-lg-size); --btn-line: var(--type-label-lg-line); --btn-weight: var(--type-label-lg-weight); --btn-tracking: var(--type-label-lg-tracking); }
.gati-btn--xl.gati-btn--pill { --btn-radius: var(--radius-pill); }
.gati-btn--link, .gati-btn--link.gati-btn--sm, .gati-btn--link.gati-btn--lg, .gati-btn--link.gati-btn--xl { --btn-h: auto; --btn-px: 0; }
.gati-btn:disabled, .gati-btn[aria-disabled="true"] { --btn-bg: transparent; --btn-bg-hover: transparent; --btn-bg-active: transparent; --btn-fg: var(--text-disabled); --btn-border: var(--border-subtle); cursor: not-allowed; }
/* bg-selected, not border-subtle: in the High contrast themes border-subtle equals text-disabled and the label would vanish */
.gati-btn--primary:disabled, .gati-btn--danger:disabled { --btn-bg: var(--bg-selected); --btn-bg-hover: var(--bg-selected); --btn-bg-active: var(--bg-selected); --btn-border: transparent; }
.gati-btn--link:disabled { text-decoration: none; }
/* Loading: keeps its variant colours and width; spinner in the text colour before the label */
.gati-btn.is-loading { cursor: progress; pointer-events: none; }
.gati-btn.is-loading::before { content: ""; flex: none; box-sizing: border-box; width: var(--icon-sm); height: var(--icon-sm); border-radius: var(--radius-pill);
  border: var(--spinner-stroke) solid currentColor; border-inline-end-color: transparent; animation: gati-spin var(--dur-spin) linear infinite; }
@keyframes gati-spin { to { transform: rotate(360deg); } }

/* Input */
.gati-field { display: flex; flex-direction: column; gap: var(--space-1); }
.gati-field label { font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); }
.gati-input { --input-h: var(--control-md); --input-px: var(--space-3); --input-radius: var(--radius-sm); --input-bg: var(--bg-elevated); --input-fg: var(--text-primary); --input-border: var(--border-strong);
  min-height: var(--input-h); padding: 0 var(--input-px); background: var(--input-bg); color: var(--input-fg);
  border: var(--hairline) solid var(--input-border); border-radius: var(--input-radius); font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); font-weight: var(--type-body-weight); letter-spacing: var(--type-body-tracking); }
.gati-input::placeholder { color: var(--text-muted); }
.gati-input:focus-visible { outline-offset: 0; --input-border: var(--focus-ring); }
.gati-input:disabled { --input-fg: var(--text-disabled); --input-border: var(--border-subtle); --input-bg: var(--bg-panel); }
.gati-input--num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: end; }
.gati-field--error .gati-input { --input-border: var(--danger); }
.gati-field-msg { font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); font-weight: var(--type-caption-weight); color: var(--text-muted); }
.gati-field--error .gati-field-msg { color: var(--danger); }

/* Toggle */
.gati-toggle { position: relative; box-sizing: border-box; width: var(--toggle-width); height: var(--toggle-height); border-radius: var(--radius-pill); border: var(--hairline) solid var(--border-strong);
  background: var(--bg-elevated); cursor: pointer; padding: 0; transition: background-color var(--dur-fast) ease-out; }
.gati-toggle::after { content: ""; position: absolute; top: 50%; inset-inline-start: calc((var(--toggle-height) - var(--toggle-thumb)) / 2 - var(--hairline)); width: var(--toggle-thumb); height: var(--toggle-thumb);
  margin-top: calc(var(--toggle-thumb) / -2); border-radius: var(--radius-pill); background: var(--border-strong); transition: transform var(--dur-fast) ease-out; }
.gati-toggle[aria-checked="true"] { background: var(--action-primary); border-color: var(--action-primary); }
.gati-toggle[aria-checked="true"]::after { transform: translateX(calc(var(--toggle-width) - var(--toggle-height))); background: var(--on-action-primary); }
.gati-toggle:disabled { border-color: var(--border-subtle); cursor: not-allowed; }
.gati-toggle:disabled::after { background: var(--text-disabled); }
/* The track is 20px tall: an invisible area brings the mouse target up to hit-pointer (24px). Touch gets hit-touch further down. */
.gati-toggle::before { content: ""; position: absolute; inset: min(0px, calc((100% - var(--hit-pointer)) / 2)); }

/* Tag */
.gati-tag { --tag-bg: var(--bg-elevated); --tag-fg: var(--text-primary); --tag-border: var(--border-subtle); --tag-dot: var(--text-muted);
  display: inline-flex; align-items: center; gap: var(--space-1); box-sizing: border-box; height: var(--tag-height); padding: 0 var(--space-2);
  border-radius: var(--radius-pill); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); font-weight: var(--type-label-weight); letter-spacing: var(--type-caption-tracking);
  border: var(--hairline) solid var(--tag-border); background: var(--tag-bg); color: var(--tag-fg); }
.gati-tag::before { content: ""; width: var(--dot-sm); height: var(--dot-sm); border-radius: var(--radius-pill); background: var(--tag-dot); }
.gati-tag--brand { --tag-bg: var(--bg-brand-soft); --tag-border: transparent; --tag-fg: var(--text-brand); --tag-dot: var(--brand); }
.gati-tag--success { --tag-dot: var(--success); }
.gati-tag--warning { --tag-bg: var(--warning-fill); --tag-fg: var(--on-warning-fill); --tag-border: transparent; --tag-dot: var(--on-warning-fill); }
.gati-tag--danger { --tag-fg: var(--danger); --tag-dot: var(--danger); }

/* Knob */
.gati-knob { display: inline-flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.gati-knob svg { display: block; overflow: visible; }
.gati-knob .track { fill: none; stroke: var(--meter-track); stroke-linecap: round; }
.gati-knob .value { fill: none; stroke: var(--accent, var(--control-fill)); stroke-linecap: round; }
.gati-knob--utility .value { stroke: var(--text-muted); }
.gati-knob.is-dragging .value { stroke: var(--param); }
.gati-knob .pointer { stroke: var(--text-primary); stroke-width: var(--peak-hold); stroke-linecap: round; }
.gati-knob .name { font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); font-weight: var(--type-caption-weight); color: var(--text-muted); }

/* Fader */
.gati-fader { display: inline-flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.gati-fader .rail { position: relative; width: var(--fader-rail); height: var(--fader-length); border-radius: var(--radius-pill); background: var(--meter-track); }
.gati-fader .fill { position: absolute; bottom: 0; left: 0; right: 0; border-radius: var(--radius-pill); background: var(--accent, var(--control-fill)); }
.gati-fader .thumb { position: absolute; left: 50%; box-sizing: border-box; width: var(--fader-thumb-width); height: var(--fader-thumb-height); transform: translate(-50%, 50%); border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: var(--hairline) solid var(--border-strong); }
.gati-fader.is-dragging .thumb { border-color: var(--param); box-shadow: 0 0 0 var(--focus-width) var(--param); }

/* Meter */
.gati-meter { display: inline-flex; gap: var(--space-1); align-items: flex-end; }
.gati-meter .ch { position: relative; width: var(--meter-width); height: var(--meter-length); border-radius: var(--radius-pill); background: var(--meter-track); overflow: hidden; }
.gati-meter .lvl { position: absolute; left: 0; right: 0; bottom: 0; }
.gati-meter .seg-safe { background: var(--meter-safe); }
.gati-meter .seg-warn { background: var(--meter-warn); }
.gati-meter .seg-clip { background: var(--meter-clip); }
.gati-meter .peak { position: absolute; left: 0; right: 0; height: var(--peak-hold); background: var(--text-primary); }
.gati-meter .clip-led { width: var(--clip-led-width); height: var(--clip-led-height); border-radius: var(--radius-pill); background: var(--meter-track); margin-bottom: var(--space-1); }
.gati-meter .clip-led.on { background: var(--meter-clip); }

/* Log */
.gati-log { background: var(--bg-panel); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md);
  padding: var(--space-3); font-family: var(--font-mono); font-size: var(--type-log-size); line-height: var(--type-log-line); font-weight: var(--type-log-weight); color: var(--text-primary); margin: 0; white-space: pre-wrap; }
.gati-log .t { color: var(--text-muted); }
.gati-log .ok { color: var(--success); font-weight: var(--type-label-weight); }
.gati-log .warn { color: var(--warning); font-weight: var(--type-label-weight); }
.gati-log .err { color: var(--danger); font-weight: var(--type-label-weight); }

/* Dropzone */
.gati-dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); text-align: center;
  min-height: var(--dropzone-min-height); padding: var(--space-6); border: var(--hairline) dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-panel); }
.gati-dropzone.is-over { border-style: solid; border-color: var(--text-primary); background: var(--bg-selected); }
.gati-dropzone svg { width: var(--icon-md); height: var(--icon-md); stroke: var(--text-muted); fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.gati-dropzone.is-over svg { stroke: var(--text-primary); }

@media (prefers-reduced-motion: reduce) {
  .gati-btn, .gati-toggle, .gati-toggle::after { transition: none; }
  .gati-btn.is-loading::before { animation-duration: calc(var(--dur-spin) * 3); } /* still shows progress, slower */
}

/* ===== 1.9 — General components ===== */
/* Shared label font for the new controls */
.gati-check, .gati-radio, .gati-seg button, .gati-tab, .gati-menu-item, .gati-nav-item, .gati-chbtn {
  font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); }

/* Checkbox & radio: checked = ink, never Sage */
.gati-check, .gati-radio { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; color: var(--text-primary); }
.gati-check input, .gati-radio input { appearance: none; -webkit-appearance: none; margin: 0; flex: none; box-sizing: border-box; display: grid; place-content: center;
  width: var(--check-size); height: var(--check-size); background: var(--bg-elevated); border: var(--hairline) solid var(--border-strong); cursor: inherit; }
.gati-check input { border-radius: var(--radius-sm); }
.gati-radio input { border-radius: var(--radius-pill); }
.gati-check input:checked, .gati-check input:indeterminate { background: var(--text-primary); border-color: var(--text-primary); }
.gati-check input:checked::before { content: ""; width: calc(var(--check-size) / 4); height: calc(var(--check-size) / 2); margin-top: calc(var(--hairline) * -2);
  border: solid var(--bg-base); border-width: 0 var(--focus-width) var(--focus-width) 0; transform: rotate(45deg); }
.gati-check input:indeterminate::before { content: ""; width: calc(var(--check-size) / 2); height: var(--focus-width); background: var(--bg-base); }
.gati-radio input:checked { border-color: var(--text-primary); }
.gati-radio input:checked::before { content: ""; width: calc(var(--check-size) / 2); height: calc(var(--check-size) / 2); border-radius: var(--radius-pill); background: var(--text-primary); }
.gati-check:has(input:disabled), .gati-radio:has(input:disabled) { color: var(--text-disabled); cursor: not-allowed; }
.gati-check input:disabled, .gati-radio input:disabled { border-color: var(--border-subtle); background: var(--bg-panel); }
.gati-check input:checked:disabled { background: var(--border-subtle); border-color: var(--border-subtle); }
.gati-check input:focus-visible, .gati-radio input:focus-visible, .gati-select:focus-visible, .gati-slider:focus-visible, .gati-seg button:focus-visible,
.gati-tab:focus-visible, .gati-menu-item:focus-visible, .gati-nav-item:focus-visible, .gati-chbtn:focus-visible, .gati-xy:focus-visible {
  outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }

/* Select (native list, styled box) */
.gati-select-wrap { position: relative; display: inline-flex; align-self: flex-start; }
.gati-select { appearance: none; -webkit-appearance: none; box-sizing: border-box; height: var(--control-md); min-width: var(--menu-min-width); padding-block: 0; padding-inline: var(--space-3) var(--space-8);
  background: var(--bg-elevated); color: var(--text-primary); border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); cursor: pointer; }
.gati-select-wrap::after { content: ""; position: absolute; inset-inline-end: var(--space-3); top: 50%; width: calc(var(--space-2) - var(--hairline)); height: calc(var(--space-2) - var(--hairline));
  margin-top: calc(var(--space-1) * -1); border: solid var(--text-muted); border-width: 0 var(--hairline) var(--hairline) 0; transform: rotate(45deg); pointer-events: none; }
.gati-select:disabled { color: var(--text-disabled); border-color: var(--border-subtle); background: var(--bg-panel); cursor: not-allowed; }
.gati-select--sm { height: var(--control-sm); min-width: 0; font-size: var(--type-caption-size); }

/* Horizontal slider: set --pct from script (0%–100%) */
.gati-slider { -webkit-appearance: none; appearance: none; width: 100%; height: var(--slider-thumb); margin: 0; background: transparent; cursor: pointer; }
.gati-slider::-webkit-slider-runnable-track { height: var(--slider-rail); border-radius: var(--radius-pill);
  background: linear-gradient(to right, var(--accent, var(--control-fill)) var(--pct, 50%), var(--meter-track) 0); }
.gati-slider::-moz-range-track { height: var(--slider-rail); border-radius: var(--radius-pill); background: var(--meter-track); }
.gati-slider::-moz-range-progress { height: var(--slider-rail); border-radius: var(--radius-pill); background: var(--accent, var(--control-fill)); }
.gati-slider::-webkit-slider-thumb { -webkit-appearance: none; box-sizing: border-box; width: var(--slider-thumb); height: var(--slider-thumb); margin-top: calc((var(--slider-rail) - var(--slider-thumb)) / 2);
  border-radius: var(--radius-pill); background: var(--bg-elevated); border: var(--hairline) solid var(--border-strong); }
.gati-slider::-moz-range-thumb { box-sizing: border-box; width: var(--slider-thumb); height: var(--slider-thumb); border-radius: var(--radius-pill); background: var(--bg-elevated); border: var(--hairline) solid var(--border-strong); }
.gati-slider:active::-webkit-slider-thumb, .gati-slider.is-dragging::-webkit-slider-thumb { border-color: var(--param); box-shadow: 0 0 0 var(--focus-width) var(--param); }
.gati-slider:active::-moz-range-thumb { border-color: var(--param); box-shadow: 0 0 0 var(--focus-width) var(--param); }
.gati-slider:disabled { cursor: not-allowed; opacity: 1; }
.gati-slider:disabled::-webkit-slider-runnable-track { background: var(--meter-track); }

/* Segmented control */
.gati-seg { display: inline-flex; box-sizing: border-box; height: var(--control-md); padding: var(--hairline); gap: var(--hairline); background: var(--bg-panel);
  border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-sm); }
.gati-seg button { flex: 1 0 auto; padding: 0 var(--space-3); border: var(--hairline) solid transparent; border-radius: calc(var(--radius-sm) - var(--hairline));
  background: transparent; color: var(--text-muted); cursor: pointer; transition: background-color var(--dur-fast) ease-out; }
.gati-seg button:hover { color: var(--text-primary); }
.gati-seg button[aria-checked="true"] { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-strong); }
.gati-seg--sm { height: var(--control-sm); }
.gati-seg--sm button { padding: 0 var(--space-2); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }

/* Tabs: selected = ink text + 2px ink underline */
.gati-tabs { display: flex; gap: var(--space-4); border-bottom: var(--hairline) solid var(--border-subtle); overflow-x: auto; scrollbar-width: none; }
.gati-tab { flex: none; white-space: nowrap; height: var(--control-lg); padding: 0; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.gati-tab:hover { color: var(--text-primary); }
.gati-tab[aria-selected="true"] { color: var(--text-primary); box-shadow: inset 0 calc(var(--focus-width) * -1) 0 var(--text-primary); }
.gati-tab:disabled { color: var(--text-disabled); cursor: not-allowed; }

/* Tooltip (500 ms show delay, hides at once) */
.gati-tooltip { position: absolute; z-index: var(--z-tooltip); max-width: var(--tooltip-max-width); padding: var(--space-1) var(--space-2);
  background: var(--bg-elevated); color: var(--text-primary); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-popover);
  font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); pointer-events: none; }
.gati-tooltip kbd { font-family: var(--font-mono); color: var(--text-muted); margin-inline-start: var(--space-2); }

/* Menu */
.gati-menu { z-index: var(--z-dropdown); min-width: var(--menu-min-width); padding: var(--space-1); background: var(--bg-elevated);
  border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-popover); }
.gati-menu-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; box-sizing: border-box; min-height: var(--control-md); padding: 0 var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-primary); text-align: start; cursor: pointer; }
.gati-menu-item:hover, .gati-menu-item.is-active { background: var(--bg-panel); }
.gati-menu-item .kbd { margin-inline-start: auto; padding-inline-start: var(--space-6); font-family: var(--font-mono); font-size: var(--type-readout-size); color: var(--text-muted); }
.gati-menu-item[aria-checked="true"]::before { content: ""; width: var(--dot-sm); height: var(--dot-sm); border-radius: var(--radius-pill); background: var(--text-primary); }
.gati-menu-item--danger { color: var(--danger); }
.gati-menu-item:disabled { color: var(--text-disabled); cursor: not-allowed; background: transparent; }
.gati-menu-sep { height: var(--hairline); margin: var(--space-1) 0; background: var(--border-subtle); }
.gati-menu-label { padding: var(--space-1) var(--space-2); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--text-muted); }

/* Modal */
.gati-scrim { position: fixed; inset: 0; z-index: var(--z-overlay); background: var(--scrim); display: grid; place-items: center; padding: var(--space-6); }
.gati-modal { z-index: var(--z-modal); box-sizing: border-box; width: min(var(--modal-width), 100%); padding: var(--space-6); background: var(--bg-elevated);
  border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); }
.gati-modal h2 { margin: 0 0 var(--space-2); font-family: var(--font-serif); font-size: var(--type-heading-size); line-height: var(--type-heading-line); font-weight: var(--type-heading-weight); }
.gati-modal p { margin: 0; color: var(--text-muted); }
.gati-modal-body { margin-top: var(--space-4); }
.gati-modal-foot { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-6); }

/* Toast (inverted ink) and banner (inline, in the page flow) */
.gati-toast { display: inline-flex; align-items: center; gap: var(--space-3); z-index: var(--z-toast); max-width: var(--modal-width); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3);
  background: var(--text-primary); color: var(--bg-base); border-radius: var(--radius-md); box-shadow: var(--shadow-popover);
  font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.gati-toast .gati-btn { color: var(--bg-base); border-color: transparent; }
.gati-toast .gati-btn:hover { background: transparent; text-decoration: underline; }
.gati-banner { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--bg-panel);
  border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: inset var(--bar-x, var(--focus-width)) 0 0 var(--banner, var(--text-muted)); }
.gati-banner strong { font-weight: var(--type-label-weight); }
.gati-banner .prefix { flex: none; font-family: var(--font-mono); font-size: var(--type-readout-size); line-height: var(--type-body-line); font-weight: var(--type-readout-weight); color: var(--banner, var(--text-muted)); }
.gati-banner--success { --banner: var(--success); }
.gati-banner--warning { --banner: var(--warning); }
.gati-banner--danger { --banner: var(--danger); }

/* Table */
.gati-table { width: 100%; border-collapse: collapse; font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.gati-table th { height: var(--control-md); padding: 0 var(--space-3); text-align: start; background: var(--bg-panel); font-weight: var(--type-label-weight);
  border-bottom: var(--hairline) solid var(--border-strong); white-space: nowrap; }
.gati-table td { height: var(--control-md); padding: 0 var(--space-3); border-bottom: var(--hairline) solid var(--border-subtle); }
.gati-table .num { text-align: end; font-family: var(--font-mono); font-size: var(--type-readout-size); font-weight: var(--type-readout-weight); font-variant-numeric: tabular-nums; }
.gati-table th.num { font-family: var(--font-sans); font-size: var(--type-body-size); }
.gati-table tbody tr:hover td { background: var(--bg-panel); }
.gati-table tbody tr[aria-selected="true"] td { background: var(--bg-selected); }
.gati-table tbody tr[aria-selected="true"] td:first-child { box-shadow: inset var(--bar-x, var(--focus-width)) 0 0 var(--text-primary); }
.gati-table--compact th, .gati-table--compact td { height: var(--control-sm); padding: 0 var(--space-2); }

/* Progress and spinner */
.gati-progress { position: relative; height: var(--progress-height); border-radius: var(--radius-pill); background: var(--meter-track); overflow: hidden; }
.gati-progress > span { position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--pct, 0%); border-radius: var(--radius-pill); background: var(--accent, var(--control-fill)); }
.gati-progress.is-indeterminate > span { width: 30%; animation: gati-indet var(--dur-shimmer) var(--ease-standard) infinite; }
@keyframes gati-indet { from { inset-inline-start: -30%; } to { inset-inline-start: 100%; } }
.gati-spinner { display: inline-block; box-sizing: border-box; width: var(--icon-md); height: var(--icon-md); border-radius: var(--radius-pill);
  border: var(--spinner-stroke) solid var(--meter-track); border-top-color: var(--text-primary); animation: gati-spin var(--dur-spin) linear infinite; }
.gati-spinner--sm { width: var(--icon-sm); height: var(--icon-sm); }

/* Empty state */
.gati-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-8) var(--space-6); text-align: center; }
.gati-empty svg { width: var(--icon-md); height: var(--icon-md); stroke: var(--text-muted); fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.gati-empty h3 { margin: var(--space-1) 0 0; font-family: var(--font-serif); font-size: var(--type-panel-header-size); line-height: var(--type-panel-header-line); font-weight: var(--type-panel-header-weight); }
.gati-empty p { margin: 0 0 var(--space-2); max-width: 40ch; color: var(--text-muted); }

/* Sidebar navigation */
.gati-nav { display: flex; flex-direction: column; gap: var(--hairline); box-sizing: border-box; width: var(--sidebar-width); padding: var(--space-3) var(--space-2);
  background: var(--bg-panel); border-inline-end: var(--hairline) solid var(--border-subtle); }
.gati-nav-label { padding: var(--space-3) var(--space-2) var(--space-1); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--text-muted); }
.gati-nav-item { display: flex; align-items: center; gap: var(--space-2); min-height: var(--control-md); padding: 0 var(--space-2); border-radius: var(--radius-sm);
  color: var(--text-primary); text-decoration: none; }
.gati-nav-item svg { width: var(--icon-sm); height: var(--icon-sm); stroke: var(--text-muted); fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.gati-nav-item:hover { background: var(--bg-selected); }
.gati-nav-item[aria-current="page"] { background: var(--bg-selected); box-shadow: inset var(--bar-x, var(--focus-width)) 0 0 var(--text-primary); }
.gati-nav-item[aria-current="page"] svg { stroke: var(--text-primary); }
.gati-nav-item .count { margin-inline-start: auto; font-family: var(--font-mono); font-size: var(--type-readout-size); color: var(--text-muted); }

/* ===== 1.9 — Audio and video components ===== */
/* Plugin header */
.gati-plughead { display: flex; align-items: center; gap: var(--space-3); box-sizing: border-box; height: var(--header-height); padding: 0 var(--space-3);
  background: var(--bg-panel); border-bottom: var(--hairline) solid var(--border-subtle); }
.gati-plughead .mark { width: var(--icon-md); height: var(--icon-md); flex: none; }
.gati-plughead .name { font-family: var(--font-serif); font-size: var(--type-panel-header-size); line-height: var(--type-panel-header-line); font-weight: var(--type-panel-header-weight); white-space: nowrap; }
.gati-plughead .sep { width: var(--hairline); align-self: stretch; margin: var(--space-2) 0; background: var(--border-subtle); }
.gati-plughead .spacer { flex: 1; }
/* Nothing in the header wraps or grows past header-height: items keep their size, the preset select and the name give way first. */
.gati-plughead { container: plughead / inline-size; min-width: 0; }
.gati-plughead > * { flex-shrink: 0; }
.gati-plughead .name { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gati-plughead .gati-select-wrap { flex: 0 1 calc(var(--menu-min-width) * 5 / 6); min-width: calc(var(--control-sm) * 4); }
.gati-plughead .gati-select { width: 100%; min-width: 0; }
.gati-plughead :is(label, .gati-row) { flex-wrap: nowrap; white-space: nowrap; }
@container plughead (max-width: 639.98px) { .gati-plughead { gap: var(--space-2); } .gati-plughead .sep { display: none; } }
/* Icon buttons in a plugin header are the tool form of IconButton; the rules are with IconButton further down. */


.gati-iconbtn:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }



/* Transport */
.gati-transport { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1); background: var(--bg-panel);
  border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); }
.gati-transport .gati-iconbtn[aria-pressed="true"] { background: var(--text-primary); color: var(--bg-base); }
.gati-transport .gati-iconbtn.rec[aria-pressed="true"] { background: var(--action-danger); color: var(--on-action-danger); }
.gati-transport .gati-iconbtn svg.fill { fill: currentColor; }

/* Timecode */
.gati-timecode { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; }
.gati-timecode .tc { font-family: var(--font-mono); font-size: var(--type-readout-lg-size); line-height: var(--type-readout-lg-line); font-weight: var(--type-readout-lg-weight);
  font-variant-numeric: tabular-nums; color: var(--text-primary); }
.gati-timecode .tc i { font-style: normal; color: var(--text-muted); }
.gati-timecode .fmt { font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--text-muted); }

/* Waveform, EQ graph, XY pad: drawn as SVG; these classes colour the parts */
.gati-graph { display: block; width: 100%; background: var(--bg-panel); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); }
.gati-graph .grid { stroke: var(--border-subtle); stroke-width: var(--hairline); fill: none; }
.gati-graph .grid-0 { stroke: var(--border-strong); stroke-width: var(--hairline); }
.gati-graph .axis { fill: var(--text-muted); font-family: var(--font-mono); font-size: var(--type-readout-size); font-variant-numeric: tabular-nums; }
.gati-graph .wave { fill: var(--accent, var(--control-fill)); }
.gati-graph .wave-dim { fill: var(--accent, var(--control-fill)); opacity: var(--opacity-dim); }
.gati-graph .sel { fill: var(--bg-selected); }
.gati-graph .playhead { stroke: var(--text-primary); stroke-width: var(--hairline); }
.gati-graph .curve { fill: none; stroke: var(--accent, var(--viz-1)); stroke-width: var(--peak-hold); stroke-linejoin: round; }
.gati-graph .area { fill: var(--accent, var(--viz-1)); opacity: var(--opacity-tint); }
.gati-graph .spectrum { fill: var(--meter-track); }
.gati-graph .handle { fill: var(--bg-elevated); stroke: var(--accent, var(--viz-1)); stroke-width: var(--peak-hold); }
.gati-graph .handle.is-active { stroke: var(--param); fill: var(--param); }
.gati-graph .handle-label { fill: var(--text-primary); font-family: var(--font-mono); font-size: var(--type-readout-size); }
.gati-graph .puck { fill: var(--accent, var(--control-fill)); stroke: var(--bg-elevated); stroke-width: var(--peak-hold); }
.gati-graph .puck-ring { fill: none; stroke: var(--accent, var(--control-fill)); stroke-width: var(--hairline); opacity: var(--opacity-ring); }
.gati-xy { cursor: crosshair; aspect-ratio: 1; }

/* Loudness readout */
.gati-lufs { display: grid; grid-template-columns: repeat(3, auto); gap: var(--space-2) var(--space-6); align-items: end; }
.gati-lufs .k { font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--text-muted); }
.gati-lufs .v { font-family: var(--font-mono); font-size: var(--type-readout-size); line-height: var(--type-readout-line); font-weight: var(--type-readout-weight); font-variant-numeric: tabular-nums; }
.gati-lufs .v--lg { font-size: var(--type-readout-lg-size); line-height: var(--type-readout-lg-line); }
.gati-lufs .ok { color: var(--success); } .gati-lufs .warn { color: var(--warning); } .gati-lufs .bad { color: var(--danger); }
.gati-lufs-bar { position: relative; grid-column: 1 / -1; height: var(--progress-height); border-radius: var(--radius-pill); background: var(--meter-track); }
.gati-lufs-bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: var(--radius-pill); background: var(--control-fill); }
.gati-lufs-bar .target { position: absolute; top: calc(var(--space-1) * -1); bottom: calc(var(--space-1) * -1); width: var(--focus-width); background: var(--text-primary); }

/* Channel buttons: Mute, Solo, Phase, Link, Record-arm */
.gati-chbtn { display: inline-grid; place-items: center; box-sizing: border-box; min-width: var(--control-sm); height: var(--control-sm); padding: 0 var(--space-1);
  border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-sm); background: transparent; color: var(--text-primary); cursor: pointer;
  font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-chbtn:hover { background: var(--bg-selected); }
.gati-chbtn[aria-pressed="true"] { background: var(--text-primary); border-color: var(--text-primary); color: var(--bg-base); }
.gati-chbtn.solo[aria-pressed="true"] { background: var(--warning-fill); border-color: var(--warning-fill); color: var(--on-warning-fill); }
.gati-chbtn.arm[aria-pressed="true"] { background: var(--action-danger); border-color: var(--action-danger); color: var(--on-action-danger); }
.gati-chbtn svg { width: var(--icon-sm); height: var(--icon-sm); stroke: currentColor; fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; }

@media (prefers-reduced-motion: reduce) {
  .gati-seg button { transition: none; }
  .gati-progress.is-indeterminate > span { animation: none; width: 100%; opacity: var(--opacity-reduced); }
  .gati-spinner { animation-duration: calc(var(--dur-spin) * 3); }
}

/* Icon button: circular, one icon, optional count */
.gati-iconbtn { position: relative; display: inline-grid; place-items: center; flex: none; box-sizing: border-box; width: var(--control-md); height: var(--control-md); padding: 0;
  border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-pill); background: transparent; color: var(--text-primary); cursor: pointer; transition: background-color var(--dur-fast) ease-out; }
.gati-iconbtn:hover { background: var(--bg-panel); }
.gati-iconbtn:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }
.gati-iconbtn:disabled { color: var(--text-disabled); border-color: var(--border-subtle); cursor: not-allowed; background: transparent; }
.gati-iconbtn svg { width: var(--icon-sm); height: var(--icon-sm); stroke: currentColor; fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.gati-iconbtn[data-count]::after { content: attr(data-count); position: absolute; top: calc(var(--space-1) * -1); inset-inline-end: calc(var(--space-1) * -1); box-sizing: border-box; min-width: var(--space-4); height: var(--space-4);
  padding: 0 var(--space-1); border-radius: var(--radius-pill); background: var(--warning-fill); color: var(--on-warning-fill); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--space-4); font-weight: var(--weight-medium); text-align: center; }

/* Tool form: square and borderless, for plugin headers, transports and dense tool racks (an in-tool button is never a pill).
   Automatic inside .gati-plughead and .gati-transport; elsewhere add .gati-iconbtn--tool. --md gives control-md with an icon-md icon. */
.gati-plughead .gati-iconbtn, .gati-transport .gati-iconbtn, .gati-iconbtn.gati-iconbtn--tool { width: var(--control-sm); height: var(--control-sm); border-color: transparent; border-radius: var(--radius-sm); }
.gati-plughead .gati-iconbtn:hover:not([aria-pressed="true"]), .gati-transport .gati-iconbtn:hover:not([aria-pressed="true"]), .gati-iconbtn.gati-iconbtn--tool:hover:not([aria-pressed="true"]) { background: var(--bg-selected); }
.gati-plughead .gati-iconbtn.gati-iconbtn--md, .gati-transport .gati-iconbtn.gati-iconbtn--md, .gati-iconbtn.gati-iconbtn--tool.gati-iconbtn--md { width: var(--control-md); height: var(--control-md); }
.gati-plughead .gati-iconbtn--md svg, .gati-transport .gati-iconbtn--md svg, .gati-iconbtn--tool.gati-iconbtn--md svg { width: var(--icon-md); height: var(--icon-md); }

/* Chip: toggleable filter */
.gati-chip { display: inline-flex; align-items: center; gap: var(--space-2); box-sizing: border-box; height: var(--control-md); padding: 0 var(--space-3); border: var(--hairline) solid var(--border-strong);
  border-radius: var(--radius-pill); background: transparent; color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); cursor: pointer; white-space: nowrap; transition: background-color var(--dur-fast) ease-out; }
.gati-chip:hover { color: var(--text-primary); background: var(--bg-panel); }
.gati-chip:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }
.gati-chip[aria-pressed="true"] { background: var(--bg-selected); border-color: var(--text-primary); color: var(--text-primary); }
.gati-chip:disabled { color: var(--text-disabled); border-color: var(--border-subtle); cursor: not-allowed; background: transparent; }

/* Stat: icon, readout and caption */
.gati-stat { display: flex; align-items: center; gap: var(--space-3); }
.gati-stat__icon { display: grid; place-items: center; flex: none; box-sizing: border-box; width: var(--control-lg); height: var(--control-lg); border: var(--hairline) solid var(--border-subtle);
  border-radius: var(--radius-pill); background: var(--bg-elevated); color: var(--text-muted); }
.gati-stat__icon svg { width: var(--icon-md); height: var(--icon-md); stroke: currentColor; fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.gati-stat__value { font-family: var(--font-mono); font-size: var(--type-readout-lg-size); line-height: var(--type-readout-lg-line); font-weight: var(--type-readout-lg-weight); color: var(--text-primary); }
.gati-stat__label { font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--text-muted); }

/* Motion: durations and easing in tokens (dur-*, ease-emphasis); see the Motion section */
@keyframes gati-fade { from { opacity: 0; } }
@keyframes gati-ping { from { opacity: 0.9; transform: scale(0.4); } 80%, to { opacity: 0; transform: scale(1.6); } }
@keyframes gati-blink { 50% { opacity: 0.25; } }
@keyframes gati-flash { from { color: var(--text-brand); } }
.gati-fade-in { animation: gati-fade var(--dur-base) var(--ease-emphasis); }
.gati-flash { animation: gati-flash var(--dur-flash) var(--ease-emphasis); }
.gati-blink { animation: gati-blink var(--dur-blink) steps(2, start) infinite; }
.gati-live { position: relative; display: inline-block; width: var(--dot-md); height: var(--dot-md); border-radius: var(--radius-pill); background: var(--accent, var(--brand)); }
.gati-live::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: inherit; animation: gati-ping var(--dur-live) var(--ease-emphasis) infinite; }
@media (prefers-reduced-motion: reduce) {
  .gati-iconbtn, .gati-chip { transition: none; }
  .gati-fade-in, .gati-flash, .gati-blink, .gati-live::after { animation: none; }
}

/* ===== 1.11 — Layout, collapse rules and page modules ===== */
/* Responsive rules use container queries on .gati-page (full-width wrapper), so they behave like viewport queries on a page and can also be previewed at any width.
   Literals below repeat bp-md 640 / bp-lg 1024 / bp-xl 1440 from tokens.json (a query cannot read a variable). */
.gati-page { container: page / inline-size; }
.gati-view { --cols: var(--grid-columns-sm); --gutter: var(--gutter-sm); --page-margin: var(--space-6); --gap-tile: var(--space-3); --gap-section: var(--space-8);
  box-sizing: border-box; width: 100%; max-width: calc(var(--container-max) + 2 * var(--page-margin)); margin-inline: auto; padding-inline: var(--page-margin); }
@container page (min-width: 640px) { .gati-view { --cols: var(--grid-columns-md); --gutter: var(--gutter-lg); --page-margin: var(--space-8); --gap-tile: var(--space-6); } }
@container page (min-width: 1024px) { .gati-view { --cols: var(--grid-columns-lg); --page-margin: var(--space-12); --gap-section: var(--space-16); } }
.gati-section { padding-block: var(--gap-section); }
.gati-prose { max-width: var(--prose-max); }
.gati-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: var(--gutter); }
.gati-grid--tiles { gap: var(--gap-tile); }
.gati-col-full, .gati-col-half, .gati-col-third { grid-column: 1 / -1; }
.gati-col-quarter { grid-column: span 2; }
@container page (min-width: 640px) { .gati-col-half, .gati-col-third, .gati-col-quarter { grid-column: span 4; } }
@container page (min-width: 1024px) { .gati-col-half { grid-column: span 6; } .gati-col-third { grid-column: span 4; } .gati-col-quarter { grid-column: span 3; } }

/* App shell: sidebar at lg and wider; a top bar below it */
.gati-shell { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
.gati-shell > .gati-nav { flex-direction: row; width: auto; overflow-x: auto; padding: var(--space-2); border-inline-end: 0; border-bottom: var(--hairline) solid var(--border-subtle); }
.gati-shell > .gati-nav .gati-nav-label { display: none; }
.gati-shell > .gati-nav .gati-nav-item { flex: none; white-space: nowrap; }
.gati-shell > .gati-nav .gati-nav-item[aria-current="page"] { box-shadow: inset 0 calc(var(--focus-width) * -1) 0 var(--text-primary); }
@container page (min-width: 1024px) {
  .gati-shell { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .gati-shell > .gati-nav { flex-direction: column; width: var(--sidebar-width); overflow: visible; padding: var(--space-3) var(--space-2); border-inline-end: var(--hairline) solid var(--border-subtle); border-bottom: 0; align-self: stretch; }
  .gati-shell > .gati-nav .gati-nav-label { display: block; }
  .gati-shell > .gati-nav .gati-nav-item[aria-current="page"] { box-shadow: inset var(--bar-x, var(--focus-width)) 0 0 var(--text-primary); }
}

/* Table: scrolls sideways below md, first column stays */
.gati-table-wrap { overflow-x: auto; border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); }
@container page (max-width: 639.98px) {
  .gati-table-wrap .gati-table { min-width: calc(var(--menu-min-width) * 3); }
  .gati-table-wrap .gati-table td:first-child { position: sticky; inset-inline-start: 0; background: var(--bg-base); }
  .gati-table-wrap .gati-table th:first-child { position: sticky; inset-inline-start: 0; }
}

/* Site navigation (web): links collapse into a menu button below lg */
.gati-sitenav { position: sticky; top: 0; z-index: var(--z-sticky); background: var(--bg-base); border-bottom: var(--hairline) solid var(--border-subtle); }
.gati-sitenav-bar { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--space-4); min-height: var(--site-nav-height); }
.gati-sitenav-brand { height: var(--site-nav-height); display: inline-flex; align-items: center; gap: var(--space-2); color: var(--text-primary); text-decoration: none; font-family: var(--font-serif); font-size: var(--type-panel-header-size); line-height: var(--type-panel-header-line); font-weight: var(--type-panel-header-weight); }
.gati-sitenav-brand svg { width: var(--control-md); height: var(--control-md); }
.gati-sitenav-toggle { margin-inline-start: auto; }
.gati-sitenav-links { display: none; flex: 1 0 100%; margin: 0; padding: 0; list-style: none; }
.gati-sitenav-links a { display: flex; align-items: center; min-height: var(--control-md); padding: 0 var(--space-2); border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none;
  font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); }
.gati-sitenav-links a:hover { color: var(--text-primary); background: var(--bg-panel); }
.gati-sitenav-links a[aria-current="page"] { color: var(--text-primary); box-shadow: inset 0 calc(var(--focus-width) * -1) 0 var(--text-primary); }
.gati-sitenav-links a:focus-visible, .gati-sitenav-brand:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }
.gati-sitenav[data-open] .gati-sitenav-links { display: flex; flex-direction: column; padding: var(--space-2) 0; }
.gati-sitenav-cta { display: none; }
.gati-sitenav[data-open] .gati-sitenav-cta { display: inline-flex; margin-bottom: var(--space-4); }
@container page (min-width: 1024px) {
  .gati-sitenav-toggle { display: none; }
  .gati-sitenav-links, .gati-sitenav[data-open] .gati-sitenav-links { display: flex; flex: 0 1 auto; flex-direction: row; gap: var(--space-1); padding: 0; margin-inline-start: auto; }
  .gati-sitenav[data-open] .gati-sitenav-cta { margin-bottom: 0; }
  .gati-sitenav-cta { display: inline-flex; margin-inline-start: var(--space-2); }
}

/* Hero: headline, lead, callout, actions, media, always in this order */
.gati-hero { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); text-align: center; }
.gati-hero-title { margin: 0; max-width: 20ch; text-wrap: balance; font-family: var(--font-serif); font-size: var(--type-display-size); line-height: var(--type-display-line); font-weight: var(--type-display-weight); letter-spacing: var(--type-display-tracking); }
.gati-hero-lead { margin: 0; max-width: var(--prose-max); font-size: var(--type-lead-size); line-height: var(--type-lead-line); font-weight: var(--type-lead-weight); letter-spacing: var(--type-lead-tracking); }
.gati-hero-callout { margin: 0; color: var(--text-muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); letter-spacing: var(--type-caption-tracking); }
.gati-hero-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--space-4); margin-top: var(--space-2); }
.gati-hero-media { align-self: stretch; margin-top: var(--space-4); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--bg-panel); overflow: hidden; }
@container page (min-width: 640px) { .gati-hero-title { font-size: var(--type-hero-size); line-height: var(--type-hero-line); font-weight: var(--type-hero-weight); letter-spacing: var(--type-hero-tracking); } }

/* Promo tiles: 1-up, 2-up, then the span you give them; --accent tints a tile */
.gati-tile { --tile-bg: var(--bg-panel); display: flex; flex-direction: column; gap: var(--space-2); box-sizing: border-box; padding: var(--space-6); background: var(--tile-bg); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-lg); }
.gati-tile--accent { --tile-bg: var(--accent-soft, var(--bg-panel)); }
.gati-tile-kicker { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--text-muted); }
.gati-tile-kicker::before { content: ""; width: var(--dot-md); height: var(--dot-md); border-radius: var(--radius-pill); background: var(--accent, var(--text-muted)); }
.gati-tile h3 { margin: 0; font-family: var(--font-serif); font-size: var(--type-heading-size); line-height: var(--type-heading-line); font-weight: var(--type-heading-weight); letter-spacing: var(--type-heading-tracking); }
.gati-tile p { margin: 0; color: var(--text-muted); }
.gati-tile .gati-btn--link { margin-top: auto; align-self: flex-start; }

/* Footer: link groups are accordions below lg, open columns from lg */
.gati-footer { background: var(--bg-panel); border-top: var(--hairline) solid var(--border-subtle); font-size: var(--type-caption-size); line-height: var(--type-caption-line); letter-spacing: var(--type-caption-tracking); color: var(--text-muted); }
.gati-foot-groups { display: grid; grid-template-columns: minmax(0, 1fr); }
.gati-foot-group { border-bottom: var(--hairline) solid var(--border-subtle); }
.gati-foot-group summary { display: flex; align-items: center; justify-content: space-between; min-height: var(--control-lg); cursor: pointer; list-style: none; color: var(--text-primary); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); }
.gati-foot-group summary::-webkit-details-marker { display: none; }
.gati-foot-group summary::after { content: "+"; font-family: var(--font-mono); font-size: var(--type-readout-lg-size); color: var(--text-muted); }
.gati-foot-group[open] summary::after { content: "\2212"; }
.gati-foot-group summary:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: calc(var(--focus-width) * -1); }
.gati-foot-group ul { margin: 0; padding: 0 0 var(--space-4); list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.gati-foot-group a { color: var(--text-muted); text-decoration: none; }
.gati-foot-group a:hover { color: var(--text-primary); text-decoration: underline; }
.gati-foot-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-2); padding-block: var(--space-4); }
@container page (min-width: 1024px) {
  .gati-foot-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); }
  .gati-foot-group { border-bottom: 0; }
  .gati-foot-group summary { min-height: auto; padding-bottom: var(--space-3); cursor: default; pointer-events: none; }
  .gati-foot-group summary::after, .gati-foot-group[open] summary::after { content: none; }
}

/* ===== 1.12 · Accessibility, behaviour and new components ===== */

/* Touch: coarse pointers get a 44px hit area. Small controls grow an invisible one; field-like controls grow for real. */
@media (pointer: coarse) {
  .gati-btn, .gati-iconbtn, .gati-toggle, .gati-chip, .gati-chbtn { position: relative; }
  .gati-btn::after, .gati-iconbtn::before, .gati-toggle::before, .gati-chip::before, .gati-chbtn::before {
    content: ""; position: absolute; inset: min(0px, calc((100% - var(--hit-touch)) / 2)); }
  .gati-input, .gati-select, .gati-check, .gati-radio, .gati-menu-item, .gati-nav-item, .gati-tab,
  .gati-numfield, .gati-search input, .gati-disclosure summary { min-height: var(--hit-touch); }
  /* SegmentedControl grows as a whole: its track has a fixed height, so growing only the segments made them overflow it. */
  .gati-seg, .gati-seg--sm { height: var(--hit-touch); }
  .gati-slider { min-height: var(--hit-touch); }
  /* 16px text in fields on touch: iOS Safari zooms the whole page when a focused field is smaller */
  .gati-input, .gati-select, .gati-search input, .gati-numfield input { font-size: var(--type-label-lg-size); }
}

/* Shared focus ring for the 1.12 components */
.gati-numfield:focus-within, .gati-search input:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: 0; border-color: var(--focus-ring); }
.gati-numfield button:focus-visible, .gati-search-clear:focus-visible, .gati-disclosure summary:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: calc(var(--focus-width) * -1); }

/* NumberField: [-] value unit [+]; pair with a Slider when the range is wide */
.gati-numfield { display: inline-flex; align-items: stretch; box-sizing: border-box; height: var(--control-md); border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); overflow: hidden; }
.gati-numfield input { flex: 1 1 auto; min-width: 0; width: 7ch; box-sizing: border-box; padding: 0 var(--space-2); border: 0; background: transparent; color: var(--text-primary); text-align: end;
  font-family: var(--font-mono); font-size: var(--type-readout-size); line-height: var(--type-readout-line); font-variant-numeric: tabular-nums; outline: none; }
.gati-numfield-unit { display: inline-flex; align-items: center; padding-inline-end: var(--space-2); color: var(--text-muted); font-family: var(--font-mono); font-size: var(--type-readout-size); }
.gati-numfield button { flex: none; display: grid; place-items: center; width: var(--control-md); padding: 0; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; transition: background-color var(--dur-fast) ease-out; }
.gati-numfield button:first-child { border-inline-end: var(--hairline) solid var(--border-subtle); }
.gati-numfield button:last-child { border-inline-start: var(--hairline) solid var(--border-subtle); }
.gati-numfield button:hover { background: var(--bg-panel); color: var(--text-primary); }
.gati-numfield button:disabled { color: var(--text-disabled); cursor: not-allowed; background: transparent; }
.gati-numfield--sm { height: var(--control-sm); }
.gati-numfield--sm button { width: var(--control-sm); }
.gati-numfield.is-invalid { border-color: var(--danger); }
.gati-slider-field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--space-4); }

/* SearchField */
.gati-search { position: relative; display: inline-flex; align-items: center; }
.gati-search > svg { position: absolute; inset-inline-start: var(--space-3); width: var(--icon-sm); height: var(--icon-sm); fill: none; stroke: var(--text-muted); stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.gati-search input { -webkit-appearance: none; appearance: none; box-sizing: border-box; width: 100%; min-width: var(--menu-min-width); height: var(--control-md); padding-block: 0; padding-inline: calc(var(--space-3) + var(--icon-sm) + var(--space-2)) var(--control-md);
  background: var(--bg-elevated); color: var(--text-primary); border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); font-weight: var(--type-body-weight); }
.gati-search input::placeholder { color: var(--text-muted); }
.gati-search input::-webkit-search-cancel-button, .gati-search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.gati-search-clear { position: absolute; inset-inline-end: 0; display: grid; place-items: center; width: var(--control-md); height: var(--control-md); padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; }
.gati-search-clear:hover { color: var(--text-primary); background: var(--bg-panel); }
.gati-search input:placeholder-shown ~ .gati-search-clear { display: none; }  /* needs a placeholder attribute */

/* Disclosure (<details>) */
.gati-disclosure { border-bottom: var(--hairline) solid var(--border-subtle); }
.gati-disclosure summary { display: flex; align-items: center; gap: var(--space-2); box-sizing: border-box; min-height: var(--control-lg); padding: 0 var(--space-2); cursor: pointer; list-style: none; color: var(--text-primary);
  font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); }
.gati-disclosure summary::-webkit-details-marker { display: none; }
.gati-disclosure summary::before { content: ""; flex: none; width: var(--space-2); height: var(--space-2); border-inline-end: var(--focus-width) solid var(--text-muted); border-bottom: var(--focus-width) solid var(--text-muted);
  transform: rotate(-45deg); transition: transform var(--dur-fast) ease-out; }
[dir="rtl"] .gati-disclosure summary::before { transform: rotate(45deg); }
.gati-disclosure[open] > summary::before { transform: rotate(45deg); }
.gati-disclosure summary:hover { background: var(--bg-panel); }
.gati-disclosure-body { padding: var(--space-1) var(--space-2) var(--space-4) calc(var(--space-2) + var(--space-2) + var(--space-2)); color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.gati-disclosure-body > * + * { margin-top: var(--space-2); }

/* Popover (non-modal) */
.gati-popover { z-index: var(--z-dropdown); box-sizing: border-box; width: var(--popover-width); max-width: 100%; padding: var(--space-4); background: var(--bg-elevated); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: var(--shadow-popover);
  color: var(--text-primary); font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.gati-popover-title { margin: 0 0 var(--space-2); font-family: var(--font-sans); font-size: var(--type-label-lg-size); line-height: var(--type-label-lg-line); font-weight: var(--type-label-lg-weight); }
.gati-popover-foot { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }

/* Badge: count or dot, ink not Sage */
.gati-badge { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: var(--badge-size); height: var(--badge-size); padding: 0 var(--space-1); border-radius: var(--radius-pill);
  background: var(--text-primary); color: var(--bg-base); font-family: var(--font-sans); font-size: var(--text-min); line-height: 1; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.gati-badge--danger { background: var(--action-danger); color: var(--on-action-danger); }
.gati-badge--quiet { background: var(--bg-selected); color: var(--text-primary); }
.gati-badge--dot { min-width: 0; width: var(--dot-md); height: var(--dot-md); padding: 0; }

/* Skeleton: placeholder shapes while content loads. Mark the region aria-busy="true"; shapes are aria-hidden. */
.gati-skeleton { display: block; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--border-subtle) 0%, var(--bg-selected) 50%, var(--border-subtle) 100%); background-size: 200% 100%; animation: gati-shimmer var(--dur-shimmer) linear infinite; }
.gati-skeleton--line { height: var(--skeleton-line); }
.gati-skeleton--line.is-short { width: 60%; }
.gati-skeleton--title { height: var(--type-heading-line); width: 40%; }
.gati-skeleton--circle { width: var(--control-lg); height: var(--control-lg); border-radius: var(--radius-pill); }
.gati-skeleton--block { height: calc(var(--control-xl) * 3); border-radius: var(--radius-md); }
@keyframes gati-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .gati-skeleton { animation: none; background: var(--border-subtle); } }

/* Truncate in the middle: keep the end (extension, version, timecode) */
.gati-trunc-mid { display: flex; min-width: 0; max-width: 100%; }
.gati-trunc-head { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gati-trunc-tail { flex: none; white-space: nowrap; }

/* Inactive window (desktop apps and plugins): chrome greys out, content keeps its colour */
.gati-window--inactive { --action-primary: var(--action-inactive); --action-primary-hover: var(--action-inactive); --action-primary-pressed: var(--action-inactive); }
.gati-window--inactive :is(.gati-plughead, .gati-nav, .gati-panel-header, .gati-tabs, .gati-nav-label) { --text-primary: var(--text-inactive); --text-muted: var(--text-inactive); color: var(--text-inactive); }
.gati-window--inactive .gati-mark-fill { fill: var(--action-inactive); }

/* Right-to-left */
[dir="rtl"] .gati-icon-dir { transform: scaleX(-1); }

/* Forced colours (Windows High Contrast): let the system palette win, keep shape and state visible */
@media (forced-colors: active) {
  .gati-btn--primary, .gati-btn--danger { border-color: ButtonText; }
  .gati-btn:disabled, .gati-input:disabled, .gati-toggle:disabled { color: GrayText; border-color: GrayText; }
  .gati-popover, .gati-menu, .gati-modal, .gati-tooltip, .gati-toast, .gati-banner, .gati-panel, .gati-numfield { border: 1px solid CanvasText; }
  :is(.gati-btn, .gati-input, .gati-select, .gati-slider, .gati-toggle, .gati-chip, .gati-iconbtn, .gati-tab, .gati-search input, .gati-numfield button, .gati-disclosure summary):focus-visible { outline: 2px solid Highlight; }
  :is(.gati-chip[aria-pressed="true"], .gati-seg [aria-pressed="true"], .gati-menu-item[aria-checked="true"], .gati-toggle[aria-checked="true"]) { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .gati-toggle[aria-checked="true"]::after { background: HighlightText; }
  .gati-tab[aria-selected="true"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
  .gati-slider::-webkit-slider-runnable-track { background: ButtonText; }
  .gati-slider::-moz-range-track { background: ButtonText; }
  .gati-slider::-webkit-slider-thumb { forced-color-adjust: none; background: Highlight; border-color: ButtonText; }
  .gati-slider::-moz-range-thumb { forced-color-adjust: none; background: Highlight; border-color: ButtonText; }
  .gati-progress > *, .gati-lufs-bar > * { forced-color-adjust: none; background: Highlight; }
  .gati-skeleton { background: GrayText; animation: none; opacity: var(--opacity-reduced); }
  .gati-badge { forced-color-adjust: none; background: CanvasText; color: Canvas; }
}

/* ===== 1.13 · Content, navigation and form additions ===== */

/* Avatar */
.gati-avatar { display: inline-grid; place-items: center; flex: none; box-sizing: border-box; width: var(--control-md); height: var(--control-md); overflow: hidden; border-radius: var(--radius-pill);
  background: var(--accent-soft, var(--bg-selected)); border: var(--hairline) solid var(--accent, var(--border-subtle)); color: var(--text-primary);
  font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: 1; font-weight: var(--weight-semibold); letter-spacing: 0; text-transform: uppercase; }
.gati-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gati-avatar--sm { width: var(--control-sm); height: var(--control-sm); font-size: var(--text-min); }
.gati-avatar--lg { width: var(--control-xl); height: var(--control-xl); font-size: var(--type-label-size); }
.gati-avatar-group { display: inline-flex; }
.gati-avatar-group > .gati-avatar { box-shadow: 0 0 0 var(--focus-width) var(--bg-base); }
.gati-avatar-group > .gati-avatar + .gati-avatar { margin-inline-start: calc(var(--space-1) * -1); }

/* Card: a container for one piece of content (radius-md) */
.gati-card { display: flex; flex-direction: column; box-sizing: border-box; overflow: hidden; background: var(--bg-elevated); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-primary); }
.gati-card--flat { background: var(--bg-panel); border-color: transparent; }
.gati-card-media { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg-selected); }
.gati-card-body { display: grid; gap: var(--space-2); padding: var(--space-4); }
.gati-card-title { margin: 0; font-family: var(--font-sans); font-size: var(--type-label-lg-size); line-height: var(--type-label-lg-line); font-weight: var(--type-label-lg-weight); letter-spacing: var(--type-label-lg-tracking); }
.gati-card-text { margin: 0; color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.gati-card-foot { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-4) var(--space-4); }
.gati-card--link { position: relative; transition: border-color var(--dur-fast) ease-out; }
.gati-card--link:hover { border-color: var(--border-strong); }
.gati-card--link a { color: inherit; text-decoration: none; }
.gati-card--link a::after { content: ""; position: absolute; inset: 0; }
.gati-card--link:focus-within { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }

/* Breadcrumbs */
.gati-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) 0; margin: 0; padding: 0; list-style: none; font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); }
.gati-crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.gati-crumbs li:not(:last-child)::after { content: "/"; margin-inline: var(--space-2); color: var(--text-muted); }
.gati-crumbs a { color: var(--text-muted); text-decoration: none; border-radius: var(--radius-sm); }
.gati-crumbs a:hover { color: var(--text-primary); text-decoration: underline; }
.gati-crumbs a:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }
.gati-crumbs [aria-current="page"] { color: var(--text-primary); font-weight: var(--weight-semibold); }

/* Pagination */
.gati-pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.gati-pager button { display: inline-grid; place-items: center; box-sizing: border-box; min-width: var(--control-md); height: var(--control-md); padding: 0 var(--space-2); background: transparent; color: var(--text-muted);
  border: var(--hairline) solid transparent; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-mono); font-size: var(--type-readout-size); font-variant-numeric: tabular-nums; transition: background-color var(--dur-fast) ease-out; }
.gati-pager button:hover { background: var(--bg-panel); color: var(--text-primary); }
.gati-pager button[aria-current="page"] { background: var(--bg-selected); border-color: var(--text-primary); color: var(--text-primary); font-weight: var(--weight-semibold); }
.gati-pager button:disabled { color: var(--text-disabled); cursor: not-allowed; background: transparent; }
.gati-pager button:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }
.gati-pager .gap { padding: 0 var(--space-1); color: var(--text-muted); font-family: var(--font-mono); }
@media (pointer: coarse) { .gati-pager button { min-width: var(--hit-touch); height: var(--hit-touch); } }

/* Steps */
.gati-steps { display: flex; margin: 0; padding: 0; list-style: none; counter-reset: gati-step; }
.gati-steps li { position: relative; flex: 1 1 0; display: grid; justify-items: start; gap: var(--space-2); padding-inline-end: var(--space-3); color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-steps li::before { counter-increment: gati-step; content: counter(gati-step); display: grid; place-items: center; box-sizing: border-box; width: var(--control-sm); height: var(--control-sm); border-radius: var(--radius-pill);
  border: var(--hairline) solid var(--border-strong); background: var(--bg-base); font-family: var(--font-mono); font-size: var(--type-readout-size); color: var(--text-muted); position: relative; z-index: 1; }
.gati-steps li::after { content: ""; position: absolute; inset-block-start: calc(var(--control-sm) / 2); inset-inline: calc(var(--control-sm) + var(--space-2)) 0; height: var(--hairline); background: var(--border-subtle); }
.gati-steps li:last-child::after { content: none; }
.gati-steps li[data-state="done"]::before { content: "\2713"; background: var(--text-primary); border-color: var(--text-primary); color: var(--bg-base); }
.gati-steps li[data-state="done"]::after { background: var(--text-primary); }
.gati-steps li[aria-current="step"] { color: var(--text-primary); font-weight: var(--weight-semibold); }
.gati-steps li[aria-current="step"]::before { border: var(--focus-width) solid var(--text-primary); color: var(--text-primary); font-weight: var(--weight-semibold); }
.gati-steps li[data-state="error"]::before { content: "!"; border-color: var(--danger); color: var(--danger); }
.gati-steps--vertical { flex-direction: column; gap: var(--space-4); }
.gati-steps--vertical li { flex: none; grid-template-columns: auto 1fr; align-items: center; column-gap: var(--space-3); padding: 0; }
.gati-steps--vertical li::after { inset-block: calc(var(--control-sm) + var(--space-1)) calc(var(--space-4) * -1); inset-inline: calc(var(--control-sm) / 2) auto; width: var(--hairline); height: auto; }
/* bp-xs 480 */
@media (max-width: 479.98px) { .gati-steps:not(.gati-steps--vertical) li:not([aria-current="step"]) > span { display: none; } }

/* Kbd */
.gati-kbd { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; min-width: var(--kbd-height); height: var(--kbd-height); padding: 0 var(--space-1); background: var(--bg-panel); color: var(--text-primary);
  border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: inset 0 calc(var(--hairline) * -1) 0 var(--border-strong); font-family: var(--font-mono); font-size: var(--text-min); line-height: 1; font-weight: var(--weight-medium); white-space: nowrap; }
.gati-kbd-combo { display: inline-flex; align-items: center; gap: var(--space-1); }

/* Divider */
.gati-divider { display: block; flex: none; align-self: stretch; margin: 0; border: 0; border-block-start: var(--hairline) solid var(--border-subtle); }
.gati-divider--strong { border-block-start-color: var(--border-strong); }
.gati-divider--vertical { align-self: stretch; width: 0; min-height: var(--control-md); border-block-start: 0; border-inline-start: var(--hairline) solid var(--border-subtle); }
.gati-divider--label { display: flex; align-items: center; gap: var(--space-3); border: 0; color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-divider--label::before, .gati-divider--label::after { content: ""; flex: 1; border-block-start: var(--hairline) solid var(--border-subtle); }

/* Textarea (add to .gati-input) */
.gati-textarea { height: auto; min-height: var(--textarea-min-height); padding-block: var(--space-2); resize: vertical; font-family: var(--font-sans); }

/* Fieldset and Label */
.gati-fieldset { display: grid; gap: var(--space-3); min-width: 0; margin: 0; padding: 0; border: 0; }
.gati-legend { padding: 0; font-family: var(--font-sans); font-size: var(--type-label-lg-size); line-height: var(--type-label-lg-line); font-weight: var(--type-label-lg-weight); color: var(--text-primary); }
.gati-label { display: flex; align-items: baseline; gap: var(--space-2); font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); color: var(--text-primary); }
.gati-label-note { color: var(--text-muted); font-weight: 400; font-size: var(--type-caption-size); }
.gati-fieldset-hint { margin: 0; color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }

/* Timeline */
.gati-timeline { display: grid; margin: 0; padding: 0; list-style: none; }
.gati-timeline li { position: relative; display: grid; grid-template-columns: 5.5em var(--space-4) 1fr; column-gap: var(--space-2); padding-bottom: var(--space-4); }
.gati-timeline li:last-child { padding-bottom: 0; }
.gati-timeline time { grid-column: 1; grid-row: 1; padding-top: var(--hairline); text-align: end; color: var(--text-muted); font-family: var(--font-mono); font-size: var(--type-readout-size); line-height: var(--type-body-line); font-variant-numeric: tabular-nums; }
.gati-timeline li::before { content: ""; grid-column: 2; grid-row: 1; justify-self: center; align-self: start; margin-top: calc((var(--type-body-line) - var(--dot-md)) / 2 + var(--hairline)); width: var(--dot-md); height: var(--dot-md); border-radius: var(--radius-pill); background: var(--accent, var(--control-fill)); position: relative; z-index: 1; }
.gati-timeline li::after { content: ""; position: absolute; inset-block: calc(var(--type-body-line) / 2 + var(--space-2)) 0; inset-inline-start: calc(5.5em + var(--space-2) + var(--space-2) - var(--hairline) / 2); width: var(--hairline); background: var(--border-strong); }
.gati-timeline li:last-child::after { content: none; }
.gati-timeline-title { grid-column: 3; grid-row: 1; margin: 0; font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); font-weight: var(--weight-semibold); color: var(--text-primary); }
.gati-timeline-text { grid-column: 3; grid-row: 2; margin: 0; color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }

/* RadialProgress */
.gati-radial { --p: 0; position: relative; display: inline-grid; place-items: center; flex: none; width: var(--radial-size); height: var(--radial-size); border-radius: var(--radius-pill);
  background: conic-gradient(var(--accent, var(--control-fill)) calc(var(--p) * 1%), var(--meter-track) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--focus-width) * 2), #000 calc(100% - var(--focus-width) * 2 + 0.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - var(--focus-width) * 2), #000 calc(100% - var(--focus-width) * 2 + 0.5px)); }
.gati-radial-wrap { position: relative; display: inline-grid; place-items: center; }
.gati-radial-value { position: absolute; font-family: var(--font-mono); font-size: var(--type-readout-size); font-variant-numeric: tabular-nums; color: var(--text-primary); }
.gati-radial--sm { width: var(--control-md); height: var(--control-md); }

/* Dropdown: a trigger plus a Menu */
.gati-dropdown { position: relative; display: inline-block; }
.gati-dropdown > .gati-menu { position: absolute; inset-block-start: calc(100% + var(--space-1)); inset-inline-start: 0; }
.gati-dropdown--end > .gati-menu { inset-inline-start: auto; inset-inline-end: 0; }
.gati-dropdown:not([data-open]) > .gati-menu { display: none; }
.gati-dropdown-caret { width: var(--space-2); height: var(--space-2); border-inline-end: var(--focus-width) solid currentColor; border-bottom: var(--focus-width) solid currentColor; transform: translateY(-2px) rotate(45deg); }

/* Window frame (mockups, screenshots, video) */
.gati-window { display: flex; flex-direction: column; box-sizing: border-box; overflow: hidden; background: var(--bg-base); border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); }
.gati-window-bar { display: flex; align-items: center; gap: var(--space-3); box-sizing: border-box; height: var(--header-height); padding: 0 var(--space-3); background: var(--bg-panel); border-block-end: var(--hairline) solid var(--border-subtle); }
.gati-window-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--text-primary); }
.gati-window-controls { display: inline-flex; gap: var(--space-2); }
.gati-window-controls i { width: var(--dot-md); height: var(--dot-md); box-sizing: border-box; border-radius: var(--radius-pill); border: var(--hairline) solid var(--border-strong); }
.gati-window-body { flex: 1; min-height: 0; }
.gati-window.gati-window--inactive .gati-window-bar { background: var(--bg-base); }
.gati-window.gati-window--inactive .gati-window-title { color: var(--text-inactive); }
.gati-window.gati-window--inactive .gati-window-controls i { border-color: var(--border-subtle); }

/* Theme switch */
.gati-themeswitch { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }

/* Calendar */
.gati-cal { display: inline-block; box-sizing: border-box; padding: var(--space-3); background: var(--bg-elevated); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); color: var(--text-primary); }
.gati-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.gati-cal-title { font-family: var(--font-sans); font-size: var(--type-label-lg-size); line-height: var(--type-label-lg-line); font-weight: var(--type-label-lg-weight); }
.gati-cal table { border-collapse: collapse; }
.gati-cal th { width: var(--control-lg); height: var(--control-sm); padding: 0; color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-caption-size); font-weight: var(--weight-medium); text-align: center; }
.gati-cal td { padding: 0; text-align: center; }
.gati-cal-day { display: inline-grid; place-items: center; box-sizing: border-box; width: var(--control-lg); height: var(--control-lg); padding: 0; background: transparent; color: var(--text-primary);
  border: var(--hairline) solid transparent; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-mono); font-size: var(--type-readout-size); font-variant-numeric: tabular-nums; transition: background-color var(--dur-fast) ease-out; }
.gati-cal-day:hover { background: var(--bg-panel); }
.gati-cal-day.is-outside { color: var(--text-muted); }
.gati-cal-day.is-today { border-color: var(--text-primary); }
.gati-cal-day[aria-selected="true"] { background: var(--text-primary); color: var(--bg-base); border-color: var(--text-primary); font-weight: var(--weight-semibold); }
.gati-cal-day:disabled { color: var(--text-disabled); cursor: not-allowed; background: transparent; }
.gati-cal-day:focus-visible, .gati-pager button:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: calc(var(--focus-width) * -1); }
@media (pointer: coarse) { .gati-cal-day { width: var(--hit-touch); height: var(--hit-touch); } .gati-cal th { width: var(--hit-touch); } }

/* 1.13 forced colours */
@media (forced-colors: active) {
  .gati-card, .gati-cal, .gati-window { border: 1px solid CanvasText; }
  .gati-pager button[aria-current="page"], .gati-cal-day[aria-selected="true"] { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .gati-steps li[data-state="done"]::before { forced-color-adjust: none; background: Highlight; color: HighlightText; border-color: Highlight; }
  .gati-steps li[aria-current="step"]::before { border-color: Highlight; }
  .gati-radial { forced-color-adjust: none; background: conic-gradient(Highlight calc(var(--p) * 1%), GrayText 0); }
  .gati-timeline li::before { forced-color-adjust: none; background: CanvasText; }
  .gati-kbd { border-color: ButtonText; }
  .gati-avatar { border-color: CanvasText; }
  .gati-cal-day:focus-visible, .gati-pager button:focus-visible, .gati-crumbs a:focus-visible { outline: 2px solid Highlight; }
}

/* ===== 1.15 · Motion tokens, overlays, selection ===== */

/* Floating layers enter in dur-mid with ease-standard and leave at once */
@keyframes gati-pop { from { opacity: 0; transform: translateY(var(--space-1)); } }
.gati-menu, .gati-popover, .gati-modal, .gati-toast { animation: gati-pop var(--dur-mid) var(--ease-standard); }
.gati-tooltip { animation: gati-fade var(--dur-mid) var(--ease-standard); }
@media (prefers-reduced-motion: reduce) { .gati-menu, .gati-popover, .gati-modal, .gati-toast, .gati-tooltip { animation: none; } }

/* Text selection: inverted ink. bg-selected is too close to the page and field backgrounds to show selected text. */
.gati-root ::selection { background: var(--text-primary); color: var(--bg-base); }
.gati-toast ::selection { background: var(--bg-base); color: var(--text-primary); }

/* ===== 1.14 · Colour balance ===== */

/* Rotate the earth tones over siblings: put .gati-accent-cycle on a grid, list or row and each child gets its own --accent / --accent-soft.
   Order: Ochre, Slate, Plum, Terracotta, Moss. Sage is not in the cycle (it stays the primary action and the brand mark). */
.gati-accent-cycle > :nth-child(5n+1) { --accent: var(--viz-1); --accent-soft: var(--viz-1-soft); }
.gati-accent-cycle > :nth-child(5n+2) { --accent: var(--viz-2); --accent-soft: var(--viz-2-soft); }
.gati-accent-cycle > :nth-child(5n+3) { --accent: var(--viz-4); --accent-soft: var(--viz-4-soft); }
.gati-accent-cycle > :nth-child(5n+4) { --accent: var(--viz-3); --accent-soft: var(--viz-3-soft); }
.gati-accent-cycle > :nth-child(5n+5) { --accent: var(--viz-5); --accent-soft: var(--viz-5-soft); }

/* Links: Slate, always underlined */
.gati-link, .gati-prose a { color: var(--text-link); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: var(--hairline); }
.gati-link:hover, .gati-prose a:hover { color: var(--text-link-hover); text-decoration-thickness: var(--focus-width); }
.gati-link:focus-visible, .gati-prose a:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); border-radius: var(--radius-sm); }

/* Secondary emphasis in the surrounding accent instead of a second Sage button */
.gati-btn--tint { --btn-bg: var(--accent-soft, var(--bg-panel)); --btn-bg-hover: var(--bg-selected); --btn-bg-active: var(--bg-pressed); --btn-fg: var(--text-primary); --btn-border: var(--accent, var(--border-strong)); }
.gati-btn--tint:disabled, .gati-btn--tint[aria-disabled="true"] { --btn-bg: transparent; --btn-fg: var(--text-disabled); --btn-border: var(--border-subtle); }

/* Accent variants of Tag, Badge, Card, Stat: take the colour of the surrounding .gati-accent-N / .gati-accent-cycle child */
.gati-tag--accent { --tag-bg: var(--accent-soft, var(--bg-panel)); --tag-border: var(--accent, var(--border-strong)); --tag-fg: var(--text-primary); --tag-dot: var(--accent, var(--text-muted)); }
.gati-badge--accent { background: var(--accent-soft, var(--bg-selected)); color: var(--text-primary); box-shadow: inset 0 0 0 var(--hairline) var(--accent, var(--border-strong)); }
.gati-card--accent { border-color: var(--accent, var(--border-subtle)); }
.gati-card--accent .gati-card-media { background: var(--accent-soft, var(--bg-selected)); }
.gati-accent-cycle .gati-stat__icon, :is(.gati-accent-1, .gati-accent-2, .gati-accent-3, .gati-accent-4, .gati-accent-5, .gati-accent-6) .gati-stat__icon { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }

@media (forced-colors: active) {
  .gati-link, .gati-prose a { color: LinkText; }
  .gati-btn--tint, .gati-tag--accent { border-color: ButtonText; }
}

/* ===== 1.16 · Phone, website, plugin and desktop pieces ===== */

/* Right-to-left: inset bars (selected row, current nav item, banner) and the Toggle thumb flip with the reading direction.
   Level bars, faders, meters and the Mod matrix stay as drawn: they show a quantity, not a reading order. */
[dir="rtl"] { --bar-x: calc(var(--focus-width) * -1); }
[dir="rtl"] .gati-toggle[aria-checked="true"]::after { transform: translateX(calc((var(--toggle-width) - var(--toggle-height)) * -1)); }

/* BottomNav: tab bar for phones. Three to five destinations, always icon plus label. Hidden from bp-lg, where the Sidebar takes over. */
.gati-bottomnav { position: sticky; inset-block-end: 0; z-index: var(--z-sticky); display: flex; box-sizing: border-box; margin: 0; padding: 0 0 env(safe-area-inset-bottom); list-style: none;
  background: var(--bg-base); border-block-start: var(--hairline) solid var(--border-subtle); }
.gati-bottomnav > li { display: flex; flex: 1 1 0; min-width: 0; }
.gati-bottomnav :is(a, button) { position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); box-sizing: border-box;
  min-height: var(--bottomnav-height); min-width: var(--hit-touch); padding: var(--space-2) var(--space-1); border: 0; background: transparent; color: var(--text-muted); text-decoration: none; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); font-weight: var(--type-caption-weight); letter-spacing: var(--type-caption-tracking); }
.gati-bottomnav :is(a, button):hover { background: var(--bg-panel); color: var(--text-primary); }
.gati-bottomnav :is(a, button):focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: calc(var(--focus-width) * -1); }
.gati-bottomnav svg { width: var(--icon-md); height: var(--icon-md); stroke: currentColor; fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.gati-bottomnav [aria-current="page"] { color: var(--text-primary); font-weight: var(--weight-semibold); box-shadow: inset 0 var(--focus-width) 0 var(--text-primary); }
.gati-bottomnav .gati-badge { position: absolute; inset-block-start: var(--space-1); inset-inline-start: calc(50% + var(--space-1)); }
@container page (min-width: 1024px) { .gati-bottomnav { display: none; } }

/* Sheet: bottom sheet for phones (modal). Grab handle, title, scrolling body, full-width actions. Add .gati-sheet-scrim--contained to show it inside a frame. */
@keyframes gati-rise { from { opacity: 0; transform: translateY(var(--space-6)); } }
.gati-sheet-scrim { position: fixed; inset: 0; z-index: var(--z-overlay); display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.gati-sheet-scrim--contained { position: absolute; }
.gati-sheet { z-index: var(--z-modal); box-sizing: border-box; display: flex; flex-direction: column; width: min(var(--sheet-width), 100%); max-height: 85%;
  padding: 0 var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); background: var(--bg-elevated); color: var(--text-primary);
  border: var(--hairline) solid var(--border-subtle); border-block-end: 0; border-start-start-radius: var(--radius-lg); border-start-end-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal); animation: gati-rise var(--dur-base) var(--ease-emphasis); }
.gati-sheet-grab { display: grid; place-items: center; align-self: stretch; min-height: var(--control-md); padding: 0; border: 0; background: transparent; cursor: grab; }
.gati-sheet-grab:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: calc(var(--focus-width) * -1); }
.gati-sheet-handle { display: block; width: var(--sheet-handle-width); height: var(--sheet-handle-height); border-radius: var(--radius-pill); background: var(--border-strong); }
.gati-sheet-title { margin: 0 0 var(--space-2); font-family: var(--font-serif); font-size: var(--type-panel-header-size); line-height: var(--type-panel-header-line); font-weight: var(--type-panel-header-weight); }
.gati-sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; color: var(--text-muted); }
.gati-sheet-foot { display: grid; gap: var(--space-2); margin-top: var(--space-4); }

/* Calendar range: ends are ink squares, days between sit on a bg-selected band. Mark days with data-range="start|in|end"; ends also get aria-selected. */
.gati-cal-day[data-range="in"] { background: var(--bg-selected); border-color: transparent; border-radius: 0; }
.gati-cal-day[data-range="in"]:hover { background: var(--bg-pressed); }
.gati-cal-day[data-range="start"], .gati-cal-day[data-range="end"] { background: var(--text-primary); color: var(--bg-base); border-color: var(--text-primary); font-weight: var(--weight-semibold); }
.gati-cal-day[data-range="start"]:not([data-range-single]) { border-start-end-radius: 0; border-end-end-radius: 0; }
.gati-cal-day[data-range="end"]:not([data-range-single]) { border-start-start-radius: 0; border-end-start-radius: 0; }

/* ShareImage: 1200 x 630 card for link previews. Everything sits inside a space-16 margin; the right third carries the accent. */
.gati-share { position: relative; box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; width: var(--share-width); height: var(--share-height); padding: var(--space-16); overflow: hidden;
  background: var(--bg-base); color: var(--text-primary); border: var(--hairline) solid var(--border-subtle); }
.gati-share::before { content: ""; position: absolute; inset-block: 0; inset-inline-end: 0; width: calc(var(--share-width) / 3); background: var(--accent-soft, var(--bg-panel)); border-inline-start: var(--hairline) solid var(--accent, var(--border-subtle)); }
.gati-share > * { position: relative; }
.gati-share-brand { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-serif); font-size: var(--type-title-size); line-height: var(--type-title-line); font-weight: var(--type-title-weight); }
.gati-share-title { max-width: calc(var(--share-width) * 2 / 3 - var(--space-16)); margin: 0; text-wrap: balance; font-family: var(--font-serif); font-size: var(--type-hero-size); line-height: var(--type-hero-line); font-weight: var(--type-hero-weight); letter-spacing: var(--type-hero-tracking); }
.gati-share-meta { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-mono); font-size: var(--type-readout-lg-size); line-height: var(--type-readout-lg-line); color: var(--text-muted); }
.gati-share-meta::before { content: ""; width: var(--dot-md); height: var(--dot-md); border-radius: var(--radius-pill); background: var(--accent, var(--text-muted)); }

/* PricingTable: plan cards in a self-wrapping row. The featured plan is ink-outlined and the only one with a Primary button. */
.gati-pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--plan-min-width)), 1fr)); gap: var(--gap-tile, var(--space-4)); align-items: stretch; }
.gati-plan { display: flex; flex-direction: column; gap: var(--space-4); box-sizing: border-box; padding: var(--space-6); background: var(--bg-elevated); color: var(--text-primary);
  border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); box-shadow: inset 0 var(--space-1) 0 var(--accent, transparent); }
.gati-plan--featured { padding: calc(var(--space-6) - var(--hairline)); border: var(--focus-width) solid var(--text-primary); }
.gati-plan-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.gati-plan-name { margin: 0; font-family: var(--font-serif); font-size: var(--type-panel-header-size); line-height: var(--type-panel-header-line); font-weight: var(--type-panel-header-weight); }
.gati-plan-price { display: flex; align-items: baseline; gap: var(--space-1); }
.gati-plan-amount { font-family: var(--font-serif); font-size: var(--type-display-size); line-height: var(--type-display-line); font-weight: var(--type-display-weight); letter-spacing: var(--type-display-tracking); font-variant-numeric: tabular-nums; }
.gati-plan-per { color: var(--text-muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-plan-desc { margin: 0; color: var(--text-muted); }
.gati-plan-list { display: grid; flex: 1; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.gati-plan-list li { display: flex; align-items: flex-start; gap: var(--space-2); }
.gati-plan-list li::before { content: ""; flex: none; box-sizing: border-box; width: calc(var(--check-size) / 4); height: calc(var(--check-size) / 2); margin: calc(var(--space-1) + var(--hairline)) var(--space-1) 0;
  border: solid var(--text-primary); border-width: 0 var(--focus-width) var(--focus-width) 0; transform: rotate(45deg); }
.gati-plan-list li[data-off] { color: var(--text-muted); }
.gati-plan-list li[data-off]::before { content: "\2212"; width: auto; height: auto; margin: 0 var(--space-1) 0 0; border: 0; transform: none; font-family: var(--font-mono); line-height: var(--type-body-line); }

/* Article: long-form reading page. Put it in a .gati-view; wrap with .gati-article-layout to get the contents list beside it from bp-lg. */
.gati-article { max-width: var(--prose-max); margin-inline: auto; font-family: var(--font-sans); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.gati-article > h1 { margin: 0 0 var(--space-3); text-wrap: balance; font-family: var(--font-serif); font-size: var(--type-display-size); line-height: var(--type-display-line); font-weight: var(--type-display-weight); letter-spacing: var(--type-display-tracking); }
.gati-article-meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0 0 var(--space-6); color: var(--text-muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-article-lead { margin: 0 0 var(--space-6); font-size: var(--type-lead-size); line-height: var(--type-lead-line); }
.gati-article h2 { margin: var(--space-8) 0 var(--space-3); font-family: var(--font-serif); font-size: var(--type-heading-size); line-height: var(--type-heading-line); font-weight: var(--type-heading-weight); scroll-margin-block-start: calc(var(--site-nav-height) + var(--space-4)); }
.gati-article h3 { margin: var(--space-6) 0 var(--space-2); font-family: var(--font-serif); font-size: var(--type-panel-header-size); line-height: var(--type-panel-header-line); font-weight: var(--type-panel-header-weight); }
.gati-article :is(p, ul, ol) { margin: 0 0 var(--space-4); }
.gati-article :is(ul, ol) { padding-inline-start: var(--space-6); }
.gati-article li + li { margin-top: var(--space-1); }
.gati-article a { color: var(--text-link); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: var(--hairline); }
.gati-article a:hover { color: var(--text-link-hover); text-decoration-thickness: var(--focus-width); }
.gati-article blockquote { margin: var(--space-6) 0; padding-inline-start: var(--space-4); border-inline-start: var(--focus-width) solid var(--text-primary); font-family: var(--font-serif); font-size: var(--type-lead-size); line-height: var(--type-lead-line); }
.gati-article blockquote p { margin: 0; }
.gati-article cite { display: block; margin-top: var(--space-2); color: var(--text-muted); font-family: var(--font-sans); font-style: normal; font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-article figure { margin: var(--space-6) 0; }
.gati-article figure img, .gati-article-media { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg-selected); border-radius: var(--radius-md); }
.gati-article figcaption { margin-top: var(--space-2); color: var(--text-muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-article code { padding: 0 var(--space-1); background: var(--bg-panel); border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--type-log-size); }
.gati-article pre { margin: 0 0 var(--space-4); padding: var(--space-3); overflow-x: auto; background: var(--bg-panel); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); font-family: var(--font-mono); font-size: var(--type-log-size); line-height: var(--type-log-line); }
.gati-article pre code { padding: 0; background: none; }
.gati-article hr { margin: var(--space-8) 0; border: 0; border-block-start: var(--hairline) solid var(--border-subtle); }
.gati-toc { margin-bottom: var(--space-6); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-toc-title { margin: 0 0 var(--space-2); color: var(--text-muted); }
.gati-toc ol { display: grid; gap: var(--hairline); margin: 0; padding: 0; list-style: none; }
.gati-toc a { display: flex; align-items: center; min-height: var(--control-sm); padding: 0 var(--space-2); border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; }
.gati-toc a:hover { color: var(--text-primary); background: var(--bg-panel); }
.gati-toc a[aria-current="true"] { color: var(--text-primary); font-weight: var(--weight-semibold); background: var(--bg-selected); box-shadow: inset var(--bar-x, var(--focus-width)) 0 0 var(--text-primary); }
.gati-toc a:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: calc(var(--focus-width) * -1); }
@container page (min-width: 1024px) {
  .gati-article-layout { display: grid; grid-template-columns: minmax(0, var(--prose-max)) var(--menu-min-width); justify-content: center; gap: var(--space-12); }
  .gati-article-layout .gati-article { margin-inline: 0; }
  .gati-article-layout .gati-toc { position: sticky; inset-block-start: calc(var(--site-nav-height) + var(--space-6)); align-self: start; order: 2; }
}

/* PresetBrowser: search, categories, list, footer. Plugin panel; rows are control-md tall. The category list becomes a row of buttons in a narrow plugin window. */
.gati-presets { container: presets / inline-size; display: flex; flex-direction: column; box-sizing: border-box; overflow: hidden; background: var(--bg-panel); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); }
.gati-presets-head, .gati-presets-foot { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); }
.gati-presets-head { border-block-end: var(--hairline) solid var(--border-subtle); }
.gati-presets-head .gati-search { flex: 1; }
.gati-presets-head .gati-search input { min-width: 0; }
.gati-presets-foot { border-block-start: var(--hairline) solid var(--border-subtle); }
.gati-presets-foot .spacer { flex: 1; }
.gati-presets-body { display: grid; grid-template-columns: calc(var(--menu-min-width) * 3 / 4) minmax(0, 1fr); min-height: 0; }
.gati-presets-cats, .gati-presets-list { display: flex; flex-direction: column; gap: var(--hairline); margin: 0; padding: var(--space-2); list-style: none; }
.gati-presets-cats { border-inline-end: var(--hairline) solid var(--border-subtle); }
.gati-presets-list { overflow-y: auto; }
.gati-presets-cats button, .gati-preset { display: flex; align-items: center; gap: var(--space-2); box-sizing: border-box; width: 100%; min-height: var(--control-md); padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-primary); text-align: start; cursor: pointer;
  font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); }
.gati-presets-cats button:hover, .gati-preset:hover { background: var(--bg-selected); }
.gati-presets-cats [aria-current="true"] { background: var(--bg-selected); box-shadow: inset var(--bar-x, var(--focus-width)) 0 0 var(--text-primary); }
.gati-preset::before { content: ""; flex: none; width: var(--dot-md); height: var(--dot-md); border-radius: var(--radius-pill); background: var(--accent, transparent); }
.gati-preset[aria-selected="true"] { background: var(--accent-soft, var(--bg-selected)); box-shadow: inset var(--bar-x, var(--focus-width)) 0 0 var(--accent, var(--text-primary)); }
.gati-preset-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gati-preset-meta { flex: none; color: var(--text-muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); font-weight: var(--type-caption-weight); }
.gati-preset-fav { display: grid; place-items: center; flex: none; width: var(--control-sm); height: var(--control-sm); padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; }
.gati-preset-fav:hover { color: var(--text-primary); }
.gati-preset-fav svg { width: var(--icon-sm); height: var(--icon-sm); stroke: currentColor; fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
.gati-preset-fav[aria-pressed="true"] { color: var(--text-primary); }
.gati-preset-fav[aria-pressed="true"] svg { fill: currentColor; }
.gati-presets-dirty { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--text-muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-presets-dirty::before { content: ""; width: var(--dot-sm); height: var(--dot-sm); border-radius: var(--radius-pill); background: var(--warning); }
.gati-presets :is(button, [role="option"]):focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: calc(var(--focus-width) * -1); }
@container presets (max-width: 479.98px) {
  .gati-presets-body { grid-template-columns: minmax(0, 1fr); }
  .gati-presets-cats { flex-direction: row; overflow-x: auto; border-inline-end: 0; border-block-end: var(--hairline) solid var(--border-subtle); }
  .gati-presets-cats button { width: auto; flex: none; white-space: nowrap; }
}
@media (pointer: coarse) { .gati-presets-cats button, .gati-preset { min-height: var(--hit-touch); } .gati-preset-fav { width: var(--hit-touch); height: var(--hit-touch); } }

/* ModMatrix: sources down, destinations across. A cell shows the signed amount as text and as a bar from the centre in Param Slate. Bars do not mirror in right-to-left. */
.gati-mod { display: grid; grid-template-columns: auto repeat(var(--mod-cols, 4), var(--mod-cell-width)); gap: var(--hairline); box-sizing: border-box; width: max-content; max-width: 100%; padding: var(--space-2); overflow-x: auto; background: var(--bg-panel); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-md); }
.gati-mod-h, .gati-mod-row { display: flex; align-items: center; min-width: 0; color: var(--text-muted); font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-mod-h { justify-content: center; height: var(--control-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gati-mod-row { gap: var(--space-2); padding-inline: var(--space-2) var(--space-3); color: var(--text-primary); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); white-space: nowrap; }
.gati-mod-row::before { content: ""; flex: none; width: var(--dot-md); height: var(--dot-md); border-radius: var(--radius-pill); background: var(--accent, var(--text-muted)); }
.gati-mod-cell { position: relative; display: grid; place-items: center; box-sizing: border-box; height: var(--control-md); padding: 0; background: var(--bg-elevated); color: var(--text-primary); border: var(--hairline) solid var(--border-subtle); border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-mono); font-size: var(--type-readout-size); line-height: var(--type-readout-line); font-weight: var(--type-readout-weight); font-variant-numeric: tabular-nums; }
.gati-mod-cell:hover { border-color: var(--border-strong); }
.gati-mod-cell:not([data-amt]) { color: transparent; }
.gati-mod-cell:not([data-amt]):hover, .gati-mod-cell:not([data-amt]):focus-visible { color: var(--text-muted); }
.gati-mod-cell[data-amt] { border-color: var(--border-strong); }
.gati-mod-cell[data-amt]::after { content: ""; position: absolute; inset-block-end: var(--hairline); height: var(--focus-width); background: var(--param); }
.gati-mod-cell[data-amt="pos"]::after { left: 50%; width: calc(var(--amt, 0) * 0.5%); }
.gati-mod-cell[data-amt="neg"]::after { right: 50%; width: calc(var(--amt, 0) * -0.5%); }
.gati-mod-cell[aria-selected="true"] { outline: var(--focus-width) solid var(--text-primary); outline-offset: calc(var(--hairline) * -1); }
.gati-mod-cell:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--hairline); }
.gati-mod-cell:disabled { color: var(--text-disabled); border-color: transparent; background: transparent; cursor: not-allowed; }
@media (pointer: coarse) { .gati-mod-cell { height: var(--hit-touch); } }

/* MIDI learn: any control with .gati-learnable. armed = waiting for a message (dashed, blinking), mapped = has a controller (solid thin ring + a tag). */
@keyframes gati-learn { 50% { outline-color: transparent; } }
.gati-learnable { position: relative; border-radius: var(--radius-sm); }
.gati-learnable[data-learn="armed"] { outline: var(--focus-width) dashed var(--param); outline-offset: var(--space-1); animation: gati-learn var(--dur-blink) steps(2, start) infinite; }
.gati-learnable[data-learn="mapped"] { outline: var(--hairline) solid var(--param); outline-offset: var(--space-1); }
.gati-learn-mode .gati-learnable { cursor: crosshair; }
.gati-learn-mode .gati-learnable:not([data-learn]):hover { outline: var(--hairline) dashed var(--param); outline-offset: var(--space-1); }
.gati-learn-tag { display: inline-flex; align-items: center; gap: var(--space-1); box-sizing: border-box; height: var(--space-4); padding: 0 var(--space-1); background: var(--bg-elevated); color: var(--text-primary); border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: var(--text-min); line-height: 1; font-weight: var(--weight-medium); white-space: nowrap; }
.gati-learn-tag[data-state="armed"] { border-style: dashed; }
.gati-learn-tag[data-state="armed"]::before { content: ""; width: var(--dot-sm); height: var(--dot-sm); border-radius: var(--radius-pill); background: var(--param); }
.gati-banner--learn { --banner: var(--param); }
.gati-banner--learn .prefix { color: var(--text-primary); }

/* SettingsWindow: sidebar of sections and a scrolling body of rows. Below bp-md of its own width the sections become a row of tabs. */
.gati-settings { container: settings / inline-size; flex: 1; min-height: 0; }
.gati-settings-layout { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100%; }
.gati-settings-layout > .gati-nav { width: auto; overflow-y: auto; }
.gati-settings-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.gati-settings-body { flex: 1; box-sizing: border-box; max-width: calc(var(--prose-max) + var(--space-12)); padding: var(--space-6); overflow-y: auto; }
.gati-settings-title { margin: 0 0 var(--space-2); font-family: var(--font-serif); font-size: var(--type-heading-size); line-height: var(--type-heading-line); font-weight: var(--type-heading-weight); }
.gati-settings-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-3) var(--space-6); background: var(--bg-panel); border-block-start: var(--hairline) solid var(--border-subtle); }
.gati-setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-1) var(--space-6); padding-block: var(--space-3); border-block-end: var(--hairline) solid var(--border-subtle); }
.gati-setting-title { margin: 0; font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); }
.gati-setting-desc { grid-column: 1; margin: 0; color: var(--text-muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.gati-setting > :last-child:not(.gati-setting-title):not(.gati-setting-desc) { grid-column: 2; grid-row: 1 / span 2; }
@container settings (max-width: 639.98px) {
  .gati-settings-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .gati-settings-layout > .gati-nav { flex-direction: row; overflow: auto hidden; padding: var(--space-2); border-inline-end: 0; border-block-end: var(--hairline) solid var(--border-subtle); }
  .gati-settings-layout > .gati-nav .gati-nav-label { display: none; }
  .gati-settings-layout > .gati-nav .gati-nav-item { flex: none; white-space: nowrap; }
  .gati-settings-body { padding: var(--space-4); }
  .gati-setting { grid-template-columns: minmax(0, 1fr); }
  .gati-setting > :last-child:not(.gati-setting-title):not(.gati-setting-desc) { grid-column: 1; grid-row: auto; justify-self: start; }
  .gati-settings-foot { padding-inline: var(--space-4); }
}

/* FirstRun: one decision per step, centred. Choice cards are radio inputs: ink ring and ink border when selected. */
.gati-firstrun { display: flex; flex-direction: column; align-items: center; gap: var(--space-6); box-sizing: border-box; max-width: calc(var(--modal-width) + var(--space-12)); margin-inline: auto; padding: var(--space-8) var(--space-6); text-align: center; }
.gati-firstrun-title { margin: 0; font-family: var(--font-serif); font-size: var(--type-title-size); line-height: var(--type-title-line); font-weight: var(--type-title-weight); letter-spacing: var(--type-title-tracking); }
.gati-firstrun-lead { margin: 0; color: var(--text-muted); }
.gati-firstrun .gati-steps { align-self: stretch; text-align: start; }
.gati-firstrun-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); align-self: stretch; }
.gati-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--menu-min-width)), 1fr)); gap: var(--space-3); align-self: stretch; text-align: start; }
.gati-choice { position: relative; display: grid; gap: var(--space-1); box-sizing: border-box; padding: var(--space-4); padding-inline-end: calc(var(--space-4) + var(--check-size) + var(--space-2)); background: var(--bg-elevated); color: var(--text-primary); border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-md); cursor: pointer; }
.gati-choice input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: inherit; }
.gati-choice::after { content: ""; position: absolute; inset-block-start: var(--space-4); inset-inline-end: var(--space-4); box-sizing: border-box; width: var(--check-size); height: var(--check-size); background: var(--bg-elevated); border: var(--hairline) solid var(--border-strong); border-radius: var(--radius-pill); }
.gati-choice:has(input:checked) { background: var(--bg-selected); border-color: var(--text-primary); box-shadow: inset 0 0 0 var(--hairline) var(--text-primary); }
.gati-choice:has(input:checked)::after { background: var(--text-primary); border-color: var(--text-primary); box-shadow: inset 0 0 0 var(--focus-width) var(--bg-selected); }
.gati-choice:has(input:focus-visible) { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-width); }
.gati-choice:has(input:disabled) { color: var(--text-disabled); border-color: var(--border-subtle); cursor: not-allowed; }
.gati-choice-title { font-family: var(--font-sans); font-size: var(--type-label-size); line-height: var(--type-label-line); font-weight: var(--type-label-weight); }
.gati-choice-text { color: var(--text-muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }

/* UpdatePrompt: a Modal with version numbers, scrolling notes and progress. */
.gati-update-ver { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); font-family: var(--font-mono); font-size: var(--type-readout-lg-size); line-height: var(--type-readout-lg-line); font-weight: var(--type-readout-lg-weight); }
.gati-update-ver .old { color: var(--text-muted); }
.gati-update-notes { max-height: calc(var(--control-xl) * 3); margin: var(--space-3) 0 0; padding-inline-start: var(--space-4); overflow-y: auto; color: var(--text-muted); }
.gati-update-notes li + li { margin-top: var(--space-1); }
.gati-update .gati-progress { margin-top: var(--space-4); }

/* Swipe actions: a row that slides to reveal actions on touch. On a mouse the actions are not shown: give the row a visible More button instead. */
.gati-swipe { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; border-block-end: var(--hairline) solid var(--border-subtle); }
.gati-swipe::-webkit-scrollbar { display: none; }
.gati-swipe-main { display: flex; align-items: center; gap: var(--space-3); flex: 0 0 100%; box-sizing: border-box; min-width: 0; min-height: var(--hit-touch); padding: 0 var(--space-4); background: var(--bg-base); scroll-snap-align: start; }
.gati-swipe-actions { display: flex; flex: none; scroll-snap-align: end; }
.gati-swipe-actions button { display: grid; place-items: center; align-content: center; gap: var(--space-1); width: var(--swipe-action-width); padding: 0; border: 0; border-radius: 0; background: var(--bg-selected); color: var(--text-primary); cursor: pointer;
  font-family: var(--font-sans); font-size: var(--type-caption-size); line-height: var(--type-caption-line); font-weight: var(--type-label-weight); }
.gati-swipe-actions button.is-danger { background: var(--action-danger); color: var(--on-action-danger); }
.gati-swipe-actions button:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: calc(var(--focus-width) * -1); }
.gati-swipe-actions svg { width: var(--icon-sm); height: var(--icon-sm); stroke: currentColor; fill: none; stroke-width: var(--icon-stroke); stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .gati-swipe { overflow: visible; } .gati-swipe-actions { display: none; } }

@media (prefers-reduced-motion: reduce) { .gati-sheet, .gati-learnable[data-learn="armed"] { animation: none; } }

@media (forced-colors: active) {
  .gati-sheet, .gati-plan, .gati-choice, .gati-presets, .gati-mod, .gati-share, .gati-bottomnav, .gati-update { border: 1px solid CanvasText; }
  :is(.gati-bottomnav [aria-current="page"], .gati-preset[aria-selected="true"], .gati-presets-cats [aria-current="true"], .gati-mod-cell[aria-selected="true"], .gati-choice:has(input:checked), .gati-toc a[aria-current="true"]) { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .gati-cal-day[data-range] { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .gati-learnable[data-learn] { outline-color: Highlight; }
  .gati-mod-cell[data-amt]::after { forced-color-adjust: none; background: Highlight; }
  .gati-article a { color: LinkText; }
}

/* ===== 1.17 · Motion ===== */
/* Four curves, one job each: ease-standard (floating layers arrive), ease-emphasis (content arrives, soft landing),
   ease-move (something on screen goes somewhere: accelerates, then decelerates), ease-exit (leaves: accelerates away).
   Only opacity, transform and colour animate. The two exceptions are absolutely positioned decorations that never move layout:
   the sliding selection indicator (.gati-ind) and the Progress fill. */

/* Colour changes on every control: one property list, one duration, one curve */
:is(.gati-btn, .gati-iconbtn, .gati-chip, .gati-chbtn, .gati-seg button, .gati-tab, .gati-menu-item, .gati-nav-item, .gati-item, .gati-cal-day, .gati-pager button,
    .gati-numfield button, .gati-search-clear, .gati-preset, .gati-presets-cats button, .gati-preset-fav, .gati-mod-cell, .gati-bottomnav a, .gati-bottomnav button, .gati-toc a,
    .gati-sitenav-links a, .gati-crumbs a, .gati-choice, .gati-input, .gati-select, .gati-search input, .gati-card--link, .gati-link, .gati-prose a, .gati-article a, .gati-swipe-actions button,
    .gati-check input, .gati-radio input, .gati-disclosure summary, .gati-plan) {
  transition-property: background-color, color, border-color, box-shadow, outline-color, text-decoration-color, fill, stroke;
  transition-duration: var(--dur-fast); transition-timing-function: var(--ease-standard); }

/* Things that travel use ease-move over dur-mid */
.gati-toggle { transition: background-color var(--dur-fast) var(--ease-standard), border-color var(--dur-fast) var(--ease-standard); }
.gati-toggle::after { transition: transform var(--dur-mid) var(--ease-move), background-color var(--dur-fast) var(--ease-standard); }
.gati-disclosure summary::before { transition: transform var(--dur-mid) var(--ease-move); }
.gati-progress > span { transition: width var(--dur-base) var(--ease-standard); }
.gati-progress.is-indeterminate > span { transition: none; }

/* Ticks and dots draw in */
@keyframes gati-tick { from { opacity: 0; transform: rotate(45deg) scale(0.4); } }
@keyframes gati-dot { from { opacity: 0; transform: scale(0); } }
@keyframes gati-bar { from { transform: scaleX(0); } }
.gati-check input:checked::before { animation: gati-tick var(--dur-mid) var(--ease-emphasis); }
.gati-check input:indeterminate::before { animation: gati-bar var(--dur-mid) var(--ease-emphasis); }
.gati-radio input:checked::before, .gati-menu-item[aria-checked="true"]::before { animation: gati-dot var(--dur-mid) var(--ease-emphasis); }
.gati-disclosure[open] > .gati-disclosure-body { animation: gati-pop var(--dur-mid) var(--ease-standard); }

/* Sliding selection indicator. One .gati-ind inside a Segmented control, Tabs or BottomNav, placed by script (see Motion):
   --ind-x and --ind-w come from the selected item's box, so it works for any widths and in right-to-left. */
.has-ind:not(.gati-bottomnav) { position: relative; }
.gati-ind { position: absolute; left: 0; width: var(--ind-w, 0); transform: translateX(var(--ind-x, 0)); pointer-events: none;
  transition: transform var(--dur-slow) var(--ease-move), width var(--dur-slow) var(--ease-move), opacity var(--dur-fast) var(--ease-standard); }
.gati-seg.has-ind button { position: relative; z-index: 1; }
.gati-seg.has-ind button[aria-checked="true"] { background: transparent; border-color: transparent; }
.gati-seg.has-ind .gati-ind { top: var(--hairline); bottom: var(--hairline); box-sizing: border-box; background: var(--bg-elevated); border: var(--hairline) solid var(--border-strong); border-radius: calc(var(--radius-sm) - var(--hairline)); }
.gati-tabs.has-ind .gati-tab[aria-selected="true"] { box-shadow: none; }
.gati-tabs.has-ind .gati-ind { bottom: 0; height: var(--focus-width); background: var(--text-primary); }
.gati-bottomnav.has-ind [aria-current="page"] { box-shadow: none; }
.gati-bottomnav.has-ind .gati-ind { top: 0; height: var(--focus-width); background: var(--text-primary); }

/* Arrivals: ease-standard for floating layers, ease-emphasis for bigger surfaces */
@keyframes gati-zoom { from { opacity: 0; transform: scale(0.96); } }
@keyframes gati-toast-in { from { opacity: 0; transform: translateY(var(--space-4)) scale(0.98); } }
@keyframes gati-slide-up { from { transform: translateY(100%); } }
.gati-menu, .gati-dropdown > .gati-menu { transform-origin: top; }
.gati-dropdown--end > .gati-menu { transform-origin: top right; }
.gati-scrim, .gati-sheet-scrim { animation: gati-fade var(--dur-mid) var(--ease-standard); }
.gati-modal { animation: gati-zoom var(--dur-base) var(--ease-emphasis); }
.gati-toast { animation: gati-toast-in var(--dur-base) var(--ease-emphasis); }
.gati-sheet { animation: gati-slide-up var(--dur-base) var(--ease-emphasis); }

/* Departures: add .is-leaving, wait for animationend, then remove the element (see Motion for the 6-line helper) */
@keyframes gati-fade-out { to { opacity: 0; } }
@keyframes gati-pop-out { to { opacity: 0; transform: translateY(var(--space-1)); } }
@keyframes gati-zoom-out { to { opacity: 0; transform: scale(0.98); } }
@keyframes gati-toast-out { to { opacity: 0; transform: translateY(var(--space-2)); } }
@keyframes gati-slide-down { to { transform: translateY(100%); } }
.gati-menu.is-leaving, .gati-popover.is-leaving { animation: gati-pop-out var(--dur-exit) var(--ease-exit) forwards; }
.gati-modal.is-leaving, .gati-scrim.is-leaving .gati-modal { animation: gati-zoom-out var(--dur-exit) var(--ease-exit) forwards; }
.gati-scrim.is-leaving, .gati-sheet-scrim.is-leaving { animation: gati-fade-out var(--dur-mid) var(--ease-exit) forwards; }
.gati-toast.is-leaving { animation: gati-toast-out var(--dur-exit) var(--ease-exit) forwards; }
.gati-sheet.is-leaving, .gati-sheet-scrim.is-leaving .gati-sheet { animation: gati-slide-down var(--dur-mid) var(--ease-exit) forwards; }
.gati-enter.is-leaving, .gati-item.is-leaving, .gati-swipe.is-leaving, .gati-card.is-leaving { animation: gati-fade-out var(--dur-exit) var(--ease-exit) forwards; }

/* New content: one element (.gati-enter) or a run of siblings, 40ms apart, capped at 8 steps (.gati-stagger) */
.gati-enter { animation: gati-pop var(--dur-base) var(--ease-emphasis); }
.gati-stagger > * { animation: gati-pop var(--dur-base) var(--ease-emphasis) backwards; animation-delay: calc(var(--i, 0) * var(--dur-stagger)); }
.gati-stagger > :nth-child(2) { --i: 1; } .gati-stagger > :nth-child(3) { --i: 2; } .gati-stagger > :nth-child(4) { --i: 3; } .gati-stagger > :nth-child(5) { --i: 4; }
.gati-stagger > :nth-child(6) { --i: 5; } .gati-stagger > :nth-child(7) { --i: 6; } .gati-stagger > :nth-child(8) { --i: 7; } .gati-stagger > :nth-child(n+9) { --i: 8; }

/* Scrolling to anchors and swipe snaps glide */
@media (prefers-reduced-motion: no-preference) { .gati-swipe, .gati-presets-list, .gati-tabs { scroll-behavior: smooth; } html:has(.gati-article) { scroll-behavior: smooth; } }

/* Reduced motion: nothing travels; colour may still change. Departures keep a 1ms animation so animationend still fires. */
@media (prefers-reduced-motion: reduce) {
  .gati-ind, .gati-toggle::after, .gati-disclosure summary::before, .gati-progress > span { transition: none; }
  .gati-scrim, .gati-sheet-scrim, .gati-modal, .gati-toast, .gati-sheet, .gati-menu, .gati-popover, .gati-enter, .gati-stagger > *,
  .gati-check input::before, .gati-radio input::before, .gati-menu-item::before, .gati-disclosure-body { animation: none; }
  .is-leaving, .is-leaving * { animation-duration: 1ms !important; animation-delay: 0s !important; }
}

@media (forced-colors: active) {
  .has-ind .gati-ind { forced-color-adjust: none; background: Highlight; border-color: Highlight; }
  .gati-seg.has-ind button[aria-checked="true"] { forced-color-adjust: none; color: HighlightText; }
}
