/* TBredIQ — Editorial / Data-Terminal design system
   --------------------------------------------------
   A single stylesheet that every page links once. No glass-blur, no
   gradients, no AI-default tells. Broadsheet typography, hairline
   rules, tabular figures, one accent color used ruthlessly.

   Type:   Newsreader (display) + IBM Plex Sans (body) + IBM Plex Mono (numerics)
   Color:  warm-dark ink #0e0d10 + paper-inverted off-white + signal-green
   Motion: restrained — one staggered page-load reveal; respects reduced-motion */

/* ── 1. RESET + BASE ─────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: 'kern' 1, 'liga' 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
a { color: inherit; }


/* ── 2. DESIGN TOKENS ────────────────────────────────────────────── */

:root {
  /* Color — single accent, ruthlessly used */
  --ink:        #0e0d10;          /* warm-dark background */
  --ink-2:      #16151a;          /* one shade up — block backgrounds */
  --ink-3:      #1d1c22;          /* two shades up — table stripe */
  --paper:      #e8e5dd;          /* paper-inverted off-white body */
  --paper-2:    #b9b6ae;          /* secondary text */
  --paper-3:    #787579;          /* muted / metadata */
  --rule:       #262428;          /* hairline rules */
  --rule-strong:#3a373d;          /* bolder rule */
  --signal:     #16a34a;          /* THE accent — signal-green */
  --signal-2:   #22c55e;          /* signal hover/active */
  --fade:       #b91c1c;          /* anti-signal red — broken / negative */
  --fade-2:     #fca5a5;          /* anti-signal text */

  /* Typography */
  --font-display: 'Newsreader', 'Iowan Old Style', 'Charter', Georgia, serif;
  --font-body:    'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'JetBrains Mono', monospace;

  /* Type scale — editorial, restrained */
  --t-display: clamp(2.4rem, 1.4rem + 4vw, 4.4rem);   /* hero headline */
  --t-h1:      clamp(1.9rem, 1.4rem + 2vw, 2.8rem);
  --t-h2:      clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem);
  --t-h3:      1.18rem;
  --t-body:    1rem;
  --t-meta:    0.82rem;
  --t-micro:   0.72rem;

  /* Space */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;
  --s-9: 6rem;

  /* Layout */
  --container: 76rem;
  --container-narrow: 56rem;
  --container-text:   38rem;

  /* Motion */
  --ease:  cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 120ms;
  --t-med:  220ms;
  --t-slow: 420ms;
}


/* ── 3. EDITORIAL TYPOGRAPHY ─────────────────────────────────────── */

.tbq-display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-display);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-5) 0;
}

.tbq-h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-h1);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--s-4) 0;
}

.tbq-h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-h2);
  line-height: 1.18;
  letter-spacing: -0.012em;
  margin: 0 0 var(--s-3) 0;
}

.tbq-h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-h3);
  letter-spacing: 0.005em;
  margin: 0 0 var(--s-3) 0;
}

.tbq-eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-3);
  margin: 0 0 var(--s-3) 0;
}

.tbq-eyebrow.is-signal { color: var(--signal); }
.tbq-eyebrow.is-fade   { color: var(--fade-2); }

.tbq-lede {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 1.32rem;
  line-height: 1.45;
  color: var(--paper-2);
  max-width: var(--container-text);
}

.tbq-meta {
  font-family: var(--font-body);
  font-size: var(--t-meta);
  color: var(--paper-3);
  letter-spacing: 0.005em;
}

.tbq-num {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1, 'zero' 1, 'ss01' 1;
  font-variant-numeric: tabular-nums slashed-zero;
}


/* ── 4. LAYOUT — broadsheet grid ─────────────────────────────────── */

.tbq-page { min-height: 100vh; display: flex; flex-direction: column; }

.tbq-container        { width: 100%; max-width: var(--container);        margin: 0 auto; padding: 0 var(--s-5); }
.tbq-container.narrow { max-width: var(--container-narrow); }
.tbq-container.text   { max-width: var(--container-text); }

.tbq-section { padding: var(--s-8) 0; }
.tbq-section.tight  { padding: var(--s-6) 0; }
.tbq-section.loose  { padding: var(--s-9) 0; }

.tbq-hairline { border-top: 1px solid var(--rule); }
.tbq-hairline-strong { border-top: 1px solid var(--rule-strong); }

