:root {
  color-scheme: light dark;
  --paper: #eef1f4;
  --ink: #1b2733;
  --line: #9db0bc;
  --line-faint: #c6d2da;
  --red: #c4472b;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --body: Seravek, "Gill Sans Nova", Ubuntu, Calibri, "DejaVu Sans", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #141b22;
    --ink: #dfe6eb;
    --line: #465866;
    --line-faint: #2c3a46;
    --red: #e05a3a;
  }
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

main, .topbar, footer {
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

a { color: inherit; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  border: 1px solid var(--line-faint);
  padding: 0 0.3em;
}

/* ---- drafting-sheet chrome ---------------------------------------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--mono);
  letter-spacing: 0.35em;
  font-weight: 600;
}

.topbar nav { display: flex; gap: 1.5rem; }
.topbar a { text-decoration: none; font-size: 0.95rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--red);
  margin-bottom: 0.9rem;
}

section {
  padding-block: 4.5rem 1rem;
  border-bottom: 1px solid var(--line-faint);
}

h1 {
  font-family: var(--mono);
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

h2 {
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 2rem;
  max-width: 32ch;
}

h3 {
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

/* ---- hero ----------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 3rem;
  align-items: center;
  padding-block: 4rem 3rem;
}

.tagline {
  font-family: var(--mono);
  margin-top: 1rem;
  color: var(--red);
}

.lede { margin-top: 1.2rem; max-width: 46ch; }

.hero-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.button {
  display: inline-block;
  background: var(--red);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  padding: 0.8em 1.6em;
  border: none;
}

.button:hover { color: var(--paper); filter: brightness(1.1); }

.quiet-link { font-size: 0.95rem; }

/* ---- the plat (signature) ------------------------------------------ */

.plat svg { width: 100%; height: auto; }

.plat .web line,
.plat .web polygon {
  stroke: var(--line);
  stroke-width: 1;
}

.plat .nodes circle { fill: var(--red); }

.plat .labels text,
.plat .dims text {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--red);
}

.plat .dim-line {
  stroke: var(--red);
  stroke-width: 0.5;
  stroke-dasharray: 4 3;
}

.plat figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--line);
  text-align: right;
  margin-top: 0.4rem;
}

@media (prefers-reduced-motion: no-preference) {
  .plat .web line,
  .plat .web polygon {
    stroke-dasharray: 1400;
    stroke-dashoffset: 1400;
    animation: draw 2.4s ease-out forwards;
  }
  .plat .labels, .plat .nodes, .plat .dims {
    opacity: 0;
    animation: appear 0.8s ease-out 1.8s forwards;
  }
}

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }

/* ---- legend (what you get) ------------------------------------------ */

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 3rem;
}

.legend > div {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 1.1rem;
  border-top: 1px solid var(--line-faint);
}

.legend dt {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding-top: 0.15rem;
}

.legend dd { font-size: 0.98rem; }

/* ---- steps ----------------------------------------------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
  counter-reset: step;
  list-style: none;
  padding: 0;
}

.steps li { counter-increment: step; }

.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono);
  color: var(--red);
  font-size: 0.8rem;
  display: block;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem;
  margin-bottom: 0.9rem;
}

.steps p { font-size: 0.98rem; }

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

#apply {
  max-width: 30rem;
  display: grid;
  gap: 1.4rem;
}

#apply label {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  display: grid;
  gap: 0.4rem;
}

#apply .opt { color: var(--line); }

#apply input,
#apply textarea {
  font-family: var(--body);
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 0.4em 0;
}

#apply input:focus,
#apply textarea:focus {
  outline: none;
  border-bottom-color: var(--red);
}

#apply button {
  justify-self: start;
  cursor: pointer;
  background: var(--red);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  padding: 0.8em 1.6em;
  border: none;
}

#apply button:disabled { opacity: 0.55; cursor: default; }

#apply-status { font-family: var(--mono); font-size: 0.85rem; min-height: 1.4em; }

/* ---- integration guide ------------------------------------------------- */

.guide { max-width: 54rem; }

/* The TOC's own rule closes the intro; the section border would double it. */
.guide-intro { padding-block: 3.5rem 0; border-bottom: none; }

.guide .lede { max-width: 60ch; }

.guide-title {
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.06em;
  margin-bottom: 1.2rem;
}

.guide h2 { margin-bottom: 1.4rem; }

.guide h3.sub {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin-top: 2.4rem;
  margin-bottom: 0.8rem;
}

.guide p, .guide ul, .guide table, .guide dl { margin-bottom: 1.1rem; }

.toc {
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding-block: 1.2rem;
}

.toc ol {
  counter-reset: toc;
  list-style: none;
  padding: 0;
  columns: 2;
  column-gap: 3rem;
}

.toc li { counter-increment: toc; break-inside: avoid; }

.toc li::before {
  content: counter(toc, decimal-leading-zero) " ";
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--red);
}

.toc a { text-decoration: none; font-size: 0.95rem; }

[aria-current="page"] { color: var(--red); }

.guide pre {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  border: 1px solid var(--line-faint);
  border-left: 2px solid var(--red);
  padding: 1rem 1.1rem;
  margin-block: 1.2rem;
  overflow-x: auto;
}

.guide pre code { border: none; padding: 0; font-size: inherit; }

.plain-list { padding-left: 1.1rem; }
.plain-list li { margin-bottom: 0.7rem; }

.guide-legend { grid-template-columns: 1fr; }

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.spec-table th {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  color: var(--red);
  padding-bottom: 0.5rem;
}

.spec-table td {
  border-top: 1px solid var(--line-faint);
  padding-block: 0.7rem;
  vertical-align: top;
}

.spec-table td:first-child {
  width: 9rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.note {
  border-left: 2px solid var(--line);
  padding: 0.7rem 0 0.7rem 1.1rem;
  font-size: 0.98rem;
}

.checklist { list-style: none; padding: 0; }

.checklist li {
  position: relative;
  padding-left: 2rem;
  padding-block: 0.55rem;
  border-top: 1px solid var(--line-faint);
  font-size: 0.98rem;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.95rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 1px solid var(--red);
}

.closing { margin-top: 2rem; font-size: 0.98rem; }

/* ---- footer ----------------------------------------------------------- */

footer {
  display: flex;
  justify-content: space-between;
  padding-block: 2rem 3rem;
  font-size: 0.9rem;
}

/* ---- small screens ----------------------------------------------------- */

@media (max-width: 52rem) {
  .hero { grid-template-columns: 1fr; }
  .legend { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; gap: 1.8rem; }
  .legend > div { grid-template-columns: 1fr; gap: 0.2rem; }
  .topbar nav { gap: 1rem; }
  .toc ol { columns: 1; }
  .spec-table td:first-child { width: 7rem; }
}
