:root {
  --paper: #F4ECDF;
  --paper-2: #EADBC2;
  --ink: #2B211B;
  --soft: #7A6857;
  --line: #CDB898;
  --ochre: #C98B3E;
  --wall: #D7A15A;
  --rust: #A9472B;
  --teal: #2F6F6A;
  --lit: #F2C14E;
  --green: #5E8C4A;
  --blue: #4A5A8C;
  --plum: #7B4B6A;
  --burnt: #3A2C24;
  --night: #241B16;
  --serif: "Gloock", Georgia, serif;
  --quote: "Crimson Pro", Georgia, serif;
  --sans: "Work Sans", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 5vw, 72px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
.mono {
  font: 400 12px/1.4 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.mono i { font-style: normal; opacity: .5; margin: 0 .4em; }

/* ---------- stage ---------- */
#stage {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100lvh;
  display: block; z-index: 0;
}
.no-webgl #stage { display: none; }

.loader {
  position: fixed; inset: 0; z-index: 50;
  background: var(--paper);
  display: grid; place-content: center; justify-items: center; gap: 18px;
  color: var(--soft);
  transition: opacity .9s ease, visibility .9s;
}
.loader.gone { opacity: 0; visibility: hidden; }
.loader-mark { display: flex; gap: 8px; }
.loader-mark span {
  width: 14px; height: 14px; border-radius: 4px; background: var(--burnt);
  animation: press 1.2s ease-in-out infinite;
}
.loader-mark span:nth-child(2) { animation-delay: .15s; background: var(--lit); }
.loader-mark span:nth-child(3) { animation-delay: .3s; }
@keyframes press { 0%, 100% { transform: scaleY(1); } 40% { transform: scaleY(.55) translateY(4px); } }

/* ---------- chrome ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--gutter);
  pointer-events: none;
}
.top a { pointer-events: auto; text-decoration: none; }
.brand span { color: var(--soft); }
.top-link {
  padding: 10px 14px; border: 1px solid var(--ink); border-radius: 999px;
  background: rgba(244, 236, 223, .7); backdrop-filter: blur(6px);
  transition: background .25s, color .25s;
}
.top-link:hover, .top-link:focus-visible { background: var(--ink); color: var(--paper); }
body.on-dark .top { color: var(--paper); }
body.on-dark .brand span { color: #B9A58C; }
body.on-dark .top-link { border-color: var(--paper); background: rgba(36, 27, 22, .5); }
.top, .rail { transition: color .5s; }

.rail {
  position: fixed; right: calc(var(--gutter) - 6px); top: 50%; z-index: 20;
  transform: translateY(-50%);
}
.rail ol { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.rail a {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  min-height: 28px; text-decoration: none;
  font: 400 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
}
.rail a span { opacity: 0; transform: translateX(6px); transition: opacity .3s, transform .3s; white-space: nowrap; }
.rail a i {
  width: 10px; height: 10px; border-radius: 3px; background: currentColor; opacity: .25;
  transition: opacity .3s, transform .3s;
}
.rail a:hover span, .rail a:focus-visible span { opacity: 1; transform: none; }
.rail a[aria-current] i { opacity: 1; transform: scale(1.25); background: var(--rust); }
body.on-dark .rail { color: var(--paper); }
.top { transition: color .5s, background .4s, border-color .4s; border-bottom: 1px solid transparent; }
body.in-ledger .top { background: rgba(244, 236, 223, .94); backdrop-filter: blur(8px); border-bottom-color: var(--line); }
.rail { transition: opacity .4s; }
body.in-ledger .rail { opacity: 0; pointer-events: none; }

/* ---------- scenes ---------- */
main { position: relative; z-index: 10; }
.scene { position: relative; height: 230vh; }
.scene:first-child { height: 200vh; }
.scene#network { height: 190vh; }
.pin {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: flex; align-items: center;
  padding: 0 var(--gutter);
  pointer-events: none;
}
.scene[data-side="right"] .pin { justify-content: flex-end; padding-right: calc(var(--gutter) + 56px); }
.scene[data-side="center"] .pin { justify-content: center; text-align: center; }

.card {
  --o: 1; --y: 0px;
  width: min(440px, 100%);
  opacity: var(--o);
  transform: translateY(var(--y));
  pointer-events: auto;
  position: relative;
}
.card::before {
  /* a soft paper halo so text always reads over the clay */
  content: ""; position: absolute; inset: -56px -64px; z-index: -1;
  background: radial-gradient(closest-side, rgba(244, 236, 223, .78), rgba(244, 236, 223, .45) 60%, rgba(244, 236, 223, 0));
  pointer-events: none;
}
.dark .card::before { background: radial-gradient(closest-side, rgba(36, 27, 22, .9), rgba(36, 27, 22, .6) 55%, rgba(36, 27, 22, 0)); }

.label { color: var(--soft); margin-bottom: 18px; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.01em; }
h1 { font-size: clamp(48px, 7.4vw, 104px); line-height: .96; margin-bottom: 22px; }
.hero { width: min(620px, 100%); }
h2 { font-size: clamp(40px, 5vw, 68px); line-height: 1; margin-bottom: 18px; }
.sub { color: var(--soft); max-width: 36ch; font-size: clamp(17px, 1.35vw, 19px); }
.hero .sub { color: var(--ink); opacity: .78; }
.src { color: var(--soft); margin-top: 18px; font-size: 11px; }
.hint { margin-top: 44px; color: var(--soft); display: flex; align-items: center; gap: 14px; }
.hint-line { display: block; width: 40px; height: 1px; background: currentColor; position: relative; overflow: hidden; }
.hint-line::after { content: ""; position: absolute; inset: 0; background: var(--rust); transform: translateX(-100%); animation: sweep 2.4s ease-in-out infinite; }
@keyframes sweep { 60%, 100% { transform: translateX(100%); } }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.chips li {
  font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  padding: 9px 12px 9px 26px; border-radius: 8px; position: relative;
  border: 1.5px solid var(--c);
}
.chips li::before { content: ""; position: absolute; left: 10px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 2px; background: var(--c); }

.gates { list-style: none; display: grid; grid-template-columns: repeat(2, auto); justify-content: start; gap: 8px 22px; margin-top: 18px; }
.gates li { font: 400 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
.gates li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--green); }

