@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-wdth.woff2") format("woff2-variations"), url("fonts/archivo-wdth.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --paper: #edf0f2;
  --panel: #f7f8f9;
  --ink: #17202e;
  --muted: #566170;
  --rule: #c5cdd6;
  --fits: #2b6b54;
  --over: #b03a2e;
  --guess: #8d6a1f;
  --zone-browser: rgba(23, 32, 46, .045);
  --zone-machine: rgba(176, 58, 46, .07);
  --focus: #2f5fb3;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151a21;
    --panel: #1c222b;
    --ink: #e3e7eb;
    --muted: #9aa5b2;
    --rule: #364050;
    --fits: #6cc4a1;
    --over: #f08a7c;
    --guess: #dcb45e;
    --zone-browser: rgba(227, 231, 235, .04);
    --zone-machine: rgba(240, 138, 124, .08);
    --focus: #8fb3ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #151a21; --panel: #1c222b; --ink: #e3e7eb; --muted: #9aa5b2; --rule: #364050;
  --fits: #6cc4a1; --over: #f08a7c; --guess: #dcb45e;
  --zone-browser: rgba(227, 231, 235, .04); --zone-machine: rgba(240, 138, 124, .08);
  --focus: #8fb3ff; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

code { font-family: var(--mono); font-size: .86em; overflow-wrap: anywhere; }

.measure { max-width: 42rem; margin-inline: auto; padding-inline: 16px; }
.measure.wide { max-width: 62rem; }

h1, h2, h3 { line-height: 1.1; margin: 0; }

h1 {
  font-size: clamp(2.25rem, 6.2vw, 4.4rem);
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: -.02em;
  max-width: 13ch;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 1.9rem);
  font-weight: 700;
  font-stretch: 112%;
  margin-bottom: .75rem;
}

h3 { font-size: 1.1rem; font-weight: 700; font-stretch: 104%; margin-bottom: .35rem; }

p { margin: 0 0 1rem; }

/* ---------- Hero ---------- */

.hero { padding-block: clamp(3rem, 9vw, 6.5rem) clamp(1rem, 3vw, 2rem); }

.lede {
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  color: var(--muted);
  max-width: 38rem;
  margin-top: 1.5rem;
}

.cta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 2rem; }
.button {
  display: inline-block;
  font-weight: 600;
  font-size: .95rem;
  padding: .7rem 1.1rem;
  border-radius: 4px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}
.button.secondary { background: transparent; color: var(--ink); }
.button:hover { text-decoration: none; filter: brightness(1.15); }
.button.secondary:hover { background: var(--zone-browser); filter: none; }

.section-lede { color: var(--muted); font-size: 1.1rem; max-width: 40rem; }

/* ---------- Login flow: two lanes, steps alternate sides ---------- */

.flow {
  list-style: none;
  counter-reset: step;
  margin: 2rem 0 0;
  padding: 0;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 4rem;
  align-items: start;
}
.flow::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  border-left: 2px dashed var(--rule);
}
.flow li {
  counter-increment: step;
  position: relative;
  padding: 1.1rem 1.25rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  margin-bottom: 1.25rem;
}
.flow li.client { grid-column: 1; border-left: 4px solid var(--ink); }
.flow li.server { grid-column: 2; border-right: 4px solid var(--ink); }
.flow li:nth-child(1) { grid-row: 1; }
.flow li:nth-child(2) { grid-row: 2; }
.flow li:nth-child(3) { grid-row: 3; }
.flow li:nth-child(4) { grid-row: 4; }
.flow li + li { margin-top: -2.75rem; }
.flow li::after {
  content: "";
  position: absolute;
  top: 1.6rem;
  width: 2rem;
  border-top: 2px solid var(--ink);
}
.flow li.client::after { right: -2rem; }
.flow li.server::after { left: -2rem; }
.flow h3 { font-size: 1.15rem; }
.flow h3::before { content: counter(step) ". "; color: var(--muted); }
.flow p { color: var(--muted); margin: 0; font-size: .97rem; }
.flow .side { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .2rem; }

/* ---------- The memory wall ---------- */

.wall { margin: clamp(2rem, 5vw, 3rem) 0 2.5rem; }

