/* Agent Ethology — flat layer (replaces the neumorphic trial). Loaded last on every page.
   One ground (#161b15), hairline outlines, tinted fills for selection and quote wells. No shadows. */
:root, :root:where(*) {
  --night: #161b15;
  --ground: #161b15;
  --line: rgba(181, 209, 204, 0.18);
  --line-strong: rgba(181, 209, 204, 0.32);
  --tile: rgba(250, 237, 143, 0.035);
  --well: rgba(181, 209, 204, 0.06);
  --pick: rgba(181, 209, 204, 0.16);
}
html, body { background: var(--ground) !important; }

/* header */
.tabs { background: var(--ground); border-bottom: 1px solid var(--line); box-shadow: none; }
.range { border-top: 1px solid var(--line); }
.range-strip { border-radius: 8px; border: 1px solid var(--line); padding: 2px 6px; box-shadow: none; }
.mast { border-bottom: 0; }

/* buttons and selects: outlined pills; selected = filled tint */
.btn, select { border: 1px solid var(--line-strong) !important; background: transparent !important; border-radius: 999px !important; box-shadow: none !important; }
select { background: var(--ground) !important; }
.btn:hover, select:hover { border-color: #b5d1cc !important; }
.btn[aria-pressed="true"] { background: var(--pick) !important; border-color: #b5d1cc !important; color: #b5d1cc; }
.btn:disabled { opacity: 0.35; }

/* findings: three outlined tiles */
.findings { background: none !important; border: 0 !important; gap: 16px !important; margin: 26px 0 30px !important; }
.finding, .finding + .finding { background: var(--tile) !important; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px !important; box-shadow: none; }

/* chart panels outlined; side panels tinted */
.chart, .map { background: transparent; border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: none; }
.chart .chart { border: 0; padding: 0; border-radius: 0; }
.side { border: 1px solid var(--line) !important; border-radius: 18px; background: var(--well); padding: 18px !important; box-shadow: none; align-self: start; }
@media (max-width: 960px) { .side { padding: 16px !important; } }
.lists { border-top: 0 !important; }

/* receipts: tinted wells, colour edge kept */
.quote, .face, .back, .note, .sess, .obs { border-radius: 4px 10px 10px 4px !important; background: var(--well) !important; box-shadow: none; padding: 10px 12px 11px 14px !important; border-left-width: 3px !important; margin-bottom: 10px; }
.quote.reply { margin-left: 16px; }

/* list rows */
.board li:hover, .rank li:hover, .pairs li:hover, .cmd li:hover { background: var(--well) !important; box-shadow: none; }
.board li.sel, .rank li.sel { background: var(--pick) !important; box-shadow: none; }

/* tooltip and drawers */
.tip { background: var(--ground) !important; border: 1px solid var(--line-strong) !important; box-shadow: none; border-radius: 12px !important; }
.convo { background: var(--ground) !important; border-left: 1px solid var(--line) !important; box-shadow: none; }
.convo-nav { border-bottom: 1px solid var(--line) !important; }
.cv-msg { margin: 0; border-radius: 0; box-shadow: none; }
.cv-msg + .cv-msg { border-top: 1px solid var(--line) !important; }
.cv-msg.focus { background: var(--pick) !important; box-shadow: none; }
.cv-chip { border: 1px solid var(--line) !important; box-shadow: none; padding: 1px 7px !important; }

/* time strip: the outline must contain the whole strip */
.range-strip { height: auto !important; padding: 4px 8px !important; box-sizing: border-box; }
.range-strip svg { height: 26px !important; display: block; }

/* side panels never stretch the row: they take the chart's height and scroll inside */
@media (min-width: 961px) {
  .split { align-items: stretch !important; }
  .split > .side { height: 0; min-height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #566b5e transparent; }
  .split > .side::-webkit-scrollbar { width: 8px; }
  .split > .side::-webkit-scrollbar-thumb { background: #566b5e; border-radius: 4px; }
  .split > .chart, .split > div:first-child { align-self: start; }
}

/* empty states: say what happened, why, and offer the way out */
.empty { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 16px 18px; display: grid; gap: 6px; justify-items: start; }
.empty b { font: 600 14px var(--sans); color: var(--bone); }
.empty p { margin: 0; color: #c9d0c5; font-size: 13px; line-height: 1.5; }
.empty .btn { margin-top: 6px; }
/* says exactly which slice of data a chart shows when it differs from the obvious reading */
.scope-note { margin: 0 0 10px; font: 12px/1.5 var(--mono); color: #b9c4b5; }

/* ============================================================ v2: legibility */
:root, :root:where(*) { --ash: #a9b8ad; --soot: #8fa298; --ink2: #d5dccf; }
body { font-size: 15px; }
.dek { font-size: 16px; line-height: 1.55; color: var(--ink2); max-width: 60ch; }
.finding p, .hint, .quote { font-size: 14px; line-height: 1.55; }
.finding p { color: var(--ink2); }
.side h2, .label, .eyebrow { font-size: 12px; }
.axis text, .tick text { font-size: 12px; }
.quote small { font-size: 11.5px; }
.foot { font-size: 12.5px; color: var(--ash); max-width: 110ch; }
.legend { font-size: 12.5px; }
.board .who span, .rank .who span { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }

/* ============================================================ v2: navigation */
.tabs-in { gap: 6px 14px; overflow: visible; flex-wrap: wrap; min-height: 54px; }
.brand { color: var(--bone) !important; text-decoration: none; font-size: 14px; }
.navlink { font: 500 13px var(--sans); color: var(--ash); text-decoration: none; padding: 6px 2px; border-bottom: 2px solid transparent; }
.navlink:hover { color: var(--bone); }
.navlink[aria-current="page"] { color: var(--bone); border-bottom-color: var(--amber); }
.navlink.about { margin-left: auto; }
.chap { position: relative; }
.chap-btn { font: 500 13px var(--sans); color: var(--bone); background: var(--well); border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 14px; cursor: pointer; }
.chap-btn b { font: 500 12px var(--mono); color: var(--amber); margin-right: 4px; }
.chap-btn:hover { border-color: var(--amber); }
.chap-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 50; width: min(520px, calc(100vw - 32px)); background: var(--ground); border: 1px solid var(--line-strong); border-radius: 16px; padding: 14px; }
.chap-title { margin: 0 0 8px; font: 500 12px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ash); }
.chap-menu ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.chap-menu a { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--bone); }
.chap-menu a:hover, .chap-menu a:focus-visible { background: var(--well); }
.chap-menu a[aria-current="page"] { background: var(--pick); }
.chap-menu a b { font: 500 13px var(--mono); color: var(--amber); padding-top: 1px; }
.chap-menu strong { display: block; font: 600 14px var(--sans); }
.chap-menu em { display: block; font-style: normal; font-size: 13px; color: var(--ash); }
.chap-step { display: inline-flex; align-items: center; gap: 8px; font: 12px var(--mono); color: var(--ash); }
.chap-step a { color: var(--bone); text-decoration: none; font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.chap-step a:hover { background: var(--well); }
.chap-step > span:first-child:not(:only-child), .chap-step > span:last-child { opacity: 0.3; font-size: 18px; }
@media (max-width: 700px) { .navlink.about { margin-left: 0; } .chap-step { display: none; } }

.next-chapter { display: grid; gap: 6px; margin-top: 36px; padding: 22px 24px; border: 1px solid var(--line-strong); border-radius: 18px; text-decoration: none; color: var(--bone); background: var(--tile); }
.next-chapter strong { font: 700 clamp(20px, 2.4vw, 28px)/1.15 var(--sans); letter-spacing: -0.02em; }
.next-chapter .go { font: 500 13px var(--mono); color: var(--amber); }
.next-chapter:hover { border-color: var(--amber); }

/* ============================================================ v2: glossary */
.term { border-bottom: 1px dotted currentColor; cursor: help; text-decoration: none; }
.term:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 2px; }
.term-pop { position: fixed; z-index: 60; max-width: 330px; background: var(--ground); border: 1px solid var(--line-strong); border-radius: 12px; padding: 11px 13px; font-size: 13.5px; line-height: 1.5; color: var(--ink2); pointer-events: none; }
.term-pop b { display: block; color: var(--bone); font: 600 14px var(--sans); margin-bottom: 4px; }

/* ============================================================ v2: finding-first header */
.mast.v2 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; padding-bottom: 18px; gap: 18px 40px; }
@media (max-width: 960px) { .mast.v2 { grid-template-columns: 1fr; } }
.mast.v2 .kicker { margin: 0 0 10px; font: 600 clamp(17px, 1.7vw, 21px)/1.25 var(--sans); color: var(--ink2); letter-spacing: -0.01em; }
.mast.v2 h1 { font-size: clamp(28px, 3.4vw, 46px); line-height: 1.06; letter-spacing: -0.03em; max-width: 24ch; }
.mast.v2 h1 em { font-style: normal; color: #b5d1cc; }
.mast.v2 .dek { margin-top: 14px; }
.lead-quote { margin: 0; align-self: center; }
.lead-quote .quote { margin: 0 0 8px; font-size: 15px; line-height: 1.55; color: var(--bone); border-left-color: #b5d1cc !important; }
.lead-quote figcaption { font: 12px/1.5 var(--mono); color: var(--ash); display: block; }
.lead-quote figcaption b { color: var(--ink2); font-weight: 500; }

/* chart panel: key on top, chart, method underneath */
.panel { border: 1px solid var(--line); border-radius: 18px; padding: 16px; min-width: 0; }
.panel > .chart, .panel .map { border: 0 !important; padding: 0 !important; border-radius: 0 !important; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; margin-bottom: 12px; }
.howto { margin: 0; font-size: 14px; line-height: 1.5; color: var(--ink2); max-width: 78ch; }
.howto b { color: var(--bone); font-weight: 600; }
.howto::before { content: "How to read it  "; font: 500 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); margin-right: 6px; }
.cue { flex: none; display: inline-flex; align-items: center; gap: 6px; font: 500 12px var(--mono); color: var(--ground); background: #b5d1cc; border-radius: 999px; padding: 5px 11px; }
.method { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font: 12.5px/1.6 var(--mono); color: var(--ash); }
.method b { color: var(--ink2); font-weight: 500; }

/* findings move below the evidence */
.more-title { margin: 30px 0 0; font: 500 12px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ash); }
.findings.more { margin-top: 12px !important; }
.findings.more .finding b { font-size: 22px; }

/* annotations and baselines drawn on charts */
.anno text, text.anno { font: 600 12.5px var(--sans); fill: var(--bone); paint-order: stroke; stroke: var(--ground); stroke-width: 4px; stroke-linejoin: round; }
.anno line, line.anno, .anno path { stroke: var(--bone); stroke-width: 1; fill: none; }
.baseline line, line.baseline { stroke: #b5d1cc; stroke-dasharray: 5 4; stroke-width: 1.2; }
.baseline text, text.baseline { font: 12px var(--mono); fill: #b5d1cc; paint-order: stroke; stroke: var(--ground); stroke-width: 4px; }
.lead-quote figcaption svg, .chap-menu svg, .next-chapter svg { width: 13px !important; height: 13px !important; display: inline-block; vertical-align: -2px; }
