/* Hallmark · pre-emit critique: P4 H5 E4 S4 R5 V4 */
/* Hallmark · genre: modern-minimal · macrostructure: Workbench · theme: Cobalt (accent retuned to brand steel blue #005580)
 * design-system: design.md · designed-as-app · nav: app masthead (brand wordmark image + label) · footer: Ft2 inline
 * contrast: pass (40–41) · slop: pass (42–45) · honest: pass (46) · chrome: pass (47)
 * tokens: pass (48) · responsive: pass (49) · mobile: pass (34, 50–57)
 * Tokens live in /css/tokens.css — every colour and face below is a var() reference. */

/* ---------- fonts ---------- */

@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/space-grotesk-var.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/fonts/ibm-plex-sans-var.woff2') format('woff2');
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

/* ---------- base ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; overflow-x: clip; }

body {
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--color-paper);
  color: var(--color-ink-2);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.frame {
  min-height: 100dvh;
  max-width: 42rem;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  display: flex;
  flex-direction: column;
}

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-rule);
}

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

.wordmark-img { display: block; height: 1.75rem; width: auto; }

.masthead-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* ---------- progress instrument ---------- */

.instrument {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) 0 var(--space-2xs);
}

.instrument-track {
  display: flex;
  gap: var(--space-2xs);
  flex: 1;
  list-style: none;
}

.instrument-track li {
  flex: 1;
  height: 0.25rem;
  border-radius: 2px;
  background: var(--color-rule);
  transition: background var(--dur-short) var(--ease-out);
}

.instrument-track li.done { background: var(--color-ink); }
.instrument-track li.current { background: var(--color-accent); }

.instrument-readout {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  min-width: 4.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- stage & transitions ---------- */

/* Horizontal padding + negative margin give the focus ring room to render
   inside the overflow-hidden boundary instead of being clipped. */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: var(--space-md) var(--space-2xs);
  margin: 0 calc(-1 * var(--space-2xs));
}

.screen {
  width: 100%;
  transition: transform var(--dur-swap) var(--ease-out), opacity var(--dur-swap) var(--ease-out);
}

.screen.exit-left  { transform: translateX(-2.5rem); opacity: 0; }
.screen.exit-right { transform: translateX(2.5rem);  opacity: 0; }
.screen.enter-prep-right { transform: translateX(2.5rem);  opacity: 0; transition: none; }
.screen.enter-prep-left  { transform: translateX(-2.5rem); opacity: 0; transition: none; }

@media (prefers-reduced-motion: reduce) {
  .screen { transition: none; }
  .instrument-track li { transition: none; }
}

/* ---------- shared screen elements ---------- */

.headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-display);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  color: var(--color-ink);
  margin-bottom: var(--space-lg);
}

.lede { color: var(--color-muted); max-width: 34rem; }

.btn {
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  color: var(--color-accent-ink);
  background: var(--color-accent);
  border: 0;
  border-radius: var(--radius-ctl);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: background-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.btn:hover { background: var(--color-accent-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--color-ink-2);
  border: 1px solid var(--color-rule-2);
  padding: calc(0.75rem - 1px) calc(1.5rem - 1px);
}
.btn-ghost:hover { background: var(--color-paper-2); border-color: var(--color-muted); }

:is(.btn, .choice, input, textarea):focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

/* ---------- welcome ---------- */

/* The page's one graphite beat — a machine-readout strip. */
.welcome-meta {
  display: flex;
  width: fit-content;
  flex-wrap: wrap;
  margin: var(--space-lg) 0 var(--space-xl);
  background: var(--color-graphite);
  color: var(--color-graphite-ink);
  border-radius: var(--radius-ctl);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
}

.welcome-meta span {
  padding: var(--space-sm) var(--space-md);
  border-left: 1px solid var(--color-graphite-2);
}
.welcome-meta span:first-child { border-left: 0; }

/* ---------- question ---------- */

.question-text {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--text-display-s);
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  color: var(--color-ink);
  min-height: 5.2rem;
  margin-bottom: var(--space-xl);
}

.choices { display: flex; gap: var(--space-sm); margin-bottom: var(--space-lg); }

.choice {
  flex: 1;
  max-width: 11rem;
  font: inherit;
  font-weight: 600;
  color: var(--color-ink);
  background: var(--color-paper);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-ctl);
  padding: var(--space-md) 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  transition: border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}