.wall-plot {
  --pad-x: clamp(16px, 4vw, 56px);
  position: relative;
  height: 330px;
  margin-inline: var(--pad-x);
  border-bottom: 2px solid var(--ink);
  background-image:
    linear-gradient(to right, var(--rule) 1px, transparent 1px);
  background-size: 10% 100%;
  background-position: 0 0;
  background-repeat: repeat-x;
}

.zone {
  position: absolute;
  top: 0; bottom: 0; right: 0;
  left: calc(var(--from) * 100%);
}
.zone-browser { background: var(--zone-browser); }
.zone-machine {
  background:
    repeating-linear-gradient(135deg, var(--zone-machine) 0 8px, transparent 8px 16px);
}

.limit {
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--pos) * 100%);
  border-left: 2px dashed var(--ink);
}
.limit-label {
  position: absolute;
  top: 8px; left: 8px;
  font-size: .8rem;
  line-height: 1.25;
  color: var(--muted);
  white-space: nowrap;
}
.limit-label b { color: var(--ink); font-stretch: 110%; font-size: .95rem; }

.axis span {
  position: absolute;
  bottom: -1.9rem;
  left: calc(var(--pos) * 100%);
  transform: translateX(-50%);
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
}
.axis span:first-child { transform: none; }
.axis span:last-child { transform: translateX(-100%); }

.loads { list-style: none; margin: 0; padding: 0; }

.load {
  position: absolute;
  top: 132px;
  left: calc(var(--pos) * 100%);
}
.wall-plot.is-entering .load { animation: travel 1.1s cubic-bezier(.2, .7, .2, 1) backwards; animation-delay: var(--delay, 0ms); }
@keyframes travel { from { left: 0; } }
.wall-plot.is-waiting .load { left: 0; }
.load .dot {
  position: absolute;
  width: 16px; height: 16px;
  left: -8px; top: -8px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 4px var(--paper);
}
.load.est .dot { background: var(--paper); border: 2px dashed var(--c); }
.load::before {
  content: "";
  position: absolute;
  left: -1px; top: 8px;
  width: 2px;
  height: calc(var(--drop) - 8px);
  background: var(--c);
  opacity: .5;
}
.load[data-row="0"] { --drop: 26px; }
.load[data-row="1"] { --drop: 96px; }

.load-label {
  position: absolute;
  top: var(--drop);
  left: -1px;
  padding-left: 10px;
  border-left: 2px solid var(--c);
  font-size: .85rem;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--ink);
  background: var(--paper);
  padding-block: 3px;
  padding-right: 8px;
}
.load-label b { display: block; font-size: 1rem; font-stretch: 108%; }
.load-label small { display: block; color: var(--muted); font-size: .78rem; }
.load.end .load-label {
  left: auto; right: -1px;
  padding-left: 8px; padding-right: 10px;
  border-left: 0; border-right: 2px solid var(--c);
  text-align: right;
}
.load.end::before { left: -1px; }

.fits { --c: var(--fits); }
.over { --c: var(--over); }
.est { --c: var(--guess); }


.wall figcaption {
  margin-top: 3.25rem;
  font-size: .85rem;
  color: var(--muted);
  max-width: 62rem;
}

/* ---------- Content ---------- */

main { padding-block: clamp(3.5rem, 8vw, 6rem) 2rem; }
main > section { margin-bottom: clamp(3rem, 7vw, 5rem); }

.table-wrap {
  max-width: 62rem;
  margin: 0 auto clamp(3rem, 7vw, 5rem);
  padding-inline: 16px;
  overflow-x: auto;
}

.circuits { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 640px; }
.circuits th, .circuits td { text-align: left; vertical-align: top; padding: .9rem .9rem .9rem 0; border-bottom: 1px solid var(--rule); }
.circuits thead th { font-size: .82rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid var(--ink); }
.circuits tbody th { font-stretch: 108%; font-weight: 700; white-space: nowrap; }
.circuits td:nth-child(2) { color: var(--muted); max-width: 30rem; }
.circuits .num { text-align: right; white-space: nowrap; }

.status { display: inline-block; white-space: nowrap; font-weight: 600; color: var(--c); }
.status::before { content: ""; display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: var(--c); margin-right: .45em; vertical-align: .08em; }