.dark { color: var(--paper); }
.dark .label { color: #B9A58C; }
blockquote {
  font: italic 400 clamp(26px, 2.6vw, 38px)/1.22 var(--quote);
  margin-bottom: 26px; max-width: 24ch;
}
.stamp-line { display: flex; align-items: center; gap: 14px; font-weight: 600; font-size: 19px; }
.stamp-line span { width: 34px; height: 3px; background: var(--rust); border-radius: 2px; }

.cta h2 { font-size: clamp(44px, 6vw, 84px); }
.cta .sub { margin: 0 auto 30px; color: var(--ink); opacity: .75; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 22px;
  border-radius: 999px; background: var(--ink); color: var(--paper);
  font: 500 13px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  box-shadow: 0 6px 0 -1px #1a130f;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(2px); box-shadow: 0 4px 0 -1px #1a130f; }
.btn:active { transform: translateY(5px); box-shadow: 0 1px 0 -1px #1a130f; }
.btn.ghost { background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); box-shadow: 0 6px 0 -1px var(--line); }
.btn.ghost:hover { box-shadow: 0 4px 0 -1px var(--line); }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }

/* ---------- ledger ---------- */
.ledger {
  position: relative; z-index: 15;
  background: var(--paper);
  border-top: 1px solid var(--ink);
  padding: clamp(72px, 10vw, 140px) 0 48px;
}
.ledger::before {
  /* pressed-paper grain, same as the one-pager */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .25 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); position: relative; }
.ledger-head h2 { font-size: clamp(40px, 5.5vw, 76px); margin-bottom: 56px; }

.figures {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.figures div { padding: 28px 20px 26px 0; }
.figures div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.figures b { display: block; font: 400 clamp(36px, 4vw, 54px)/1 var(--serif); margin-bottom: 10px; }
.figures em { font-style: normal; color: var(--rust); margin: 0 .08em; }
.figures span { font-size: 15px; color: var(--soft); display: block; max-width: 18ch; line-height: 1.4; }

.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 56px; margin-top: 64px; }
.col ol, .col ul { list-style: none; }
.col li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 17px; display: flex; gap: 14px; align-items: baseline; }
.ws { counter-reset: w; }
.ws li i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; transform: translateY(1px); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); }
.no li::before { content: ""; width: 12px; height: 2px; background: var(--rust); flex: none; transform: translateY(-4px); }
.yes li::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--green); flex: none; transform: translateY(-1px); }

