
:root {
  --void: #08110f;
  --panel: #0d1a17;
  --panel-2: #122420;
  --ink: #e8f4ee;
  --dim: #8fb3a6;
  --line: #1c332c;
  --line-2: #27453c;
  --phos: #6ee7a8;
  --sand: #e8d9a8;
  --rose: #ff8098;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 190ms;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.68;
  background-image:
    radial-gradient(90% 60% at 70% -10%, rgba(110, 231, 168, 0.07) 0%, transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 100%, 100% 112px;
}

.mono { font-family: var(--mono); font-size: 0.92em; }

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.14;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}
h1 { font-size: clamp(1.95rem, 1.2rem + 3vw, 3.1rem); }
h2 { font-size: clamp(1.35rem, 1.05rem + 1.3vw, 1.9rem); margin-top: 2.3rem; }
h3 { font-size: 1.1rem; letter-spacing: -0.012em; }
p { margin: 0 0 1rem; }

a { color: var(--phos); text-underline-offset: 3px; text-decoration-thickness: 1px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 40;
  background: var(--phos); color: var(--void); padding: 0.6rem 0.9rem; font-size: 0.85rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- top bar ---------- */
.top {
  border-bottom: 1px solid var(--line-2);
  background: rgba(8, 17, 15, 0.9);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.top .bar { display: flex; align-items: center; gap: 1rem; padding: 0.7rem 1.4rem; }
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem; margin-right: auto;
  color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.02em;
}
.mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 0.7rem; color: var(--phos);
}
.top-note { font-family: var(--mono); font-size: 0.72rem; color: var(--dim); letter-spacing: 0.04em; }
@media (max-width: 720px) { .top-note { display: none; } }

/* ---------- buttons ---------- */
.btn, .ghost {
  display: inline-block; font-size: 0.85rem; font-weight: 700; text-decoration: none;
  border-radius: 6px; white-space: nowrap;
  transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn { background: var(--phos); color: #04140d; padding: 0.6rem 1rem; }
.btn:hover { background: var(--sand); transform: translateY(-1px); }
.ghost { border: 1px solid var(--line-2); color: var(--ink); padding: 0.56rem 0.95rem; }
.ghost:hover { border-color: var(--phos); transform: translateY(-1px); }

/* ---------- frame: left rail + content ---------- */
.frame { display: grid; grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
@media (max-width: 940px) { .frame { grid-template-columns: 1fr; } }

.rail {
  position: sticky; top: 59px; align-self: start;
  border-right: 1px solid var(--line-2);
  padding: 1.5rem 1rem 1.5rem 1.4rem;
  min-height: calc(100vh - 59px);
}
@media (max-width: 940px) {
  .rail { position: static; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line-2); padding: 1rem 1.2rem; }
}
.rail-title {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 0.85rem;
}
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
@media (max-width: 940px) { .rail-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.25rem; } }
.rail-link {
  display: flex; align-items: baseline; gap: 0.6rem; text-decoration: none;
  color: var(--dim); padding: 0.34rem 0.5rem 0.34rem 0.55rem;
  border-left: 2px solid transparent; border-radius: 0 5px 5px 0;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.rail-link:hover { color: var(--ink); background: var(--panel); transform: translateX(2px); }
.rail-link[aria-current="page"] { color: var(--phos); border-left-color: var(--phos); background: var(--panel); }
.rail-n { font-family: var(--mono); font-size: 0.7rem; color: var(--line-2); }
.rail-link[aria-current="page"] .rail-n { color: var(--phos); }
.rail-label { font-size: 0.92rem; font-weight: 600; }
.rail-note {
  margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line);
  font-size: 0.78rem; color: var(--dim); line-height: 1.6;
}
@media (max-width: 940px) { .rail-note { margin-top: 0.9rem; } }

/* ---------- hero ---------- */
.page-hero {
  border-bottom: 1px solid var(--line-2);
  padding: 2.6rem 1.4rem 2rem;
  background: linear-gradient(180deg, rgba(18, 36, 32, 0.6) 0%, transparent 100%);
}
.crumb-line { font-family: var(--mono); font-size: 0.72rem; color: var(--dim); margin-bottom: 1.3rem; letter-spacing: 0.04em; }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--phos);
  border-bottom: 1px solid var(--line-2); padding-bottom: 0.2rem; margin-bottom: 0.9rem;
}
.lede { font-size: clamp(1rem, 0.95rem + 0.4vw, 1.2rem); color: var(--dim); max-width: 64ch; margin-top: 1rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.5rem; }
.page-hero h1, .page-hero .lede, .page-hero .hero-cta { animation: rise var(--dur) var(--ease) both; }
.page-hero .lede { animation-delay: 55ms; }
.page-hero .hero-cta { animation-delay: 105ms; }
@keyframes rise {
  from { opacity: 0.001; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- flow diagram ---------- */
.flow-wrap { padding: 0 1.4rem; }
.flow {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px;
  background: var(--line-2); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden;
}
@media (max-width: 1100px) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .flow { grid-template-columns: 1fr; } }
.flow-node { background: var(--panel); padding: 0.95rem 1rem 1.05rem; display: flex; flex-direction: column; gap: 0.35rem; }
.flow-k { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--phos); }
.flow-v { font-size: 0.86rem; color: var(--ink); word-break: break-word; }
.flow-n { font-size: 0.82rem; color: var(--dim); }

