/* ============================================================
   MattCrosbyPro — shared design system
   Dark, technical, data-dense. Sans + mono.
   Theme: [data-theme="dark"|"light"] on <html>
   Accent: [data-accent="purple"|"blue"|"green"] on <html>
   ============================================================ */

:root {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 1240px;
  --gutter: clamp(18px, 4vw, 48px);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 22px;

  --header-h: 68px;

  /* market semantics */
  --up: oklch(0.74 0.15 155);
  --down: oklch(0.64 0.19 25);

  --shadow-card: 0 1px 0 rgba(255,255,255,0.02) inset, 0 18px 40px -28px rgba(0,0,0,0.7);
  --speed: 220ms;
}

/* ---------- accent palettes (theme-independent) ---------- */
[data-accent="purple"] {
  --accent: oklch(0.66 0.17 295);
  --accent-hi: oklch(0.74 0.15 305);
  --accent-glow: oklch(0.66 0.17 295 / 0.18);
}
[data-accent="blue"] {
  --accent: oklch(0.66 0.15 248);
  --accent-hi: oklch(0.74 0.13 240);
  --accent-glow: oklch(0.66 0.15 248 / 0.18);
}
[data-accent="green"] {
  --accent: oklch(0.72 0.14 165);
  --accent-hi: oklch(0.80 0.13 160);
  --accent-glow: oklch(0.72 0.14 165 / 0.18);
}

/* ---------- dark theme (default) ---------- */
[data-theme="dark"] {
  --bg: oklch(0.17 0.014 265);
  --bg-grad: radial-gradient(1200px 700px at 78% -10%, var(--accent-glow), transparent 60%);
  --surface: oklch(0.205 0.016 265);
  --surface-2: oklch(0.245 0.018 265);
  --surface-hover: oklch(0.27 0.02 265);
  --border: oklch(0.32 0.018 265);
  --border-soft: oklch(0.27 0.016 265);
  --text: oklch(0.965 0.004 265);
  --text-dim: oklch(0.73 0.014 265);
  --text-faint: oklch(0.56 0.014 265);
  --grid-line: oklch(0.30 0.016 265 / 0.7);
  --on-accent: oklch(0.16 0.02 265);
  color-scheme: dark;
}

/* ---------- light theme ---------- */
[data-theme="light"] {
  --bg: oklch(0.975 0.004 265);
  --bg-grad: radial-gradient(1100px 640px at 80% -12%, var(--accent-glow), transparent 62%);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0.006 265);
  --surface-hover: oklch(0.945 0.008 265);
  --border: oklch(0.90 0.008 265);
  --border-soft: oklch(0.93 0.006 265);
  --text: oklch(0.23 0.02 265);
  --text-dim: oklch(0.46 0.02 265);
  --text-faint: oklch(0.60 0.016 265);
  --grid-line: oklch(0.88 0.01 265);
  --on-accent: oklch(0.99 0 0);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  min-height: 100vh;
  transition: background var(--speed) ease, color var(--speed) ease;
}

/* page-wide subtle accent wash */
.app-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  background: var(--bg-grad);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.tabular { font-variant-numeric: tabular-nums; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: color-mix(in oklch, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 19px;
  color: var(--text);
}
.brand .mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--accent-hi), var(--accent));
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--accent) 50%, transparent), 0 6px 18px -8px var(--accent);
  position: relative;
  flex: none;
}
.brand .mark::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 8px;
  background:
    linear-gradient(transparent 58%, color-mix(in oklch, var(--on-accent) 35%, transparent) 58% 64%, transparent 64%),
    linear-gradient(90deg, transparent 30%, color-mix(in oklch, var(--on-accent) 40%, transparent) 30% 36%, transparent 36% 62%, color-mix(in oklch, var(--on-accent) 40%, transparent) 62% 68%, transparent 68%);
  opacity: 0.9;
}
.brand b { color: var(--accent); font-weight: 600; }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}
.nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color var(--speed), background var(--speed);
  position: relative;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.header-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  transition: all var(--speed);
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); background: var(--surface-hover); }

.burger { display: none; }

/* mobile nav drawer */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
  opacity: 0; pointer-events: none;
  transition: opacity var(--speed);
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(82vw, 320px);
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 50;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(.2,.7,.2,1);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.drawer.open { transform: translateX(0); }
.drawer .drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.drawer a {
  padding: 14px 14px;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 12px;
}
.drawer a:hover, .drawer a.active { background: var(--surface-2); color: var(--text); }
.drawer a.active { color: var(--accent); }

