:root {
  --wall: #e6e8e3;
  --panel: #d8dcd4;
  --ink: #16201c;
  --steel: #52605a;
  --line: #b7beb5;
  --seal: #2337d6;
  --seal-ink: #ffffff;
  --ok: #2b7549;
  --hatch: rgba(22, 32, 28, 0.16);

  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Atkinson Hyperlegible", "Helvetica Neue", Arial, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, Menlo, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --measure: 62ch;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --wall: #131917;
    --panel: #1c2421;
    --ink: #e2e7e0;
    --steel: #9ba7a0;
    --line: #34403b;
    --seal: #8392ff;
    --seal-ink: #0d1330;
    --ok: #63c48d;
    --hatch: rgba(226, 231, 224, 0.13);
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--display);
  font-stretch: 125%;
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h2 { font-size: clamp(1.75rem, 3.6vw, 2.75rem); }
h3 { font-size: 1.25rem; font-stretch: 112%; font-weight: 750; letter-spacing: -0.01em; }

p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: var(--seal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--seal); outline-offset: 3px; }

code { font-family: var(--mono); font-size: 0.92em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: var(--gutter); top: -60px;
  background: var(--seal); color: var(--seal-ink); padding: 8px 14px; z-index: 10;
}
.skip:focus { top: 12px; }

/* Header */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px var(--gutter);
  max-width: 1280px; margin: 0 auto;
}

.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-family: var(--display); font-stretch: 125%; font-weight: 800; font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.wordmark svg { width: 28px; height: 20px; fill: var(--ink); stroke: var(--seal); stroke-width: 1.5; }

.top-cta { font-weight: 700; text-decoration: none; }
.top-cta:hover { text-decoration: underline; }

/* Buttons */

.btn {
  display: inline-block;
  font: inherit; font-weight: 700;
  padding: 0.8em 1.3em;
  border: 2px solid transparent;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--seal); color: var(--seal-ink); }
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:disabled { opacity: 0.6; cursor: progress; }
.btn-quiet { color: var(--ink); border-color: var(--ink); }
.btn-quiet:hover { background: var(--ink); color: var(--wall); }

/* Hero */

.hero {
  max-width: 1280px; margin: 0 auto;
  padding: clamp(32px, 7vw, 96px) var(--gutter) clamp(48px, 7vw, 96px);
}

.hero-copy h1 {
  font-size: clamp(2.4rem, 6.4vw, 5.4rem);
  max-width: 16ch;
  letter-spacing: -0.035em;
}

.lede { font-size: clamp(1.15rem, 1.6vw, 1.35rem); margin-top: 1.4em; max-width: 54ch; color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2rem; }

/* The gap figure */

.gap {
  margin: clamp(48px, 7vw, 88px) 0 0;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) clamp(56px, 9vw, 120px) minmax(0, 1.2fr);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.side { padding: 28px clamp(16px, 2.4vw, 32px) 32px; }
.side-out { background: var(--panel); }
.side-in { position: relative; }

.side-name {
  font-family: var(--display); font-stretch: 112%; font-weight: 750;
  font-size: 1.05rem; margin-bottom: 18px;
}

.side-list { list-style: none; margin: 0; padding: 0; color: var(--steel); }
.side-list li { padding: 8px 0; border-top: 1px solid var(--line); }

.void {
  position: relative;
  background-image: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 11px);
  border-left: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
}
.void-label {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  white-space: nowrap;
  background: var(--wall); padding: 4px 10px;
  font-family: var(--display); font-stretch: 112%; font-weight: 700; font-size: 0.95rem;
}

.manifest {
  background: var(--wall);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--seal);
  font-family: var(--mono);
  font-size: 0.82rem;
  max-width: 520px;
}
.manifest-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 2px solid var(--ink);
  font-weight: 600;
}
.seal {
  background: var(--seal); color: var(--seal-ink);
  padding: 2px 8px; border-radius: 2px;
}
.manifest table { width: 100%; border-collapse: collapse; }
.manifest th, .manifest td { text-align: left; padding: 7px 14px; border-bottom: 1px solid var(--line); font-weight: 400; }
.manifest td:nth-child(2) { color: var(--steel); }
.manifest .ok { color: var(--ok); font-weight: 600; text-align: right; }
.manifest-foot { margin: 0; padding: 10px 14px; font-weight: 600; max-width: none; }

/* The one orchestrated moment: the bundle crosses the gap, then each line verifies. */
.js .manifest.is-crossing { transform: translateX(var(--from, -110%)); }
.js .manifest.is-crossing .ok,
.js .manifest.is-crossing .seal,
.js .manifest.is-crossing .manifest-foot { opacity: 0; }
.js .manifest.is-landed { transition: transform 1.1s cubic-bezier(.65, 0, .25, 1); }
.js .manifest.is-landed .ok { transition: opacity .2s ease; }

@media (prefers-reduced-motion: reduce) {
  .js .manifest.is-crossing { transform: none; }
  .js .manifest.is-crossing .ok,
  .js .manifest.is-crossing .seal,
  .js .manifest.is-crossing .manifest-foot { opacity: 1; }
}