/* ---------- bands ---------- */
.band { padding: 2.2rem 1.4rem; border-bottom: 1px solid var(--line); }
.band:last-child { border-bottom: 0; }
.prose { max-width: 70ch; }
.prose > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 1.05rem; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 940px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

/* ---------- cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 1.1rem 1.15rem 1.2rem;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--phos); }
.card-quiet { background: var(--panel-2); }
.tag {
  display: block; font-family: var(--mono); font-size: 0.67rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--dim); margin-bottom: 0.5rem;
}
.text-link {
  font-size: 0.86rem; font-weight: 700; color: var(--phos); text-decoration: none;
  border-bottom: 1px solid var(--line-2); transition: border-color var(--dur) var(--ease);
}
.text-link:hover { border-bottom-color: var(--phos); }

/* ---------- metrics ---------- */
.metrics {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line-2); border: 1px solid var(--line-2); border-radius: 8px;
  overflow: hidden; margin-bottom: 1.6rem;
}
@media (max-width: 720px) { .metrics { grid-template-columns: 1fr; } }
.metric { background: var(--panel); padding: 1rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: 0.3rem; }
.kpi { font-size: 1.5rem; font-weight: 700; color: var(--phos); letter-spacing: -0.02em; }
.metric-label { font-size: 0.85rem; color: var(--dim); line-height: 1.5; }

