/* ==========================================================================
   Gradus — SPEC.md §§2-6. Every colour is a token; no hex may appear below.
   Flat fills only. No shadow rule exists in this file, by design: elevation is
   a value change plus a 1px border (SPEC §1, enforcement rule 1).
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ground-text);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  font-optical-sizing: auto;
}

h1,
h2,
h3,
p,
figure,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img,
svg {
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
}

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

/* SPEC §5: the ring is never removed. On a vermilion fill it turns ink-navy so
   it stays visible without introducing a second accent. */
.btn--primary:focus-visible {
  outline-color: var(--focus-ring-on-accent);
}

/* The file input is visually hidden, so its ring is drawn on the label. */
.target__input:focus-visible + .btn {
  outline: var(--focus-width) solid var(--focus-ring-on-accent);
  outline-offset: var(--focus-offset);
}

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

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: calc(-1 * var(--space-9));
  z-index: 2;
  background: var(--card);
  color: var(--card-text);
  font-family: var(--font-data);
  font-size: var(--size-data-13);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-control);
  border: var(--border-hairline) solid var(--slate-blue);
}

.skip-link:focus {
  top: var(--space-2);
}

/* --------------------------------------------------------------------------
   Type roles (SPEC §1)
   -------------------------------------------------------------------------- */
.t-h1 {
  font-family: var(--font-display);
  font-size: var(--size-h1);
  line-height: var(--leading-h1);
  font-weight: var(--weight-medium);
  color: var(--ground-text);
}

.t-h1--piece {
  font-size: var(--size-h1-piece);
  font-style: italic;
  line-height: var(--leading-piece-title);
}

.t-piece-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--size-piece-title);
  line-height: var(--leading-piece-title);
  font-weight: var(--weight-medium);
  color: var(--sheet-text);
}

.t-body-lg {
  font-size: var(--size-body-lg);
  line-height: var(--leading-body-lg);
  text-wrap: pretty;
}

.t-body {
  font-size: var(--size-body);
  line-height: var(--leading-body);
  text-wrap: pretty;
}

.t-body-sm {
  font-size: var(--size-body-sm);
  line-height: var(--leading-body-sm);
}

/* slate-blue is legal only here: >=14px, on a pale surface (SPEC §1 rule 5). */
.t-secondary {
  font-size: var(--size-body-sm);
  line-height: var(--leading-body-sm);
  color: var(--sheet-text-secondary);
}

.t-dim-title {
  font-size: var(--size-dim-title);
  line-height: var(--leading-dim-title);
  font-weight: var(--weight-bold);
}

.t-data {
  font-family: var(--font-data);
  font-size: var(--size-data);
  line-height: var(--leading-data);
}

.t-data-sm {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  letter-spacing: var(--track-data-sm);
}

/* Lowercase mono block marks sit above sections like tempo marks (SPEC §4). */
.block-mark {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  letter-spacing: var(--track-data-sm);
  color: var(--ground-text);
  display: block;
}

.block-mark--sheet {
  color: var(--sheet-text);
}

.measure-tight {
  max-width: 40em;
}

/* --------------------------------------------------------------------------
   Layout (SPEC §4)
   -------------------------------------------------------------------------- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.column {
  max-width: var(--measure);
  margin: 0 auto;
  padding-inline: var(--gutter);
  width: 100%;
}

.site-header {
  border-bottom: var(--border-on-ground);
}

.site-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-5);
  padding-block: var(--space-5) var(--space-4);
}

.wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: var(--weight-wordmark);
  letter-spacing: var(--track-wordmark);
  color: var(--ground-text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: var(--space-6);
  align-items: baseline;
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
}

.site-nav__full {
  display: flex;
  gap: var(--space-6);
  align-items: baseline;
}

/* Shown only at the mobile breakpoint, where the nav collapses to `menu`. */
.site-nav__menu {
  display: none;
}

