/* KGKM — kgkmlab.com
   Palette and type follow the brand guideline v0.1.
   Signal orange appears once per screen: the live test count. */

:root {
  --paper: #F5F5F0;
  --field: #FFFFFF;
  --ink: #111111;
  --graphite: #55554F;
  --rule: #C9C9C2;
  --signal: #FF4D00;

  --sans: Inter, "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --rail: 220px;
  --gap: 48px;
}

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ink); color: var(--paper); }

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

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

.nb { white-space: nowrap; }

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

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  z-index: 10;
}
.skip:focus { top: 16px; }

.wrap {
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

/* ---------- header ---------- */

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-block: 28px;
}

.brand { display: block; line-height: 0; }
.brand svg { display: block; height: 22px; width: auto; }

.top nav {
  display: flex;
  gap: 28px;
  font: 400 0.875rem/1 var(--mono);
}
.top nav a { text-decoration: none; padding-block: 6px; }
.top nav a:hover { text-decoration: underline; }

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

.hero {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: var(--gap);
  padding-block: clamp(40px, 6vw, 72px) clamp(56px, 8vw, 96px);
  border-top: 1px solid var(--ink);
}

.hero-rail { position: relative; }

.spine {
  display: block;
  height: clamp(360px, 58vh, 540px);
  width: auto;
}

/* a measuring scale down the rail's right edge: a tick every 10px, a long one every 50px */
.hero-rail::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 14px;
  background:
    repeating-linear-gradient(to bottom, var(--graphite) 0 1px, transparent 1px 50px) right / 14px 100% no-repeat,
    repeating-linear-gradient(to bottom, var(--rule) 0 1px, transparent 1px 10px) right / 7px 100% no-repeat;
}

h1 {
  margin: 0 0 0.32em;
  font: 800 clamp(3.75rem, 11.5vw, 9.5rem)/0.9 var(--sans);
  letter-spacing: -0.055em;
}

.lede {
  margin: 0;
  max-width: 40ch;
  font-size: clamp(1.125rem, 1.7vw, 1.375rem);
  line-height: 1.45;
  text-wrap: pretty;
}

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

.join {
  position: relative;
  max-width: 580px;
  margin-top: 44px;
  scroll-margin-top: 24px;
}

.join label {
  display: block;
  margin-bottom: 8px;
  font: 400 0.8125rem/1.2 var(--mono);
  color: var(--graphite);
}

.join-row { display: flex; }

.join input[type="email"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  border-right: 0;
  border-radius: 0;
  background: var(--field);
  color: var(--ink);
  font: 400 1rem/1 var(--sans);
}
.join input[type="email"]::placeholder { color: #767670; }

.join button {
  flex: 0 0 auto;
  height: 54px;
  padding: 0 24px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font: 500 1rem/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}
.join button:hover { background: #2B2B29; }
.join button[disabled] { cursor: progress; background: var(--graphite); border-color: var(--graphite); }

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

.note, .msg {
  margin: 10px 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--graphite);
}
.msg:empty { display: none; }
.msg { color: var(--ink); font-weight: 500; }

.join[data-state="done"] .join-row,
.join[data-state="done"] label,
.join[data-state="done"] .note { display: none; }
.join[data-state="done"] .msg {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--ink);
  font-size: 1rem;
}

/* ---------- readout ---------- */

.readout {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  column-gap: clamp(28px, 5vw, 64px);
  margin: 56px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
}
.readout dt {
  margin-bottom: 8px;
  font-size: 0.8125rem;
  color: var(--graphite);
}
.readout dd {
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  margin: 0;
  font-size: 0.9375rem;
}
.count {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--signal);
  color: var(--ink);
  font-weight: 500;
}

/* ---------- content bands ---------- */

.band {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: var(--gap);
  padding-block: clamp(48px, 7vw, 88px);
  border-top: 1px solid var(--ink);
  scroll-margin-top: 0;
}

p.rail {
  margin: 0;
  padding-top: 0.6rem;
  font: 400 0.875rem/1.3 var(--mono);
  color: var(--graphite);
}