/* ============================================================
   GENERIC UI
   ============================================================ */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  padding: 13px 20px;
  border-radius: 11px;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid transparent;
  transition: transform var(--speed), background var(--speed), border-color var(--speed), box-shadow var(--speed);
}
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  background: linear-gradient(145deg, var(--accent-hi), var(--accent));
  color: var(--on-accent);
  box-shadow: 0 10px 26px -12px var(--accent);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px var(--accent); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.delta { font-family: var(--font-mono); font-weight: 600; }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.02em;
  margin: 8px 0 0;
}
.section-head p { color: var(--text-dim); margin: 4px 0 0; font-size: 14.5px; }

main { position: relative; z-index: 1; }
.page { padding: clamp(34px, 6vw, 70px) 0 90px; }
.page-enter { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .page-enter { animation: pageIn 420ms cubic-bezier(.2,.7,.2,1); }
}
@keyframes pageIn {
  from { transform: translateY(12px); }
  to { transform: none; }
}

/* ============================================================
   HOMEPAGE HERO
   ============================================================ */
.hero {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  padding-top: clamp(20px, 5vw, 56px);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 18px 0 0;
}
.hero h1 .accent-text { color: var(--accent); }
.hero .tagline {
  font-size: clamp(18px, 2.4vw, 23px);
  color: var(--text);
  font-weight: 500;
  margin: 18px 0 0;
  max-width: 30ch;
}
.hero .bio {
  color: var(--text-dim);
  margin: 16px 0 0;
  max-width: 52ch;
  font-size: 16px;
}
.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.portrait {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  aspect-ratio: 1 / 1;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.7);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, transparent 55%, color-mix(in oklch, var(--accent) 30%, transparent));
  mix-blend-mode: screen;
  pointer-events: none;
}
.portrait .tag {
  position: absolute;
  left: 14px; bottom: 14px;
  display: flex; gap: 8px; align-items: center;
  white-space: nowrap;
  background: color-mix(in oklch, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 600;
}
.portrait .tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 8px var(--up); }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 44px;
}
.stat-strip .stat {
  background: var(--surface);
  padding: 16px 18px;
}
.stat .k { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; }
.stat .v { font-family: var(--font-mono); font-size: clamp(18px, 2.4vw, 23px); font-weight: 600; margin-top: 4px; }
.stat .d { font-family: var(--font-mono); font-size: 12.5px; margin-top: 2px; }

/* ============================================================
   CHART
   ============================================================ */
.chart-card { padding: clamp(18px, 3vw, 26px); margin-top: 26px; }
.chart-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 18px; flex-wrap: wrap; margin-bottom: 18px;
}
.chart-top > div:first-child { min-width: 0; }
.chart-title-row { display: flex; align-items: center; gap: 14px; }
.chart-price { font-family: var(--font-mono); font-size: clamp(24px, 3.4vw, 34px); font-weight: 600; }
.chart-asset { display: flex; align-items: baseline; gap: 10px; }
.chart-asset .sym { font-family: var(--font-display); font-weight: 600; font-size: 19px; }
.chart-asset .name { color: var(--text-faint); font-size: 13px; white-space: nowrap; }

.range-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.range-tabs button {
  border: none; background: transparent; color: var(--text-dim);
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 7px; transition: all var(--speed);
}
.range-tabs button:hover { color: var(--text); }
.range-tabs button.active { background: var(--accent); color: var(--on-accent); }

.chart-area { position: relative; width: 100%; }
.chart-area svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -120%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.6);
  white-space: nowrap;
  z-index: 5;
}
.chart-tooltip .tt-date { color: var(--text-faint); font-size: 11.5px; font-family: var(--font-mono); }
.chart-tooltip .tt-price { font-family: var(--font-mono); font-weight: 600; font-size: 15px; margin-top: 2px; }

