/* Launch Funnel Router - editorial paper over an ops console.
   Fraunces display, IBM Plex Sans UI, IBM Plex Mono instruments. */

:root {
  --paper: #F6EFE2;
  --paper-2: #EEE3CC;
  --paper-3: #E6D8BC;
  --ink: #221A11;
  --ink-2: #5C4D3A;
  --ink-3: #8A7A63;
  --rust: #B4451F;
  --rust-deep: #933616;
  --gold: #C1913C;
  --console: #1C150B;
  --console-2: #261D10;
  --console-line: #43331A;
  --cream: #F2E8D5;
  --pass: #5FA778;
  --fail: #D4502B;
  --amber: #DFAE54;
  --serif: "Fraunces", Georgia, serif;
  --sans: "IBM Plex Sans", -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* grain overlay */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.13 0 0 0 0 0.1 0 0 0 0 0.06 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
main { position: relative; z-index: 1; }

/* ---------- disclosure ribbon ---------- */
.ribbon {
  background: var(--ink); color: var(--cream);
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .02em;
  padding: 9px 20px; text-align: center;
}
.ribbon strong { color: var(--amber); font-weight: 600; }

/* ---------- pipeline strip ---------- */
.pipeline {
  position: sticky; top: 0; z-index: 50;
  background: rgba(34, 26, 17, .97);
  border-bottom: 1px solid #46351d;
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  flex-wrap: wrap;
}
.pipe-stage {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; color: #A08D6F;
  padding: 5px 12px; border-radius: 999px; border: 1px solid transparent;
  transition: all .35s ease;
}
.pipe-stage .lamp {
  width: 9px; height: 9px; border-radius: 50%;
  background: #4A3D28; transition: all .35s ease;
}
.pipe-stage.active { color: var(--cream); border-color: #6b5327; background: #2d2312; }
.pipe-stage.active .lamp { background: var(--amber); box-shadow: 0 0 10px 2px rgba(223,174,84,.55); }
.pipe-stage.done { color: #9fc8ab; }
.pipe-stage.done .lamp { background: var(--pass); box-shadow: 0 0 8px 1px rgba(95,167,120,.4); }
.pipe-arrow { color: #5d4a2c; font-family: var(--mono); font-size: 12px; }

/* ---------- hero ---------- */
.hero {
  max-width: 1120px; margin: 0 auto; padding: 72px 28px 64px;
  display: grid; grid-template-columns: 340px 1fr; gap: 64px; align-items: center;
}
.book {
  width: 300px; height: 430px; margin: 0 auto;
  background: linear-gradient(160deg, #2B2213 0%, #1C150B 70%);
  border-radius: 4px 14px 14px 4px;
  position: relative;
  box-shadow: -24px 28px 50px rgba(34,26,17,.35), inset 12px 0 20px rgba(0,0,0,.5);
  transform: rotate(-3deg);
  padding: 34px 26px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: var(--cream);
}
.book::before {
  content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.02));
}
.book .b-kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; color: var(--amber); text-transform: uppercase; }
.book .b-title { font-family: var(--serif); font-size: 52px; line-height: .98; font-weight: 700; margin-top: 14px; }
.book .b-title em { font-style: italic; color: var(--amber); }
.book .b-rule { width: 48px; height: 3px; background: var(--rust); margin: 18px 0; }
.book .b-sub { font-size: 13.5px; color: #CBBFA4; line-height: 1.5; }
.book .b-author { font-family: var(--serif); font-size: 18px; font-style: italic; color: var(--cream); }
.book .b-press { font-family: var(--mono); font-size: 10.5px; letter-spacing: .2em; color: #8A7A63; text-transform: uppercase; margin-top: 6px; }

.hero-copy .kicker {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--rust); margin-bottom: 18px;
}
.hero-copy h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(40px, 5.4vw, 66px);
  line-height: 1.02; letter-spacing: -.01em;
}
.hero-copy h1 em { font-style: italic; color: var(--rust); }
.hero-copy .lede {
  font-size: 18px; color: var(--ink-2); max-width: 52ch; margin: 22px 0 30px;
}
.optin { display: flex; gap: 10px; flex-wrap: wrap; max-width: 520px; }
.optin input[type="email"] {
  flex: 1 1 240px; padding: 14px 16px; font-size: 15px; font-family: var(--sans);
  border: 1.5px solid var(--ink); border-radius: 10px; background: #FFFDF7; color: var(--ink);
}
.optin input[type="email"]:focus { outline: 3px solid rgba(180,69,31,.35); }
.btn {
  border: none; border-radius: 10px; padding: 14px 22px;
  background: var(--rust); color: #FFF6E8; font-weight: 600; font-size: 15px;
  box-shadow: 0 3px 0 var(--rust-deep);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--rust-deep); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--rust-deep); }
