/* ============================================================
   THE FUNDED EDGE — design system
   Mobile-first. Dark. Dense. No decoration without information.
   ============================================================ */

:root {
  --bg: #0b0e14;
  --surface: #121723;
  --raised: #1a2132;
  --line: #232b3d;
  --line-strong: #2f3a52;
  --text: #e8ecf4;
  --muted: #9aa3b5;
  --faint: #6b7488;
  --gold: #f5b941;
  --gold-dim: #b8860b;
  --green: #2ecc8f;
  --red: #ff5c5c;
  --blue: #5ca8ff;
  --purple: #b48cff;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --maxw: 44rem;
  --pad: 1.125rem;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 14, 20, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.hdr-in {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.65rem var(--pad);
}
.brand {
  font-weight: 800; letter-spacing: 0.02em; text-decoration: none;
  color: var(--text); font-size: 1rem; white-space: nowrap;
}
.brand b { color: var(--gold); }
.hdr-right { display: flex; align-items: center; gap: 0.75rem; }
.tier-pill {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem; border-radius: 999px; text-transform: uppercase;
  border: 1px solid var(--line-strong); color: var(--muted); text-decoration: none;
}
.tier-pill.pro { border-color: var(--gold-dim); color: var(--gold); }
.nav-btn {
  background: none; border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 8px; padding: 0.35rem 0.7rem; font-size: 0.85rem; cursor: pointer;
  font-family: var(--sans);
}

/* progress bar under header */
.readbar { height: 2px; background: transparent; position: relative; }
.readbar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); width: 0%; display: block; }

/* ---------- nav overlay ---------- */
.nav-ov {
  position: fixed; inset: 0; z-index: 100; background: rgba(8, 10, 15, 0.97);
  display: none; overflow-y: auto; padding: 1rem var(--pad) 4rem;
}
.nav-ov.open { display: block; }
.nav-ov .nav-head { display: flex; justify-content: space-between; align-items: center; max-width: var(--maxw); margin: 0 auto 1rem; }
.nav-list { max-width: var(--maxw); margin: 0 auto; padding: 0; list-style: none; }
.nav-sec {
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--faint); margin: 1.4rem 0 0.4rem; font-weight: 700;
}
.nav-list a {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.55rem 0.25rem; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--line); font-size: 0.98rem;
}
.nav-list a:active { background: var(--surface); }
.nav-list .mnum { font-family: var(--mono); color: var(--faint); font-size: 0.8rem; min-width: 1.6rem; }
.nav-list .lock { margin-left: auto; font-size: 0.75rem; color: var(--gold-dim); }
.nav-list a.current { color: var(--gold); }

