/* trades.run blog skin — ALL viewports, BOTH themes.
   (Was core/static/core/mobile/blog.css, loaded only for mobile UAs, and it
   hard-coded the dark palette with !important on every rule. That made the blog
   two different products: phones got Fraunces headlines, mono stat tiles and the
   brand green, while desktop — the public, indexed, stranger-facing half — got
   system sans on white with a generic blue accent.)

   This file now carries only what is true in BOTH themes: the typographic
   system, the shapes, and the spacing. Every colour comes from a var() token
   defined in blog_post.html / blog_index.html, which set light values on :root
   and dark values on [data-theme="dark"]. Nothing here hard-codes a colour
   except where a value is theme-independent.

   Load order matters: the templates' inline <style> comes first, so these rules
   win at equal specificity without needing !important. */

/* ---------------------------------------------------------------- type */
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Headlines carry the editorial voice — Fraunces italic, as on mobile and in
   the report's takeaway. */
h1,
.post-card h2 a {
  font-family: Fraunces, Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.28;
}

/* Section headings stay in the UI face: they are signposts, not voice. */
main h2,
main h3 {
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  font-style: normal;
  letter-spacing: -0.01em;
}

/* The micro-label convention: mono, tracked out, uppercase. This one rule is
   most of what makes the mobile report read like an instrument panel. */
.eyebrow,
.q-label,
.ce-label,
.stat-tile .s-label,
.s-label,
.chart-title,
.table-wrap thead th {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Every number in mono with tabular figures, so columns line up. */
.stat-tile .s-value,
.s-value,
.table-wrap td,
.post-card .stat strong {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- header */
.site-header {
  backdrop-filter: blur(10px);
}
.site-header .brand {
  font-weight: 700;
  letter-spacing: -0.01em;
}
.site-header .cta,
.site-header a.cta,
.footer-cta,
a.footer-cta {
  background: var(--cta-bg);
  color: var(--cta-ink);
  border: none;
  border-radius: 12px;
  font-weight: 700;
}
.site-header .cta:hover,
.footer-cta:hover {
  filter: brightness(1.06);
  text-decoration: none;
}

/* ---------------------------------------------------------------- hero */
/* The article opens with its headline number, the same figure the /history/
   card and the mobile app show (blog.py takes stats[0]). */
.post-hero {
  margin: 6px 0 22px;
}
.post-hero .ph-value {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: clamp(38px, 6vw, 58px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-green);
  text-shadow: var(--hero-glow);
  word-break: break-word;
}
.post-hero .ph-label {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 7px;
}

/* ---------------------------------------------------------------- chrome */
.ticker-tag {
  background: var(--bg-accent);
  color: var(--accent-green);
  border: 1px solid var(--border-accent);
  border-radius: 7px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  text-transform: none;
}
.quality-chip,
.post-card .quality {
  background: var(--bg-accent);
  color: var(--accent-green);
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
}

/* Research question — the human voice again. */
.question-card {
  background: var(--bg-accent);
  border: 1px solid var(--border-accent);
  border-radius: 16px;
}
.question-card p,
.question-card .q-text {
  font-family: Fraunces, Georgia, serif;
  font-style: italic;
  color: var(--text);
}

/* ---------------------------------------------------------------- blocks */
.stats-grid {
  gap: 10px;
}
.stat-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.stat-tile .s-value,
.s-value {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.stat-tile .s-context,
.s-context {
  color: var(--text-muted);
}

figure {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 14px 12px;
}
.chart-mount {
  border: none;
  background: transparent;
}
/* Explainer as an inset slab with a brand rule, tucked under its own chart. */
.chart-explainer {
  background: var(--bg);
  border-left: 3px solid var(--border-accent);
  border-radius: 10px;
}
.chart-explainer p {
  color: var(--text-muted);
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-subtle);
  padding: 4px 6px;
}
.table-wrap table th,
.table-wrap table td {
  white-space: nowrap;
}
.table-wrap td {
  color: var(--text-muted);
}

/* The takeaway is the conclusion — accent surround, serif voice. */
.takeaway {
  background: var(--bg-accent);
  border: 1px solid var(--border-accent);
  border-radius: 16px;
}
.takeaway p {
  font-family: Fraunces, Georgia, serif;
  font-style: italic;
  color: var(--text);
}

ul.caveats li {
  color: var(--text-muted);
}

.post-nav a {
  color: var(--accent-green);
}
.post-footer {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 16px;
}

/* ---------------------------------------------------------------- index */
.post-card {
  border-bottom: 1px solid var(--border);
}
.post-card h2 a {
  color: var(--text);
}
.post-card h2 a:hover {
  color: var(--accent-green);
}
.post-card .stat {
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- phones */
@media (max-width: 640px) {
  main {
    max-width: 640px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
  .stat-tile .s-value,
  .s-value {
    font-size: 1.15rem;
  }
}