.site-nav a {
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

/* Never coloured — vermilion is spent elsewhere (SPEC §4). */
.checks-left {
  color: var(--ground-text);
}

.checks-left--exhausted {
  font-weight: var(--weight-bold);
}

.main {
  flex: 1;
  padding-block: var(--space-7) var(--space-8);
}

.main--narrow {
  max-width: 720px;
  margin-inline: auto;
  width: 100%;
}

.site-footer {
  border-top: var(--border-on-ground);
}

.site-footer__inner {
  padding-block: var(--space-3) var(--space-6);
  font-family: var(--font-data);
  font-size: var(--size-data-xs);
  line-height: var(--leading-data-xs);
  color: var(--ground-text);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */
.sheet {
  background: var(--sheet);
  color: var(--sheet-text);
  border: var(--border-on-sheet);
  border-radius: var(--radius-surface);
  padding: var(--sheet-padding-block) var(--sheet-padding-inline) 0;
}

.strip {
  display: inline-flex;
  background: var(--card);
  border: var(--border-hairline) solid var(--slate-blue);
  border-radius: var(--radius-control);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  color: var(--card-text);
}

/* --------------------------------------------------------------------------
   Buttons and links (SPEC §3.9)
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-data);
  font-size: var(--size-button);
  line-height: 1.2;
  border-radius: var(--radius-control);
  padding: 11px 18px;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  border: var(--border-hairline) solid transparent;
  transition: border-color var(--dur-hover) var(--ease-hover),
    background-color var(--dur-hover) var(--ease-hover);
}

.btn:active {
  transform: translateY(0.5px);
}

.btn--primary {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: var(--weight-bold);
  font-size: var(--size-button-lg);
  border-color: var(--accent);
}

/* Hover adds an inset rule; the fill never tints — there is no second red. */
.btn--primary:hover {
  border-color: var(--ink-navy);
}

.btn--outline {
  border-color: var(--ink-navy);
  color: var(--ink-navy);
}

.btn--outline:hover {
  background: var(--card);
  color: var(--card-text);
  border-color: var(--card);
}

.btn--outline-dark {
  border-color: var(--pale);
  color: var(--pale);
}

.btn--outline-dark:hover {
  background: var(--ink-navy);
}

.btn--quiet {
  border-color: var(--slate-blue);
  color: var(--ink-navy);
}

.btn--quiet:hover {
  border-color: var(--ink-navy);
}

.btn[disabled],
.btn--disabled {
  background: var(--card);
  color: var(--card-text);
  border-color: var(--card);
  cursor: default;
  pointer-events: none;
  font-weight: var(--weight-regular);
}

.btn--block {
  display: flex;
  width: 100%;
  min-height: 44px;
}

.link {
  color: var(--sheet-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link--on-ground {
  color: var(--ground-text);
}

a {
  color: var(--ground-text);
  text-underline-offset: 3px;
}

.actions {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Upload target (SPEC §3.1)
   -------------------------------------------------------------------------- */
.free-paid-strip {
  margin-bottom: var(--space-3);
}

.target {
  position: relative;
  background: var(--sheet);
  color: var(--sheet-text);
  border: var(--border-on-sheet);
  border-radius: var(--radius-surface);
  padding: var(--space-8) var(--space-6) var(--space-7);
  text-align: center;
  transition: border-color var(--dur-hover) var(--ease-hover);
}

.target__tick {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 0 solid var(--ink-navy);
}

.target__tick--tl {
  top: 12px;
  left: 12px;
  border-top-width: var(--border-emphatic);
  border-left-width: var(--border-emphatic);
}

.target__tick--tr {
  top: 12px;
  right: 12px;
  border-top-width: var(--border-emphatic);
  border-right-width: var(--border-emphatic);
}

.target__tick--bl {
  bottom: 12px;
  left: 12px;
  border-bottom-width: var(--border-emphatic);
  border-left-width: var(--border-emphatic);
}

.target__tick--br {
  bottom: 12px;
  right: 12px;
  border-bottom-width: var(--border-emphatic);
  border-right-width: var(--border-emphatic);
}

.target__display {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.1;
  font-weight: var(--weight-medium);
  color: var(--sheet-text);
  margin-bottom: var(--space-3);
}

.target__or {
  font-size: var(--size-body-sm);
  color: var(--sheet-text-secondary);
  margin-bottom: var(--space-4);
}

.target__formats {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  color: var(--sheet-text);
  margin-top: var(--space-5);
}

.target:hover {
  border-color: var(--ink-navy);
}

/* drag-over: the target IS the primary action for the duration, so it takes
   the accent and the button inside gives it up (SPEC §3.1). */
.target--dragover {
  border: var(--border-emphatic) solid var(--accent);
  padding: calc(var(--space-8) - 1px) calc(var(--space-6) - 1px) calc(var(--space-7) - 1px);
}

.target--dragover .target__tick {
  border-color: var(--accent);
}

.target--dragover .btn--primary {
  background: transparent;
  color: var(--ink-navy);
  border-color: var(--ink-navy);
  font-weight: var(--weight-regular);
}

.target--disabled {
  border-color: var(--slate-blue);
}

.target--disabled .target__display,
.target--disabled .target__formats {
  color: var(--sheet-text-secondary);
  font-size: var(--size-body-sm);
}

.target--disabled .target__display {
  font-family: var(--font-display);
  font-size: 30px;
}

.target--disabled .target__tick {
  border-color: var(--slate-blue);
}

.target--error {
  border: var(--border-emphatic) solid var(--ink-navy);
  padding: calc(var(--space-8) - 1px) calc(var(--space-6) - 1px) calc(var(--space-7) - 1px);
}

.target__error-text {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data-xs);
  color: var(--sheet-text);
  margin-top: var(--space-5);
  max-width: 46em;
  margin-inline: auto;
}

.target__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* --------------------------------------------------------------------------
   Level display (SPEC §3.4)
   -------------------------------------------------------------------------- */
.level {
  display: flex;
  align-items: flex-start;
  gap: var(--level-gap);
  margin-top: var(--space-5);
}

.level__numeral {
  font-family: var(--font-display);
  font-size: var(--size-level-xl);
  line-height: var(--leading-level-xl);
  font-weight: var(--weight-regular);
  color: var(--accent);
}

.level--lg .level__numeral {
  font-size: var(--size-level-lg);
}

.level--md .level__numeral {
  font-size: var(--size-level-md);
  line-height: var(--leading-level);
}

/* Low confidence: the numeral surrenders the accent (SPEC §1 rule 2, §3.8). */
.level--range .level__numeral {
  font-size: var(--size-level-range);
  line-height: var(--leading-level);
  color: var(--ink-navy);
}

.level__column {
  padding-top: var(--space-3);
}

.level__rcm {
  font-family: var(--font-data);
  font-size: var(--size-scale-label);
  line-height: var(--leading-scale-label);
  color: var(--sheet-text);
}

.level__henle {
  font-family: var(--font-data);
  font-size: var(--size-data);
  line-height: var(--leading-data);
  color: var(--sheet-text);
  margin-top: var(--space-1);
}

.level__scale-note {
  font-size: var(--size-body-sm);
  color: var(--sheet-text-secondary);
  margin-top: var(--space-2);
}

.level--range .level__scale-note {
  color: var(--sheet-text);
  font-weight: var(--weight-bold);
}

.level--md .level__rcm {
  font-size: var(--size-scale-label-sm);
}

.level--md .level__henle {
  font-size: var(--size-data-13);
}

/* §3.4 cropped variant: 54px beside the scale line, top-right of the sheet. */
.level--crop {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-top: 0;
}

.level--crop .level__numeral {
  font-size: var(--size-level-crop);
  line-height: 1;
}

.level--crop .level__column {
  padding-top: 0;
}

.level--crop .level__rcm {
  font-size: var(--size-data);
}

/* --------------------------------------------------------------------------
   Hairpin ruler (SPEC §2)
   -------------------------------------------------------------------------- */
.hairpin {
  display: block;
  width: 100%;
  max-width: 620px;
  height: auto;
  margin: var(--space-4) 0 var(--space-1);
}

.hairpin__outline {
  stroke: var(--slate-blue);
  stroke-width: 1.5;
  fill: none;
}

.hairpin__tick {
  stroke: var(--slate-blue);
  stroke-width: 1;
}

.hairpin__tick--filled {
  stroke: var(--pale);
}

.hairpin__fill {
  fill: var(--ink-navy);
}

.hairpin__marker {
  stroke: var(--ink-navy);
  fill: none;
}

.hairpin__marker-rect {
  fill: var(--ink-navy);
  stroke: none;
}

.hairpin__hatch {
  stroke: var(--slate-blue);
  stroke-width: 1;
}

.hairpin__band-edge {
  stroke: var(--ink-navy);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.hairpin__best-guess {
  stroke: var(--ink-navy);
  stroke-width: 2.5;
}

.hairpin__numeral {
  font-family: var(--font-data);
  font-size: 10px;
  fill: var(--ink-navy);
}

.hairpin__numeral--current {
  font-size: 11px;
  font-weight: var(--weight-bold);
}

/* --------------------------------------------------------------------------
   Result sheet (SPEC §3.2)
   -------------------------------------------------------------------------- */
.sheet__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.sheet__composer {
  font-size: var(--size-body);
  color: var(--sheet-text-secondary);
  margin-top: var(--space-1);
}

.sheet__composer .link {
  font-size: var(--size-body-xs);
}

.sheet__hardest {
  font-size: var(--size-body-lg);
  line-height: var(--leading-body-lg);
  color: var(--sheet-text);
  margin: var(--space-3) 0 var(--space-1);
  max-width: 640px;
  text-wrap: pretty;
}

.sheet__actions {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin: var(--space-4) 0 var(--space-5);
}

/* The approximation line. Inside the sheet border, above a slate-blue rule,
   never collapsible, never removed (ARCHITECTURE non-negotiable 8). */
.sheet__footer {
  border-top: var(--border-on-sheet);
  margin: 0 calc(-1 * var(--sheet-padding-inline));
  padding: var(--space-3) var(--sheet-padding-inline);
  font-family: var(--font-data);
  font-size: var(--size-data-xs);
  line-height: var(--leading-data-xs);
  color: var(--sheet-text);
}

.sheet--loading .sheet__hardest {
  color: var(--sheet-text-secondary);
}

.sheet__error {
  font-size: var(--size-body-lg);
  line-height: var(--leading-body-lg);
  color: var(--sheet-text);
  margin: var(--space-5) 0 var(--space-5);
  max-width: 640px;
  text-wrap: pretty;
}

.result-meta {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  color: var(--ground-text);
  margin-bottom: var(--space-2);
}

.result-h1 {
  margin-bottom: var(--space-5);
}

/* --------------------------------------------------------------------------
   Disclosure (SPEC §3.3)
   -------------------------------------------------------------------------- */
.disclosure__button {
  font-family: var(--font-data);
  font-size: var(--size-button);
  background: transparent;
  color: var(--ink-navy);
  border: var(--border-hairline) solid var(--slate-blue);
  border-radius: var(--radius-control);
  padding: 10px 16px;
  cursor: pointer;
  transition: border-color var(--dur-hover) var(--ease-hover),
    background-color var(--dur-hover) var(--ease-hover);
}

.disclosure__button:hover {
  border-color: var(--ink-navy);
}

.disclosure__button[aria-expanded='true'] {
  background: var(--card);
  color: var(--card-text);
  border-color: var(--card);
}

.disclosure__caret::before {
  content: '\25BE';
}

.disclosure__button[aria-expanded='true'] .disclosure__caret::before {
  content: '\25B4';
}

.disclosure__region[hidden] {
  display: none;
}

.dimension {
  border-top: var(--border-on-sheet);
  padding: var(--space-5) 0 var(--space-1);
  display: flex;
  justify-content: space-between;
  gap: var(--space-5);
  align-items: baseline;
}

.dimension__title {
  font-size: var(--size-dim-title);
  line-height: var(--leading-dim-title);
  font-weight: var(--weight-bold);
  color: var(--sheet-text);
}

.dimension__prose {
  font-size: var(--size-body);
  line-height: var(--leading-body);
  color: var(--sheet-text);
  margin: var(--space-2) 0 var(--space-4);
  max-width: 560px;
  text-wrap: pretty;
}

.chip {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  background: var(--card);
  color: var(--card-text);
  border-radius: var(--radius-control);
  padding: 3px 9px;
  white-space: nowrap;
}

/* Reference pages put the same rows on the ground (SPEC §3.5). */
.dimension--on-ground {
  border-top-color: var(--rule-on-ground);
}

.dimension--on-ground .dimension__title,
.dimension--on-ground .dimension__prose {
  color: var(--ground-text);
}

.dimension--on-ground .chip {
  background: var(--pale);
  color: var(--ink-navy);
}

/* --------------------------------------------------------------------------
   Low-confidence notice (SPEC §3.8)
   -------------------------------------------------------------------------- */
.low-confidence {
  background: var(--card);
  color: var(--card-text);
  border-left: var(--border-notice-rule) solid var(--accent);
  border-radius: var(--radius-surface);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-5);
}

.low-confidence__lead {
  font-size: 22px;
  line-height: 1.3;
  font-weight: var(--weight-bold);
  color: var(--card-text);
}

.low-confidence__body {
  font-size: 16.5px;
  line-height: var(--leading-body);
  margin: var(--space-2) 0 var(--space-4);
  max-width: 660px;
  text-wrap: pretty;
}

.low-confidence__actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Pricing (SPEC §3.6)
   -------------------------------------------------------------------------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  align-items: stretch;
}

.plan {
  background: var(--sheet);
  color: var(--sheet-text);
  border: var(--border-on-sheet);
  border-radius: var(--radius-surface);
  padding: var(--space-5) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
}

.plan__label {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  letter-spacing: var(--track-data-sm);
  color: var(--sheet-text);
}

.plan__price {
  font-family: var(--font-display);
  font-size: 44px;
  line-height: 1.1;
  font-weight: var(--weight-regular);
  margin-top: var(--space-2);
  color: var(--sheet-text);
}

.plan__unit {
  font-size: var(--size-scale-label);
  color: var(--sheet-text-secondary);
}

.plan__qualifier {
  font-size: var(--size-body-xs);
  line-height: var(--leading-body-sm);
  color: var(--sheet-text-secondary);
  margin-top: var(--space-1);
}

.plan__rule {
  border-top: var(--border-on-sheet);
  margin: var(--space-4) 0 var(--space-3);
}

.plan__rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--size-body-sm);
  line-height: 1.45;
  flex: 1;
  color: var(--sheet-text);
}

.plan__cta {
  margin-top: var(--space-5);
}

.plan__current {
  font-family: var(--font-data);
  font-size: var(--size-button);
  color: var(--sheet-text);
  margin-top: var(--space-5);
  padding: 11px 0;
}

.why-block {
  border-top: var(--border-on-ground);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  max-width: 720px;
}

.why-block .block-mark {
  margin-bottom: var(--space-2);
}

/* --------------------------------------------------------------------------
   Cap notice (SPEC §3.7)
   -------------------------------------------------------------------------- */
.cap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.cap-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-surface);
  border: var(--border-hairline) solid var(--slate-blue);
}