/* ---------- MVRV Z-Score chart ---------- */
.mvrv-chart { width: 100%; padding: 4px 0 2px; }
.mvrv-plot { position: relative; width: 100%; }
.mvrv-chart svg { overflow: visible; }
.mvrv-loading {
  padding: clamp(18px, 3vw, 26px);
  min-height: 240px; display: grid; place-items: center;
  color: var(--text-dim); font-size: 15px;
}
.mvrv-ylab-l, .mvrv-ylab-r, .mvrv-xlab {
  position: absolute; font-size: 11px; color: var(--text-faint);
  transform: translateY(-50%); white-space: nowrap;
}
.mvrv-ylab-l { left: 0; }
.mvrv-ylab-r { right: 18px; text-align: right; }
.mvrv-xlab { transform: translate(-50%, 4px); }
.mvrv-axis-title {
  position: absolute; right: -2px; top: 50%;
  transform: rotate(90deg); transform-origin: right center;
  font-size: 11px; color: var(--text-faint); white-space: nowrap;
  letter-spacing: .04em;
}
.mvrv-legend {
  display: flex; flex-wrap: wrap; gap: 14px 22px;
  justify-content: center; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px; color: var(--text-dim); font-weight: 500;
}
.mvrv-leg-item { display: inline-flex; align-items: center; gap: 8px; }
.mvrv-leg-line { width: 20px; height: 3px; border-radius: 2px; display: inline-block; }
.mvrv-tip.chart-tooltip {
  transform: none; top: 12px; min-width: 168px;
}
.mvrv-tip-rows { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.mvrv-tip-row { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; }
.mvrv-tip-row .sw { width: 9px; height: 9px; border-radius: 2px; }
.mvrv-tip-row .lb { color: var(--text-dim); font-size: 12px; }
.mvrv-tip-row .vl { font-size: 12.5px; font-weight: 600; }

/* ---------- Lightweight Charts (TradingView) wrapper ---------- */
.lw-chart-wrap { width: 100%; padding: 4px 0 2px; }
.lw-toolbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: nowrap; gap: 10px 16px; margin-bottom: 10px;
}
/* legend takes the remaining width and wraps internally; the actions block
   (crosshair date + LIN/LOG + capture) stays pinned top-right even when a
   many-series legend spills onto several rows. */
.lw-legends { display: flex; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
/* a thin divider between per-pane legend groups (price pane vs. data pane) */
.lw-legends .lw-legend + .lw-legend { padding-left: 14px; border-left: 1px solid var(--border-soft); }
.lw-legend { display: flex; flex-wrap: wrap; gap: 6px 8px; }
.lw-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 9px; padding: 5px 10px; transition: all var(--speed);
}
.lw-chip:hover { border-color: var(--border); }
.lw-chip.off { opacity: 0.45; }
.lw-chip.off .lw-lb, .lw-chip.off .lw-vl { text-decoration: line-through; }
.lw-chip .lw-sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
/* dashed-line swatch for reference-line overlay chips (uses chip's inline color) */
.lw-chip .lw-sw.dash { width: 14px; height: 0; border-radius: 0; background: none; border-top: 2px dashed currentColor; }
.lw-chip .lw-lb { color: var(--text-dim); font-size: 12.5px; font-weight: 500; }
.lw-chip .lw-vl { color: var(--text); font-size: 12.5px; font-weight: 600; }
.lw-actions { display: inline-flex; flex: none; align-items: center; gap: 8px; }
.lw-hover-date { color: var(--text-faint); font-size: 12px; }
.lw-scale-toggle {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 9px; padding: 3px; gap: 2px;
}
.lw-scale-toggle button {
  border: none; background: transparent; color: var(--text-dim);
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 600;
  padding: 4px 9px; border-radius: 6px; transition: all var(--speed);
}
.lw-scale-toggle button:hover { color: var(--text); }
.lw-scale-toggle button.active { background: var(--accent); color: var(--on-accent); }
.lw-cap {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border-soft);
  border-radius: 9px; transition: all var(--speed);
}
.lw-cap:hover { color: var(--text); border-color: var(--border); }
.lw-canvas { position: relative; width: 100%; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.metric {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
}
.metric .m-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.metric .m-label { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.metric .m-val { font-family: var(--font-mono); font-size: 27px; font-weight: 600; letter-spacing: -0.01em; }
.metric .m-foot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.spark { width: 100%; height: 40px; }

.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.gauge-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; height: 100%; }
.gauge-val { font-family: var(--font-mono); font-size: 44px; font-weight: 600; }
.gauge-label { color: var(--text-dim); font-size: 14px; }

.table-card { padding: 6px 0; overflow: hidden; }
.dtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.dtable th {
  text-align: right; font-weight: 500; color: var(--text-faint);
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  padding: 12px 18px; border-bottom: 1px solid var(--border-soft);
}
.dtable th:first-child, .dtable td:first-child { text-align: left; }
.dtable td { padding: 13px 18px; border-bottom: 1px solid var(--border-soft); font-family: var(--font-mono); text-align: right; }
.dtable tr:last-child td { border-bottom: none; }
.dtable tbody tr:hover { background: var(--surface-2); }
.dtable .asset-cell { display: flex; align-items: center; gap: 10px; font-family: var(--font-sans); font-weight: 600; }
.coin-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; color: var(--on-accent); font-family: var(--font-mono); }
.coin-img { width: 22px; height: 22px; border-radius: 50%; flex: none; }

