:root {
  --ink: #20201f;
  --muted: #6e6c66;
  --paper: #f5f1e8;
  --paper-deep: #e9e2d5;
  --surface: #fffdf8;
  --line: #d8d0c2;
  --red: #c7442f;
  --red-dark: #8f2e20;
  --green: #2d6b57;
  --blue: #335f85;
  --gold: #a66b19;
  --shadow: 0 16px 45px rgb(62 50 34 / 10%);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 28px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgb(117 97 69 / 4%) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.7;
}
a { color: inherit; }
code, pre { font-family: "DM Mono", ui-monospace, monospace; }
code { font-size: .86em; }
pre {
  overflow-x: auto;
  margin: 18px 0;
  padding: 20px 22px;
  border: 1px solid #34322f;
  border-radius: 12px;
  color: #f7f2e8;
  background: #252422;
  box-shadow: inset 0 1px rgb(255 255 255 / 6%);
  font-size: .84rem;
  line-height: 1.75;
}
pre code { font-size: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  padding: 9px 14px;
  border-radius: 8px;
  color: white;
  background: var(--ink);
}
.skip-link:focus { transform: none; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 0 max(24px, calc((100vw - 1280px) / 2));
  color: #f8f4eb;
  background: #20201f;
}
.hero::before {
  content: "";
  position: absolute;
  width: 540px;
  height: 540px;
  right: -120px;
  top: -240px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 50%;
  box-shadow: 0 0 0 90px rgb(255 255 255 / 2%), 0 0 0 180px rgb(255 255 255 / 2%);
}
.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid rgb(255 255 255 / 14%);
}
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.brand, .back-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgb(255 255 255 / 50%);
  border-radius: 50%;
  color: #fff;
  font: 500 .72rem "DM Mono", monospace;
  letter-spacing: .08em;
}
.back-link { color: #d9d2c7; font-size: .9rem; }
.back-link:hover, footer a:hover { color: var(--red); }
.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr);
  gap: 72px;
  align-items: end;
  padding: 92px 0 88px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font: 500 .72rem "DM Mono", monospace;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.hero .eyebrow { color: #e27661; }
h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.9rem, 7vw, 6.6rem);
  line-height: .97;
  letter-spacing: -.065em;
}
.lede {
  max-width: 680px;
  margin: 30px 0 0;
  color: #c7c0b5;
  font-size: clamp(1.05rem, 1.7vw, 1.28rem);
}
.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.status {
  padding: 7px 11px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 999px;
  font: 500 .7rem "DM Mono", monospace;
  letter-spacing: .03em;
}
.status.current { color: #b8ddcf; background: rgb(45 107 87 / 25%); }
.status.rollout { color: #f3c98e; background: rgb(166 107 25 / 20%); }
.hero-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 5%);
  backdrop-filter: blur(8px);
}
.card-label { margin-bottom: 4px; color: #bcb5aa; font: 500 .7rem "DM Mono", monospace; text-transform: uppercase; letter-spacing: .12em; }
.hero-card code { padding: 9px 11px; border-radius: 7px; color: #e6dfd4; background: rgb(0 0 0 / 20%); font-size: .72rem; }
.hero-card a { margin-top: 8px; color: #ee8b77; font-size: .82rem; font-weight: 700; text-decoration: none; }

.page-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 920px);
  gap: 64px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 80px 32px 120px;
}
.toc {
  position: sticky;
  top: 28px;
  align-self: start;
  display: flex;
  flex-direction: column;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}
.toc p { margin: 0 0 12px; color: var(--muted); font: 500 .68rem "DM Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
.toc a { padding: 5px 0; color: var(--muted); font-size: .84rem; text-decoration: none; }
.toc a:hover { color: var(--red); }
main { min-width: 0; }
.doc-section { padding: 12px 0 90px; border-bottom: 1px solid var(--line); }
.doc-section + .doc-section { padding-top: 90px; }
.doc-section:last-child { border-bottom: 0; padding-bottom: 0; }
.section-heading { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 28px; }
.section-number { padding-top: 10px; color: var(--red); font: 500 .68rem "DM Mono", monospace; }
h2 { margin: 0; font-size: clamp(2.3rem, 5vw, 4rem); line-height: 1; letter-spacing: -.055em; }
h3 { margin: 34px 0 10px; font-size: 1.18rem; letter-spacing: -.02em; }
p { margin: 10px 0; color: #47453f; }
.intro { max-width: 760px; margin-bottom: 28px; color: #34332f; font-size: 1.12rem; }
.card-grid { display: grid; gap: 18px; }
.card-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgb(255 253 248 / 65%);
  box-shadow: 0 8px 24px rgb(70 55 35 / 4%);
}
.card h3 { margin-top: 0; }
.card pre { margin-inline: -10px; }
.callout { margin: 26px 0; padding: 20px 22px; border-left: 4px solid; border-radius: 0 12px 12px 0; background: var(--surface); box-shadow: var(--shadow); }
.callout strong { display: block; margin-bottom: 3px; font-size: .94rem; }
.callout p { margin: 0; }
.callout.danger { border-color: var(--red); }
.callout.warning { border-color: var(--gold); }
.callout.info { border-color: var(--blue); }

.flow { display: grid; grid-template-columns: repeat(9, auto); align-items: center; gap: 9px; margin: 28px 0 40px; }
.flow i { color: var(--red); font-style: normal; }
.flow-node { min-width: 120px; padding: 16px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.flow-node span { display: block; color: var(--red); font: 500 .64rem "DM Mono", monospace; }
.flow-node strong, .flow-node small { display: block; }
.flow-node strong { margin: 4px 0 2px; font-size: .88rem; }
.flow-node small { color: var(--muted); font-size: .68rem; line-height: 1.35; }
.steps { list-style: none; padding: 0; counter-reset: steps; }
.steps li { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 16px; padding: 22px 0; border-top: 1px solid var(--line); counter-increment: steps; }
.steps li::before { content: counter(steps, decimal-leading-zero); color: var(--red); font: 500 .67rem "DM Mono", monospace; padding-top: 4px; }
.steps p { margin: 3px 0 0; }

.architecture-stack { display: grid; gap: 1px; margin: 28px 0 36px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.architecture-stack > div { display: grid; grid-template-columns: 120px 1fr 1.2fr; gap: 24px; padding: 19px 22px; align-items: center; background: var(--surface); }
.architecture-stack span { color: var(--red); font: 500 .67rem "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.architecture-stack strong { font-size: .92rem; }
.architecture-stack small { color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font: 500 .67rem "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td:first-child { width: 35%; }

.comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.comparison article { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.comparison h3 { margin: 18px 0 8px; font-size: 1.4rem; }
.comparison ul { margin: 18px 0 0; padding-left: 20px; color: var(--muted); }
.pill { display: inline-block; padding: 6px 10px; border-radius: 999px; color: var(--green); background: #e1eee8; font: 500 .68rem "DM Mono", monospace; }
.pill.accent { color: var(--blue); background: #e2ebf2; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin: 24px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.metric-grid div { padding: 20px; background: var(--surface); }
.metric-grid span, .metric-grid strong { display: block; }
.metric-grid span { color: var(--muted); font: 500 .65rem "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.metric-grid strong { margin-top: 5px; font-size: .95rem; }
.compact-list { padding-left: 24px; }
.compact-list li { padding: 4px 0 4px 8px; }
.faq { border-top: 1px solid var(--line); }
.math-block {
  margin: 22px 0;
  padding: 22px 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.math-block p {
  margin: 8px 0;
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.8;
  text-align: center;
}
.math-block math {
  font-family: "STIX Two Math", "Cambria Math", "DejaVu Serif", serif;
  font-size: 1.08em;
}
.math-block code { margin-left: .35em; font-size: .82em; }
details { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; padding: 21px 4px; font-weight: 700; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; float: right; color: var(--red); font: 500 1.25rem "DM Mono", monospace; }
details[open] summary::after { content: "−"; }
details p { margin: -6px 40px 22px 4px; }

footer { display: flex; justify-content: space-between; align-items: center; padding: 42px max(32px, calc((100vw - 1180px) / 2)); color: #d6cfc4; background: var(--ink); }
footer div { display: flex; gap: 14px; align-items: baseline; }
footer span { color: #8e8981; font-size: .78rem; }
footer a { color: #ddd5c9; font-size: .85rem; text-decoration: none; }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 42px; padding: 72px 0; }
  .hero-card { max-width: 520px; }
  .page-shell { grid-template-columns: 1fr; padding-top: 42px; }
  .toc { position: static; flex-flow: row wrap; gap: 5px 18px; padding: 0 0 22px; border: 0; border-bottom: 1px solid var(--line); }
  .toc p { width: 100%; }
  .flow { grid-template-columns: 1fr; }
  .flow i { transform: rotate(90deg); justify-self: center; }
  .flow-node { text-align: center; }
}

@media (max-width: 680px) {
  body { font-size: 15px; }
  .hero { padding-inline: 20px; }
  .topbar { min-height: 64px; }
  .back-link { font-size: 0; }
  .back-link span { font-size: 1.1rem; }
  .hero-grid { padding: 54px 0 60px; }
  h1 { font-size: clamp(2.7rem, 15vw, 4.3rem); }
  .page-shell { padding: 34px 20px 80px; }
  .doc-section { padding-bottom: 64px; }
  .doc-section + .doc-section { padding-top: 64px; }
  .card-grid.two, .comparison, .metric-grid { grid-template-columns: 1fr; }
  .architecture-stack > div { grid-template-columns: 1fr; gap: 5px; }
  .architecture-stack small { margin-top: 3px; }
  .section-heading { gap: 12px; }
  pre { padding: 16px; font-size: .72rem; }
  footer { align-items: flex-start; padding: 34px 20px; }
  footer div { flex-direction: column; gap: 1px; }
}

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