h2 {
  margin: 0 0 20px;
  font: 700 clamp(1.75rem, 3.2vw, 2.5rem)/1.1 var(--sans);
  letter-spacing: -0.03em;
}

.band-body > p { margin: 0; max-width: 62ch; }

/* status marker: an empty box until a result exists */
.result::before, .status::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 10px;
  border: 1px solid var(--ink);
}

/* ---------- spec table ---------- */

.spec {
  width: 100%;
  margin-top: 36px;
  border-collapse: collapse;
  text-align: left;
}
.spec thead th {
  padding: 0 20px 12px 0;
  border-bottom: 1px solid var(--ink);
  font: 400 0.8125rem/1.3 var(--mono);
  color: var(--graphite);
}
.spec tbody th, .spec tbody td {
  padding: 18px 20px 18px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.spec tbody th { width: 34%; font-weight: 500; }
.spec .result {
  width: 1%;
  padding-right: 0;
  font: 400 0.875rem/1.7 var(--mono);
  white-space: nowrap;
}

/* ---------- test log ---------- */

.test {
  max-width: 780px;
  margin-top: 36px;
  padding: clamp(20px, 3vw, 36px);
  border: 1px solid var(--ink);
}
.test-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
h3 {
  margin: 0;
  font: 700 1.375rem/1.2 var(--sans);
  letter-spacing: -0.015em;
}
.test-id {
  margin-right: 12px;
  font: 500 1.125rem/1.2 var(--mono);
  letter-spacing: 0;
}
.status {
  margin: 0;
  font: 400 0.875rem/1.3 var(--mono);
  white-space: nowrap;
}
.test p { margin: 0 0 16px; max-width: 62ch; }
.test p:last-child { margin-bottom: 0; }
.steps { margin: 4px 0 20px; padding-left: 1.5em; max-width: 62ch; }
.steps li { margin-bottom: 8px; padding-left: 6px; }
.steps li::marker { font-family: var(--mono); font-size: 0.875rem; }

/* ---------- rules ---------- */

.rules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 36px 0 0;
}
.rules dt {
  margin-bottom: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--ink);
  font-weight: 700;
}
.rules dd { margin: 0; }

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

.foot {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: var(--gap);
  padding-block: 48px 72px;
  border-top: 1px solid var(--ink);
  font-size: 0.9375rem;
  color: var(--graphite);
}
.foot-mark svg { display: block; width: 56px; height: auto; color: var(--ink); }
.foot p { margin: 0 0 8px; max-width: 62ch; }
.foot p:first-child { color: var(--ink); font-family: var(--mono); }

/* ---------- simple pages (404) ---------- */

.plain {
  padding-block: clamp(56px, 10vw, 120px);
  border-top: 1px solid var(--ink);
}
.plain h1 { font-size: clamp(2.5rem, 7vw, 5rem); }

/* ---------- narrow screens ---------- */

@media (max-width: 800px) {
  .hero, .band, .foot {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 16px;
  }
  .hero-rail { display: none; }
  p.rail { padding-top: 0; }
  .foot-mark svg { width: 44px; margin-bottom: 8px; }

  .join-row { flex-direction: column; gap: 10px; }
  .join input[type="email"] { border-right: 1px solid var(--ink); flex-basis: 54px; }
  .join button { width: 100%; }

  .readout { grid-template-columns: minmax(0, 1fr); row-gap: 14px; }
  .readout > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
  .readout dt { margin: 0; }

  .rules { grid-template-columns: minmax(0, 1fr); gap: 20px; }

  .spec thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .spec, .spec tbody, .spec tr, .spec tbody th, .spec tbody td { display: block; width: auto; }
  .spec tr { padding: 16px 0; border-bottom: 1px solid var(--rule); }
  .spec tbody tr:first-child { border-top: 1px solid var(--ink); }
  .spec tbody th, .spec tbody td { padding: 0; border: 0; }
  .spec tbody td { margin-top: 6px; }
  .spec .result { width: auto; white-space: normal; }
}

@media (max-width: 420px) {
  .top nav { gap: 18px; }
}