.cap-card--free {
  background: var(--sheet);
  color: var(--sheet-text);
}

.cap-card--paid {
  background: var(--card);
  color: var(--card-text);
}

.cap-card__body {
  font-size: var(--size-body);
  line-height: var(--leading-body);
  margin: var(--space-3) 0 var(--space-4);
  flex: 1;
  text-wrap: pretty;
}

.cap-card__cta {
  align-self: flex-start;
}

.cap-inline {
  background: var(--card);
  color: var(--card-text);
  border: var(--border-hairline) solid var(--slate-blue);
  border-radius: var(--radius-surface);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-4);
}

.cap-inline__links {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin-top: var(--space-2);
  font-size: var(--size-body-sm);
}

/* --------------------------------------------------------------------------
   Processing (SPEC §3.10)
   -------------------------------------------------------------------------- */
.processing {
  text-align: center;
}

.processing__file {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  color: var(--ground-text);
}

.processing__h1 {
  margin: var(--space-4) 0 var(--space-6);
}

.processing__sheet {
  position: relative;
  background: var(--sheet);
  border: var(--border-on-sheet);
  border-radius: var(--radius-surface);
  padding: var(--space-5) var(--space-4);
  width: 560px;
  max-width: 100%;
  margin: 0 auto;
}

.processing__staff line {
  stroke: var(--slate-blue);
  stroke-width: 1;
}