.tbq-rule {
  display: block;
  width: 100%;
  height: 1px;
  background: var(--rule);
  margin: var(--s-5) 0;
  border: 0;
}

/* Hung-headline editorial grid: label column + content column */
.tbq-grid-hung {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: var(--s-5);
  align-items: baseline;
}
@media (max-width: 700px) {
  .tbq-grid-hung { grid-template-columns: 1fr; gap: var(--s-2); }
}

.tbq-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
}
.tbq-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4); }
@media (max-width: 760px) {
  .tbq-grid-3, .tbq-grid-2 { grid-template-columns: 1fr; }
}


/* ── 5. NAV + FOOTER (broadsheet masthead) ───────────────────────── */

.tbq-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(14, 13, 16, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.tbq-nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.tbq-brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-2);
  text-decoration: none;
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: -0.01em;
}
.tbq-brand-mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--signal);
  transform: translateY(-1px);
}
.tbq-nav-links { display: flex; gap: var(--s-5); align-items: center; }
.tbq-nav-link {
  text-decoration: none;
  color: var(--paper-2);
  font-size: 0.92rem;
  letter-spacing: 0.005em;
  transition: color var(--t-fast) var(--ease);
}
.tbq-nav-link:hover,
.tbq-nav-link:focus-visible { color: var(--paper); }
.tbq-nav-link.is-active { color: var(--signal); }
@media (max-width: 700px) {
  .tbq-nav-links .is-secondary { display: none; }
}

.tbq-footer {
  margin-top: auto;
  border-top: 1px solid var(--rule);
  padding: var(--s-6) 0;
  font-size: var(--t-meta);
  color: var(--paper-3);
}
.tbq-footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-5);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-4);
}
.tbq-footer a { color: var(--paper-3); text-decoration: none; }
.tbq-footer a:hover { color: var(--paper-2); }


/* ── 6. HERO (broadsheet front-page treatment) ───────────────────── */

.tbq-hero {
  padding: var(--s-9) 0 var(--s-8) 0;
  border-bottom: 1px solid var(--rule);
}
.tbq-hero-eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--t-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--signal);
  margin: 0 0 var(--s-5) 0;
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.tbq-hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--signal);
}

.tbq-hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-display);
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin: 0 0 var(--s-5) 0;
  max-width: 22ch;
}
.tbq-hero h1 em {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  color: var(--signal);
}


/* ── 7. CALLOUT, PULL-QUOTE, RULE-BLOCK ──────────────────────────── */

.tbq-callout {
  border-left: 2px solid var(--signal);
  padding: var(--s-2) 0 var(--s-2) var(--s-5);
  margin: var(--s-5) 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.18rem;
  line-height: 1.45;
  color: var(--paper);
}
.tbq-callout cite {
  display: block;
  margin-top: var(--s-2);
  font-style: normal;
  font-family: var(--font-body);
  font-size: var(--t-meta);
  color: var(--paper-3);
  letter-spacing: 0.04em;
}
.tbq-callout.is-fade { border-left-color: var(--fade); }

.tbq-block {
  background: var(--ink-2);
  border: 1px solid var(--rule);
  padding: var(--s-5);
}
.tbq-block.tight { padding: var(--s-4); }


/* ── 8. STAT (data-density figure block) ─────────────────────────── */

.tbq-stat {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.tbq-stat-label {
  font-size: var(--t-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-3);
}
.tbq-stat-value {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1, 'zero' 1;
  font-variant-numeric: tabular-nums slashed-zero;
  font-size: 1.95rem;
  line-height: 1;
  color: var(--paper);
  letter-spacing: -0.02em;
}
.tbq-stat-value.is-signal { color: var(--signal); }
.tbq-stat-value.is-fade   { color: var(--fade-2); }
.tbq-stat-foot {
  font-size: var(--t-micro);
  color: var(--paper-3);
  margin-top: var(--s-1);
}


/* ── 9. BADGES ───────────────────────────────────────────────────── */

.tbq-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid currentColor;
  border-radius: 0;
  vertical-align: middle;
  line-height: 1;
}
.tbq-badge.is-signal   { color: var(--signal); border-color: var(--signal); }
.tbq-badge.is-fade     { color: var(--fade-2); border-color: var(--fade); background: rgba(185, 28, 28, 0.06); }
.tbq-badge.is-mid      { color: var(--paper-2); border-color: var(--rule-strong); }
.tbq-badge.is-standout { color: var(--signal); border-color: var(--signal); background: rgba(22, 163, 74, 0.08); }


