/* Site-wide base styles. Shared across portfolios, rankings, how-it-works,
 * backtest pages, etc. Page-specific styles (chart, holdings-table, etc.)
 * stay inline in the respective view files. */

:root {
  --bg: #0a0a0a; --surface: #141414; --surface-elev: #1c1c1c;
  --text-primary: #f5f5f5; --text-secondary: #9a9a9a; --text-muted: #555555;
  /* Trenyx electric yellow on near-black. Differentiates from the sea of
   * fintech blue (Robinhood, Vanguard, Fidelity, eToro all use blue/green). */
  --accent: #FFD600; --accent-dim: #5c4d00;
  --positive: #3fb950; --positive-dim: #1f4a26;
  --negative: #f85149; --negative-dim: #5a1f1c;
  --border: #222222; --border-strong: #333333;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg); color: var(--text-primary);
  /* Inter site-wide (prose, data, numbers, brand). Mono is reserved for
   * literal code only — see the .mono/code rule below. */
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px; line-height: 1.55;
  font-variant-numeric: tabular-nums; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* One typeface site-wide: Inter (the How It Works prose font) everywhere,
 * including the data tables, tickers, numbers, brand wordmark, and titles.
 * Mono is reserved for literal code snippets only. Numeric columns stay
 * aligned via font-variant-numeric: tabular-nums on the body. */
.mono, code, pre, kbd, samp {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.page { max-width: 1280px; margin: 0 auto; padding: 28px 32px 60px; }

/* ─── Unified site header (shared/_site_header.html.erb) ─── */
.site-header { margin-bottom: 6px; }
.site-header-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 32px; padding-bottom: 14px; flex-wrap: wrap;
}
.brand { font-weight: 800; font-size: 22px; letter-spacing: 0.18em; color: var(--text-primary); }
.brand-accent { color: var(--accent); }
.site-header-meta {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary);
}
.meta-item { display: flex; align-items: center; gap: 6px; }
.meta-item strong { color: var(--text-primary); font-weight: 600; }

/* Page title (BASELINE / OPTIMIZED A / RANKINGS / HOW IT WORKS / etc.) */
.page-title {
  font-size: 26px; font-weight: 800; letter-spacing: 0.18em;
  color: var(--accent); margin: 28px 0 4px;
}

.subtitle-row {
  display: flex; justify-content: space-between; gap: 24px;
  margin-top: 14px; margin-bottom: 32px;
  font-size: 12px; color: var(--text-secondary); flex-wrap: wrap;
}
.subtitle-row .lhs { max-width: 720px; }
.subtitle-row .rhs { color: var(--text-muted); text-align: right; }

/* ─── Section blocks ─── */
.section { margin-top: 36px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px; padding-bottom: 10px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 11px; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-secondary);
}
.section-aside { font-size: 11px; color: var(--text-muted); letter-spacing: 0.04em; }
.section-link {
  margin-left: 14px; font-size: 10px; font-weight: 500; color: var(--accent);
  letter-spacing: 0.08em; text-transform: none; text-decoration: none;
  border-bottom: 1px solid transparent; padding-bottom: 1px;
  transition: border-color 0.12s ease;
}
.section-link:hover { border-bottom-color: var(--accent); text-decoration: none; }

/* ─── Top navigation (shared/_topnav.html.erb) ─── */
.topnav {
  display: flex; flex-wrap: wrap; gap: 4px 18px;
  align-items: center;
  margin-top: 14px; padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
}
.topnav-link {
  color: var(--text-primary); text-decoration: none; font-weight: 600;
  padding: 4px 2px; border-bottom: 1px solid transparent;
  transition: color 0.1s ease, border-color 0.1s ease;
}
.topnav-link:hover { color: var(--accent); text-decoration: none; border-bottom-color: var(--accent-dim); }
.topnav-link.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.topnav-divider { color: var(--text-muted); font-size: 12px; }
/* Paywall lock — teaser shown to non-subscribers on gated pages. */
.paywall-lock { position: relative; margin: 10px 0 6px; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; background: var(--surface); }
.paywall-lock-ghosts { display: flex; flex-direction: column; gap: 12px; padding: 20px; filter: blur(3px); opacity: 0.4; }
.paywall-ghost { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-elev), var(--border-strong), var(--surface-elev)); }
.paywall-ghost:nth-child(2) { width: 86%; }
.paywall-ghost:nth-child(3) { width: 72%; }
.paywall-lock-panel { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; text-align: center; padding: 16px; background: rgba(10, 10, 10, 0.62); }
.paywall-lock-title { color: var(--text-primary); font-weight: 700; font-size: 14px; }
.paywall-lock-sub { color: var(--text-secondary); font-size: 12px; line-height: 1.5; margin: 0; max-width: 360px; }
.paywall-lock-btn { display: inline-block; margin-top: 5px; padding: 10px 22px; background: var(--accent); color: var(--bg); border: 1px solid var(--accent); border-radius: 4px; font-weight: 700; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: background 0.12s ease; }
.paywall-lock-btn:hover { background: #ffe34d; }
.paywall-lock form.button_to { margin: 0; }

.topnav-auth { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topnav-user { color: var(--text-muted); text-transform: none; letter-spacing: 0; font-size: 11px; }
/* button_to renders a <form><button>; strip native chrome so it reads as a link. */
.topnav-auth form.button_to { display: inline; margin: 0; }
.topnav-signout {
  background: none; border: none; border-bottom: 1px solid transparent;
  cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit;
}

/* ─── Regime pill (status indicator) ─── */
.regime-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 9px;
  border: 1px solid var(--border-strong); border-radius: 3px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.regime-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.regime-pill.on  { color: var(--positive); border-color: var(--positive-dim); }
.regime-pill.on  .regime-dot { background: var(--positive); box-shadow: 0 0 6px var(--positive); }
.regime-pill.off { color: var(--negative); border-color: var(--negative-dim); }
.regime-pill.off .regime-dot { background: var(--negative); box-shadow: 0 0 6px var(--negative); }
.regime-pill.unknown { color: var(--text-secondary); }

/* ─── Disclosure (footer text) ─── */
.disclosure {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 11px; color: var(--text-muted); line-height: 1.7; letter-spacing: 0.02em;
}

/* ─── Shared mobile breakpoints (page-specific overrides live in views) ─── */
@media (max-width: 720px) {
  .page { padding: 18px 14px 40px; }
  .site-header-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .page-title { font-size: 22px; }
  .subtitle-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .subtitle-row .rhs { text-align: left; }

  /* Topnav: horizontal scroll with subtle snap rather than wrapping —
   * fits 8+ links cleanly on phones without the awkward 2-row wrap. */
  .topnav {
    flex-wrap: nowrap; overflow-x: auto; gap: 16px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    /* Hide scrollbar visually but keep it functional */
    scrollbar-width: thin;
  }
  .topnav::-webkit-scrollbar { height: 3px; }
  .topnav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
  .topnav-link { white-space: nowrap; scroll-snap-align: start; }
  .topnav-divider { display: none; }
}