/* ---------- Live password demo ---------- */
.live-section { margin-block: 0 4rem; }
.live-label, .step-number { display: block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; color: var(--fits); margin-bottom: .75rem; }
.live-note { padding: 1rem 1.2rem; border-left: 3px solid var(--focus); background: var(--zone-browser); font-size: .9rem; color: var(--muted); }
.live-forms, .live-inspect { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.25rem; }
.live-stage, .inspect-panel { min-width: 0; padding: clamp(1rem, 3vw, 1.6rem); background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; }
.live-stage { display: flex; flex-direction: column; align-items: stretch; border-top: 3px solid var(--fits); }
.live-stage h3, .inspect-panel h3 { font-size: 1.35rem; margin-bottom: 1rem; }
.live-stage label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .35rem; }
.live-stage input { width: 100%; min-width: 0; font: inherit; color: var(--ink); background: var(--paper); padding: .8rem; border: 1px solid var(--rule); border-radius: 4px; margin-bottom: .8rem; }
.live-stage button { margin-top: auto; }
.live-stage p { font-size: .85rem; color: var(--muted); margin-bottom: 0; }
.live-verdict { margin-top: 1rem; border: 1px solid var(--rule); border-radius: 6px; padding: 1.25rem; }
#live-status { margin: 0; font-weight: 600; }
#live-status[data-state="accepted"], #live-status[data-state="ready"] { color: var(--fits); }
#live-status[data-state="rejected"], #live-status[data-state="error"] { color: var(--over); }
#live-timing { display: block; color: var(--muted); margin-top: .3rem; }
#replay-button { margin-top: .8rem; font-size: .85rem; }
.inspect-panel .side { color: var(--muted); font-size: .8rem; }
.inspect-panel h3 { margin-top: .35rem; }
.inspect-panel p, .network-view p { font-size: .88rem; color: var(--muted); }
.inspect-panel pre, .network-view pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: .78rem; line-height: 1.6; background: var(--paper); border: 1px solid var(--rule); padding: .9rem; border-radius: 4px; }
.browser-panel { border-top: 3px solid var(--focus); }
.server-panel { border-top: 3px solid var(--fits); }
.hash-toggle { font-size: .85rem; display: flex; align-items: center; gap: .5rem; }
.hash-toggle input { accent-color: var(--focus); }
.live-values { margin-bottom: 0; }
.live-values div { margin-top: .9rem; }
.live-values dt { font-size: .8rem; color: var(--muted); }
.live-values dd { margin: .2rem 0 0; }
.live-values code { font-size: .76rem; }
.privacy-receipt { padding: .8rem; background: var(--zone-browser); border-left: 3px solid var(--fits); }
.network-view { margin-top: 1rem; padding: 1rem 1.25rem; border: 1px solid var(--rule); border-radius: 6px; }
.network-view summary { cursor: pointer; font-size: .95rem; font-weight: 600; }
.network-view pre { max-height: 26rem; overflow-y: auto; }
.live-footnote { font-size: .85rem; color: var(--muted); margin-top: 1rem; }
@media (max-width: 760px) { .live-forms, .live-inspect { grid-template-columns: 1fr; } }

/* ---------- Verifier ---------- */

.verifier {
  max-width: 46rem;
  margin: 1.5rem auto 0;
  margin-inline: max(16px, calc((100% - 46rem) / 2));
  background: var(--panel);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--fits);
  border-radius: 6px;
  padding: clamp(1rem, 3vw, 1.75rem);
}

.statement { margin: 0 0 1.5rem; display: grid; gap: .6rem; }
.statement div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; }
.statement dt { color: var(--muted); font-size: .88rem; }
.statement dd { margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }

button {
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  padding: .65rem 1rem;
  border-radius: 4px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
button.secondary { background: transparent; color: var(--ink); }
button:hover:not(:disabled) { filter: brightness(1.15); }
button.secondary:hover:not(:disabled) { background: var(--zone-browser); filter: none; }
button:disabled { opacity: .45; cursor: not-allowed; }

.guess { flex: 1 1 100%; margin-top: .8rem; }
.guess label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: .3rem; }
.guess-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.guess input {
  flex: 1 1 12rem;
  font: inherit;
  font-family: var(--mono);
  font-size: .95rem;
  padding: .6rem .75rem;
  border: 2px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
}
.guess input:focus-visible { border-color: var(--focus); outline-offset: 1px; }