/* The sweep track spans the sheet's inner width, so translateX(100%) is a
   full traversal at any breakpoint without a hard-coded pixel distance. */
.processing__sweep {
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: var(--space-4);
  right: var(--space-4);
  animation: gradus-sweep var(--dur-sweep) linear infinite;
}

.processing__barline {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2.5px;
  background: var(--ink-navy);
}

.processing__stages {
  display: inline-flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-6);
  text-align: left;
  font-family: var(--font-data);
  font-size: var(--size-data);
  line-height: var(--leading-data);
  color: var(--ground-text);
}

.processing__stage--now {
  font-weight: var(--weight-bold);
}

.processing__expectation {
  font-size: 15.5px;
  line-height: var(--leading-body-sm);
  color: var(--ground-text);
  margin: var(--space-6) auto 0;
  max-width: 440px;
  text-wrap: pretty;
}

.processing__stop {
  margin-top: var(--space-5);
  font-family: var(--font-data);
  font-size: var(--size-button);
}

/* --------------------------------------------------------------------------
   Landing (2a) and reference pages (2e)
   -------------------------------------------------------------------------- */
.lede {
  margin-top: var(--space-3);
  font-size: var(--size-body-lg);
  line-height: var(--leading-body-lg);
  color: var(--ground-text);
  max-width: 620px;
  margin-bottom: var(--space-5);
  text-wrap: pretty;
}