/* ── 10. BUTTON ──────────────────────────────────────────────────── */

.tbq-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 20px;
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  text-decoration: none;
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--paper-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.tbq-btn:hover { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.tbq-btn.is-primary {
  background: var(--signal);
  color: #051a0c;
  border-color: var(--signal);
}
.tbq-btn.is-primary:hover {
  background: var(--signal-2);
  color: #051a0c;
  border-color: var(--signal-2);
}
.tbq-btn.is-ghost { border-color: var(--rule-strong); color: var(--paper-2); }
.tbq-btn.is-ghost:hover { background: var(--ink-2); color: var(--paper); border-color: var(--paper-3); }


/* ── 11. PICKS — top-edge tile + table row ───────────────────────── */

.tbq-edges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.tbq-edge-tile {
  padding: var(--s-5);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease);
  text-decoration: none;
  color: inherit;
}
.tbq-edge-tile:last-child { border-right: 0; }
.tbq-edge-tile:hover { background: var(--ink-2); }
.tbq-edge-tile.is-broken { opacity: 0.78; }
@media (max-width: 760px) {
  .tbq-edges { grid-template-columns: 1fr; }
  .tbq-edge-tile { border-right: 0; border-bottom: 1px solid var(--rule); }
  .tbq-edge-tile:last-child { border-bottom: 0; }
}

.tbq-edge-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.tbq-edge-meta-track {
  font-family: var(--font-body);
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-3);
}
.tbq-edge-horse {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.32rem;
  line-height: 1.18;
  color: var(--paper);
  margin: var(--s-1) 0 0 0;
  letter-spacing: -0.015em;
}
.tbq-edge-horse .post {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--paper-3);
  margin-right: 4px;
}
.tbq-edge-line {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: var(--paper-2);
  font-variant-numeric: tabular-nums slashed-zero;
}
.tbq-edge-line .price { color: var(--signal); margin-left: var(--s-2); }
.tbq-edge-rationale {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--paper-2);
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: 1px solid var(--rule);
}


/* ── 12. PICK ROW (table) ────────────────────────────────────────── */

.tbq-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.92rem;
}
.tbq-table th {
  text-align: left;
  font-weight: 600;
  font-size: var(--t-micro);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--rule-strong);
}
.tbq-table td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.tbq-table tbody tr:hover { background: var(--ink-2); }
.tbq-table tbody tr.is-broken { opacity: 0.78; }
.tbq-table .is-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums slashed-zero;
  text-align: right;
}


/* ── 13. FOCUS, LINKS, A11Y ──────────────────────────────────────── */

a:focus-visible,
button:focus-visible,
.tbq-btn:focus-visible,
.tbq-edge-tile:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

::selection { background: var(--signal); color: #051a0c; }


/* ── 14. MOTION — one staggered reveal, respects reduced-motion ──── */

.tbq-reveal { opacity: 0; transform: translateY(8px); animation: tbq-reveal var(--t-slow) var(--ease) forwards; }
.tbq-reveal[data-d="1"] { animation-delay: 60ms; }
.tbq-reveal[data-d="2"] { animation-delay: 120ms; }
.tbq-reveal[data-d="3"] { animation-delay: 180ms; }
.tbq-reveal[data-d="4"] { animation-delay: 240ms; }
.tbq-reveal[data-d="5"] { animation-delay: 300ms; }
@keyframes tbq-reveal {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .tbq-reveal { opacity: 1; transform: none; }
}


/* ── 15. PAPER GRAIN (subtle atmospheric texture) ────────────────── */

.tbq-grain::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}


/* ── 16. UTILITY ─────────────────────────────────────────────────── */

.tbq-mute { color: var(--paper-3); }
.tbq-signal { color: var(--signal); }
.tbq-fade { color: var(--fade-2); }
.tbq-italic { font-style: italic; font-family: var(--font-display); }
.tbq-no-deco { text-decoration: none; }
.tbq-stack { display: flex; flex-direction: column; gap: var(--s-3); }
.tbq-row   { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.tbq-spread { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.tbq-hide-mobile { @media (max-width: 700px) { display: none; } }