.runtime { margin: 1.25rem 0 0; font-size: .88rem; color: var(--muted); }
.runtime.error { color: var(--over); }

.results { list-style: none; margin: .75rem 0 0; padding: 0; }
.results:empty { display: none; }
.results li {
  display: grid;
  grid-template-columns: 6.5rem 1fr auto;
  gap: .25rem 1rem;
  padding: .7rem 0;
  border-top: 1px solid var(--rule);
  font-size: .92rem;
  animation: arrive .35s ease-out;
}
.results .verdict { font-weight: 700; color: var(--c); }
.results .verdict::before { content: ""; display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: var(--c); margin-right: .45em; vertical-align: .08em; }
.results .detail { color: var(--ink); }
.results .detail small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.results .time { color: var(--muted); white-space: nowrap; }
.results .accepted { --c: var(--fits); }
.results .rejected { --c: var(--over); }

@keyframes arrive { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Routes and caveats ---------- */

.routes { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.routes li { padding: 1.1rem 0 1.1rem 1.1rem; border-left: 3px solid var(--rule); margin-bottom: 1rem; }
.routes p { color: var(--muted); margin-bottom: .6rem; }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; border: 1.5px solid currentColor; }
.tag.planned { color: var(--fits); }
.tag.measure-tag { color: var(--guess); }
.tag.open { color: var(--muted); }

.caveats ul { padding-left: 1.2rem; color: var(--muted); }
.caveats li { margin-bottom: .45rem; }

.lab-link { margin-top: 1.5rem; color: var(--muted); font-size: .95rem; }

footer { padding-block: 2rem 4rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .9rem; }

/* ---------- Narrow screens: the wall turns vertical ---------- */

@media (max-width: 760px) {
  .wall-plot {
    height: 640px;
    margin-inline: 16px;
    border-bottom: 0;
    border-left: 2px solid var(--ink);
    margin-left: 72px;
    background-image: linear-gradient(to bottom, var(--rule) 1px, transparent 1px);
    background-size: 100% 10%;
    background-repeat: repeat-y;
  }
  .zone { left: 0; right: 0; bottom: 0; top: calc(var(--from) * 100%); }
  .limit { left: 0; right: 0; bottom: auto; top: calc(var(--pos) * 100%); border-left: 0; border-top: 2px dashed var(--ink); }
  .limit-label { top: 4px; left: auto; right: 0; text-align: right; }
  .axis span { bottom: auto; left: -8px; top: calc(var(--pos) * 100%); transform: translate(-100%, -50%); }
  .axis span:first-child { transform: translate(-100%, 0); }
  .axis span:last-child { transform: translate(-100%, -100%); }
  .load, .load.end { left: 0; top: calc(var(--pos) * 100%); }
  .wall-plot.is-entering .load { animation-name: travel-down; }
  @keyframes travel-down { from { top: 0; } }
  .wall-plot.is-waiting .load { left: 0; top: 0; }
  .load::before { top: -1px; left: 8px; height: 2px; width: 18px; }
  .load .load-label, .load.end .load-label {
    top: -.9rem; left: 26px; right: auto;
    padding-left: 8px; padding-right: 0;
    border-right: 0; border-left: 2px solid var(--c);
    text-align: left;
  }
  .load:first-child .load-label { top: -.2rem; }
  .load.lift .load-label { top: auto; bottom: -.5rem; }
  .wall figcaption { margin-top: 1.5rem; }
  .flow { grid-template-columns: 1fr; }
  .flow::before { display: none; }
  .flow li.client, .flow li.server { grid-column: 1; grid-row: auto; margin-top: 0; border-left: 4px solid var(--ink); border-right: 1px solid var(--rule); }
  .flow li.server { margin-left: 1.5rem; border-left-style: dashed; }
  .flow li::after { display: none; }
  .statement div { grid-template-columns: 1fr; gap: .1rem; }
  .results li { grid-template-columns: 1fr auto; }
  .results .detail { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .wall-plot.is-entering .load { animation: none; }
  .results li { animation: none; }
}
