:root {
  color-scheme: dark;
  --base: #0a1420;
  --section: #0d1926;
  --panel: #101f2d;
  --ink: #f2f6fa;
  --muted: #b2c1cf;
  --accent: #8ae5ca;
  --line: #2b4051;
  --amber: #f1ce8e;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font: 1rem/1.6 system-ui, "Segoe UI", sans-serif;
}
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
section[id] { scroll-margin-top: 1.5rem; }

.wrap { width: min(100% - 3rem, 78rem); margin-inline: auto; }
.skip {
  position: fixed;
  z-index: 2;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-200%);
  background: var(--accent);
  color: var(--base);
  padding: 0.6rem 1rem;
  font-weight: 700;
}
.skip:focus { transform: none; outline-color: var(--ink); }

.site-header, .site-footer { border-block-end: 1px solid var(--line); }
.header-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.header-inner { min-height: 5rem; padding-block: 0.75rem; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  width: fit-content;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 760;
  letter-spacing: -0.05em;
  text-decoration: none;
}
.nav { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 1.65rem; }
.nav a { color: var(--muted); font-size: 0.93rem; font-weight: 600; text-decoration: none; padding-block: 0.45rem; }
.nav a:hover { text-decoration: underline; text-underline-offset: 0.25em; color: var(--ink); }
.nav a.nav-status { color: var(--accent); }