.btn.ghost {
  background: transparent; color: var(--ink); box-shadow: none;
  border: 1.5px solid var(--ink);
}
.btn.ghost:hover { background: var(--paper-2); }
.hero-note { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-top: 12px; }

.cred { max-width: 1120px; margin: 0 auto; padding: 0 28px 70px; }
.cred-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.cred blockquote {
  background: #FFFDF6; border: 1px solid var(--paper-3); border-radius: 14px;
  padding: 22px; font-family: var(--serif); font-size: 16.5px; font-style: italic; line-height: 1.45;
  box-shadow: 0 6px 18px rgba(34,26,17,.06);
}
.cred cite { display: block; margin-top: 12px; font-family: var(--mono); font-style: normal; font-size: 12px; color: var(--ink-3); }

/* ---------- section scaffolding ---------- */
.sec { max-width: 1120px; margin: 0 auto; padding: 64px 28px; scroll-margin-top: 58px; }
.sec-head { margin-bottom: 34px; max-width: 68ch; }
.sec-head .tag {
  display: inline-block; font-family: var(--mono); font-size: 11.5px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--cream); background: var(--ink);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.sec-head h2 { font-family: var(--serif); font-size: clamp(28px, 3.6vw, 42px); font-weight: 600; line-height: 1.08; }
.sec-head p { color: var(--ink-2); margin-top: 12px; }