/* Keycap chips — graphite, like the keys they name */
.choice .key {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1;
  color: var(--color-graphite-ink);
  background: var(--color-graphite);
  border-radius: var(--radius-chip);
  padding: 0.25rem 0.5rem;
  transition: background-color var(--dur-short) var(--ease-out);
}

.choice:hover { background: var(--color-paper-2); }

.choice[aria-pressed="true"] {
  border-color: var(--color-accent);
  background: var(--color-accent-wash);
}
.choice[aria-pressed="true"] .key { background: var(--color-accent); color: var(--color-accent-ink); }

.elaboration {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-swap) var(--ease-out), opacity var(--dur-swap) var(--ease-out);
  opacity: 0;
  margin-bottom: var(--space-lg);
}
.elaboration.open { grid-template-rows: 1fr; opacity: 1; }
.elaboration > div { overflow: hidden; padding: 0 var(--space-2xs) var(--space-2xs); margin: 0 calc(-1 * var(--space-2xs)); }

.elaboration label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-muted);
  margin-bottom: var(--space-2xs);
  padding-top: var(--space-2xs);
}

textarea, input[type="text"], input[type="email"], input[type="tel"] {
  width: 100%;
  font: inherit;
  color: var(--color-ink);
  background: var(--color-paper);
  border: 1px solid var(--color-rule-2);
  border-radius: var(--radius-ctl);
  padding: calc(0.75rem - 1px) 1rem;
  transition: background-color var(--dur-short) var(--ease-out);
}

:is(textarea, input[type="text"], input[type="email"], input[type="tel"]):hover {
  background: var(--color-paper-2);
}

textarea { resize: vertical; min-height: 4.25rem; }

.screen-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xs);
}

.keyboard-hint {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--color-muted);
}

@media (max-width: 520px) {
  .keyboard-hint { display: none; }
  .choices { flex-direction: column; }
  .choice { max-width: none; }
  .choice .key { display: none; }
  .masthead-label { display: none; }
  .welcome-meta { flex-direction: column; width: 100%; }
  .welcome-meta span { border-left: 0; border-top: 1px solid var(--color-graphite-2); }
  .welcome-meta span:first-child { border-top: 0; }
}

/* ---------- contact form ---------- */

.field { margin-bottom: var(--space-xs); }

.field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-ink);
  margin-bottom: var(--space-2xs);
}

/* Error line reserves its height so validation never shifts the layout. */
.field-error {
  visibility: hidden;
  min-height: 1lh;
  font-size: 0.8125rem;
  color: var(--color-danger);
  margin-top: var(--space-2xs);
}

.field.invalid input { border-color: var(--color-danger); }
.field.invalid .field-error { visibility: visible; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--space-md);
  margin-top: var(--space-lg);
}

.form-grid .field-wide { grid-column: 1 / -1; }

@media (max-width: 520px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* honeypot — hidden from humans, tab order, and screen readers */
.hp-field {
  position: absolute;
  left: -600rem;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.banner {
  display: none;
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-ctl);
  background: var(--color-danger-wash);
  color: var(--color-ink);
  font-size: 0.9375rem;
  padding: 0.75rem var(--space-md);
  margin-bottom: var(--space-lg);
}
.banner.show { display: block; }

.spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid color-mix(in oklch, var(--color-accent-ink) 35%, transparent);
  border-top-color: var(--color-accent-ink);
  border-radius: 50%;
  vertical-align: -0.1em;
  margin-right: 0.5em;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .elaboration, .btn, .choice, .choice .key,
  textarea, input[type="text"], input[type="email"], input[type="tel"] { transition: none; }
  .spinner { animation-duration: 1.4s; }
}

/* ---------- success ---------- */

.success-mark {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  border: 1px solid var(--color-accent);
  background: var(--color-accent-wash);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.success-mark svg { width: 1.5rem; height: 1.5rem; stroke: var(--color-accent); }

.score-readout {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-rule);
  display: grid;
  gap: var(--space-2xs);
  justify-items: start;
}

.score-label {
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.score-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-display);
  line-height: 1;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
}

/* ---------- colophon ---------- */

.colophon {
  border-top: 1px solid var(--color-rule);
  padding-top: var(--space-md);
  font-size: 0.8125rem;
  color: var(--color-muted);
}