/* Top-assets table: in-place manual refresh control + status */
.table-refresh { display: inline-flex; align-items: center; gap: 12px; }
.live-dot { width: 7px; height: 7px; border-radius: 9px; display: inline-block; }
.table-stamp { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.table-stamp.err { color: var(--down); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 9px; }
.refresh-icon { display: inline-block; font-size: 15px; line-height: 1; }
.refresh-icon.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.table-empty { padding: 28px 18px; text-align: center; color: var(--text-dim); font-size: 14px; }

/* ============================================================
   CHARTS GALLERY
   ============================================================ */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.mini-chart-card { padding: 18px 20px; transition: border-color var(--speed), transform var(--speed); cursor: pointer; }
.mini-chart-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.mini-chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.mini-chart-head > div:first-child { flex: 1; min-width: 0; }
.mini-chart-head .delta { flex: none; }
.mini-chart-head .t { font-weight: 600; font-size: 15px; }
.mini-chart-head .s { font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-dim);
  transition: all var(--speed);
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ============================================================
   VIDEOS / REPORTS
   ============================================================ */
.video-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 16px; }
.video-card { overflow: hidden; transition: transform var(--speed), border-color var(--speed); cursor: pointer; }
.video-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.video-thumb {
  aspect-ratio: 16 / 9; position: relative;
  background:
    repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 11px, var(--surface) 11px, var(--surface) 22px);
  display: grid; place-items: center;
}
.video-thumb .play {
  width: 54px; height: 54px; border-radius: 50%;
  background: color-mix(in oklch, var(--accent) 88%, black);
  display: grid; place-items: center; color: var(--on-accent);
  box-shadow: 0 8px 24px -8px var(--accent);
  transition: transform var(--speed);
}
.video-card:hover .play { transform: scale(1.1); }
.video-thumb .dur { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,.7); color:#fff; font-family: var(--font-mono); font-size: 12px; padding: 2px 7px; border-radius: 6px; }
.video-meta { padding: 15px 17px; }
.video-meta .vt { font-weight: 600; font-size: 15px; line-height: 1.35; }
.video-meta .vm { color: var(--text-faint); font-size: 12.5px; margin-top: 7px; font-family: var(--font-mono); }

.report-row {
  display: flex; align-items: center; gap: 18px;
  padding: 20px; border-bottom: 1px solid var(--border-soft);
  transition: background var(--speed); cursor: default;
}
.report-row.is-link { cursor: pointer; }
.report-row.is-link:hover { background: var(--surface-2); }
.report-row.is-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.report-row:last-child { border-bottom: none; }
.report-date { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); width: 92px; flex: none; }
.report-row .rt { font-weight: 600; font-size: 16px; }
.report-row .rd { color: var(--text-dim); font-size: 14px; margin-top: 2px; }
.report-row .ra { color: var(--text-faint); font-size: 12.5px; margin-top: 4px; }
.report-tag { margin-left: auto; flex: none; }
.report-row.is-link > svg:last-child { color: var(--text-faint); flex: none; }
.report-row.is-link:hover > svg:last-child { color: var(--accent); }

/* ---- Report detail page ---- */
.report-head { margin-bottom: 22px; }
.report-head h2 { margin: 6px 0 0; }
.report-precis { color: var(--text-dim); font-size: 16px; max-width: 70ch; margin-top: 10px; }
.report-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 13.5px; color: var(--text-dim); }
.report-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.report-meta-date { font-family: var(--font-mono); color: var(--text-faint); }

.report-intro { color: var(--text-dim); font-size: 15.5px; line-height: 1.6; max-width: 80ch; margin: 0 0 18px; }
.chart-jump {
  color: var(--accent); font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  border-radius: 4px;
}
.chart-jump:hover { text-decoration: underline; }
.chart-jump:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chart-jump svg { transform: translateY(1px); }

