/* =====================================================================
   The Evolution of the AI Engineer — dark theme, matched to ai.engineer
   Inter / Mona Sans · black canvas · yellow (#f8e18e) accent
   ===================================================================== */

:root {
  --bg:        #0a0a0b;
  --panel:     #131317;
  --panel-2:   #1a1a20;
  --text:      #ffffff;
  --text-2:    #c4c4cd;
  --text-3:    #8a8a95;
  --line:      rgba(255, 255, 255, 0.09);
  --line-2:    rgba(255, 255, 255, 0.16);
  --accent:    #f8e18e;
  --accent-2:  #f3d35f;
  --green:     #4ade80;
  --blue:      #60a5fa;
  --red:       #f87171;

  --sans: "Mona Sans", "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px),
    radial-gradient(circle at 50% -10%, rgba(248,225,142,0.06), transparent 55%);
  background-size: 48px 48px, 48px 48px, 100% 800px;
  color: var(--text-2);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

strong { color: var(--text); font-weight: 600; }
em { color: var(--text); font-style: normal; }
a { color: var(--accent); }

/* ---------- topbar ---------- */
.deco-strip { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.6rem clamp(1rem, 4vw, 2.5rem);
  background: rgba(10, 10, 11, 0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand {
  font-family: var(--mono); font-weight: 500; font-size: 0.82rem;
  letter-spacing: 0.02em; color: var(--text); text-decoration: none;
}
.topbar__brand::before { content: "▸ "; color: var(--accent); }
.topbar__links { display: flex; gap: clamp(0.6rem, 2vw, 1.5rem); list-style: none; margin: 0; padding: 0; }
.topbar__links a {
  font-size: 0.85rem; color: var(--text-3); text-decoration: none;
  padding-bottom: 2px; border-bottom: 1.5px solid transparent; transition: color .15s, border-color .15s;
}
.topbar__links a:hover { color: var(--text); border-color: var(--accent); }

/* ---------- layout ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: clamp(2.6rem, 6vw, 5rem) clamp(1.1rem, 4vw, 2rem); }
.section--alt { border-top: 1px solid var(--line); }
.section__head { max-width: 760px; margin-bottom: 1.8rem; }
.kicker {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.74rem; color: var(--accent); margin: 0 0 0.6rem;
}
.section__title {
  font-family: var(--display); font-weight: 800; letter-spacing: -0.02em;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem); line-height: 1.1; margin: 0 0 0.7rem; color: var(--text);
}
.section__intro { font-size: 1rem; margin: 0; color: var(--text-2); }
.section__intro a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- LEAD (merged hero + Exhibit I) ---------- */
.lead { max-width: var(--maxw); margin: 0 auto; padding: clamp(1.6rem, 4vw, 3rem) clamp(1.1rem, 4vw, 2rem) clamp(2rem, 5vw, 3.5rem); }
.lead__eyebrow {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.2em;
  font-size: 0.8rem; color: var(--accent); margin: 0 0 0.8rem;
}
.lead__title {
  font-family: var(--display); font-weight: 800; letter-spacing: -0.03em;
  font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.02; margin: 0 0 0.9rem; color: var(--text);
}
.lead__title .accent { color: var(--accent); }
.lead__sub { max-width: 680px; font-size: clamp(1rem, 2vw, 1.18rem); color: var(--text-2); margin: 0 0 1rem; }
.statline {
  font-family: var(--mono); font-size: 0.86rem; color: var(--text-3);
  display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin: 0 0 1.6rem;
}
.statline b { color: var(--accent); font-weight: 500; }
.statline .sep { color: var(--line-2); }

/* ---------- legend / chips ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-bottom: 1.1rem; }
.legend__item { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--text-3); }
.legend__swatch { width: 22px; height: 4px; border-radius: 2px; display: inline-block; }
.ink-chip {
  font-family: var(--mono); font-size: 0.8em; padding: 0.05em 0.45em; border-radius: 4px;
  color: #0a0a0b; font-weight: 500; white-space: nowrap;
}
.ink-chip.rose { background: var(--green); }
.ink-chip.faded { background: var(--red); }
.ink-chip.new { background: var(--accent); }

/* ---------- chart frames ---------- */
.chart-frame {
  border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(180deg, var(--panel), #0e0e11);
  padding: 1.1rem clamp(0.5rem, 2vw, 1.2rem) 0.5rem;
}
.hero-chart { width: 100%; min-height: 500px; }
.hero-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.echart { width: 100%; height: 380px; }
.chart-hint {
  font-family: var(--mono); font-size: 0.72rem; color: var(--text-3);
  text-align: center; margin: 0.5rem 0 0.4rem; opacity: 0.85;
}

/* side-by-side charts */
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.duo .panel-title {
  font-family: var(--display); font-weight: 700; font-size: 1.05rem; color: var(--text); margin: 0 0 0.2rem;
}
.duo .panel-sub { font-size: 0.85rem; color: var(--text-3); margin: 0 0 0.9rem; }

/* bump (D3) */
.bump-line { fill: none; stroke-width: 2.5; opacity: 0.6; transition: opacity .2s, stroke-width .2s; cursor: pointer; }
.bump-line.dim { opacity: 0.08; }
.bump-line.hot { opacity: 1; stroke-width: 4; }
.bump-node { cursor: pointer; transition: opacity .2s; }
.bump-node.dim { opacity: 0.1; }
.bump-label { font-family: var(--sans); font-size: 12.5px; fill: var(--text-2); cursor: pointer; }
.bump-label.dim { opacity: 0.12; }
.bump-year { font-family: var(--display); font-weight: 700; font-size: 18px; fill: var(--text); text-anchor: middle; }
.bump-axisrule { stroke: var(--line); stroke-width: 1; }

.d3-tooltip {
  position: fixed; pointer-events: none; z-index: 100;
  background: #0e0e12; color: var(--text-2);
  border: 1px solid var(--line-2); border-radius: 8px;
  padding: 0.7rem 0.85rem; max-width: 290px; font-size: 0.84rem; line-height: 1.45;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5); opacity: 0; transition: opacity .12s;
}
.d3-tooltip strong { color: var(--text); font-weight: 600; display: block; margin-bottom: 0.3rem; font-size: 0.95rem; }
.tt-row { display: flex; justify-content: space-between; gap: 1.4rem; align-items: baseline; }
.tt-row span:last-child { font-family: var(--mono); }
.d3-tooltip .tt-row span:last-child { color: var(--accent); font-size: 0.76rem; }

/* mobile heatmap fallback */
.hero-heatmap { display: none; }
.heat-grid { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 4px; }
.heat-grid .hh-head { font-family: var(--display); font-weight: 700; font-size: 0.95rem; text-align: center; padding: 4px 0; color: var(--text); }
.heat-grid .hh-topic { font-size: 0.8rem; display: flex; align-items: center; padding-right: 6px; color: var(--text-2); }
.heat-cell { height: 28px; border-radius: 4px; }

/* ---------- sessions table ---------- */
.sessions-controls { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.1rem; }
.scrow { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.scrow--filters { align-items: flex-start; }
.scrow--filters .ts-wrapper { flex: 1 1 260px; min-width: 200px; max-width: none; }
.scrow--filters .sessions-count { align-self: center; }
.atlas-search, .sessions-select {
  font-family: var(--sans); font-size: 0.9rem; padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel-2); color: var(--text);
}
.atlas-search { flex: 1 1 320px; }
.atlas-search::placeholder { color: var(--text-3); }
.atlas-search:focus, .sessions-select:focus { outline: none; border-color: var(--accent); }
.sessions-select { max-width: 210px; cursor: pointer; }
.sessions-years { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.filter-chip {
  font-family: var(--mono); font-size: 0.78rem; padding: 0.42rem 0.75rem;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-3);
  cursor: pointer; border-radius: 8px; transition: all .15s;
}
.filter-chip:hover { color: var(--text); border-color: var(--text-3); }
.filter-chip.is-active { background: var(--accent); color: #0a0a0b; border-color: var(--accent); font-weight: 600; }
.sessions-count { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); margin-left: auto; }

/* Tom Select — searchable multi-select, dark theme */
.ts-wrapper { min-width: 200px; max-width: 300px; font-family: var(--sans); font-size: 0.9rem; }
.ts-control { background: var(--panel-2) !important; border: 1px solid var(--line-2) !important; border-radius: 8px !important; color: var(--text) !important; box-shadow: none !important; }
.ts-wrapper.focus .ts-control { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent) !important; }
.ts-control input { color: var(--text) !important; }
.ts-control input::placeholder { color: var(--text-3) !important; }
.ts-wrapper.multi .ts-control > .item { background: var(--accent) !important; color: #0a0a0b !important; border: none !important; border-radius: 5px !important; font-size: 0.76rem; font-weight: 600; }
.ts-wrapper.multi .ts-control > .item .remove { border-left: 1px solid rgba(0,0,0,0.25) !important; color: #0a0a0b !important; }
.ts-wrapper.multi .ts-control > .item .remove:hover { background: rgba(0,0,0,0.14) !important; }
.ts-dropdown { background: #131317 !important; border: 1px solid var(--line-2) !important; border-radius: 8px !important; color: var(--text-2) !important; box-shadow: 0 12px 32px rgba(0,0,0,0.5) !important; margin-top: 4px; }
.ts-dropdown .option { color: var(--text-2); padding: 6px 10px; }
.ts-dropdown .option.active { background: rgba(248,225,142,0.15) !important; color: var(--text) !important; }
.ts-dropdown .no-results { color: var(--text-3); }

.sessions-table-wrap {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel);
}
.sessions-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.sessions-table thead th {
  background: var(--panel-2); color: var(--text-3);
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.7rem; font-weight: 500;
  text-align: left; padding: 0.65rem 0.85rem; white-space: nowrap; border-bottom: 1px solid var(--line-2);
  cursor: pointer; user-select: none;
}
.sessions-table thead th:hover { color: var(--text); }
.sessions-table thead th .arr { color: var(--accent); margin-left: 3px; }
.sessions-table tbody td { padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.sessions-table tbody tr:last-child td { border-bottom: none; }
.sessions-table tbody tr:hover { background: rgba(255,255,255,0.025); }
.col-yr { width: 60px; }
.sess-yr { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); }
.sess-title { color: var(--text); font-weight: 500; }
.sess-speaker { color: var(--text-3); font-size: 0.84rem; }
.sess-company { color: var(--text-2); font-size: 0.85rem; }
.sess-track { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); }
.sess-topics { display: flex; flex-wrap: wrap; gap: 4px; }
.t-chip {
  font-family: var(--mono); font-size: 0.64rem; padding: 1px 6px; border-radius: 4px;
  color: #0a0a0b; cursor: pointer; white-space: nowrap; font-weight: 500;
}
.t-chip:hover { outline: 1.5px solid var(--text); }
.sessions-empty { padding: 2.5rem; text-align: center; color: var(--text-3); }

.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.1rem; }
.pager button {
  font-family: var(--mono); font-size: 0.8rem; padding: 0.45rem 0.9rem;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); border-radius: 8px; cursor: pointer;
}
.pager button:disabled { opacity: 0.35; cursor: default; }
.pager button:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.pager__info { font-family: var(--mono); font-size: 0.78rem; color: var(--text-3); }

/* ---------- companies ---------- */
.companies { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.4rem; margin-top: 1.8rem; }
.sector { border-top: 1px solid var(--line-2); padding-top: 0.7rem; }
.sector__name { font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--text); margin: 0 0 0.5rem; }
.sector__list { list-style: none; margin: 0; padding: 0; }
.sector__list li { display: flex; justify-content: space-between; gap: 0.6rem; align-items: baseline; padding: 0.22rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; color: var(--text-2); }
.sector__yrs { font-family: var(--mono); font-size: 0.66rem; color: var(--text-3); white-space: nowrap; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 2rem; background: #060607; }
.footer__inner { max-width: var(--maxw); margin: 0 auto; padding: clamp(2.2rem, 5vw, 3.5rem) clamp(1.1rem, 4vw, 2rem); }
.footer__title { font-family: var(--display); font-weight: 800; font-size: clamp(1.4rem, 3vw, 2rem); color: var(--text); margin: 0 0 0.9rem; }
.footer__method { color: var(--text-2); max-width: 850px; font-size: 0.92rem; }
.footer__cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin: 2rem 0 1.4rem; }
.footer__cols h3 { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.74rem; color: var(--accent); margin: 0 0 0.7rem; }
.footer__cols ul { list-style: none; margin: 0; padding: 0; }
.footer__cols li { padding: 0.25rem 0; font-size: 0.88rem; color: var(--text-2); display: flex; align-items: center; gap: 0.5rem; }
.footer__cols a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--line-2); }
.footer__cols a:hover { color: var(--accent); }
.footer__cols .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.footer__credit { color: var(--text-2); font-size: 0.9rem; margin: 0 0 0.5rem; }
.footer__note { color: var(--text-3); font-size: 0.82rem; }
.footer__sign { border-top: 1px solid var(--line); margin-top: 1.3rem; padding-top: 1.1rem; font-family: var(--mono); font-size: 0.78rem; color: var(--text-3); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .topbar__links { display: none; }
  .duo { grid-template-columns: 1fr; }
  .footer__cols { grid-template-columns: 1fr; }
  .hero-chart { display: none; }
  .hero-heatmap { display: block; }
  .sessions-table th:nth-child(3), .sessions-table td:nth-child(3),
  .sessions-table th:nth-child(4), .sessions-table td:nth-child(4),
  .sessions-table th:nth-child(5), .sessions-table td:nth-child(5) { display: none; }
  .sessions-select { max-width: 46%; }
  .sessions-count { margin-left: 0; }
}

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