/* ---------- hash / code blocks ---------- */
.hashbox {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px;
  margin: 1.4rem 0; overflow: hidden;
}
.hash-row { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 0.8rem; padding: 0.62rem 0.95rem; border-bottom: 1px solid var(--line); }
.hash-row:last-child { border-bottom: 0; }
@media (max-width: 720px) { .hash-row { grid-template-columns: 1fr; gap: 0.2rem; } }
.hash-k { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.hash-v { font-family: var(--mono); font-size: 0.82rem; color: var(--phos); word-break: break-all; }

.code {
  background: #06100e; border: 1px solid var(--line-2); border-left: 3px solid var(--phos);
  border-radius: 0 8px 8px 0; padding: 1rem 1.1rem; margin: 1.4rem 0;
  overflow-x: auto; font-family: var(--mono); font-size: 0.8rem; line-height: 1.65; color: var(--ink);
}
.code code { font-family: inherit; }

/* ---------- numbered lists ---------- */
.inputs, .steps, .limits { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.inputs > li, .steps > li, .limits > li { background: var(--panel); display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: 0.3rem; padding: 1rem 1.15rem; }
.inputs h3, .steps h3, .limits h3 { margin: 0 0 0.3rem; }
.inputs p, .steps p, .limits p { margin: 0; color: var(--dim); font-size: 0.95rem; }
.input-n, .step-n, .limit-n { font-family: var(--mono); font-size: 0.78rem; color: var(--phos); padding-top: 0.28rem; }
.owner { font-family: var(--mono); font-size: 0.72rem; color: var(--dim); font-weight: 400; }

/* ---------- tables ---------- */
.worked { width: 100%; border-collapse: collapse; margin: 1.3rem 0 0.8rem; background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; }
.worked caption { caption-side: top; text-align: left; font-size: 0.8rem; color: var(--dim); padding-bottom: 0.55rem; }
.worked th, .worked td { text-align: left; padding: 0.55rem 0.9rem; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.worked thead th { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.13em; text-transform: uppercase; color: var(--dim); background: var(--panel-2); }
.worked tbody tr:last-child td { border-bottom: 0; }
.worked td.mono { color: var(--phos); word-break: break-all; }
.caption-note { font-size: 0.85rem; color: var(--dim); }

/* ---------- callouts & notes ---------- */
.callout { background: var(--panel); border-left: 3px solid var(--phos); border-radius: 0 8px 8px 0; padding: 1.05rem 1.2rem; }
.callout-warn { border-left-color: var(--rose); background: rgba(255, 128, 152, 0.06); }
.callout h3 { margin-top: 0; }
.lab-note {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.7rem;
  border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line);
  padding: 0.8rem 0; margin: 1.7rem 0;
}
.lab-tag {
  font-family: var(--mono); font-size: 0.67rem; letter-spacing: 0.15em; text-transform: uppercase;
  color: #04140d; background: var(--sand); padding: 0.15rem 0.5rem; border-radius: 3px;
}
.lab-note p { margin: 0; flex: 1 1 20rem; font-size: 0.92rem; color: var(--dim); }

.ticks, .crosses { list-style: none; margin: 0 0 1rem; padding: 0; }
.ticks li, .crosses li { position: relative; padding-left: 1.6rem; margin-bottom: 0.5rem; font-size: 0.95rem; }
.ticks li::before, .crosses li::before { position: absolute; left: 0; top: 0; font-family: var(--mono); font-weight: 700; }
.ticks li::before { content: "\2713"; color: var(--phos); }
.crosses li::before { content: "\00D7"; color: var(--rose); }

/* ---------- FAQ ---------- */
.qa { background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; margin-bottom: 0.65rem; }
.qa summary { cursor: pointer; padding: 0.9rem 1.1rem; font-weight: 700; letter-spacing: -0.012em; list-style: none; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; float: right; color: var(--phos); font-family: var(--mono); }
.qa[open] summary::after { content: "\2212"; }
.qa p { padding: 0 1.1rem 1rem; margin: 0; color: var(--dim); font-size: 0.95rem; }

/* ---------- disclosure ---------- */
.disclosure {
  background: var(--panel-2); border: 1px dashed var(--line-2); border-radius: 8px;
  padding: 0.95rem 1.1rem; font-size: 0.9rem; color: var(--dim); margin-top: 1.5rem;
}
.disclosure strong { color: var(--ink); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line-2); background: var(--panel); padding: 2.2rem 1.4rem 1.9rem; }
.foot-grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr; gap: 1.6rem; }
@media (max-width: 860px) { .foot-grid { grid-template-columns: 1fr; } }
.foot-grid p { color: var(--dim); font-size: 0.9rem; margin: 0.6rem 0 0; max-width: 44ch; }
.foot-grid strong { display: block; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--ink); margin-bottom: 0.65rem; }
.foot-grid a:not(.brand) { display: block; font-size: 0.89rem; color: var(--dim); text-decoration: none; padding: 0.15rem 0; transition: color var(--dur) var(--ease); }
.foot-grid a:not(.brand):hover { color: var(--phos); }
.fine { margin-top: 1.8rem; padding-top: 1.1rem; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--dim); max-width: 94ch; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card:hover, .btn:hover, .ghost:hover, .rail-link:hover { transform: none; }
}