.downloads { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 80px; }
.downloads a {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 18px;
  padding: 24px; border-radius: 14px; text-decoration: none;
  background: var(--paper-2); box-shadow: inset 0 -5px 0 rgba(58, 44, 36, .08);
  transition: transform .2s, box-shadow .2s;
}
.downloads a:hover { transform: translateY(-3px); box-shadow: inset 0 -5px 0 rgba(58, 44, 36, .08), 0 14px 24px -14px rgba(58, 44, 36, .5); }
.downloads .mono { grid-row: span 2; align-self: center; width: 52px; height: 64px; border-radius: 6px; background: var(--rust); color: var(--paper); display: grid; place-items: center; }
.downloads b { font: 400 24px/1.15 var(--serif); }
.downloads em { font-style: normal; color: var(--soft); font-size: 15px; }

.contact {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center;
  margin-top: 96px; padding: clamp(28px, 4vw, 48px); border-radius: 18px;
  background: var(--burnt); color: var(--paper);
}
.contact .label { color: #B9A58C; }
.contact h3 { font: 400 clamp(32px, 3.6vw, 48px)/1.05 var(--serif); margin-bottom: 14px; }
.contact .sub { color: #D8C8B2; }
.contact-card {
  display: grid; gap: 10px; padding: 26px 28px; border-radius: 14px; text-decoration: none;
  background: var(--paper); color: var(--ink);
  box-shadow: inset 0 -6px 0 rgba(58, 44, 36, .12);
  transition: transform .2s, box-shadow .2s;
}
.contact-card:hover { transform: translateY(-3px); box-shadow: inset 0 -6px 0 rgba(58, 44, 36, .12), 0 16px 28px -14px rgba(0, 0, 0, .6); }
.contact-card .mono { color: var(--soft); }
.contact-card b { font: 400 clamp(20px, 2vw, 26px)/1.15 var(--serif); overflow-wrap: anywhere; }
.contact-card em { font-style: normal; font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--rust); }
.foot a { text-decoration: none; border-bottom: 1px solid var(--line); }
.foot { margin-top: 96px; padding-top: 22px; border-top: 1px solid var(--ink); display: grid; gap: 12px; }
.foot .mono { color: var(--soft); }
.fine { font-size: 13px; color: var(--soft); max-width: 90ch; line-height: 1.5; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .top { padding: 14px 16px; }
  .brand span { display: none; }
  .brand i { display: none; }
  .top-link { padding: 8px 12px; }
  .rail { display: none; }
  .pin, .scene[data-side="right"] .pin, .scene[data-side="center"] .pin {
    align-items: flex-end; justify-content: flex-start; text-align: left;
    padding: 0 16px calc(28px + env(safe-area-inset-bottom));
  }
  .card::before { inset: -40px -16px -28px; background: linear-gradient(to top, rgba(244,236,223,.97) 60%, rgba(244,236,223,0)); }
  .dark .card::before { background: linear-gradient(to top, rgba(36,27,22,.97) 60%, rgba(36,27,22,0)); }
  .scene[data-side="center"] .card { text-align: left; }
  .cta .sub { margin-left: 0; }
  .actions { justify-content: flex-start; }
  h1 { font-size: 46px; margin-bottom: 14px; }
  h2 { font-size: 38px; margin-bottom: 12px; }
  .hint { margin-top: 22px; }
  blockquote { font-size: 24px; }
  .figures { grid-template-columns: 1fr 1fr; }
  .figures div, .figures div + div { padding: 20px 12px 20px 0; border-left: 0; border-bottom: 1px solid var(--line); }
  .figures div:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--line); }
  .cols, .downloads, .contact { grid-template-columns: 1fr; gap: 40px; }
  .contact { gap: 24px; }
  .contact-card { padding: 22px 20px; }
  .contact-card b { font-size: 19px; overflow-wrap: normal; }
}

/* ---------- without 3D ---------- */
.no-webgl .scene { height: auto; min-height: 90vh; }
.no-webgl .pin { position: relative; min-height: 90vh; }
.no-webgl .scene:nth-child(even) { background: var(--paper-2); }
.no-webgl .scene.dark { background: var(--night); }
.no-webgl .loader { display: none; }
