:root {
  color-scheme: light;
  --paper: #f5f6f9;
  --surface: #ffffff;
  --tint: #eceef4;
  --ink: #141b33;
  --muted: #566078;
  --line: #d9dde7;
  --indigo: #2b3f8c;
  --indigo-deep: #1f2f6e;
  --cochineal: #b4233c;
  --sans: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 1160px;
  --gutter: 24px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--indigo);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 4px;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
}

.wrap {
  width: min(var(--max), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 64px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 28px;
  margin-left: auto;
}

.site-nav a {
  color: var(--muted);
  font-size: 15.5px;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.button-primary {
  background: var(--indigo);
  color: #fff;
}

.button-primary:hover {
  background: var(--indigo-deep);
}

.button-quiet {
  border-color: #b9c0d0;
  color: var(--ink);
  background: var(--surface);
}

.button-quiet:hover {
  border-color: var(--ink);
}

.button-light {
  background: #fff;
  color: var(--ink);
}

.button-light:hover {
  background: #e4e8f5;
}

.header-cta {
  min-height: 38px;
  padding: 0 14px;
  font-size: 15px;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--indigo);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Hero ---------- */

.hero {
  padding: 72px 0 88px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 56px;
  align-items: start;
}

.hero-copy {
  padding-top: 28px;
}

h1 {
  font-size: clamp(2.5rem, 4.6vw, 3.9rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: 34em;
  margin-top: 24px;
  color: var(--muted);
  font-size: 1.16rem;
}

.hero .actions {
  margin-top: 32px;
}

.fineprint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14.5px;
}

/* ---------- Demo ---------- */

.demo {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 48px -32px rgba(20, 27, 51, 0.35);
}

.demo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.demo-title {
  color: var(--muted);
  font-size: 15.5px;
}

.demo-title strong {
  color: var(--ink);
  font-weight: 600;
}

.demo-body {
  padding: 8px 20px 18px;
}

.graph {
  position: relative;
  padding-top: 8px;
}

#edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.edge {
  fill: none;
  stroke: #c3c9d8;
  stroke-width: 1.5;
}

.edge.is-lit {
  stroke: var(--ink);
  stroke-width: 2;
}

.layer + .layer {
  margin-top: 30px;
}

.layer-name {
  position: relative;
  display: table;
  margin-bottom: 6px;
  padding-right: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.layer-nodes {
  position: relative;
}

.layer-nodes {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.node {
  position: relative;
  min-height: 44px;
  padding: 6px 4px;
  border: 1.5px solid #b9c0d0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
}

.layer-message .node {
  background: var(--paper);
  font-weight: 400;
}

.layer-thread .node {
  background: #e3e8f7;
  border-color: var(--indigo);
  color: var(--indigo-deep);
}

.layer-pattern .node {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.node:hover:not(:disabled) {
  border-color: var(--ink);
}

.node.is-selected {
  outline: 2.5px solid var(--cochineal);
  outline-offset: 2px;
}

.node.is-dim {
  opacity: 0.38;
}

.node.is-gone {
  background: none;
  border-style: dashed;
  border-color: var(--line);
  color: var(--muted);
  font-weight: 400;
  cursor: default;
}

.evidence {
  min-height: 132px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.evidence blockquote {
  padding-left: 14px;
  border-left: 3px solid var(--line);
  font-size: 16.5px;
  font-weight: 500;
}

.evidence-kind {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13.5px;
}

.evidence-meta,
.evidence-empty {
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 14.5px;
}

.demo-note {
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- Sections ---------- */

.section {
  padding: 96px 0;
}

.section-tint {
  background: var(--tint);
}

.section-ink {
  background: var(--ink);
  color: #fff;
}

h2 {
  max-width: 22em;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.028em;
  text-wrap: balance;
}

h3 {
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.3;
}

.section-lede {
  max-width: 38em;
  margin-top: 16px;
  color: var(--muted);
  font-size: 1.08rem;
}

.section-ink .section-lede {
  color: #b8c0d8;
}

.plain-list li {
  position: relative;
  padding: 7px 0 7px 20px;
}

.plain-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 17px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}

/* ---------- Contrast table ---------- */

.contrast {
  margin-top: 48px;
  border-top: 2px solid var(--ink);
}

.contrast-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.contrast-row > * {
  padding: 24px 32px 26px 0;
}

.contrast-row > :last-child {
  padding-left: 32px;
  background: var(--surface);
}

.contrast-head > * {
  padding-block: 12px;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
}

.contrast-row p {
  max-width: 30em;
  margin-top: 6px;
  color: var(--muted);
}

.contrast-row > :first-child h3 {
  color: var(--cochineal);
}

/* ---------- Steps ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-top: 48px;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  padding-top: 18px;
  border-top: 3px solid var(--ink);
}

.steps li:nth-child(1) { border-color: #b4233c; }
.steps li:nth-child(2) { border-color: #b7791f; }
.steps li:nth-child(3) { border-color: #2b3f8c; }
.steps li:nth-child(4) { border-color: #4f7a4a; }

.steps h3::before {
  content: counter(step) ". ";
  color: var(--muted);
  font-weight: 500;
}

.steps p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 16px;
}

.steps code,
.contrast code,
.section-lede code {
  padding: 2px 6px;
  background: rgba(20, 27, 51, 0.07);
  border-radius: 4px;
}

.section-ink .section-lede code {
  background: rgba(255, 255, 255, 0.12);
}

.stack {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 64px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.stack div {
  position: relative;
  padding: 18px 20px;
  border-left: 1px solid var(--line);
}

.stack div:first-child {
  border-left: 0;
}

.stack div + div::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
}

.stack strong,
.stack span {
  display: block;
}

.stack strong {
  font-weight: 600;
}

.stack span {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.35;
}

/* ---------- Benchmarks ---------- */

.bench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 64px;
  align-items: start;
}

.limits {
  margin-top: 32px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.limits li {
  margin-top: 10px;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 15.5px;
}

.limits a {
  display: inline-block;
  margin-top: 16px;
  font-size: 15.5px;
  font-weight: 500;
}

.bars figcaption {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 15px;
}

.bars li {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) 56px;
  align-items: center;
  column-gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.bar-name {
  font-size: 15.5px;
  font-weight: 500;
}

.bar-track {
  display: block;
  height: 14px;
}

.bar {
  display: block;
  width: calc(var(--v) * 1%);
  height: 100%;
  background: #a9b1c6;
  border-radius: 0 4px 4px 0;
}

.bar-value {
  font-size: 15.5px;
  text-align: right;
}

.bar-ctx {
  grid-column: 2 / -1;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13.5px;
}

.is-quipu .bar {
  background: var(--indigo);
}

.is-quipu .bar-name,
.is-quipu .bar-value {
  font-weight: 700;
}

/* ---------- Cost ---------- */

.table-scroll {
  margin-top: 40px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.cost {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 16px;
}

.cost th,
.cost td {
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  text-align: left;
  font-weight: 400;
}

.cost thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
}

.cost tbody th {
  font-weight: 500;
}

.cost .is-quipu th,
.cost .is-quipu td {
  font-weight: 600;
}

.cost .is-quipu th {
  box-shadow: inset 4px 0 0 var(--indigo);
}

.cost-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 36px;
}

.cost-points p {
  color: var(--muted);
  font-size: 16px;
}

.cost-points strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 600;
}

.footnote {
  max-width: 52em;
  margin-top: 32px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Quickstart ---------- */

.quick-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 56px;
  align-items: start;
}

.quick-grid .plain-list {
  margin: 24px 0 28px;
  color: #dfe3f0;
}

.code-card {
  background: #0d1326;
  border: 1px solid #2c3554;
  border-radius: 12px;
  overflow: hidden;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid #2c3554;
  overflow-x: auto;
}

.tabs button {
  padding: 7px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #a3acc7;
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
}

.tabs button:hover {
  color: #fff;
}

.tabs [aria-selected="true"] {
  background: #263056;
  color: #fff;
}

.tabs .copy {
  margin-left: auto;
  border: 1px solid #2c3554;
}

.section-ink :focus-visible {
  outline-color: #9fb0ff;
}

.code-card pre {
  margin: 0;
  padding: 22px;
  min-height: 330px;
  overflow-x: auto;
  color: #e3e7f5;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
}

.code-card pre code {
  font-size: inherit;
}

/* ---------- Rules ---------- */

.rules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 48px;
  margin-top: 40px;
}

.rules div {
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.rules dt {
  font-weight: 600;
}

.rules dd {
  margin-top: 4px;
  color: var(--muted);
  font-size: 16px;
}

/* ---------- Status ---------- */

.status-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 48px;
}

.status-grid h3 {
  margin-bottom: 8px;
}

.status-grid .plain-list {
  color: var(--muted);
  font-size: 16px;
}

/* ---------- Closing and footer ---------- */

.closing {
  padding: 104px 0;
  text-align: center;
}

.closing h2 {
  margin-inline: auto;
}

.closing .actions {
  justify-content: center;
  margin-top: 28px;
}

.site-footer {
  padding: 36px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14.5px;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px 48px;
}

.footer-row p {
  max-width: 32em;
}

.footer-row nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.footer-row a {
  color: var(--muted);
}

.footer-row a:hover {
  color: var(--ink);
}

/* ---------- Smaller screens ---------- */

@media (max-width: 1000px) {
  .hero-grid,
  .bench-grid,
  .quick-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .hero {
    padding: 40px 0 64px;
  }

  .hero-copy {
    padding-top: 0;
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .rules {
    grid-template-columns: repeat(2, 1fr);
  }

  .status-grid {
    grid-template-columns: 1fr 1fr;
  }

  .status-grid > :first-child {
    grid-column: 1 / -1;
  }

  .stack {
    grid-template-columns: 1fr;
  }

  .stack div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .stack div:first-child {
    border-top: 0;
  }

  .stack div + div::before {
    left: 28px;
    top: -1px;
    transform: translateY(-50%) rotate(135deg);
  }
}

@media (max-width: 680px) {
  :root {
    --gutter: 16px;
  }

  body {
    font-size: 16px;
  }

  .site-nav {
    display: none;
  }

  .header-cta {
    margin-left: auto;
  }

  .section {
    padding: 64px 0;
  }

  .demo-head,
  .demo-note {
    padding-inline: 14px;
  }

  .demo-body {
    padding-inline: 14px;
  }

  .layer-nodes {
    gap: 5px;
  }

  .node {
    padding: 4px 1px;
    font-size: 11px;
  }

  .node.is-gone {
    font-size: 9.5px;
  }

  .contrast-row {
    grid-template-columns: 1fr;
  }

  .contrast-head {
    display: none;
  }

  .contrast-row > * {
    padding: 20px 0 8px;
  }

  .contrast-row > :last-child {
    padding: 16px;
    margin-bottom: 20px;
    border-radius: 8px;
  }

  .steps,
  .rules,
  .status-grid,
  .cost-points {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .bars li {
    grid-template-columns: 118px minmax(0, 1fr) 52px;
  }

  .code-card pre {
    min-height: 0;
    padding: 16px;
    font-size: 12.5px;
  }

  .closing {
    padding: 72px 0;
  }
}

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