.report-viewer-card { padding: 0; overflow: hidden; }
.report-viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-soft); background: var(--surface-2);
}
.report-viewer-label { font-weight: 600; font-size: 14px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-pdf { display: block; width: 100%; height: clamp(520px, 78vh, 1100px); border: 0; background: var(--surface); }

.report-body { margin-top: 22px; }
.report-body p { color: var(--text-dim); margin: 0 0 12px; }
.report-body p:last-child { margin-bottom: 0; }

.report-charts { margin-top: 30px; display: flex; flex-direction: column; gap: 22px; }
.report-charts .section-head { margin-bottom: 0; }

.coming-banner {
  padding: 26px; display: flex; gap: 16px; align-items: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); margin-bottom: 24px;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  margin-top: 8px;
}
.about-portrait {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.7);
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.about-portrait::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, transparent 60%, color-mix(in oklch, var(--accent) 22%, transparent));
  mix-blend-mode: screen;
  pointer-events: none;
}
.about-copy p { color: var(--text-dim); font-size: 16px; margin: 0 0 14px; max-width: 56ch; }
.about-copy .about-lead {
  font-family: var(--font-display);
  font-size: clamp(21px, 2.6vw, 27px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 18px;
}
.about-copy .about-lead .accent-text { color: var(--accent); }

.about-creds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 44px;
}
.about-cred { background: var(--surface); padding: 22px 24px; }
.about-cred .cv {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.about-cred .ck { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-portrait { max-width: 520px; }
  .about-creds { grid-template-columns: 1fr; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border-soft);
  margin-top: 40px;
  background: color-mix(in oklch, var(--bg) 60%, var(--surface));
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 34px;
  padding: 48px 0 30px;
}
.footer-brand .brand { font-size: 21px; }
.footer-brand p { color: var(--text-dim); font-size: 14px; margin: 14px 0 18px; max-width: 34ch; }
.social-row { display: flex; gap: 10px; }
.social-btn {
  width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--text-dim);
  transition: all var(--speed);
}
.social-btn:hover { color: var(--on-accent); background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.foot-col h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); margin: 0 0 14px; font-weight: 600; }
.foot-col a { display: block; color: var(--text-dim); font-size: 14.5px; padding: 5px 0; transition: color var(--speed); }
.foot-col a:hover { color: var(--accent); }