/* ---------- layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem var(--pad) 3rem; }
article > * + * { margin-top: 1.1rem; }

/* module hero */
.mhero { padding: 1.2rem 0 0.4rem; }
.mhero .mkind {
  font-family: var(--mono); font-size: 0.78rem; color: var(--gold);
  letter-spacing: 0.12em; text-transform: uppercase;
}
.mhero h1 { font-size: 1.85rem; line-height: 1.15; margin: 0.45rem 0 0.5rem; letter-spacing: -0.015em; }
.mhero .mmeta { color: var(--muted); font-size: 0.88rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.mhero .mlede { color: var(--muted); font-size: 1.05rem; margin-top: 0.8rem; border-left: 3px solid var(--gold); padding-left: 0.9rem; }

h2 {
  font-size: 1.35rem; line-height: 1.25; margin: 2.6rem 0 0.2rem;
  padding-top: 1.4rem; border-top: 1px solid var(--line); letter-spacing: -0.01em;
}
h3 { font-size: 1.08rem; margin: 1.8rem 0 0.2rem; color: var(--gold); font-weight: 700; }
h4 { font-size: 0.95rem; margin: 1.4rem 0 0.2rem; color: var(--text); }
p { margin: 0.9rem 0; }
a { color: var(--blue); }
strong { color: #fff; }
hr { border: none; border-top: 1px solid var(--line); margin: 2rem 0; }
ul, ol { padding-left: 1.3rem; margin: 0.9rem 0; }
li { margin: 0.45rem 0; }
li::marker { color: var(--gold-dim); }

/* ---------- callouts ---------- */
.co { border-radius: 12px; padding: 1rem 1.1rem; margin: 1.4rem 0; border: 1px solid var(--line-strong); background: var(--surface); }
.co .co-tag {
  display: inline-block; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.13em;
  text-transform: uppercase; margin-bottom: 0.5rem; padding: 0.18rem 0.5rem; border-radius: 5px;
}
.co p { margin: 0.5rem 0; }
.co p:last-child { margin-bottom: 0; }

.co.edge { border-color: rgba(245, 185, 65, 0.45); background: linear-gradient(180deg, rgba(245, 185, 65, 0.07), rgba(245, 185, 65, 0.02)); }
.co.edge .co-tag { background: rgba(245, 185, 65, 0.15); color: var(--gold); }

.co.trap { border-color: rgba(255, 92, 92, 0.45); background: linear-gradient(180deg, rgba(255, 92, 92, 0.07), rgba(255, 92, 92, 0.02)); }
.co.trap .co-tag { background: rgba(255, 92, 92, 0.15); color: var(--red); }

.co.note { border-color: rgba(92, 168, 255, 0.4); }
.co.note .co-tag { background: rgba(92, 168, 255, 0.14); color: var(--blue); }

/* CLIP block — extractable short-form moment */
.clip {
  position: relative; border-radius: 14px; margin: 1.6rem 0;
  padding: 1.1rem 1.15rem 0.9rem;
  background:
    linear-gradient(var(--raised), var(--raised)) padding-box,
    linear-gradient(135deg, var(--gold), #ff5c5c 60%, var(--purple)) border-box;
  border: 1.5px solid transparent;
}
.clip .clip-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.55rem; }
.clip .clip-tag {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.14em; color: #0b0e14;
  background: var(--gold); border-radius: 5px; padding: 0.2rem 0.55rem; text-transform: uppercase;
}
.clip .clip-copy {
  background: none; border: 1px solid var(--line-strong); color: var(--muted);
  font-size: 0.72rem; border-radius: 6px; padding: 0.25rem 0.6rem; cursor: pointer; font-family: var(--sans);
}
.clip .clip-copy:active { color: var(--gold); border-color: var(--gold-dim); }
.clip p { margin: 0.5rem 0; }
.clip .clip-hook { font-weight: 700; font-size: 1.06rem; color: #fff; }

/* math block */
.math {
  font-family: var(--mono); font-size: 0.86rem; line-height: 1.7;
  background: #0d1119; border: 1px solid var(--line); border-radius: 10px;
  padding: 0.9rem 1rem; overflow-x: auto; margin: 1.2rem 0; white-space: pre;
}
.math .gold { color: var(--gold); }
.math .grn { color: var(--green); }
.math .red { color: var(--red); }
.math .dim { color: var(--faint); }

code { font-family: var(--mono); font-size: 0.88em; background: var(--raised); padding: 0.1em 0.35em; border-radius: 5px; }

/* gut-check (collapsible) */
details.gut { border: 1px solid var(--line-strong); border-radius: 10px; padding: 0; margin: 1.3rem 0; background: var(--surface); }
details.gut summary {
  cursor: pointer; padding: 0.8rem 1rem; font-weight: 700; font-size: 0.95rem;
  list-style: none; display: flex; gap: 0.5rem; align-items: center;
}
details.gut summary::before { content: "?"; color: var(--bg); background: var(--blue); border-radius: 50%; min-width: 1.25rem; height: 1.25rem; display: inline-flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 800; }
details.gut[open] summary { border-bottom: 1px solid var(--line); }
details.gut .gut-body { padding: 0.2rem 1rem 0.9rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- tables ---------- */
.tscroll { overflow-x: auto; margin: 1.3rem -0.25rem; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 0.86rem; min-width: 540px; }
.tscroll table { min-width: 560px; }
th {
  text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--faint); padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--line-strong);
  background: var(--surface); position: sticky; top: 0;
}
td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { font-family: var(--mono); font-size: 0.82rem; white-space: nowrap; }
.pos { color: var(--green); } .neg { color: var(--red); } .gold-t { color: var(--gold); }
.t-note { font-size: 0.78rem; color: var(--faint); margin: 0.5rem 0.25rem 0; }

/* ---------- figures / svg ---------- */
figure { margin: 1.5rem 0; }
figure svg { width: 100%; height: auto; display: block; border-radius: 12px; }
figcaption { font-size: 0.8rem; color: var(--faint); margin-top: 0.5rem; text-align: center; }

/* ---------- module footer nav ---------- */
.modnav { display: flex; gap: 0.75rem; margin: 3rem 0 1rem; }
.modnav a {
  flex: 1; text-decoration: none; border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 0.8rem 0.9rem; color: var(--text); background: var(--surface); min-width: 0;
}
.modnav a .dir { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); display: block; }
.modnav a .ttl { font-size: 0.9rem; font-weight: 700; display: block; margin-top: 0.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modnav a.next { text-align: right; }
.modnav a.locked .ttl::after { content: " 🔒"; font-size: 0.75rem; }

/* ---------- footer ---------- */
.ftr { border-top: 1px solid var(--line); margin-top: 2rem; }
.ftr-in { max-width: var(--maxw); margin: 0 auto; padding: 1.6rem var(--pad) 2.6rem; color: var(--faint); font-size: 0.78rem; line-height: 1.6; }
.ftr-in a { color: var(--muted); }
.ftr-in .risk { border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 0.95rem; margin-top: 1rem; background: var(--surface); }

/* ---------- landing ---------- */
.hero { padding: 2.6rem 0 1.4rem; text-align: left; }
.hero h1 { font-size: 2.3rem; line-height: 1.08; letter-spacing: -0.025em; margin: 0.8rem 0; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero .sub { color: var(--muted); font-size: 1.1rem; max-width: 36rem; }
.hero .kicker { font-family: var(--mono); color: var(--gold); font-size: 0.8rem; letter-spacing: 0.15em; text-transform: uppercase; }
.cta-row { display: flex; gap: 0.7rem; margin: 1.6rem 0; flex-wrap: wrap; }
.btn {
  display: inline-block; text-decoration: none; font-weight: 700; border-radius: 10px;
  padding: 0.78rem 1.25rem; font-size: 0.98rem; text-align: center; border: 1px solid transparent;
  font-family: var(--sans); cursor: pointer;
}
.btn.primary { background: var(--gold); color: #14100a; }
.btn.primary:active { background: #ffd town; }
.btn.ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn.block { display: block; width: 100%; }

.modgrid { display: grid; grid-template-columns: 1fr; gap: 0.7rem; margin: 1.2rem 0; }
.modcard {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 14px;
  padding: 0.95rem 1.05rem; text-decoration: none; color: var(--text); display: block; position: relative;
}
.modcard:active { background: var(--raised); }
.modcard .mc-num { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); }
.modcard .mc-ttl { font-weight: 750; font-size: 1.02rem; margin: 0.25rem 0 0.3rem; line-height: 1.3; }
.modcard .mc-desc { color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.modcard .mc-badge {
  position: absolute; top: 0.9rem; right: 0.95rem; font-size: 0.64rem; font-weight: 800;
  letter-spacing: 0.1em; text-transform: uppercase; padding: 0.16rem 0.45rem; border-radius: 5px;
}
.modcard .mc-badge.free { background: rgba(46, 204, 143, 0.15); color: var(--green); }
.modcard .mc-badge.pro { background: rgba(245, 185, 65, 0.15); color: var(--gold); }
.modcard.locked { opacity: 0.92; }

.secband { margin-top: 2.4rem; }
.secband .sb-kicker { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.secband h2 { border: none; padding-top: 0.2rem; margin-top: 0.2rem; }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin: 1.6rem 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 0.6rem; text-align: center; }
.stat .v { font-family: var(--mono); font-weight: 700; font-size: 1.15rem; color: var(--gold); display: block; }
.stat .k { font-size: 0.68rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- calculators ---------- */
.calc { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 16px; padding: 1.15rem; margin: 1.4rem 0; }
.calc h3 { margin-top: 0; }
.cfield { margin: 0.9rem 0; }
.cfield label { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.84rem; color: var(--muted); font-weight: 600; margin-bottom: 0.35rem; }
.cfield label output { font-family: var(--mono); color: var(--gold); font-size: 0.95rem; }
.cfield input[type="range"] { width: 100%; accent-color: var(--gold); height: 2rem; }
.cfield input[type="number"], .cfield select, .cfield input[type="text"], .cfield input[type="password"] {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 0.7rem 0.8rem; font-size: 1rem; font-family: var(--mono);
}
.cfield input:focus, .cfield select:focus { outline: 2px solid var(--gold-dim); border-color: var(--gold-dim); }
.cgrid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.8rem; }
.cresults { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-top: 1.1rem; }
.cres { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 0.7rem 0.8rem; }
.cres .rv { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; display: block; line-height: 1.2; }
.cres .rk { font-size: 0.68rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; }
.cres.wide { grid-column: 1 / -1; }
canvas.chart { width: 100%; height: auto; border-radius: 12px; background: #0d1119; border: 1px solid var(--line); margin-top: 1rem; display: block; }
.verdict { border-radius: 12px; padding: 0.9rem 1rem; margin-top: 1rem; font-size: 0.95rem; border: 1px solid; }
.verdict.ok { border-color: rgba(46,204,143,.5); background: rgba(46,204,143,.08); }
.verdict.warn { border-color: rgba(245,185,65,.5); background: rgba(245,185,65,.08); }
.verdict.bad { border-color: rgba(255,92,92,.5); background: rgba(255,92,92,.08); }

/* unlock page */
.unlock-box { max-width: 26rem; margin: 1.5rem auto; }
.price-card { border: 1px solid var(--line-strong); border-radius: 16px; padding: 1.3rem; background: var(--surface); margin: 1rem 0; }
.price-card.feat { border-color: var(--gold-dim); background: linear-gradient(180deg, rgba(245,185,65,.06), var(--surface)); }
.price-card .pc-name { font-weight: 800; font-size: 1.05rem; }
.price-card .pc-price { font-family: var(--mono); font-size: 1.9rem; font-weight: 700; color: var(--gold); margin: 0.3rem 0; }
.price-card .pc-price s { color: var(--faint); font-size: 1.1rem; margin-right: 0.5rem; }
.price-card ul { margin: 0.7rem 0 0.4rem; padding-left: 1.15rem; font-size: 0.9rem; }
.field-err { color: var(--red); font-size: 0.85rem; margin-top: 0.5rem; min-height: 1.2em; }
.field-ok { color: var(--green); font-size: 0.85rem; margin-top: 0.5rem; }

/* checklist */
ul.check { list-style: none; padding-left: 0; }
ul.check li { padding-left: 1.7rem; position: relative; }
ul.check li::before { content: "✓"; position: absolute; left: 0.2rem; color: var(--green); font-weight: 800; }
ul.cross { list-style: none; padding-left: 0; }
ul.cross li { padding-left: 1.7rem; position: relative; }
ul.cross li::before { content: "✕"; position: absolute; left: 0.2rem; color: var(--red); font-weight: 800; }

/* ---------- wider screens ---------- */
@media (min-width: 700px) {
  body { font-size: 1.085rem; }
  .mhero h1 { font-size: 2.3rem; }
  .hero h1 { font-size: 3rem; }
  .modgrid { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  main { padding-top: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

::selection { background: rgba(245, 185, 65, 0.3); }