.hero {
  padding-block: clamp(3.5rem, 8vw, 7rem);
  background-image:
    linear-gradient(90deg, #0a1420 25%, #0a142000 100%),
    linear-gradient(#8ae5ca0c 1px, transparent 1px),
    linear-gradient(90deg, #8ae5ca0c 1px, transparent 1px);
  background-size: 100% 100%, 38px 38px, 38px 38px;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5.5rem);
}
.eyebrow, .mono {
  font: 600 0.875rem/1.5 var(--mono);
  letter-spacing: 0.075em;
  text-transform: uppercase;
}
.eyebrow { color: var(--accent); margin-bottom: 1rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.33rem 0.7rem;
  background: #132a31;
  border: 1px solid #326258;
  border-radius: 0.35rem;
  margin-bottom: 1.35rem;
}
.dot { width: 0.46rem; height: 0.46rem; border-radius: 50%; background: currentColor; }
h1 { font-size: clamp(2.65rem, 4.9vw, 4.75rem); font-weight: 730; letter-spacing: -0.065em; line-height: 1.04; }
h1 em { color: var(--accent); font-style: normal; }
h2 { font-size: clamp(2rem, 3.4vw, 3.2rem); font-weight: 720; letter-spacing: -0.055em; line-height: 1.1; }
h3 { font-size: 1.1rem; line-height: 1.3; }
.lead { max-width: 54ch; color: var(--muted); font-size: clamp(1.05rem, 1.65vw, 1.2rem); margin-block: 1.5rem 1.8rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.6rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 0.38rem;
}
.primary { background: var(--accent); color: #081914; }
.primary:hover { background: #b4f8e5; }
.secondary { border: 1px solid #587184; background: var(--base); }
.secondary:hover { border-color: var(--accent); }

.ledger, .architecture-diagram {
  background: var(--panel);
  border: 1px solid #3a5468;
  border-radius: 0.65rem;
  overflow: hidden;
}
.ledger { box-shadow: 0 1.1rem 3rem #040a1190; }
.ledger figcaption, .architecture-diagram figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.3rem 1rem;
  padding: 0.8rem 1.15rem;
  background: #132535;
  border-bottom: 1px solid var(--line);
  font-weight: 680;
}
figcaption .mono { color: var(--muted); font-size: 0.75rem; }
.ledger-body { padding: 1.2rem 1.15rem 1.1rem; }
.ledger-heading { display: grid; gap: 0.25rem; margin-bottom: 1.25rem; }
.ledger-heading .mono, .boundary .mono, .counterparty .mono { color: var(--accent); }
.ledger-heading strong { font-size: 1.4rem; letter-spacing: -0.035em; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { color: var(--muted); font-size: 0.875rem; }
th, td { border-bottom: 1px solid var(--line); padding: 0.65rem 0; vertical-align: middle; }
th:first-child { padding-right: 0.6rem; }
tbody th { font-size: 0.95rem; font-weight: 570; }
.verdict, .state {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 660;
  white-space: nowrap;
}
.ok, .done { background: #183b35; color: var(--accent); }
.pending { background: #3d3120; color: var(--amber); }
.planned { background: #1d344c; color: #baddff; }
.ledger-foot { display: flex; gap: 0.65rem; align-items: baseline; margin-top: 1rem; color: var(--muted); font-size: 0.9rem; }
.ledger-mark { width: 0.7rem; height: 0.5rem; border: solid var(--accent); border-width: 0 0 2px 2px; transform: translateY(-0.13rem) rotate(-45deg); flex: none; }

.section { padding-block: clamp(3.5rem, 6.5vw, 6rem); border-top: 1px solid var(--line); }
.problem, .architecture, .technology { background: var(--section); }
.split { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); align-items: start; gap: clamp(1.4rem, 7vw, 7rem); }
.copy p, .section-head > p:last-child, .muted, .flow p, .principles p, dd { color: var(--muted); }
.copy p { font-size: 1.08rem; }
.copy p + p { margin-top: 1rem; }
.intro, .section-head > p:last-child { margin-top: 1rem; }
.section-head { max-width: 48rem; margin-bottom: 2rem; }

.flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  counter-reset: stage;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--section);
}
.flow li {
  counter-increment: stage;
  min-width: 0;
  padding: 1.35rem 1.45rem 1.5rem;
  border-inline-end: 1px solid var(--line);
}
.flow li:nth-child(3n) { border-inline-end: 0; }
.flow li:nth-child(n+4) { border-top: 1px solid var(--line); }
.flow li::before {
  display: block;
  content: counter(stage, decimal-leading-zero) " /" / "";
  color: var(--accent);
  font: 600 0.875rem/1.4 var(--mono);
  margin-bottom: 0.75rem;
}
.flow p { margin-top: 0.55rem; }
.glossary > div, .status-list > div { border-top: 1px solid var(--line); padding-block: 0.9rem; }
.glossary > div { display: grid; grid-template-columns: minmax(10rem, 1fr) minmax(0, 2.2fr); gap: 0.25rem 1rem; }
.glossary dt, .status-list dt { font-weight: 680; }
.glossary > div:last-child, .status-list > div:last-child { border-bottom: 1px solid var(--line); }

.boundary-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 3fr); align-items: center; gap: 1rem; padding: 1.35rem; }
.counterparty, .boundary { padding: 1rem; border: 1px solid #405a70; border-radius: 0.35rem; }
.boundary { border-style: dashed; border-color: #639b94; }
.counterparty strong { display: block; line-height: 1.3; margin-block: 0.35rem; }
.counterparty p, .entities span { color: var(--muted); font-size: 0.9rem; }
.exchange { display: grid; justify-items: center; gap: 0.35rem; color: var(--accent); font: 600 0.875rem/1.5 var(--mono); }
.exchange span { padding-inline: 0.2rem; border-bottom: 1px solid #639b94; }
.exchange span:first-child::before { content: "← " / ""; }
.exchange span:last-child::after { content: " →" / ""; }
.entities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; margin: 0.85rem 0 0; padding: 0; list-style: none; }
.entities li { padding: 0.65rem; background: #142736; border: 1px solid var(--line); border-radius: 0.3rem; }
.entities strong, .entities span { display: block; line-height: 1.45; }
.entities span { margin-top: 0.25rem; }
.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem 2.5rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.principles p { margin-top: 0.35rem; }

.status-list dt { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.4rem 0.7rem; }
.status-list dd { margin-top: 0.45rem; }
.stack { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 0 0 1rem; }
.stack li { padding: 0.35rem 0.65rem; background: var(--panel); border: 1px solid #405a70; border-radius: 0.3rem; font-size: 0.9rem; font-weight: 640; }
.site-footer { border-top: 1px solid var(--line); padding-block: 2rem; }
.footer-inner p { color: var(--muted); margin-top: 0.5rem; }
.error-page { padding-block: 5rem; }

@media (max-width: 60rem) {
  .hero-grid { gap: 2rem; }
  .split { gap: 2.1rem; }
  .boundary-row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 2fr); }
  .entities { grid-template-columns: 1fr; }
}
@media (max-width: 48rem) {
  .hero-grid, .split { grid-template-columns: 1fr; }
  .hero-grid { gap: 2.5rem; }
  .ledger { width: min(100%, 34rem); }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow li:nth-child(3n) { border-inline-end: 1px solid var(--line); }
  .flow li:nth-child(2n) { border-inline-end: 0; }
  .flow li:nth-child(n+3) { border-top: 1px solid var(--line); }
  .nav { column-gap: 1.15rem; }
  .footer-inner { align-items: start; flex-direction: column; }
}
@media (max-width: 33rem) {
  .wrap { width: calc(100% - 2rem); }
  .header-inner { align-items: flex-start; flex-direction: column; gap: 0.45rem; }
  .nav { column-gap: 1rem; }
  .actions { flex-direction: column; align-items: stretch; }
  .flow, .glossary > div, .boundary-row, .principles { grid-template-columns: 1fr; }
  .flow li:nth-child(n) { border-inline-end: 0; }
  .flow li + li { border-top: 1px solid var(--line); }
  .boundary-row { gap: 0.75rem; padding: 0.85rem; }
  .exchange { grid-template-columns: auto auto; justify-content: center; gap: 1rem; }
  .exchange span:first-child::before { content: "↑ " / ""; }
  .exchange span:last-child::after { content: " ↓" / ""; }
}
