:root {
  --bg: #000000;
  --panel: #110a1c;
  --border: #2a1d3f;
  --border-strong: #3d2c58;
  --text: #ece6f5;
  --text-dim: #b3a8c5;
  --text-mute: #756a8a;
  --accent: #b78bff;
  --accent-2: #d6a8ff;
  --card: rgba(5, 2, 10, 0.55);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --measure: 84ch;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { background: none; min-height: 100vh; }

/* Fixed grid background layer */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('grid-bg.svg') center / cover no-repeat;
  pointer-events: none;
  z-index: -1;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ext { margin-left: 0.3em; font-size: 0.85em; vertical-align: 0.12em; }
a:hover .ext { text-decoration: none; display: inline-block; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.05em 0.4em;
  color: var(--text);
}

/* ===== Masthead ===== */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}
.brand:hover { text-decoration: none; }
.brand-mark { display: block; }
.brand-name { font-family: var(--mono); font-size: 16px; letter-spacing: 0; }
.masthead-gh {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-mute);
}
.masthead-gh:hover { color: var(--text); text-decoration: none; }

/* ===== Document layout ===== */
.doc {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 28px 96px;
}

/* ===== Body / reading column ===== */
.body { min-width: 0; padding-top: 72px; }
.body p { color: var(--text); }

/* Abstract / title block */
.abstract { padding-bottom: 8px; margin-bottom: 24px; }
.abstract h1 {
  font-size: clamp(38px, 6vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin: 0 0 6px;
}
.abstract .lede {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-mute);
  margin: 0 0 24px;
  letter-spacing: 0.01em;
}
.abstract > p {
  font-size: 19px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0 0 22px;
}
.abstract > p a { color: var(--accent-2); }

/* Terminal block */
.term {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--card);
  padding: 16px 18px;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text-dim);
}
.term .prompt { color: var(--text-mute); user-select: none; }
.term .cmd { color: var(--text); }
.term .comment { color: var(--text-mute); }

/* ===== Section headers ===== */
.body section { padding: 60px 0 8px; scroll-margin-top: 80px; }
.body section h2 {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 26px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.sec-no {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
}
.body section h3 {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
  margin: 40px 0 16px;
}
.body section h3 + table { margin-top: 0; }
.body p + p { margin-top: 19px; }

/* ===== Lists (en-dash markers) ===== */
.body ul {
  margin: 20px 0;
  padding: 0;
  list-style: none;
  max-width: var(--measure);
}
.body ul li {
  position: relative;
  padding-left: 22px;
  margin-top: 12px;
  color: var(--text-dim);
  font-size: 15px;
}
.body ul li:first-child { margin-top: 0; }
.body ul li::before {
  content: "\2013";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
}
.body ul strong { color: var(--text); font-weight: 600; }

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 8px;
  font-size: 14.5px;
}
table th {
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  font-weight: 500;
  text-align: right;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
table th:first-child, table td:first-child { text-align: left; }
table td {
  padding: 11px 16px;
  text-align: right;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
table td:first-child { color: var(--text); white-space: nowrap; }
table tr:last-child td { border-bottom: none; }

/* Comparison tables: highlight our row */
table.cmp td { white-space: nowrap; }
table.cmp tr.ours td {
  background: rgba(183, 139, 255, 0.08);
  color: var(--text);
  border-bottom-color: var(--border-strong);
}
table.cmp tr.ours td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.cmp tr.ours strong { color: var(--accent-2); }
table.cmp sup { color: var(--text-mute); font-size: 0.7em; }

/* Libraries table */
table.libs td:nth-child(2) {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-mute);
  text-align: left;
  white-space: nowrap;
}
table.libs td:last-child { text-align: left; color: var(--text-dim); white-space: normal; }
table.libs td:first-child a { font-family: var(--mono); font-weight: 600; }
table.libs td.lib-cat {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  padding: 22px 0 8px;
  border-bottom: 1px solid var(--border-strong);
}
table.libs tr:first-child td.lib-cat { padding-top: 4px; }

/* ===== Hero banner ===== */
.hero-banner { margin: 0 0 40px; }
.hero-banner img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* ===== Figures / diagrams ===== */
.diagram { margin: 36px 0 12px; overflow-x: auto; }
.diagram img {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #070608;
  padding: 10px 12px;
}
.diagram-bare img {
  border: none;
  border-radius: 0;
  background: none;
  padding: 0;
}
.diagram figcaption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.5;
  margin-top: 12px;
}

/* ===== Notes & inline link rows ===== */
.bench-note { color: var(--text-dim); font-size: 14.5px; margin-top: 22px; }
.body .footnote { color: var(--text-mute); font-size: 13px; margin-top: 10px; }
.body .footnote sup { color: var(--text-mute); }
.more {
  font-family: var(--mono);
  font-size: 13px;
  margin-top: 24px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

/* ===== Footer ===== */
.doc-footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 13px;
}
.footer-links {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  margin-bottom: 18px;
}
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: var(--accent-2); }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .doc { padding: 0 24px 72px; }
  .body { padding-top: 44px; }
  .diagram img { min-width: 0; }
}

@media (max-width: 560px) {
  .masthead { padding: 12px 18px; }
  .doc { padding: 0 18px 56px; }
  .abstract h1 { font-size: 34px; }
  .abstract > p { font-size: 17px; }
  .abstract > p.lede { font-size: 13px; }
  .term { font-size: 12px; }
  .diagram { margin-left: -18px; margin-right: -18px; }
  .diagram img { border-radius: 0; border-left: none; border-right: none; }
}

/* ===== Benefit cards (HypAware) ===== */
.benefits {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 28px 0 8px;
}
.benefit {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  padding: 18px 20px;
}
.benefit h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.benefit p { color: var(--text-dim); font-size: 14.5px; margin: 0; line-height: 1.55; }

/* ===== CTA buttons ===== */
.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 28px 0 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn-primary {
  background: rgba(183, 139, 255, 0.12);
  border-color: var(--accent);
  color: var(--accent-2);
}
.btn-primary:hover { background: rgba(183, 139, 255, 0.2); }

/* ===== Setup steps ===== */
.steps { counter-reset: step; margin: 24px 0 8px; padding: 0; list-style: none; }
.steps > li {
  position: relative;
  padding-left: 44px;
  margin-top: 22px;
  color: var(--text-dim);
  font-size: 15px;
}
.steps > li:first-child { margin-top: 0; }
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--card);
}
.steps > li strong { color: var(--text); font-weight: 600; }
.steps .term { margin-top: 12px; }

@media (max-width: 560px) {
  .benefits { grid-template-columns: 1fr; }
}
