/* Shared styling for the /guides/* calculator pages.
 *
 * Tokens are copied from landing.html deliberately rather than imported: the
 * landing page keeps its CSS inline for first-paint reasons, and a guide page
 * that drifted to a different blue would read as a different site. If the
 * landing tokens change, change them here too — tests/guides.test.js pins the
 * accent and background so the two cannot silently diverge.
 */
:root {
  --bg: #060810;
  --bg-1: #0b0f1a;
  --bg-2: #111627;
  --bg-3: #1a2138;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #eef1fa;
  --text-dim: #9aa3c0;
  --text-mute: #5b647f;
  --accent: #6aa1ff;
  --accent-2: #8b7bff;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --warn: #ffb547;
  --grad: linear-gradient(120deg, #6aa1ff 0%, #8b7bff 55%, #c26bff 100%);
  --radius: 18px;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  line-height: 1.6;
}
::selection { background: rgba(106, 161, 255, .3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Ambient background ──────────────────────────────────────────────── */
.glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(60vw 50vh at 15% -5%, rgba(106, 161, 255, .13), transparent 60%),
    radial-gradient(50vw 45vh at 92% 8%, rgba(139, 123, 255, .11), transparent 62%);
}
.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 22px; }

/* ── Header ──────────────────────────────────────────────────────────── */
.gnav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(6, 8, 16, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.gnav-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15.5px; letter-spacing: -.2px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-dot { width: 22px; height: 22px; border-radius: 7px; background: var(--grad); }
.gnav-cta {
  padding: 8px 16px; border-radius: 10px; background: var(--grad);
  color: #fff; font-weight: 700; font-size: 13px; white-space: nowrap;
}
.gnav-cta:hover { text-decoration: none; opacity: .92; }

/* ── Hero ────────────────────────────────────────────────────────────── */
.ghero { padding: 46px 0 26px; }
.crumb { font-size: 12.5px; color: var(--text-mute); margin-bottom: 14px; }
.crumb a { color: var(--text-dim); }
h1 {
  font-size: clamp(28px, 4.6vw, 44px); line-height: 1.12; letter-spacing: -1px;
  font-weight: 850; margin-bottom: 14px;
}
h1 .hl {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lede { font-size: 16.5px; color: var(--text-dim); max-width: 700px; }

/* ── Standout metric cards — the numbers people came for ─────────────── */
.metrics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin: 30px 0 26px;
}
.metric {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border); border-radius: 16px; padding: 18px 18px 16px;
}
/* The colour bar is the at-a-glance signal — profit, loss, or neutral. */
.metric::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--accent); opacity: .85;
}
.metric.is-good::before { background: var(--good); }
.metric.is-bad::before { background: var(--bad); }
.metric.is-warn::before { background: var(--warn); }
.metric-k {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-mute); margin-bottom: 9px;
}
.metric-v {
  font-family: var(--mono); font-size: clamp(26px, 3.5vw, 34px); font-weight: 700;
  letter-spacing: -1px; line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: color .18s ease;
}
.metric.is-good .metric-v { color: var(--good); }
.metric.is-bad .metric-v { color: var(--bad); }
.metric.is-warn .metric-v { color: var(--warn); }
.metric-sub { font-size: 12px; color: var(--text-mute); margin-top: 7px; }

/* A value that just changed gets a brief pulse — makes the link between
   moving a slider and the number responding impossible to miss. */
@keyframes pulse { 0% { opacity: .35; } 100% { opacity: 1; } }
.metric-v.flash { animation: pulse .28s ease; }

/* ── Calculator panel ────────────────────────────────────────────────── */
.calc {
  background: linear-gradient(170deg, rgba(17, 22, 39, .9), rgba(11, 15, 26, .9));
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 22px; margin-bottom: 30px;
}
.calc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.calc-title { font-size: 16px; font-weight: 800; letter-spacing: -.3px; }
.calc-note { font-size: 12px; color: var(--text-mute); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 13px; margin-bottom: 20px; }
.field label {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-mute); margin-bottom: 6px;
}
.field input, .field select {
  width: 100%; background: var(--bg); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 10px 12px; color: var(--text);
  font-family: var(--mono); font-size: 14.5px; font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106, 161, 255, .15);
}
.field input.bad { border-color: var(--bad); }
.field-hint { font-size: 11px; color: var(--text-mute); margin-top: 5px; }