.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-7);
}

.related {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.related__row {
  display: flex;
  gap: var(--space-3);
  align-items: baseline;
}

.related__level {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  color: var(--ground-text);
  border: var(--border-hairline) solid var(--slate-blue);
  border-radius: var(--radius-control);
  padding: 1px 7px;
}

.edition-note {
  background: var(--card);
  border: var(--border-hairline) solid var(--slate-blue);
  border-radius: var(--radius-surface);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-7);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.crumbs {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  color: var(--ground-text);
  margin-bottom: var(--space-4);
}

.page-foot-note {
  border-top: var(--border-on-ground);
  margin-top: var(--space-6);
  padding-top: var(--space-3);
  font-family: var(--font-data);
  font-size: var(--size-data-xs);
  line-height: var(--leading-data-xs);
  color: var(--ground-text);
}

.getting-started {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-7);
  margin-top: var(--space-7);
}

.getting-started ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--size-body-sm);
}

.index-group {
  border-top: var(--border-on-ground);
  padding: var(--space-4) 0;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--space-5);
  align-items: baseline;
}

.index-group__pieces {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  font-size: var(--size-body-sm);
}

/* --------------------------------------------------------------------------
   Improvised screens — built from tokens only. See gradus/web/HANDOFF.md.
   -------------------------------------------------------------------------- */
