/* Shared visual layer for the five Atlas exploration pages.
   Loaded last, so it restyles without touching data, interactions or labels. */
:root {
  --t-bg: #FAF8F4; --t-ink: #29243D; --t-muted: #5e5a6e; --t-violet: #5B4BC4; --t-plum: #8D4B79; --t-terra: #D88169; --t-coral: #E8742A;
  --t-yellow: #E7C878; --t-line: #E5DFE7; --t-soft: #ECE8FB; --t-halo: #D9D2F3;
  --t-font: "Avenir Next", "Helvetica Neue", Inter, "Segoe UI", system-ui, sans-serif;
  --bg: var(--t-bg); --ink: var(--t-ink); --muted: var(--t-muted); --line: var(--t-line); --panel: #fff;
  --accent: var(--t-violet); --accent-ink: #4636a8; --accent-soft: var(--t-soft); --cyan: var(--t-violet); --gold: var(--t-coral);
}
body { background: var(--t-bg); color: var(--t-ink); font-family: var(--t-font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .big { font-family: var(--t-font); letter-spacing: -.04em; font-weight: 900; }
.eyebrow { color: var(--t-plum); letter-spacing: .14em; }
a { color: #4636a8; text-decoration-color: var(--t-terra); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--t-ink); outline-offset: 3px; }

/* flat panels, hard edge, no glass */
.panel { background: #fff; border: 2px solid var(--t-ink); border-radius: 6px; box-shadow: 4px 4px 0 var(--t-halo); backdrop-filter: none; }
input, select, .search { font-family: var(--t-font); border: 2px solid var(--t-ink) !important; border-radius: 4px !important; background: #fff !important; color: var(--t-ink) !important; }
input[type="range"] { accent-color: var(--t-violet); border: 0 !important; }
.pill { border: 1.5px solid var(--t-ink); border-radius: 99px; color: var(--t-ink); background: transparent; font-weight: 700; }
.big { color: var(--t-violet); font-weight: 900; }
.papers li, .paperlist li, .idea-group, .idea-list li { border-color: var(--t-line); }
.papers a, .paperlist a { font-weight: 600; text-decoration-thickness: 1px; text-decoration-color: var(--t-plum); }

/* About the data disclosure (replaces the long footer paragraph) */
details.aboutdata { margin: 22px 0 0; max-width: 1000px; font-size: 13px; color: var(--t-muted); }
details.aboutdata summary { cursor: pointer; width: max-content; font-weight: 800; color: var(--t-violet); }
details.aboutdata p { margin: 8px 0 0; }

/* compact header for pages opened on their own (injected by atlas-theme.js) */
.atlas-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; padding: 8px clamp(14px, 3vw, 46px); background: var(--t-bg); border-bottom: 2px solid var(--t-ink); font-family: var(--t-font); }
.atlas-bar .crumb { font-weight: 900; letter-spacing: -.02em; }
.atlas-bar .crumb a { color: var(--t-violet); text-decoration: none; }
.atlas-bar nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.atlas-bar nav a { padding: 4px 11px; border-radius: 99px; text-decoration: none; font-size: .88rem; font-weight: 700; color: var(--t-muted); border: 2px solid transparent; }
.atlas-bar nav a:hover { color: var(--t-ink); border-color: var(--t-line); }
.atlas-bar nav a[aria-current="page"] { background: var(--t-violet); color: #fff; border-color: var(--t-violet); }
html.chrome .shell > .eyebrow, html.chrome .shell > .meta, html.chrome .shell > .warning, html.chrome .masthead, html.chrome .hero .eyebrow, html.chrome .hero-orb { display: none; }
html.chrome h1 { font-size: clamp(26px, 3vw, 40px); margin: 18px 0 8px; }
html.chrome .intro { font-size: 15px; margin-bottom: 14px; }

/* ---------- Topics ---------- */
#map { background: #fff; border: 2px solid var(--t-ink); border-radius: 6px; }
#map .orbit { stroke: var(--t-line); stroke-dasharray: none; stroke-width: 1.5; }
#map .link { stroke: var(--t-plum); stroke-dasharray: none; opacity: .42; }
#map .link:hover { stroke: var(--t-plum); opacity: .7; }
#map .link.active { stroke: var(--t-terra); opacity: 1; stroke-dasharray: none; }
#map .link:focus-visible { outline: none; opacity: 1; stroke: var(--t-ink); }
#map .node { fill: var(--nc, #5B4BC4); stroke: #fff; stroke-width: 2.5; filter: none; }
#map g:nth-of-type(4n+1) .node { --nc: #5B4BC4; } #map g:nth-of-type(4n+2) .node { --nc: #8D4B79; }
#map g:nth-of-type(4n+3) .node { --nc: #D88169; } #map g:nth-of-type(4n+4) .node { --nc: #B2A3F0; }
#map .node.active { fill: var(--t-yellow); stroke: var(--t-ink); stroke-width: 4; }
#map g:hover .node { stroke: var(--t-ink); stroke-width: 3.5; transform: none; }
#map text { fill: var(--t-ink); font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
#map text.focus { fill: var(--t-ink); font-weight: 900; }
#map [role="button"]:focus-visible { outline: none; }
#map g[role="button"]:focus-visible .node { stroke: var(--t-ink); stroke-width: 5; }
.legend .dot { background: var(--t-yellow); border: 2px solid var(--t-ink); width: 12px; height: 12px; }
.legend .dash { border-top: 3px solid var(--t-terra); }
.fill { background: var(--t-violet); }
.track { background: var(--t-soft); }
.chartpanel .controls label { font-weight: 700; color: var(--t-ink); }
.rangeout { color: var(--t-ink); font-weight: 900; }

/* ---------- Methods ---------- */
.matrixpanel { padding: 18px; }
.layout:has(.matrixpanel) { grid-template-columns: minmax(0, 2.5fr) minmax(300px, .9fr); }
.toolbar { display: grid; grid-template-columns: minmax(130px, 190px) minmax(180px, 340px) 1fr; gap: 4px 16px; align-items: end; margin-bottom: 8px; }
.toolbar > label:first-child { grid-area: 1 / 1; } .toolbar > select { grid-area: 2 / 1; }
.toolbar > .search-label { grid-area: 1 / 2; } .toolbar > .search { grid-area: 2 / 2; max-width: none; width: 100%; }
.toolbar > .totals { grid-area: 2 / 3; justify-self: end; color: var(--t-ink); font-weight: 900; }
.toolbar label { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--t-muted); }
.matrixpanel .small { margin: 4px 0 10px; }
.scroll { border: 2px solid var(--t-ink); border-radius: 4px; max-height: 780px; }
thead th, tbody th { background: #fff; color: var(--t-ink); }
thead th { font-size: 12.5px; font-weight: 800; height: 150px; }
thead th span { max-height: 136px; }
tbody th { font-size: 13px; font-weight: 800; min-width: 190px; max-width: 190px; border-right: 2px solid var(--t-line); }
thead th:first-child { min-width: 190px; font-size: 12px; color: var(--t-muted); }
.cell { border: 0; border-radius: 3px; font-weight: 800; }
.cell:hover, .cell:focus-visible { outline: 3px solid var(--t-ink); outline-offset: 1px; }
.cell.active { outline: 4px solid var(--t-ink); outline-offset: 2px; box-shadow: 0 0 0 8px var(--t-yellow); position: relative; z-index: 1; }
tbody tr:has(.cell.active) > th { background: var(--t-ink); color: #fff; }
thead th.col-on { background: var(--t-ink); color: #fff; }
.legend { color: var(--t-muted); }
.detail h2 { font-weight: 900; }

/* ---------- People ---------- */
.layout:has(.finder) { grid-template-columns: minmax(220px, 250px) minmax(0, 1fr) minmax(300px, 340px); gap: 18px; }
.finder { padding: 16px; }
.finder label { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--t-muted); margin-top: 10px; }
.finder input, .finder select { padding: 8px 10px; }
.finder p { font-size: 12px; }
.name-list { max-height: 520px; }
.name-button { font-weight: 600; border-top-color: var(--t-line); }
.name-button small { font-weight: 800; color: var(--t-ink); }
.name-button:hover, .name-button:focus-visible { color: var(--t-violet); outline: 2px solid var(--t-violet); }
.name-button.active { background: var(--t-soft); color: var(--t-ink); font-weight: 900; box-shadow: inset 4px 0 0 var(--t-violet); padding-left: 10px; }
.chartpanel > p { font-size: 12.5px; }
.chartpanel:has(#map) svg { min-height: 560px; }
svg .groove { stroke: var(--t-line); stroke-width: 1.5; }
svg .link { stroke: var(--t-plum); opacity: .5; }
svg .link.active { stroke: var(--t-terra); opacity: 1; }
svg .center { fill: var(--t-terra); stroke: var(--t-ink); stroke-width: 4; }
svg .node { fill: #5B4BC4; stroke: #fff; stroke-width: 3; }
svg .node-group:nth-of-type(3n+2) .node { fill: #8D4B79; } svg .node-group:nth-of-type(3n+3) .node { fill: #B2A3F0; }
svg .node:hover, svg .node.active { fill: var(--t-yellow); stroke: var(--t-ink); stroke-width: 4; }
svg .node-group:focus-visible .node { stroke: var(--t-ink); stroke-width: 5; }
svg text { fill: var(--t-ink); font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
#map .center ~ text { stroke: none; fill: var(--t-ink); font-weight: 900; }
svg .centername { fill: var(--t-ink); font-weight: 900; } svg .nodecount { fill: var(--t-muted); }
.yearbar { background: var(--t-violet); }
#detail-note { margin-top: 10px; padding: 8px 10px; border-left: 4px solid var(--t-terra); background: #f4f0e8; color: var(--t-ink); font-size: 12.5px; }
@media (max-width: 1120px) { .layout:has(.finder) { grid-template-columns: minmax(210px, 240px) minmax(0, 1fr); } }
@media (max-width: 700px) { .layout:has(.finder) { grid-template-columns: 1fr; } .chartpanel:has(#map) svg { min-height: 300px; } }
@media (max-width: 720px) {
  .layout:has(.matrixpanel) { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar > .totals { grid-area: 3 / 1 / 4 / 3; justify-self: start; }
  thead th { height: 132px; } tbody th, thead th:first-child { min-width: 150px; max-width: 150px; }
}

/* ---------- Through the Years: accents follow the selected year ---------- */
.stop { --accent: color-mix(in srgb, var(--year-tone, #5b4bc4) 82%, #29243d); }
.stop .entry { border-left-color: var(--year-tone, var(--t-line)); }
.stop .entry:before { background: var(--year-tone, #5b4bc4); }
.embedded .intro, .embedded .wheel-controls > span { display: none; }
.embedded .wheel-controls { padding-bottom: 0; }
.embedded .years-nav { padding-bottom: 14px; }
.years-nav a { border: 2px solid var(--t-ink); font-weight: 800; }
.years-nav a[aria-current="true"] { background: var(--t-ink); border-color: var(--t-ink); color: #fff; }
.wheel-controls button { border: 2px solid var(--t-ink); border-radius: 4px; font-weight: 800; }
.feature h2 { font-weight: 900; }
.discovery summary { font-weight: 700; }

/* ---------- Questions ---------- */
.questions, .answer, .ideas, .featured { border: 2px solid var(--t-ink); border-radius: 6px; box-shadow: 4px 4px 0 var(--t-halo); backdrop-filter: none; }
.qbutton { border: 2px solid var(--t-ink); border-radius: 4px; }
.qbutton.active { background: var(--t-yellow); }
.status { border-radius: 4px; border: 1.5px solid var(--t-ink); background: transparent; color: var(--t-ink); }
.bar { background: var(--t-violet); }

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

/* keep the Questions cards typography as designed */
.card h3 { letter-spacing: normal; font-weight: inherit; font-family: inherit; }

/* mobile: keep graph labels legible by letting the graphs scroll sideways inside their panel; network first on People */
@media (max-width: 620px) {
  .chartpanel { overflow-x: auto; }
  #map { min-width: 560px; }
  .chartpanel:has(#map) svg { min-width: 520px; }
  .layout:has(.finder) .chartpanel { order: -1; }
  .layout:has(.finder) .finder { order: 0; } .layout:has(.finder) .detail { order: 1; }
}