/* ── Payoff chart ────────────────────────────────────────────────────── */
.chart-wrap { position: relative; }
.chart-scroll { overflow-x: auto; }
svg.payoff { display: block; width: 100%; min-width: 460px; height: auto; }
.axis-line { stroke: var(--border-strong); stroke-width: 1; }
.zero-line { stroke: var(--text-mute); stroke-width: 1; stroke-dasharray: 3 4; opacity: .75; }
.grid-line { stroke: rgba(255, 255, 255, .05); stroke-width: 1; }
.pl-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.tick { font-family: var(--mono); font-size: 10.5px; fill: var(--text-mute); }
.strike-mark { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 3; opacity: .5; }
.be-mark { stroke: var(--warn); stroke-width: 1.5; stroke-dasharray: 4 3; }
.be-label { font-family: var(--mono); font-size: 10.5px; fill: var(--warn); font-weight: 700; }
.spot-dot { fill: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--text-dim); }
.legend i { display: inline-block; width: 11px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ── Prose ───────────────────────────────────────────────────────────── */
.sec { padding: 34px 0; border-top: 1px solid var(--border); }
h2 { font-size: clamp(21px, 2.8vw, 27px); letter-spacing: -.5px; font-weight: 800; margin-bottom: 14px; }
h3 { font-size: 16.5px; font-weight: 750; margin: 22px 0 8px; letter-spacing: -.2px; }
.sec p { color: var(--text-dim); margin-bottom: 13px; max-width: 760px; }
.sec ul { color: var(--text-dim); margin: 0 0 14px 20px; }
.sec li { margin-bottom: 7px; }
strong { color: var(--text); font-weight: 700; }

/* Formula callout — the thing a searcher screenshots. */
.formula {
  background: var(--bg-1); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  border-radius: 10px; padding: 14px 16px; margin: 14px 0 18px;
  font-family: var(--mono); font-size: 13.5px; color: var(--text);
  overflow-x: auto; white-space: pre; line-height: 1.75;
}
.callout {
  background: rgba(255, 181, 71, .07); border: 1px solid rgba(255, 181, 71, .22);
  border-radius: 12px; padding: 14px 16px; margin: 16px 0;
  font-size: 14px; color: var(--text-dim);
}
.callout b { color: var(--warn); }

table.spec { width: 100%; border-collapse: collapse; margin: 14px 0 18px; font-size: 14px; }
table.spec th, table.spec td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
table.spec th { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-mute); font-weight: 700; }
table.spec td { color: var(--text-dim); }
table.spec td:first-child { color: var(--text); font-weight: 600; }
.tbl-scroll { overflow-x: auto; }

/* ── FAQ ─────────────────────────────────────────────────────────────── */
details.faq-item {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px; background: var(--bg-1);
}
details.faq-item summary {
  cursor: pointer; font-weight: 650; font-size: 15px; list-style: none;
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after { content: "+"; color: var(--accent); font-weight: 700; font-size: 19px; line-height: 1; }
details.faq-item[open] summary::after { content: "−"; }
details.faq-item .fa { color: var(--text-dim); font-size: 14.5px; margin-top: 10px; }

/* ── CTA + footer ────────────────────────────────────────────────────── */
.cta-band {
  background: linear-gradient(150deg, rgba(106, 161, 255, .1), rgba(139, 123, 255, .07));
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 30px 26px; text-align: center; margin: 34px 0;
}
.cta-band h2 { margin-bottom: 10px; }
.cta-band p { color: var(--text-dim); margin: 0 auto 20px; max-width: 560px; }
.btn-primary {
  display: inline-block; padding: 13px 30px; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 750; font-size: 15px;
}
.btn-primary:hover { text-decoration: none; opacity: .93; }
.cta-fine { font-size: 12px; color: var(--text-mute); margin-top: 12px; }

.gfoot { border-top: 1px solid var(--border); padding: 26px 0 40px; font-size: 13px; color: var(--text-mute); }
.gfoot-links { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 14px; }
.gfoot-links a { color: var(--text-dim); }
.risk-note { max-width: 760px; line-height: 1.65; }

@media (max-width: 620px) {
  .ghero { padding: 32px 0 20px; }
  .metrics { gap: 11px; }
  .calc { padding: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