.form-panel {
  background: var(--card);
  color: var(--card-text);
  border: var(--border-hairline) solid var(--slate-blue);
  border-radius: var(--radius-surface);
  padding: var(--space-6);
  max-width: 460px;
}

/* The "or" between the password button and Google. On the deep-indigo card
   the only legal small text is pale (SPEC §1 rule 5). */
.form-or {
  font-size: var(--size-body-xs);
  line-height: var(--leading-body-sm);
  color: var(--card-text);
  text-align: center;
  margin: var(--space-3) 0;
}

.field {
  display: block;
  margin-bottom: var(--space-4);
}

.field__label {
  display: block;
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  letter-spacing: var(--track-data-sm);
  color: var(--card-text);
  margin-bottom: var(--space-2);
}

.field__input {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: var(--leading-body);
  background: var(--pale);
  color: var(--ink-navy);
  border: var(--border-hairline) solid var(--slate-blue);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  min-height: 44px;
}

.form-error {
  border-left: var(--border-notice-rule) solid var(--accent);
  background: var(--card);
  color: var(--card-text);
  border-radius: var(--radius-surface);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--size-body-sm);
}

.definition-row {
  border-top: var(--border-on-ground);
  padding: var(--space-4) 0;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-5);
  align-items: baseline;
}

.definition-row__key {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  letter-spacing: var(--track-data-sm);
  color: var(--ground-text);
}

