/* Base: reset, type and the shared controls (buttons, chips, switches, segmented controls, panels).
   Used by the landing page, the brand page and the demo. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  background: var(--paper); color: var(--ink);
  font: 400 var(--fs-md)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -0.005em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
code { font-family: var(--font-mono); font-size: 0.88em; background: var(--fog); padding: 1px 6px; border-radius: 6px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 10px; }

.num { font-variant-numeric: tabular-nums; }
.muted, .dim { color: var(--ink-muted); }
.small, .fine { font-size: var(--fs-sm); }
.fine { color: var(--ink-muted); }
.lead { font-size: var(--fs-lg); }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font: 700 var(--fs-xs)/1.3 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.display { font-size: var(--fs-3xl); font-weight: 600; line-height: 1.02; letter-spacing: -0.015em; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 768px) { .wrap { padding: 0 var(--s8); } }
.icon { flex: none; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 300; padding: 8px 16px; border-radius: var(--r-pill); background: var(--ink); color: var(--paper); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---- logo */
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; }
.sym, .wm { display: block; }

/* ---- buttons: substantial lettering, thin outline, a short solid shadow that compresses on press */
.btn {
  --bg: var(--panel);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border: var(--line); border-radius: var(--r-md);
  background: var(--bg); color: var(--ink); box-shadow: var(--shadow);
  font: 500 var(--fs-md)/1 var(--font-display); letter-spacing: 0.005em; text-decoration: none; white-space: nowrap;
  transform: translateY(0); transition: transform var(--dur-press) ease-out, box-shadow var(--dur-press) ease-out, background-color 160ms;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { background: color-mix(in srgb, var(--bg) 90%, var(--ink)); }
.btn:active { transform: translateY(2px); box-shadow: var(--shadow-pressed); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }
.btn-primary { --bg: var(--mint); font-weight: 600; }
.btn-ghost { --bg: var(--panel); }
.btn-quiet { --bg: transparent; border-color: transparent; box-shadow: none; padding: 0 12px; }
.btn-quiet:hover { background: var(--fog); }
.btn-quiet:active, .btn-quiet[disabled] { box-shadow: none; }
.btn-danger { --bg: var(--apricot); }
.btn-sm { min-height: 38px; padding: 0 15px; font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.icon-btn { width: 40px; min-height: 40px; padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.text-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px; text-decoration-color: var(--ink-line); transition: text-decoration-color 160ms; }
.text-link:hover { text-decoration-color: var(--ink); }

/* ---- chips: labels with an icon, colour is never the only signal */
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 11px;
  border-radius: var(--r-pill); background: var(--fog); color: var(--ink);
  font: 700 var(--fs-xs)/1.2 var(--font-body); letter-spacing: 0.01em; text-decoration: none; white-space: nowrap; border: 0;
}
.chip .icon { width: 13px; height: 13px; }
a.chip, button.chip { border: 1.5px solid transparent; }
a.chip:hover, button.chip:hover { border-color: var(--ink); }
.chip.state-working { background: var(--state-working); }
.chip.state-slipping { background: var(--state-slipping); }
.chip.state-emerging { background: var(--state-emerging); }
.chip.state-neutral { background: var(--state-neutral); }
.chip.state-insufficient { background: var(--state-insufficient); background-image: var(--hatch); }
.chip.prov-historical { background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--ink-line); background-image: var(--hatch); }
.chip.prov-observed { background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--ink); }
.chip.preview { background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--ink-line); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }

/* ---- switch: the knob settles softly */
.switch {
  position: relative; flex: none; width: 50px; height: 30px; padding: 0; border: var(--line); border-radius: var(--r-pill);
  background: var(--fog); box-shadow: 0 2px 0 var(--ink); transition: background-color 200ms;
}
.switch i { position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--panel); border: var(--line); transition: transform 360ms var(--ease-soft); }
.switch.on, .switch[aria-checked="true"] { background: var(--mint); }
.switch.on i, .switch[aria-checked="true"] i { transform: translateX(19px); }
.switch:active i { width: 24px; }

/* ---- segmented control: the selected marker slides into place (see segmented() in demo/js/ui/dom.js) */
.seg {
  position: relative; overflow-x: auto; scrollbar-width: none; display: inline-grid; grid-auto-flow: column; grid-auto-columns: auto; align-items: stretch;
  padding: 3px; border: var(--line); border-radius: var(--r-md); background: var(--panel); box-shadow: 0 2px 0 var(--ink); max-width: 100%;
}
.seg-mark { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: calc(var(--r-md) - 4px); background: var(--mint); box-shadow: inset 0 0 0 1.5px var(--ink); transition: transform var(--dur-move) var(--ease-settle), width var(--dur-move) var(--ease-settle); }
.seg button {
  position: relative; z-index: 1; min-height: 34px; padding: 0 13px; border: 0; border-radius: calc(var(--r-md) - 4px); background: none;
  font: 700 var(--fs-sm)/1 var(--font-body); color: var(--ink-muted); white-space: nowrap; transition: color 160ms;
}
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { color: var(--ink); }
.seg button:hover { color: var(--ink); }
.seg.no-mark button[aria-pressed="true"] { background: var(--mint); box-shadow: inset 0 0 0 1.5px var(--ink); }

/* ---- panels: only for grouped controls and genuinely related information */
.panel, .card { background: var(--panel); border-radius: var(--r-xl); border: 1.5px solid var(--ink-line); padding: var(--s6); }
@media (max-width: 640px) { .panel, .card { padding: var(--s4); border-radius: var(--r-lg); } }

/* ---- motion control */
.motion-toggle { font-size: var(--fs-xs); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }
.motion-off *, .motion-off *::before, .motion-off *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
.tab-hidden * { animation-play-state: paused !important; }