@media (max-width: 760px) {
  .gap { grid-template-columns: 1fr; grid-template-rows: auto 56px auto; }
  .void { border: 0; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
  .void-label { transform: translate(-50%, -50%); }
  .side-list { display: flex; flex-wrap: wrap; gap: 0 18px; }
  .side-list li { border: 0; padding: 2px 0; }
  .manifest { font-size: 0.74rem; }
  .manifest th, .manifest td { padding: 6px 10px; }
  .manifest td:nth-child(2) { display: none; }
}

/* Sections */

section:not(.hero) {
  max-width: 1280px; margin: 0 auto;
  padding: clamp(56px, 8vw, 112px) var(--gutter);
  border-top: 1px solid var(--line);
}

.breaks { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.breaks h2 { margin-bottom: 0.8em; }

.fails { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.fails li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.fails code { font-size: 0.95rem; text-decoration: line-through; text-decoration-color: var(--seal); text-decoration-thickness: 2px; }
.fails span { color: var(--steel); font-size: 0.95rem; }

.how h2, .inside h2, .who h2 { margin-bottom: clamp(28px, 4vw, 48px); }

.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  counter-reset: step;
  border-top: 2px solid var(--ink);
}
.steps li { counter-increment: step; padding: 22px 24px 8px 0; }
.steps li + li { padding-left: 24px; border-left: 1px solid var(--line); }
.steps li::before {
  content: counter(step);
  display: block;
  font-family: var(--display); font-stretch: 125%; font-weight: 900;
  font-size: 3rem; line-height: 1; color: var(--seal); margin-bottom: 18px;
}
.steps h3 { margin-bottom: 0.5em; }
.steps p { color: var(--steel); font-size: 1.02rem; }

.spec { margin: 0; border-top: 2px solid var(--ink); }
.spec div {
  display: grid; grid-template-columns: minmax(140px, 0.32fr) minmax(0, 1fr); gap: 24px;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.spec dt { font-family: var(--display); font-stretch: 112%; font-weight: 750; }
.spec dd { margin: 0; max-width: var(--measure); color: var(--steel); }

.who-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(24px, 3vw, 40px); }
.who article { border-top: 6px solid var(--ink); padding-top: 18px; }
.who article:first-child { border-top-color: var(--seal); }
.who h3 { margin-bottom: 0.6em; }
.who p { color: var(--steel); }

.note { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 5vw, 80px); }
.note-body { font-size: 1.2rem; }
.sign { font-weight: 700; margin-top: 1.4em; }

/* Form */

.access { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 5vw, 80px); align-items: start; }
.access h2 { margin-bottom: 0.8em; }
.access-copy p { color: var(--steel); }

.form {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 20px;
  background: var(--panel);
  border: 2px solid var(--ink);
  padding: clamp(20px, 3vw, 36px);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-wide, .form-end { grid-column: 1 / -1; }

label, legend { font-weight: 700; font-size: 1rem; }
legend { padding: 0; margin-bottom: 8px; }
.optional { font-weight: 400; color: var(--steel); }

input, textarea {
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--wall);
  border: 2px solid var(--line);
  border-radius: 3px;
  padding: 10px 12px;
  width: 100%;
}
input:focus, textarea:focus { border-color: var(--seal); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--seal) 30%, transparent); }
input::placeholder, textarea::placeholder { color: var(--steel); opacity: 0.8; }
textarea { resize: vertical; min-height: 110px; }
[aria-invalid="true"] { border-color: #c2321f; }

.choices { display: grid; gap: 4px; }
.choices label { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; padding: 6px 0; cursor: pointer; }
.choices input { width: 18px; height: 18px; margin: 3px 0 0; padding: 0; accent-color: var(--seal); flex: none; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-end { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.status { margin: 0; font-weight: 700; }
.status.is-error { color: #c2321f; }
.status.is-ok { color: var(--ok); }

@media (prefers-color-scheme: dark) {
  [aria-invalid="true"] { border-color: #ff7a66; }
  .status.is-error { color: #ff7a66; }
}

.form.is-done { display: block; }
.done h3 { margin-bottom: 0.5em; }

/* Footer */

.foot {
  max-width: 1280px; margin: 0 auto;
  display: flex; justify-content: space-between; gap: 16px;
  padding: 28px var(--gutter) 40px;
  border-top: 2px solid var(--ink);
  color: var(--steel); font-size: 0.95rem;
}
.foot p { margin: 0; }

/* Responsive */

@media (max-width: 960px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps li:nth-child(3) { padding-left: 0; border-left: 0; }
  .steps li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .who-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .breaks, .note, .access { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .steps li, .steps li + li { padding-left: 0; border-left: 0; }
  .steps li + li { border-top: 1px solid var(--line); }
  .spec div { grid-template-columns: 1fr; gap: 4px; }
  .form { grid-template-columns: 1fr; }
  .top-cta { font-size: 0.95rem; }
}
