/* In Good Order shared tokens and controls. Every page links this first. See DESIGN.md. */
:root {
  --studio: #eaeaea;
  --panel: #f1f1f0;
  --graphite: #1e2124;
  --graphite-dim: rgba(30, 33, 36, 0.64);
  --hairline: rgba(30, 33, 36, 0.16);
  --track: rgba(30, 33, 36, 0.35);
  --alert: #8a3b2e;

  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --type-display: clamp(32px, 4.9vw, 72px);
  --type-section: clamp(30px, 3.6vw, 52px);
  --type-block: clamp(24px, 2.4vw, 32px);
  --type-body: 16px;

  --pad-x: clamp(24px, 4.4vw, 64px);
  --content-max: 1200px;
  --space-section: clamp(96px, 12vw, 176px);
  --nav-h: 92px;
  --ease: cubic-bezier(.3, .6, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--studio); }
body {
  min-height: 100vh; background: var(--studio); color: var(--graphite);
  font-family: var(--sans); -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 1.5px solid var(--graphite); outline-offset: 6px; border-radius: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; z-index: 20; left: var(--pad-x); top: -100px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--hairline); color: var(--graphite); font-size: 14px; }
.skip-link:focus { top: 12px; }

/* Steel ball shared by every control. */
.ball {
  position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #fff 0 12%, #c9ccd2 34%, #6b7078 78%, #3a3e44 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Secondary control: small mono label; the track draws in and the ball travels on hover/focus. */
.track-link {
  position: relative; min-height: 44px; min-width: 44px; padding: 0 2px;
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--graphite-dim); text-decoration: none; transition: color .3s;
}
.track-link::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 9px; height: 1px;
  background: var(--track); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease);
}
.track-link .ball { width: 6px; height: 6px; bottom: 6.5px; left: -2px; opacity: 0; transition: left .8s var(--ease), opacity .3s; }
.track-link:hover, .track-link:focus-visible, .track-link[aria-current="true"] { color: var(--graphite); }
.track-link:hover::before, .track-link:focus-visible::before, .track-link[aria-current="true"]::before { transform: scaleX(1); }
.track-link:hover .ball, .track-link:focus-visible .ball { opacity: 1; left: calc(100% - 4px); }

/* Primary control: label on a track; the ball rolls its length. */
.race {
  position: relative; display: inline-flex; align-items: center; min-height: 44px;
  padding: 6px 2px 16px;
  font-size: 15px; font-weight: 500; letter-spacing: 0.01em; color: var(--graphite); text-decoration: none;
}
.race::before { content: ""; position: absolute; left: 0; right: 0; bottom: 9px; height: 1px; background: var(--track); transition: background .3s; }
.race .ball { bottom: 5px; left: -4px; transition: left 1.1s var(--ease), transform 1.1s var(--ease); }
.race:hover .ball, .race:focus-visible .ball, .race:active .ball { left: calc(100% - 5px); transform: rotate(540deg); }
.race:hover::before, .race:focus-visible::before { background: var(--graphite); }
.race:disabled { color: var(--graphite-dim); cursor: default; }
.race:disabled .ball { left: -4px; transform: none; }
/* Keyboard focus stays on the track instead of boxing the control: a heavier rule and a ringed ball. */
.race:focus-visible, .track-link:focus-visible { outline: none; }
.race:focus-visible::before { height: 2px; bottom: 8.5px; }
.race:focus-visible .ball, .track-link:focus-visible .ball { box-shadow: 0 0 0 2.5px var(--studio), 0 0 0 3.5px var(--graphite); }
.track-link:focus-visible::before { height: 2px; background: var(--graphite); }

/* Field: label, borderless input, and a track that thickens with the ball at its start on focus. */
.field { position: relative; }
.field label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--graphite-dim); }
.field .optional { text-transform: none; letter-spacing: 0; }
.field input, .field textarea, .field select {
  display: block; width: 100%; min-height: 44px; padding: 8px 0 10px;
  border: 0; background: transparent; color: var(--graphite);
  font-family: var(--serif); font-size: 20px; line-height: 1.35; resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; }
/* Optional choice: the native list, drawn like the other fields, with a small drawn chevron. */
.field select { appearance: none; -webkit-appearance: none; padding-right: 28px; border-radius: 0; cursor: pointer; }
.field select:disabled { color: var(--graphite-dim); cursor: default; }
.field-choice::after {
  content: ""; position: absolute; right: 6px; top: 34px; width: 7px; height: 7px; pointer-events: none;
  border-right: 1.5px solid var(--graphite-dim); border-bottom: 1.5px solid var(--graphite-dim); transform: rotate(45deg);
}
.field-help { display: block; padding-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--graphite-dim); }
.field-track { position: relative; display: block; height: 1px; background: var(--track); transition: background .3s, height .3s; }
.field-track .ball { left: -12px; top: -4px; opacity: 0; transition: left .6s var(--ease), opacity .3s; }
.field:focus-within .field-track { background: var(--graphite); height: 2px; }
.field:focus-within .field-track .ball { left: 0; top: -3.5px; opacity: 1; }
.field.invalid .field-track { background: var(--alert); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
  .race:hover .ball, .race:focus-visible .ball, .race:active .ball { left: -4px; transform: none; }
  .track-link:hover .ball, .track-link:focus-visible .ball { left: -2px; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
