/* AI Trend Intelligence — dark mode site styles
   Design language: inspired by davidamitchell.github.io/Research
   Palette: #0d0d0d bg · #0f1115 surface · #252b33 border · #e6e6e6 text · #00C3A5 teal */

:root {
  --bg:         #0d0d0d;
  --surface:    #0f1115;
  --surface-2:  #161b22;
  --border:     #252b33;
  --text:       #e6e6e6;
  --text-muted: #666;
  --teal:       #00C3A5;
  --dusk:       #E8A1A8;
  --grid:       rgba(255,255,255,0.05);

  --text-xs:   0.7rem;
  --text-sm:   0.8rem;
  --text-base: 0.9rem;
  --text-lg:   1.1rem;
  --text-xl:   1.4rem;
  --text-2xl:  2rem;
}

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

body {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: var(--text-base);
  line-height: 1.7;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  letter-spacing: 0.02em;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────── */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 12px;
}

.site-header h1 {
  font-size: var(--text-xl);
  color: var(--text);
  margin: 0 0 4px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0 0 8px;
}

.meta-bar {
  font-size: var(--text-xs);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.meta-bar .pill {
  display: inline-block;
  background: var(--surface-2);
  color: var(--teal);
  border-radius: 0;
  padding: 1px 7px;
  font-weight: 500;
  margin: 0 2px;
  border: 1px solid var(--border);
}

/* ── Nav tabs ───────────────────────────── */
.site-nav {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.05em;
  transition: color .15s, border-color .15s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--teal);
  border-bottom-color: var(--teal);
}

/* ── Main container ─────────────────────── */
.site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section headings ───────────────────── */
.section-heading {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--teal);
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
  margin: 24px 0 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-heading:first-child { margin-top: 0; }

/* ── State badges ───────────────────────── */
.state-badge {
  display: inline-block;
  border-radius: 0;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.state-emerging  { background: rgba(255,200,0,0.12);  color: #f5c842; border-color: rgba(245,200,66,0.3); }
.state-scaling   { background: rgba(0,195,165,0.12);  color: #00C3A5; border-color: rgba(0,195,165,0.3); }
.state-mature    { background: rgba(100,149,237,0.12); color: #6495ed; border-color: rgba(100,149,237,0.3); }
.state-declining { background: rgba(232,161,168,0.12); color: #E8A1A8; border-color: rgba(232,161,168,0.3); }
.state-unknown   { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* ── Confidence bar ─────────────────────── */
.confidence-bar {
  display: inline-block;
  width: 80px;
  height: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-left: 6px;
}

.confidence-fill {
  height: 100%;
  background: var(--teal);
}

/* ── Theme cards grid ───────────────────── */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.theme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal);
  padding: 14px 16px;
  transition: border-color .15s;
}

.theme-card:hover { border-color: var(--teal); cursor: pointer; }

.theme-card.selected {
  border-color: var(--teal) !important;
  background: rgba(0,195,165,0.04);
}

.theme-card-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: right;
  margin-top: 6px;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity .15s;
}

.theme-card:hover .theme-card-hint,
.theme-card.selected .theme-card-hint {
  opacity: 1;
}

/* ── Item drill-down provenance panel ───── */
.drill-down-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal);
  padding: 14px 16px;
  margin: 0 0 20px;
}

.drill-down-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.drill-down-title {
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.drill-down-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-base);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.drill-down-close:hover { color: var(--text); }

.provenance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.provenance-table th {
  text-align: left;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.provenance-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.provenance-table tbody tr:hover { background: var(--surface-2); }
.provenance-table tbody tr:last-child td { border-bottom: none; }

.theme-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.theme-name {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text);
  flex: 1;
  letter-spacing: 0.02em;
}

.theme-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
}

.theme-domain {
  display: inline-block;
  background: var(--surface-2);
  color: #9b7ed4;
  border: 1px solid rgba(155,126,212,0.3);
  padding: 1px 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  margin-right: 6px;
  letter-spacing: 0.04em;
}

.theme-metrics {
  display: flex;
  gap: 14px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.metric { display: flex; flex-direction: column; }
.metric-label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-weight: 500; color: var(--text); }

/* hype risk colouring */
.hype-low  { color: var(--teal); }
.hype-mid  { color: #f5c842; }
.hype-high { color: var(--dusk); }

/* ── Chart containers ───────────────────── */
.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 20px;
}

.chart-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--teal);
  margin: 0 0 12px;
  letter-spacing: 0.04em;
}

.chart-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: -8px 0 12px;
  letter-spacing: 0.04em;
}

/* ── Heatmap ────────────────────────────── */
.heatmap-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.heatmap-table {
  width: 100%;
  min-width: 380px;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.heatmap-table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.heatmap-table th:first-child { text-align: left; }

.heatmap-table td {
  padding: 6px 10px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.heatmap-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text);
}

.heatmap-table tr:last-child td { border-bottom: none; }

/* Cell heat colours — dark mode */
.heat-0 { background: var(--surface); color: var(--text-muted); }
.heat-1 { background: rgba(0,195,165,0.08);  color: rgba(0,195,165,0.7); }
.heat-2 { background: rgba(0,195,165,0.18);  color: rgba(0,195,165,0.85); }
.heat-3 { background: rgba(0,195,165,0.35);  color: #00C3A5; }
.heat-4 { background: rgba(0,195,165,0.6);   color: #0d0d0d; }

/* ── Source coverage ─────────────────────── */
.source-class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.source-class-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-top: 3px solid var(--teal);
}

.source-class-name {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.source-class-count {
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

.source-class-list {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Source detail table ────────────────── */
.source-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
  margin-bottom: 8px;
}

.source-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
}

.source-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.source-table tbody tr:hover { background: var(--surface-2); }

.source-name-cell {
  font-weight: 500;
  color: var(--text);
}

.num-cell {
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.date-cell {
  color: var(--text-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.themes-cell { max-width: 280px; }

.source-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 0;
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.theme-pill {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 1px 6px;
  font-size: var(--text-xs);
  margin: 2px 2px 2px 0;
  white-space: nowrap;
}

/* ── Trends table ───────────────────────── */
.trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.trend-table thead tr {
  border-bottom: 1px solid var(--border);
}

.trend-table th {
  padding: 8px 10px;
  text-align: left;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  background: var(--surface-2);
}

.trend-table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.trend-table tbody tr:hover { background: var(--surface-2); }

/* ── Hype split panel ───────────────────── */
.hype-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.hype-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
}

.hype-panel-title {
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.hype-panel-title.evidence { color: var(--teal); }
.hype-panel-title.media    { color: #f5c842; }

/* ── Empty state ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: var(--text-base); color: var(--text-muted); margin: 0 0 8px; font-weight: 500; }
.empty-state p  { font-size: var(--text-sm); margin: 0; }

/* ── Footer ──────────────────────────────── */
.site-footer {
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: 24px 16px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  letter-spacing: 0.04em;
}

/* ── Prose / About ───────────────────────── */
.prose {
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--text-muted);
}

.prose p { margin: 0 0 12px; }
.prose strong { color: var(--text); font-weight: 500; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 640px) {
  .site-header h1 { font-size: var(--text-lg); }
  .hype-split { grid-template-columns: 1fr; }
  .theme-grid { grid-template-columns: 1fr; }
  .source-class-grid { grid-template-columns: 1fr 1fr; }
  .source-table th, .source-table td { padding: 8px 6px; }
  .themes-cell { display: none; }
}