/* ---------- source simulator ---------- */
.sources { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.src-chip {
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: 999px; padding: 9px 18px; font-size: 14px; font-weight: 600;
  transition: all .15s ease;
}
.src-chip:hover { background: var(--paper-2); }
.src-chip.active { background: var(--ink); color: var(--cream); }
.hidden-fields {
  background: var(--console); color: var(--cream); border-radius: 12px;
  font-family: var(--mono); font-size: 13px; padding: 16px 18px;
  display: flex; gap: 18px; flex-wrap: wrap;
}
.hidden-fields .hf { color: #A08D6F; }
.hidden-fields .hf b { color: var(--amber); font-weight: 500; }

/* ---------- assessment ---------- */
.assess-wrap { display: grid; grid-template-columns: 1fr 300px; gap: 28px; align-items: start; }
.q-card {
  background: #FFFDF6; border: 1px solid var(--paper-3); border-radius: 14px;
  padding: 20px 22px; margin-bottom: 14px;
  box-shadow: 0 4px 14px rgba(34,26,17,.05);
  transition: opacity .3s ease;
}
.q-card .q-num { font-family: var(--mono); font-size: 11.5px; color: var(--rust); letter-spacing: .12em; }
.q-card h3 { font-family: var(--serif); font-size: 19px; font-weight: 600; margin: 6px 0 14px; }
.q-opts { display: flex; flex-direction: column; gap: 8px; }
.q-opt {
  text-align: left; border: 1.5px solid var(--paper-3); background: var(--paper);
  border-radius: 10px; padding: 11px 14px; font-size: 14.5px; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  transition: all .12s ease;
}
.q-opt:hover { border-color: var(--ink-3); background: var(--paper-2); }
.q-opt.sel { border-color: var(--rust); background: #FBEADF; font-weight: 600; }
.q-opt .pts { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.q-opt.sel .pts { color: var(--rust); }
.q-skip {
  border: 1.5px dashed var(--ink-3); border-radius: 14px; padding: 14px 20px; margin-bottom: 14px;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-3);
}

.calc-panel {
  position: sticky; top: 64px;
  background: var(--console); color: var(--cream); border-radius: 16px; padding: 22px;
  font-family: var(--mono);
}
.calc-panel h4 { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--amber); margin-bottom: 16px; }
.calc-row { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px solid #382c18; color: #C9BA9C; }
.calc-row b { color: var(--cream); font-weight: 500; }
.calc-score { font-size: 44px; font-weight: 600; color: var(--amber); margin: 14px 0 2px; font-family: var(--serif); }
.calc-tier { font-size: 13px; color: #C9BA9C; }
.calc-bar { height: 6px; background: #382c18; border-radius: 4px; margin-top: 14px; overflow: hidden; }
.calc-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--rust), var(--amber)); transition: width .4s ease; }
.persona-row { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.persona-row button {
  background: #2d2312; color: var(--cream); border: 1px solid #4A3A20; border-radius: 8px;
  font-family: var(--mono); font-size: 12px; padding: 9px 10px; text-align: left;
  transition: all .12s ease;
}
.persona-row button:hover { border-color: var(--amber); color: var(--amber); }

.finish {
  margin-top: 22px; background: #FFFDF6; border: 1.5px solid var(--ink); border-radius: 16px; padding: 24px;
}
.finish h3 { font-family: var(--serif); font-size: 21px; margin-bottom: 14px; }
.finish .frow { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.finish input[type="text"], .finish input[type="email"] {
  flex: 1 1 200px; padding: 12px 14px; font-size: 14.5px; font-family: var(--sans);
  border: 1.5px solid var(--paper-3); border-radius: 10px; background: var(--paper);
}
.finish label.consent {
  display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2);
  margin: 10px 0 16px; max-width: 60ch;
}
.finish input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--rust); margin-top: 2px; }

/* ---------- result panels ---------- */
.result {
  border-radius: 18px; padding: 34px; margin-top: 26px; color: var(--cream);
  display: none; position: relative; overflow: hidden;
}
.result.show { display: block; animation: rise .5s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.result.tier-firefighter { background: linear-gradient(150deg, #6E2A12, #933616); }
.result.tier-conductor { background: linear-gradient(150deg, #7A5A18, #9A742A); }
.result.tier-operator { background: linear-gradient(150deg, #1F4D35, #2E6A49); }
.result .r-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .25em; text-transform: uppercase; opacity: .85; }
.result h3 { font-family: var(--serif); font-size: clamp(26px, 3.4vw, 38px); margin: 10px 0 6px; }
.result .r-score { font-family: var(--serif); font-size: 74px; font-weight: 700; line-height: 1; }
.result .r-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 22px; }
.result .r-col h5 { font-family: var(--mono); font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; opacity: .8; margin-bottom: 10px; }
.result .r-col ul { list-style: none; }
.result .r-col li { font-size: 14px; padding: 7px 0; border-top: 1px solid rgba(255,246,232,.22); }

/* ---------- console band (routing + crm + selftest) ---------- */
.band { background: var(--console); color: var(--cream); position: relative; }
.band::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 8px;
  background: repeating-linear-gradient(90deg, var(--rust) 0 26px, var(--amber) 26px 52px, var(--console) 52px 78px);
  opacity: .85;
}
.band .sec-head .tag { background: var(--amber); color: var(--console); }
.band .sec-head h2 { color: var(--cream); }
.band .sec-head p { color: #B7A886; }

.console-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.panel {
  background: var(--console-2); border: 1px solid #43331A; border-radius: 16px; padding: 22px;
  min-width: 0; /* let .tbl-scroll actually scroll instead of forcing the grid wide */
}
.panel h4 {
  font-family: var(--mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center;
}
.panel h4 .st { font-size: 10.5px; letter-spacing: .08em; padding: 3px 9px; border-radius: 999px; background: #43331A; color: #C9BA9C; }
.mono-list { font-family: var(--mono); font-size: 13px; line-height: 1.7; color: #DCCFB2; }
.mono-list .dim { color: #8A7A63; }
.mono-list .hot { color: var(--amber); }
.mono-list .ok { color: var(--pass); }
.mono-list .bad { color: var(--fail); }
.chiprow { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.chip {
  font-family: var(--mono); font-size: 12px; padding: 4px 11px; border-radius: 999px;
  background: #3A2C14; color: var(--cream); border: 1px solid #55401D;
}
.chip.tag-tier { background: #274434; border-color: #3A6B50; color: #9FD3B2; }
.chip.tag-supp { background: #4A1F10; border-color: #7A3018; color: #F0A98E; }
.chip.tag-consent { background: #2C3A4A; border-color: #40587A; color: #A9C6EE; }

.route-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; margin-top: 8px; }
.route-table th, .route-table td { text-align: left; padding: 8px 10px; border-top: 1px solid #43331A; color: #DCCFB2; vertical-align: top; }
.route-table th { color: #8A7A63; font-weight: 500; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; border-top: none; }
.route-table td.on { color: var(--amber); }
.tbl-scroll { overflow-x: auto; }

.toggles { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toggle {
  font-family: var(--mono); font-size: 12.5px; padding: 8px 14px; border-radius: 8px;
  background: #3A2C14; color: var(--cream); border: 1px solid #55401D; transition: all .12s;
}
.toggle:hover { border-color: var(--amber); }
.toggle.on { background: #274434; border-color: #3A6B50; color: #9FD3B2; }
.toggle.off { background: #4A1F10; border-color: #7A3018; color: #F0A98E; }

/* crm cards */
.crm-objects { display: grid; grid-template-columns: 1fr; gap: 8px; max-height: 300px; overflow-y: auto; padding-right: 4px; }
.obj {
  border: 1px solid #43331A; border-radius: 10px; padding: 10px 13px;
  font-family: var(--mono); font-size: 12.5px; color: #DCCFB2;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  transition: border-color .3s ease, background .3s ease;
}
.obj .oid { color: var(--amber); }
.obj.flash { border-color: var(--pass); background: #20301F; }
.obj.new { border-color: var(--amber); }
.ledger { max-height: 260px; overflow-y: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.8; color: #C9BA9C; }
.ledger .op-create { color: var(--pass); }
.ledger .op-update { color: var(--amber); }
.ledger .op-review { color: #A9C6EE; }

/* selftest */
.selftest-summary {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 20px;
}
.selftest-summary .big {
  font-family: var(--serif); font-size: 56px; font-weight: 700; color: var(--pass);
}
.selftest-summary .big.failing { color: var(--fail); }
.selftest-summary p { font-family: var(--mono); font-size: 13px; color: #B7A886; max-width: 52ch; }
.st-group { margin-bottom: 18px; }
.st-group h5 { font-family: var(--mono); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--amber); margin-bottom: 8px; }
.assert {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: baseline;
  font-family: var(--mono); font-size: 12.5px; padding: 7px 10px; border-radius: 8px;
  color: #DCCFB2;
}
.assert:nth-child(even) { background: #221A0D; }
.assert .mark { font-weight: 700; }
.assert.pass .mark { color: var(--pass); }
.assert.fail .mark { color: var(--fail); }
.assert.fail { outline: 1px solid var(--fail); }
.assert .vals { color: #8A7A63; white-space: nowrap; }
.assert .vals b { color: var(--cream); font-weight: 500; }

/* brand tokens */
.tokens { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.tok {
  border: 1px solid var(--paper-3); border-radius: 12px; overflow: hidden; background: #FFFDF6;
}
.tok .swatch { height: 64px; }
.tok .lbl { font-family: var(--mono); font-size: 11.5px; padding: 10px 12px; color: var(--ink-2); }
.type-spec { margin-top: 22px; display: grid; gap: 6px; }
.type-spec .ts { display: flex; align-items: baseline; gap: 16px; border-top: 1px solid var(--paper-3); padding: 10px 0; }
.type-spec .ts .n { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); min-width: 170px; }

/* footer */
footer {
  background: var(--ink); color: #B7A886; padding: 40px 28px; text-align: center;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.9;
}
footer .f-title { color: var(--cream); font-family: var(--serif); font-size: 18px; font-style: italic; }

/* toast */
#toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(90px);
  background: var(--ink); color: var(--cream); font-family: var(--mono); font-size: 13px;
  padding: 12px 20px; border-radius: 10px; border: 1px solid #55401D;
  transition: transform .3s ease; z-index: 99; max-width: min(92vw, 560px); text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 44px; padding-top: 48px; }
  .book { transform: rotate(-2deg) scale(.92); max-width: 84vw; }
  .cred-row { grid-template-columns: 1fr; }
  .assess-wrap { grid-template-columns: 1fr; }
  .calc-panel { position: static; }
  .console-grid { grid-template-columns: 1fr; }
  .result .r-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .assert { grid-template-columns: 22px 1fr; }
  .assert .vals { white-space: normal; overflow-wrap: anywhere; grid-column: 2; }
  .mono-list, .ledger, .hidden-fields { overflow-wrap: anywhere; }
  .hero { padding-left: 20px; padding-right: 20px; }
  .sec { padding-left: 20px; padding-right: 20px; }
}