.library-row {
  border-top: var(--border-on-ground);
  padding: var(--space-4) 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.library-row__level {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  line-height: var(--leading-data);
  color: var(--ink-navy);
  background: var(--pale);
  border-radius: var(--radius-control);
  padding: 2px 8px;
}

.empty-state {
  border: var(--border-on-ground);
  border-radius: var(--radius-surface);
  padding: var(--space-6);
  font-size: var(--size-body-lg);
  line-height: var(--leading-body-lg);
  color: var(--ground-text);
}

.subscore-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--size-body-sm);
}

.subscore-table th,
.subscore-table td {
  border-top: var(--border-on-ground);
  padding: var(--space-2) var(--space-3);
  text-align: left;
  color: var(--ground-text);
}

.subscore-table th {
  font-family: var(--font-data);
  font-size: var(--size-data-sm);
  letter-spacing: var(--track-data-sm);
  font-weight: var(--weight-regular);
}

.subscore-table td:last-child,
.subscore-table th:last-child {
  font-family: var(--font-data);
  text-align: right;
}

.scroll-x {
  overflow-x: auto;
}

/* --------------------------------------------------------------------------
   JS-optional plumbing.

   With JavaScript off the disclosure ships EXPANDED and its control is not
   rendered visible — a toggle that cannot toggle is worse than no toggle. The
   inline one-liner in <head> stamps `js` on <html>; only then does the
   collapsed layout (and the control) appear.
   -------------------------------------------------------------------------- */
[hidden] {
  display: none !important;
}

.disclosure__button {
  display: none;
}

.js .disclosure__button {
  display: inline-flex;
  align-items: center;
}

.sheet--toggling .sheet__grade--full {
  display: none;
}

.js .sheet--toggling .sheet__grade--full {
  display: block;
}

/* --------------------------------------------------------------------------
   Page-level spacing utilities. Values are scale steps, never ad hoc.
   -------------------------------------------------------------------------- */
.section-mark {
  margin: var(--space-7) 0 var(--space-3);
}

.section-gap {
  margin-top: var(--space-7);
}

.retention-line {
  color: var(--ground-text);
  margin-top: var(--space-3);
  max-width: 46em;
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--size-body-sm);
}

.target-form__hint {
  margin-top: var(--space-3);
}

.target-form__actions {
  margin-top: var(--space-4);
}

.piece-facts {
  color: var(--ground-text);
  margin-top: var(--space-2);
}

.piece-sheet {
  margin-top: var(--space-5);
  padding-bottom: 0;
}

.before-after-lede {
  color: var(--ground-text);
  margin: 0 0 var(--space-3);
}

.edition-note__text {
  color: var(--card-text);
  max-width: 600px;
  margin: 0;
  text-wrap: pretty;
}

.why-block__text {
  color: var(--ground-text);
  margin: 0;
}

.billing-note {
  color: var(--ground-text);
  margin-top: var(--space-4);
}

.cap-h1 {
  margin-bottom: var(--space-3);
}

.cap-reason {
  color: var(--ground-text);
  max-width: 660px;
  margin-bottom: var(--space-6);
}

