:root {
  --night: #101a2b;
  --paper: #f7f8f4;
  --ink: #172033;
  --muted: #667085;
  --line: #ccd3dc;
  --signal: #ff5d3b;
  --aqua: #64d8d0;
  --blue: #3457d5;
  --lime: #c9f45b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Avenir Next", "Segoe UI", sans-serif; line-height: 1.55; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
code { padding: .12em .3em; border-radius: 4px; background: rgba(52,87,213,.1); font: 700 .88em ui-monospace, monospace; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 9; padding: 10px; background: #fff; }

.topbar { position: sticky; top: 0; z-index: 8; display: flex; min-height: 66px; align-items: center; gap: 24px; padding: 0 max(22px, calc((100vw - 1180px) / 2)); border-bottom: 1px solid var(--line); background: rgba(247,248,244,.94); backdrop-filter: blur(10px); }
.brand { font-weight: 900; letter-spacing: -.04em; text-decoration: none; }
.brand span { color: var(--signal); }
.pilot-mark { color: var(--blue); font: 700 10px ui-monospace, monospace; letter-spacing: .12em; }
.topnav { display: flex; gap: 18px; margin-left: auto; }
.topnav a, .quiet-link { color: var(--muted); font-size: 13px; text-underline-offset: 4px; }
.quiet-link { white-space: nowrap; }

.hero { display: grid; min-height: 720px; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 80px; overflow: hidden; padding: 100px max(24px, calc((100vw - 1180px) / 2)); background: var(--night); color: #fff; }
.eyebrow { color: var(--signal); font: 700 11px ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 20px 0 30px; font-size: clamp(50px, 7vw, 96px); line-height: .95; letter-spacing: -.065em; }
h1 em { color: var(--aqua); font-style: normal; }
.lead { max-width: 760px; color: #c8d1df; font-size: clamp(18px, 2vw, 24px); }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; padding: 14px 20px; border: 1px solid var(--ink); border-radius: 8px; font: 700 15px inherit; cursor: pointer; text-decoration: none; }
.primary { border-color: var(--signal); background: var(--signal); color: #fff; }
.secondary { background: transparent; color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 22px; }
.hero-link { color: #fff; font-weight: 800; text-underline-offset: 5px; }
.trust-rail { position: relative; display: grid; gap: 8px; }
.trust-rail:before { position: absolute; top: 40px; bottom: 40px; left: 29px; width: 1px; background: #456079; content: ""; }
.rail-node { position: relative; display: grid; grid-template-columns: 60px 1fr; column-gap: 18px; padding: 18px 20px; border: 1px solid #2d425f; border-radius: 14px; background: #17263d; }
.rail-node b { display: grid; width: 42px; height: 42px; grid-row: 1 / 3; place-items: center; border-radius: 50%; background: var(--night); color: var(--aqua); font: 700 12px ui-monospace; }
.rail-node span { font-size: 18px; font-weight: 800; }
.rail-node small { color: #9aaac0; }
.rail-node.active { border-color: var(--aqua); transform: translateX(-18px); }

section:not(.hero) { padding: 100px max(24px, calc((100vw - 1180px) / 2)); }
.section-heading h2, .rules h2 { max-width: 850px; font-size: clamp(38px, 5vw, 68px); line-height: 1; letter-spacing: -.055em; }

.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 34px 0; }
.entry-card { min-height: 180px; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.entry-card span, .records article > span { color: var(--blue); font: 700 10px ui-monospace; letter-spacing: .1em; }
.entry-card b, .entry-card small { display: block; }
.entry-card b { margin: 18px 0 10px; font-size: 22px; line-height: 1.1; }
.entry-card small { color: var(--muted); }
.entry-card.is-active { border: 2px solid var(--blue); box-shadow: 0 10px 30px rgba(52,87,213,.12); }
.workbench { display: grid; grid-template-columns: 1.25fr .75fr; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: #fff; }
form, .draft { padding: 34px; }
.draft { border-left: 1px solid var(--line); background: #e9edf5; }
.form-head { display: flex; justify-content: space-between; gap: 20px; }
.form-head span, .local-only, .draft-kicker { color: var(--blue); font: 700 10px ui-monospace; letter-spacing: .1em; }
label { display: grid; gap: 7px; margin-top: 18px; font-weight: 700; }
textarea, input, select { width: 100%; padding: 13px; border: 1px solid #b8c1ce; border-radius: 8px; background: #fbfcfd; color: var(--ink); font: inherit; }
textarea:focus, input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(52,87,213,.3); outline-offset: 2px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.consent { grid-template-columns: 20px 1fr; align-items: start; font-weight: 500; }
.consent input { margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.form-status { min-height: 24px; margin: 14px 0 0; color: var(--muted); }
.form-status.error { color: #b42318; }
.draft h3 { margin: 18px 0; font-size: 30px; line-height: 1.05; }
.draft dl { display: grid; grid-template-columns: 100px 1fr; gap: 9px; margin: 24px 0; }
.draft dt { color: var(--muted); }
.draft dd { margin: 0; font-weight: 700; }

.matching-core { border-block: 1px solid #aab5c5; background: #e7ebf1; }
.scheme-heading, .comparison-heading, .depth-heading { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); align-items: end; gap: 54px; }
.contract-download { padding: 24px; border: 1px solid var(--night); background: var(--night); color: #fff; box-shadow: 12px 12px 0 var(--lime); }
.contract-download span { color: var(--lime); font: 800 10px ui-monospace, monospace; letter-spacing: .1em; }
.contract-download b { display: block; margin: 28px 0 22px; font-size: 20px; line-height: 1.15; }
.contract-download a { color: #fff; font-weight: 800; text-underline-offset: 5px; }

.match-flow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; margin-top: 54px; padding: 1px; background: #7e899c; }
.match-flow article { position: relative; display: flex; min-width: 0; min-height: 280px; flex-direction: column; padding: 20px; background: var(--paper); }
.match-flow article:after { position: absolute; z-index: 2; top: 36px; right: -8px; display: grid; width: 16px; height: 16px; place-items: center; border-radius: 50%; background: var(--signal); color: #fff; font: 900 10px/1 ui-monospace; content: "→"; }
.match-flow article:last-child:after { display: none; }
.match-flow small { color: var(--blue); font: 800 10px ui-monospace, monospace; }
.match-flow b { margin: auto 0 12px; font-size: 21px; line-height: 1.05; letter-spacing: -.035em; }
.match-flow p { margin: 0; color: var(--muted); font-size: 13px; }
.match-flow .gate { background: #17263d; color: #fff; }
.match-flow .gate p { color: #b8c4d6; }
.match-flow .score { background: var(--lime); }
.match-flow .score b { font: 900 44px/1 ui-monospace, monospace; }
.match-flow .proof { background: var(--aqua); }

.score-ledger { display: grid; grid-template-columns: .78fr 1.22fr .85fr; margin-top: 28px; border: 1px solid var(--night); background: var(--night); gap: 1px; }
.score-ledger > div { min-width: 0; padding: 28px; background: #fff; }
.ledger-label { margin-bottom: 30px; color: var(--blue); font: 800 10px ui-monospace, monospace; letter-spacing: .1em; }
.score-ledger h3 { margin-bottom: 24px; font-size: 27px; line-height: 1.05; }
.hard-gates ul { margin: 0; padding: 0; list-style: none; }
.hard-gates li { display: grid; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hard-gates li span { color: var(--muted); font-size: 13px; }
.gate-note, .output-note { margin: 24px 0 0; padding-left: 12px; border-left: 3px solid var(--signal); color: var(--muted); font-size: 13px; }
.weights dl { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0; border: 1px solid var(--line); }
.weights dl div { display: grid; grid-template-columns: 1fr auto; padding: 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.weights dl div:nth-child(2n) { border-right: 0; }
.weights dl div:nth-last-child(-n+2) { border-bottom: 0; }
.weights dt { font-weight: 800; }
.weights dd { margin: 0; color: var(--blue); font: 900 24px/1 ui-monospace, monospace; }
.weights span { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.score-output { background: var(--lime) !important; }
.score-rules { display: grid; gap: 9px; }
.score-rules p { display: grid; grid-template-columns: 88px 1fr; align-items: center; margin: 0; padding: 12px 0; border-bottom: 1px solid rgba(23,32,51,.25); }
.score-rules b { font: 900 23px/1 ui-monospace, monospace; }
.score-rules span { font-size: 13px; }

.comparison { background: #fff; }
.comparison-heading > p, .depth-heading > p { margin: 0; color: var(--muted); font-size: 18px; }
.compare-table { margin-top: 48px; border: 1px solid var(--ink); }
.compare-row { display: grid; grid-template-columns: .45fr 1fr 1fr; border-bottom: 1px solid var(--line); }
.compare-row:last-child { border-bottom: 0; }
.compare-row > * { min-width: 0; padding: 17px 20px; border-right: 1px solid var(--line); }
.compare-row > *:last-child { border-right: 0; }
.compare-row > b:first-child { color: var(--blue); font: 800 11px ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; }
.compare-head { background: var(--night); color: #fff; }
.compare-head > b { color: #fff !important; font: 800 11px ui-monospace, monospace !important; }
.compare-row span { font-size: 14px; }
.source-line { margin: 22px 0 0; padding: 18px 20px; border-left: 4px solid var(--aqua); background: #edf7f6; color: #465269; font-size: 13px; }
.source-line a { font-weight: 800; text-underline-offset: 4px; }

.depth-map { background: var(--night); color: #fff; }
.depth-heading .eyebrow { color: var(--lime); }
.depth-heading > p { color: #b5bfd0; }
.depth-stack { display: grid; gap: 1px; margin-top: 50px; padding: 1px; background: #46536a; }
.depth-stack article { display: grid; grid-template-columns: 70px minmax(0, 1fr) 180px; align-items: center; gap: 24px; min-height: 142px; padding: 24px 28px; background: #17263d; }
.depth-stack article > span { display: grid; width: 50px; height: 50px; place-items: center; border: 1px solid #52627c; color: var(--aqua); font: 900 13px ui-monospace, monospace; }
.depth-stack small { color: #8797af; font: 800 10px ui-monospace, monospace; letter-spacing: .09em; }
.depth-stack h3 { margin: 8px 0 5px; font-size: 24px; line-height: 1.05; }
.depth-stack p { margin: 0; color: #b5bfd0; font-size: 14px; }
.depth-stack article > b { color: #c9d1df; font: 800 12px ui-monospace, monospace; text-align: right; }
.depth-stack article.priority { background: #213451; box-shadow: inset 7px 0 0 var(--lime); }
.depth-stack article.priority > span, .depth-stack article.priority > b { color: var(--lime); }
.depth-next { display: grid; grid-template-columns: .35fr 1fr auto; align-items: center; gap: 28px; margin-top: 22px; padding: 24px 28px; background: var(--lime); color: var(--ink); }
.depth-next > b { font-size: 16px; }
.depth-next p { margin: 0; font-size: 14px; }
.depth-next a { font-weight: 900; text-underline-offset: 5px; }

.system-map { background: #dde4ec; }
.records { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 38px; border: 1px solid #aeb8c5; background: #aeb8c5; }
.records article { min-height: 230px; padding: 26px; background: var(--paper); }
.records h3 { margin: 18px 0; font-size: 26px; }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 70px; background: var(--night); color: #fff; }
.rules ul { margin: 0; padding: 0; list-style: none; }
.rules li { padding: 18px 0; border-bottom: 1px solid #34445c; font-size: 18px; }
.rules li:before { margin-right: 12px; color: var(--aqua); content: "→"; }
footer { display: flex; justify-content: space-between; gap: 24px; padding: 28px max(24px, calc((100vw - 1180px) / 2)); border-top: 1px solid var(--line); color: var(--muted); }
footer div { display: flex; flex-wrap: wrap; gap: 20px; }
footer a { font-weight: 700; text-underline-offset: 4px; }

@media (max-width: 1040px) {
  .topnav { display: none; }
  .quiet-link { margin-left: auto; }
  .match-flow { grid-template-columns: repeat(2, 1fr); }
  .match-flow article { min-height: 220px; }
  .match-flow article:after { display: none; }
  .match-flow article:last-child { grid-column: 1 / -1; }
  .score-ledger { grid-template-columns: 1fr 1fr; }
  .score-output { grid-column: 1 / -1; }
  .depth-next { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 48px; padding-top: 72px; }
  .entry-grid, .records { grid-template-columns: 1fr 1fr; }
  .workbench, .rules, .scheme-heading, .comparison-heading, .depth-heading { grid-template-columns: 1fr; }
  .draft { border-top: 1px solid var(--line); border-left: 0; }
  .contract-download { max-width: 560px; }
  .compare-row { grid-template-columns: .55fr 1fr 1fr; }
  .depth-stack article { grid-template-columns: 58px minmax(0, 1fr); }
  .depth-stack article > b { grid-column: 2; text-align: left; }
}

@media (max-width: 560px) {
  .topbar { gap: 12px; }
  .pilot-mark { display: none; }
  .quiet-link { font-size: 12px; }
  .hero { min-height: auto; padding-block: 64px; }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .trust-rail { margin-left: 8px; }
  .entry-grid, .records, .form-grid, .match-flow, .score-ledger { grid-template-columns: 1fr; }
  .match-flow article:last-child, .score-output { grid-column: auto; }
  .entry-card { min-height: 0; }
  section:not(.hero) { padding-block: 68px; }
  form, .draft { padding: 24px; }
  .form-head { display: block; }
  .local-only { display: block; margin-top: 8px; }
  .form-actions { display: grid; }
  .scheme-heading, .comparison-heading, .depth-heading { gap: 26px; }
  .contract-download { margin-right: 9px; }
  .weights dl { grid-template-columns: 1fr; }
  .weights dl div { border-right: 0; border-bottom: 1px solid var(--line) !important; }
  .weights dl div:last-child { border-bottom: 0 !important; }
  .compare-table { border: 0; }
  .compare-row, .compare-head { display: block; margin-bottom: 12px; border: 1px solid var(--line); }
  .compare-row > * { display: block; border-right: 0; border-bottom: 1px solid var(--line); }
  .compare-row > *:last-child { border-bottom: 0; }
  .compare-head > b:first-child { display: none; }
  .depth-stack article { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; padding: 20px; }
  .depth-stack article > span { width: 42px; height: 42px; }
  .depth-stack article > b { grid-column: 1 / -1; text-align: left; }
  .rules { gap: 30px; }
  footer { display: grid; gap: 12px; }
  footer div { display: grid; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rail-node.active { transform: none; }
}
