/* Palette and type tokens - swap here. */
:root {
  --surface: #F6F5F1;
  --raised: #ECEBE5;
  --text: #0A0A0A;
  --muted: #5C5B55;
  --line: #D6D5CE;
  --accent: #D4864A;       /* fills only - too light for text on this surface */
  --accent-hover: #E2A063;
  --accent-ink: #96511E;   /* amber for text, thin lines and focus rings */
  --on-accent: #0A0A0A;
  --teal: #2A7D70;

  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, Consolas, monospace;

  --max: 1100px;
  --gutter: 16px;
  --gap: clamp(64px, 10vw, 128px);
}

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

html {
  background: var(--surface);
  color-scheme: light;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: 400 1rem/1.6 var(--font-body);
  overflow-wrap: break-word;
}

h1, h2, h3, p, ol, ul, fieldset, table { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
}

.wrap {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.nw { white-space: nowrap; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 8px 12px;
  background: var(--raised);
  font: 400 0.8125rem var(--font-mono);
}
.skip:focus { top: 8px; }

/* Mono labels */
.label, .caption, .num, .tags li, .foot,
.field label, .field output, .seg legend, .seg span, .qty caption {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Hero */
.hero { padding-top: clamp(32px, 6vw, 56px); padding-bottom: var(--gap); }

.wordmark {
  font: 600 1.5rem/1 var(--font-head);
  letter-spacing: -0.01em;
  margin-bottom: clamp(72px, 14vw, 168px);
}

h1 {
  font: 600 clamp(1.75rem, 1.1rem + 3vw, 3.25rem)/1.12 var(--font-head);
  letter-spacing: -0.02em;
  max-width: 21em;
  text-wrap: balance;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  margin-top: 40px;
}

.btn {
  display: inline-block;
  padding: 13px 22px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 500;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); }

.link {
  padding-block: 12px;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.link:hover { color: var(--accent-ink); text-decoration-color: currentColor; }

/* Sections */
section { border-top: 1px solid var(--line); padding-block: 28px var(--gap); }
section.wrap { border-top: 0; position: relative; }
section.wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--line);
}

.label { color: var(--muted); margin-bottom: 40px; }
.label::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 12px; background: var(--accent); }

h3 { font: 600 1.375rem/1.25 var(--font-head); letter-spacing: -0.01em; }

.lede { max-width: 38em; font-size: 1.125rem; color: var(--text); }

/* Steps */
.steps { display: grid; gap: 40px; }
.steps li { border-top: 1px solid var(--line); padding-top: 16px; }
.steps .num { display: block; color: var(--accent-ink); margin-bottom: 20px; }
.steps p { color: var(--muted); margin-top: 10px; max-width: 30em; }

/* Demo */
.label:has(+ .caption) { margin-bottom: 12px; }
.caption { color: var(--muted); letter-spacing: 0.04em; text-transform: none; margin-bottom: 40px; max-width: 46em; }

.demo { display: grid; gap: 32px; align-items: start; }

.sheet { border: 1px solid var(--line); max-width: 520px; }
.sheet svg { display: block; width: 100%; height: auto; }

svg text { font-family: var(--font-mono); font-size: 14px; fill: var(--text); }
.frame rect { fill: none; stroke: var(--text); stroke-width: 1.25; }
.frame #f-in { stroke-width: 0.75; }
.frame #m1, .frame #m2 { stroke-width: 0.75; fill: var(--surface); }
.frame [hidden] { display: none; }
.dim line, .dim path { fill: none; stroke: var(--teal); stroke-width: 1; }
.dim text { text-anchor: middle; }
.arrowed { marker-start: url(#arrow); marker-end: url(#arrow); }
#arrow path { fill: var(--teal); }
.tb path { fill: none; stroke: var(--line); stroke-width: 1; }
.tb text { font-size: 11px; letter-spacing: 0.08em; fill: var(--muted); }
.tb .tb-name { fill: var(--accent-ink); }

.controls { display: grid; gap: 22px; margin-bottom: 36px; }

.field { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: baseline; }
.field label { color: var(--muted); }
.field output { color: var(--text); }
.field input { grid-column: 1 / -1; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: var(--muted); }
input[type="range"]::-moz-range-track { height: 1px; background: var(--muted); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 22px;
  margin-top: -11px;
  border: 0;
  border-radius: 0;
  background: var(--accent-ink);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 22px;
  border: 0;
  border-radius: 0;
  background: var(--accent-ink);
}
input[type="range"]:hover::-webkit-slider-thumb { background: var(--accent); }
input[type="range"]:hover::-moz-range-thumb { background: var(--accent); }

.seg { border: 0; display: flex; flex-wrap: wrap; }
.seg legend { color: var(--muted); margin-bottom: 10px; padding: 0; }
.seg label { flex: 1 1 0; cursor: pointer; }
.seg label + label { margin-left: -1px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block;
  padding: 11px 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}
.seg label:hover span { color: var(--text); }
.seg input:checked + span { position: relative; border-color: var(--accent-ink); color: var(--accent-ink); }
.seg input:focus-visible + span { position: relative; outline: 2px solid var(--accent-ink); outline-offset: 3px; }

.qty { width: 100%; border-collapse: collapse; }
.qty caption { text-align: left; color: var(--muted); padding-bottom: 10px; }
.qty th, .qty td { padding: 11px 0; border-top: 1px solid var(--line); vertical-align: baseline; }
.qty tr:last-child th, .qty tr:last-child td { border-bottom: 1px solid var(--line); }
.qty th { text-align: left; font-weight: 400; color: var(--muted); padding-right: 16px; }
.qty td { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.qty sup { font-size: 0.7em; line-height: 0; }

/* Built for */
.tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 36px; }
.tags li { padding: 8px 12px; border: 1px solid var(--line); color: var(--text); }

/* Contact */
.big { font: 600 clamp(1.75rem, 1.2rem + 2.4vw, 2.75rem)/1.15 var(--font-head); letter-spacing: -0.02em; margin-top: 20px; margin-bottom: 16px; }
.email {
  display: inline-block;
  margin-top: 24px;
  padding-block: 8px;
  font: 400 clamp(1.125rem, 0.9rem + 1.2vw, 1.5rem) var(--font-mono);
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}
.email:hover { color: var(--text); }

/* Footer */
.foot { border-top: 1px solid var(--line); max-width: none; padding-block: 28px 40px; color: var(--muted); }
.foot p { max-width: var(--max); margin-inline: auto; }

/* 404 */
.lost { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding-block: 48px; }
.lost .wordmark { margin-bottom: 48px; }
.lost .link { display: inline-block; margin-top: 24px; }

@media (min-width: 720px) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: 32px; }
}

@media (min-width: 900px) {
  .demo { grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); }
}

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