.cap-urgent {
  color: var(--ground-text);
  margin-top: var(--space-5);
}

.cancel-body,
.not-built-body,
.error-body {
  color: var(--ground-text);
  margin-top: var(--space-4);
  margin-bottom: var(--space-6);
}

.error-actions {
  margin-top: var(--space-5);
}

.form-alt {
  color: var(--ground-text);
  margin-top: var(--space-4);
}

.account-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-6);
}

.library-row__meta {
  color: var(--ground-text);
  margin-top: var(--space-1);
}

/* --------------------------------------------------------------------------
   Motion — exactly three animations (SPEC §6). Nothing else moves.
   -------------------------------------------------------------------------- */
@keyframes gradus-hairpin-wipe {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes gradus-sweep {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

.hairpin__fill--animated {
  animation: gradus-hairpin-wipe var(--dur-hairpin) var(--ease-hairpin) var(--delay-hairpin)
    both;
}

.disclosure__region {
  overflow: hidden;
  transition: height var(--dur-disclose-open) ease-out,
    opacity var(--dur-disclose-open) ease-out;
}

.disclosure__region--closing {
  transition-duration: var(--dur-disclose-close);
  transition-timing-function: ease-in;
}

@media (prefers-reduced-motion: reduce) {
  .hairpin__fill--animated {
    animation: none;
  }

  /* Barline parks mid-sheet; the stage list still updates (SPEC §6). */
  .processing__sweep {
    animation: none;
    transform: translateX(50%);
  }

  .disclosure__region {
    transition: none;
  }

  .btn,
  .target,
  .disclosure__button {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Breakpoints (SPEC §4)
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .site-header__inner {
    gap: var(--space-4);
  }
}

@media (max-width: 900px) {
  .pricing-grid,
  .cap-grid,
  .two-up,
  .getting-started {
    grid-template-columns: 1fr;
  }

  .index-group {
    grid-template-columns: 1fr;
  }

  .definition-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .t-h1 {
    font-size: var(--size-h1-mobile);
  }

  .t-h1--piece {
    font-size: 38px;
  }

  .t-piece-title {
    font-size: var(--size-piece-title-mobile);
  }

  .level__numeral {
    font-size: var(--size-level-sm);
  }

  .level--lg .level__numeral,
  .level--md .level__numeral {
    font-size: var(--size-level-sm);
  }

  .level--range .level__numeral {
    font-size: 72px;
  }

  .level--crop .level__numeral {
    font-size: var(--size-level-crop);
  }

  .level__rcm {
    font-size: var(--size-scale-label-sm);
  }

  .level__henle {
    font-size: var(--size-data-sm);
  }

  /* Nav collapses to `menu`; :target opens it with no JavaScript at all. */
  .site-nav {
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .site-nav__full {
    display: none;
  }

  .site-nav__full:target {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-2);
    width: 100%;
    padding-top: var(--space-3);
  }

  .site-nav__menu {
    display: inline;
  }

  /* The ruler scales with the column, so its labels are bumped in user units
     to stay legible at the reduced render scale. */
  .hairpin__numeral {
    font-size: 16px;
  }

  .hairpin__numeral--current {
    font-size: 18px;
  }

  .target {
    padding: 40px 20px;
  }

  .target--dragover,
  .target--error {
    padding: 39px 19px;
  }

  .target__display {
    font-size: 24px;
  }

  .dimension {
    flex-direction: column;
    gap: var(--space-2);
    align-items: flex-start;
  }

  .dimension__title {
    font-size: var(--size-dim-title-mobile);
  }

  .dimension__prose {
    font-size: 14.5px;
  }

  .sheet__footer {
    font-size: var(--size-data-footer-mobile);
  }

  .btn {
    width: 100%;
    min-height: 44px;
  }

  .actions,
  .sheet__actions,
  .low-confidence__actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .disclosure__button {
    width: 100%;
    min-height: 44px;
  }

  .cap-card__cta,
  .plan__cta {
    align-self: stretch;
  }
}