.theme-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.theme-switch button {
  border: none; background: transparent; color: var(--text-dim);
  width: 38px; height: 34px; border-radius: 7px; display: grid; place-items: center;
  transition: all var(--speed);
}
.theme-switch button svg { width: 17px; height: 17px; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button.active { background: var(--accent); color: var(--on-accent); }

.footer-bottom {
  border-top: 1px solid var(--border-soft);
  padding: 18px 0;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap;
  color: var(--text-faint); font-size: 13px;
}
.footer-bottom .mono { color: var(--text-faint); }

/* ---- locked landing mode (temporary single-report view) ---- */
/* Eyebrow uses a real icon instead of the default accent square. */
.eyebrow-report::before { display: none; }
.eyebrow-report svg { color: var(--accent); }
/* X / Twitter link next to the report author. */
.report-author .author-x {
  display: inline-flex; align-items: center; margin-left: 8px;
  color: var(--text-faint); transition: color var(--speed);
}
.report-author .author-x:hover { color: var(--accent); }
/* With the breadcrumb removed, lift the report header toward the top. */
.page-bare { padding-top: clamp(26px, 4vw, 44px); }
/* Slim footer has no upper content block, so drop the doubled border. */
.site-footer-slim { margin-top: 60px; }
.site-footer-slim .footer-bottom { border-top: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero .portrait { max-width: 360px; order: -1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .chart-grid { grid-template-columns: 1fr; }
  .video-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-inner .theme-block { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .burger { display: grid; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .metric-grid { grid-template-columns: 1fr; }
  .video-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero h1 { font-size: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ============================================================
   CHARTS MEGA-MENU (desktop) + DRAWER ACCORDION (mobile)
   ============================================================ */
.nav-charts { position: relative; }
.nav-charts > a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; color: var(--text-dim);
  cursor: pointer; transition: color var(--speed), background var(--speed);
}
.nav-charts > a:hover { color: var(--text); background: var(--surface-2); }
.nav-charts > a.active { color: var(--text); }
.caret { font-size: 10px; transition: transform var(--speed); }
.caret.up { transform: rotate(180deg); }

.mega {
  position: absolute; top: calc(100% + 10px); left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 520px; max-width: 90vw;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), 0 24px 50px -24px rgba(0,0,0,0.45);
  padding: 18px; opacity: 0; pointer-events: none; z-index: 50;
  transition: opacity var(--speed), transform var(--speed);
}
.mega.open { opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.mega-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 22px; }
.mega-col { min-width: 140px; }
.mega-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint); font-weight: 600; padding: 6px 10px;
}
.mega-link { display: block; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--text-dim); }
.mega-link:hover { background: var(--surface-2); color: var(--text); }
.mega-empty { color: var(--text-faint); padding: 8px 10px; font-size: 14px; }

.drawer-charts { display: flex; flex-direction: column; }
.drawer-acc, .drawer-cat {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; background: none; border: none; text-align: left; cursor: pointer; font: inherit;
}
.drawer-acc { padding: 12px 14px; border-radius: 10px; color: var(--text-dim); font-size: 16px; font-weight: 500; }
.drawer-acc:hover, .drawer-acc.active { background: var(--surface-2); color: var(--text); }
.drawer-acc.active { color: var(--accent); }
.drawer-sub { padding: 2px 0 6px; margin-left: 14px; border-left: 2px solid var(--border-soft); }
.drawer-cat { padding: 9px 12px; border-radius: 8px; color: var(--text-dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; }
.drawer-cat:hover { color: var(--text); }
.drawer .drawer-chart { display: block; padding: 9px 12px 9px 18px; font-size: 14.5px; color: var(--text-dim); border-radius: 8px; }
.drawer .drawer-chart:hover { background: var(--surface-2); color: var(--text); }

/* ============================================================
   CLICKABLE DASHBOARD WIDGETS + GALLERY CARDS
   ============================================================ */
.metric-link, .mini-link {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; display: block;
}
.metric.metric-link { transition: border-color var(--speed), transform var(--speed); }
.metric-link:hover, .mini-link:hover { border-color: var(--accent); transform: translateY(-3px); }
.metric .m-val.muted { color: var(--text-faint); }
.mini-chart-card.is-placeholder { cursor: default; opacity: 0.82; }
.mini-chart-card.is-placeholder:hover { border-color: var(--border-soft); transform: none; }
.soon-badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  background: var(--surface-2); color: var(--text-faint);
  border: 1px solid var(--border-soft); padding: 1px 6px; border-radius: 999px;
  margin-left: 6px; vertical-align: middle;
}

/* ============================================================
   CHART DETAIL PAGE
   ============================================================ */
.crumb { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--text-faint); margin-bottom: 16px; }
.crumb a { color: var(--text-dim); }
.crumb a:hover { color: var(--accent); }
.crumb .cur { color: var(--text); }

.detail-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.detail-about, .detail-related { padding: 22px 24px; }
.detail-about h3, .detail-related h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 12px; }
.detail-about p { color: var(--text-dim); line-height: 1.7; margin: 0 0 14px; font-size: 15px; }
.creator-line { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); font-size: 13.5px; color: var(--text-faint); }
.creator-line a { color: var(--accent); display: inline-flex; align-items: center; gap: 5px; }
.creator-line a svg { width: 14px; height: 14px; }
.creator-name { color: var(--text-dim); }

.related-row { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 10px; color: var(--text-dim); }
.related-row:hover { background: var(--surface-2); color: var(--text); }
.related-row svg { width: 18px; height: 18px; flex: none; color: var(--text-faint); }
.related-title { flex: 1; font-size: 14px; }
.related-tag { text-transform: capitalize; font-size: 11px; }
.muted { color: var(--text-faint); }

.dash-sentiment { margin-top: 18px; max-width: 360px; }

.chart-updated { margin-top: 10px; text-align: right; font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }

/* ============================================================
   SERVICES PAGE
   ============================================================ */
.services-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.service-card {
  position: relative; padding: 24px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color var(--speed), transform var(--speed);
}
.service-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.service-ico {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--accent);
}
.service-card .st { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.service-card .sd { color: var(--text-dim); font-size: 14.5px; line-height: 1.6; }
.service-tag { align-self: flex-start; margin-top: auto; }
.services-note { margin-top: 18px; font-size: 12.5px; }

@media (max-width: 760px) { .services-grid { grid-template-columns: 1fr; } }

@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .mega { min-width: 0; }
}
