/* 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 {
  /* Colour now comes from theme.css — nine palettes in dark and light.
     Keeping a copy here would silently win over the theme on all 23 guide
     pages, which is the drift the old sync test was written to catch. */
  --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: color-mix(in srgb, var(--accent) 30%, transparent); }
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%, color-mix(in srgb, var(--accent) 13%, transparent), transparent 60%),
    radial-gradient(50vw 45vh at 92% 8%, color-mix(in srgb, var(--accent-2) 11%, transparent), transparent 62%);
}
/* The frame, from the token, so /guides and its 28 sub-pages sit on the same
   column as every other page. This was 1080px with a 22px gutter against the
   header's 1160/24, which is how one page ended up showing three widths. */
.wrap { position: relative; z-index: 1; max-width: var(--page-measure, 1240px); margin: 0 auto; padding: 0 var(--page-gutter, 24px); }

/* ── Header ──────────────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15.5px; letter-spacing: -.2px; color: var(--text); }
/* The logo's underline exemption moved into site-header.html, which owns the
   markup — .brand was this page's OLD logo class and nothing loading this
   stylesheet renders it any more, so the rule here guarded nothing while the
   real logo (.gv-logo) underlined on hover. */
.brand-dot { width: 22px; height: 22px; border-radius: 7px; background: var(--grad); }

/* ── 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, color-mix(in srgb, var(--bg-2) 90%, transparent), color-mix(in srgb, var(--bg-1) 90%, transparent));
  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;
  /* Explicit, and shared. A select is laid out from its own intrinsic metrics
     rather than from the padding that governs an input, so identical padding
     still rendered it visibly shorter than the boxes beside it. Pinning the
     height on both is the only way to guarantee they line up across browsers,
     rather than hoping two different default layouts happen to agree. */
  height: 42px;
  line-height: 1.2;
}
.field select {
  /* Sized to its longest option instead of filling the grid cell: a two-word
     dropdown stretched to the width of a price field reads as a text box the
     user cannot type in. The extra right padding leaves room for the native
     chevron, which appearance:none would otherwise have to be redrawn. */
  width: auto;
  min-width: 7.5rem;
  max-width: 100%;
  padding-right: 30px;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.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: color-mix(in srgb, var(--tint) 5%, transparent); 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: color-mix(in srgb, var(--warn) 7%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent);
  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 ────────────────────────────────────────────────────── */
/* The one link out to the live feature page. Reads as a quiet aside
   between the prose and the sign-up band, not a second call to action
   competing with it. */
.pl-callout {
  margin: 34px 0 0; padding: 20px 22px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm, 11px); background: var(--bg-1);
}
.pl-callout h2 { font-size: 17px; margin: 0 0 8px; }
.pl-callout p { color: var(--text-dim); margin: 0 0 14px; max-width: 62ch; font-size: 14.5px; line-height: 1.6; }
.pl-callout-link { font-weight: 600; color: var(--accent); text-decoration: none; }
.pl-callout-link:hover { text-decoration: underline; }

.cta-band {
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 10%, transparent), color-mix(in srgb, var(--accent-2) 7%, transparent));
  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; }
}

/* ── Cards ────────────────────────────────────────────────────────────
   These were inline in the /guides route, which was fine while that page
   was the only thing using them. The Alpaca hub is a static file that
   loads this stylesheet and nothing else, so a second copy would have been
   two definitions free to drift. One home. */
.guide-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:16px; margin:28px 0 40px; }
.guide-card { display:block; background:linear-gradient(160deg,var(--bg-2),var(--bg-1));
  border:1px solid var(--border); border-radius:16px; padding:20px;
  transition:border-color .16s ease, transform .16s ease; }
.guide-card:hover { border-color:var(--accent); transform:translateY(-2px); text-decoration:none; }
.guide-card h3 { font-size:16.5px; font-weight:800; letter-spacing:-.3px; margin:0 0 8px; color:var(--text); }
.guide-card p { font-size:13.5px; color:var(--text-dim); line-height:1.55; margin:0; }
.guide-card-t { font-size:16.5px; font-weight:800; letter-spacing:-.3px; margin-bottom:8px; color:var(--text); }
.guide-card-b { font-size:13.5px; color:var(--text-dim); line-height:1.55; margin-bottom:14px; }
.guide-card-go { font-size:13px; font-weight:700; color:var(--accent); }
.guide-card-i { color:var(--text-mute); margin-bottom:12px; }
.guide-card-i svg { display:block; width:52px; height:30px; overflow:visible; }
.guide-card:hover .guide-card-i { color:var(--accent); }
.guide-group { font-size:12px; font-weight:800; letter-spacing:.1em; text-transform:uppercase;
  color:var(--text-mute); margin:26px 0 2px; }
.guide-group:first-of-type { margin-top:0; }

/* An inline conversion prompt, mid-article. Deliberately quieter than the
   footer band — it should read as the next step, not as an interruption. */
.callout.is-cta { border-color:var(--accent); background:linear-gradient(160deg,color-mix(in srgb, var(--accent) 10%, transparent),transparent); }
.callout.is-cta .btn-primary { display:inline-block; margin-top:12px; }

/* Tables inside a guide. The wrapper already scrolls; this is the grid. */
.tbl-scroll table { width:100%; border-collapse:collapse; font-size:13.5px; }
.tbl-scroll th { text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.06em;
  color:var(--text-mute); padding:8px 12px; border-bottom:1px solid var(--border); white-space:nowrap; }
.tbl-scroll td { padding:10px 12px; border-bottom:1px solid var(--border); color:var(--text-dim);
  line-height:1.5; vertical-align:top; }
.tbl-scroll tr:last-child td { border-bottom:none; }
.tbl-scroll td:first-child { color:var(--text); font-weight:600; }
