/* =============================================================================
   Comorbidity Atlas — scoped styles (COMORBIDITY-ATLAS-BRIEF.md)
   Loaded after global.css on every atlas surface. Inherits the site's tokens
   (--fg, --bg, --accent=violet, --radius*, --shadow*) and adds the atlas-only
   vocabulary: sub-nav, evidence tiers, taxonomic palette, marginalia, and the
   Read / Explore / Conditions / Mechanisms / Data surfaces.
============================================================================= */

.atlas-wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px);
  padding-bottom: 6rem;
}
.atlas-loading { color: var(--fg-mute); padding: 3rem 0; font-size: 15px; }

/* --- surface sub-nav strip ------------------------------------------------ */
.atlas-subnav {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}
.atlas-subnav-inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 0 clamp(16px, 4vw, 48px);
  height: 52px; display: flex; align-items: center; gap: 1.25rem;
}
.atlas-brand {
  display: inline-flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: 14px; letter-spacing: -.01em;
  color: var(--fg); text-decoration: none; white-space: nowrap;
}
.atlas-brand-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.atlas-tabs { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.atlas-tabs::-webkit-scrollbar { display: none; }
.atlas-tab {
  padding: .4rem .8rem; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--fg-dim);
  text-decoration: none; white-space: nowrap; transition: background .15s, color .15s;
}
.atlas-tab:hover { background: var(--bg-soft); color: var(--fg); }
.atlas-tab.active { background: color-mix(in srgb, var(--accent) 16%, var(--bg-soft)); color: var(--accent-2); }
:root[data-theme="dark"] .atlas-tab.active { color: var(--c-violet-1); }

/* --- generic atlas section headers --------------------------------------- */
.atlas-head { padding: 2.5rem 0 1.5rem; }
.atlas-eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-2); font-weight: 600;
}
:root[data-theme="dark"] .atlas-eyebrow { color: var(--c-violet-1); }
.atlas-head h1 { font-size: clamp(1.7rem, 3.5vw, 2.6rem); margin: .4rem 0 .5rem; letter-spacing: -.02em; }
.atlas-head p.lead { color: var(--fg-dim); font-size: 1.05rem; max-width: 62ch; line-height: 1.55; }

/* --- evidence tiers (brief §5) ------------------------------------------- */
.ev-tier {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  padding: .14rem .5rem; border-radius: 999px;
  border: 1px solid var(--border-hi); color: var(--fg-dim);
  background: var(--bg-soft); white-space: nowrap;
}
.ev-tier::before {
  content: ""; width: 16px; height: 0; border-top-width: 2.5px; border-top-style: solid;
  border-color: currentColor; display: inline-block; opacity: .9;
}
.ev-tier.ev-solid  { color: var(--c-mint-2); border-color: color-mix(in srgb, var(--c-mint-1) 40%, transparent); }
.ev-tier.ev-dashed { color: var(--c-amber-2); border-color: color-mix(in srgb, var(--c-amber-1) 40%, transparent); }
.ev-tier.ev-dashed::before { border-top-style: dashed; }
.ev-tier.ev-dotted { color: var(--fg-mute); border-style: dashed; font-style: italic; }
.ev-tier.ev-dotted::before { border-top-style: dotted; opacity: .7; }
:root[data-theme="dark"] .ev-tier.ev-solid  { color: var(--c-mint-1); }
:root[data-theme="dark"] .ev-tier.ev-dashed { color: var(--c-amber-1); }

/* --- taxonomic_group chips ----------------------------------------------- */
.tg-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: 11.5px; font-weight: 600; padding: .16rem .55rem;
  border-radius: 999px; white-space: nowrap;
  color: var(--tg, var(--fg-mute));
  background: color-mix(in srgb, var(--tg, var(--fg-mute)) 14%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--tg, var(--fg-mute)) 35%, transparent);
}
.tg-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tg, var(--fg-mute)); }

/* status / diagnostic badges */
.atlas-badge {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; padding: .16rem .5rem;
  border-radius: 6px; border: 1px solid var(--border-hi); color: var(--fg-dim);
  background: var(--bg-soft);
}
.atlas-badge.rs-literature_passed, .atlas-badge.rs-verified { color: var(--c-mint-2); border-color: color-mix(in srgb,var(--c-mint-1) 35%, transparent); }
.atlas-badge.rs-seeded, .atlas-badge.rs-drafted { color: var(--c-amber-2); border-color: color-mix(in srgb,var(--c-amber-1) 35%, transparent); }
.atlas-badge.dx-phenotypic_construct, .atlas-badge.dx-research_criteria, .atlas-badge.dx-trait_construct {
  color: var(--c-violet-2); border-color: color-mix(in srgb,var(--c-violet-1) 40%, transparent); }
:root[data-theme="dark"] .atlas-badge.rs-literature_passed { color: var(--c-mint-1); }
:root[data-theme="dark"] .atlas-badge.rs-seeded { color: var(--c-amber-1); }
:root[data-theme="dark"] .atlas-badge.dx-phenotypic_construct { color: var(--c-violet-1); }

/* =============================================================================
   Shared index controls
============================================================================= */
.atlas-group-head {
  margin-top: 1.4rem; font-size: 13px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--fg-dim);
  display: flex; align-items: center; gap: .5rem;
}
.atlas-search {
  flex: 1 1 240px; max-width: 360px; padding: .55rem .95rem;
  border-radius: 999px; border: 1px solid var(--border-hi); background: var(--bg-soft);
  color: var(--fg); font-size: 14px;
}
.atlas-search:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px; }
.atlas-count { color: var(--fg-mute); font-size: 13px; }

/* =============================================================================
   Node detail pages (condition / mechanism)
============================================================================= */
.atlas-node-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 360px); gap: clamp(1.6rem, 3.5vw, 3rem); align-items: start; padding-bottom: 4rem; }
.atlas-node-main { min-width: 0; }
.atlas-node-aside { position: sticky; top: 84px; }
@media (max-width: 900px) { .atlas-node-page { grid-template-columns: 1fr; } .atlas-node-aside { position: static; } }

.atlas-node-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem .9rem; padding-top: 1.4rem; }
.atlas-node-header h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); letter-spacing: -.035em; line-height: 1.03; font-weight: 800; margin: 0; }
.atlas-aliases { color: var(--fg-mute); font-size: 14px; }
.atlas-badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .2rem; width: 100%; }
.atlas-summary { color: var(--fg-dim); font-size: 1.04rem; line-height: 1.65; margin: 1.3rem 0 .4rem; max-width: 72ch; }

.atlas-back { display: inline-block; color: var(--fg-mute); text-decoration: none; font-size: 13px; margin-top: 1rem; }
.atlas-back:hover { color: var(--accent-2); }

.atlas-sec { margin-top: 1.8rem; }
.atlas-sec > h2 { font-size: 1.15rem; letter-spacing: -.01em; margin: 0 0 .2rem; }
.atlas-sec > .sec-note { color: var(--fg-mute); font-size: 13px; line-height: 1.55; margin: 0 0 1.1rem; max-width: 76ch; }

.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.kc-chip { font-size: 12.5px; padding: .26rem .7rem; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg-dim); }

/* edge rows */
.edge-list { display: flex; flex-direction: column; gap: 10px; }
.edge-row {
  background: var(--bg-elev); border: 1px solid var(--border); border-left: 3px solid var(--edge-c, var(--border-hi));
  border-radius: var(--radius-xs); padding: .9rem 1.1rem; position: relative;
}
.edge-row .edge-top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.edge-row .edge-target { font-weight: 700; font-size: 15px; letter-spacing: -.012em; text-decoration: none; color: var(--fg); }
.edge-row .edge-target:hover { color: var(--accent-2); }
.edge-dir { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--fg-mute); padding: .1rem .4rem; border: 1px solid var(--border); border-radius: 5px; }
.edge-claim { color: var(--fg-dim); font-size: 13.5px; line-height: 1.6; margin: .5rem 0 0; }
.edge-meta { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.edge-cites { font-size: 12px; color: var(--fg-mute); }
.edge-caveat { margin-top: .5rem; font-size: 12.5px; color: var(--fg-mute); border-top: 1px dashed var(--border); padding-top: .45rem; }
.edge-caveat b { color: var(--fg-dim); font-weight: 600; }
.edge-estimates { margin-top: .5rem; }
.edge-estimates summary { cursor: pointer; font-size: 12.5px; color: var(--accent-2); font-weight: 600; }
.edge-est-item { font-size: 12.5px; color: var(--fg-dim); padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.edge-est-item:last-child { border-bottom: 0; }
.edge-mag { font-size: 11px; font-weight: 700; color: var(--fg-mute); }

/* citations list */
.cite-list { display: grid; gap: 6px; }
.cite-item { font-size: 13px; color: var(--fg-dim); line-height: 1.55; padding: .65rem .85rem; background: var(--bg-soft); border-radius: var(--radius-xs); }
.cite-item a { color: var(--accent-2); text-decoration: none; }
.cite-item .cite-type { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-mute); font-weight: 700; }

/* node aside / mini-viz */
.node-miniviz { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.1rem 1.15rem; box-shadow: var(--shadow-sm); }
.node-miniviz h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--fg-mute); margin: 0 0 .9rem; }
.miniviz-bar { display: grid; grid-template-columns: 1fr; gap: 6px; }
.mvb-row { display: grid; grid-template-columns: 96px 1fr 26px; gap: .6rem; align-items: center; font-size: 12px; }
.mvb-label { color: var(--fg-dim); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mvb-track { height: 9px; border-radius: 6px; background: var(--bg-soft); overflow: hidden; }
.mvb-fill { height: 100%; border-radius: 6px; background: var(--mvb-c, var(--accent)); }
.mvb-num { color: var(--fg-mute); text-align: right; }

/* =============================================================================
   Marginalia — affordance + popover
============================================================================= */
[data-atlas-target] { position: relative; }
[data-atlas-target].has-marginalia::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg);
}
.atlas-margin-affordance {
  position: absolute; z-index: 60; width: 20px; height: 20px; padding: 0;
  border-radius: 50%; border: 1px solid var(--border-hi);
  background: var(--accent); color: #fff; font-size: 15px; line-height: 1;
  cursor: pointer; box-shadow: var(--shadow-sm); display: grid; place-items: center;
}
.atlas-margin-affordance:hover { transform: scale(1.12); }

.atlas-margin-pop {
  position: absolute; z-index: 80; background: var(--bg-elev);
  border: 1px solid var(--border-hi); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: .9rem; font-size: 13px;
}
.amp-head { display: grid; grid-template-columns: 1fr auto; gap: .1rem .5rem; align-items: center; margin-bottom: .6rem; }
.amp-title { font-weight: 700; font-size: 14px; }
.amp-target { grid-column: 1 / 2; font-size: 11.5px; color: var(--fg-mute); display: flex; gap: .4rem; align-items: center; }
.amp-target code { font-size: 11px; }
.amp-kind { text-transform: capitalize; }
.amp-close { grid-row: 1 / 3; grid-column: 2; background: none; border: 0; font-size: 20px; color: var(--fg-mute); cursor: pointer; }
.amp-list { max-height: 200px; overflow: auto; display: grid; gap: 6px; margin-bottom: .7rem; }
.amp-empty { color: var(--fg-mute); font-size: 12px; margin: .2rem 0; }
.amp-item { background: var(--bg-soft); border-radius: var(--radius-xs); padding: .45rem .6rem; }
.amp-item-meta { display: flex; align-items: center; gap: .4rem; font-size: 11px; }
.amp-item-type { font-weight: 700; color: var(--accent-2); }
.amp-item-date { color: var(--fg-mute); }
.amp-item-del { margin-left: auto; background: none; border: 0; color: var(--fg-mute); cursor: pointer; font-size: 15px; line-height: 1; }
.amp-item-del:hover { color: var(--c-coral-2); }
.amp-item-body { font-size: 12.5px; color: var(--fg-dim); margin-top: .25rem; line-height: 1.4; }
.amp-type-row { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .55rem; }
.amp-type { font-size: 11px; padding: .22rem .5rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--fg-dim); cursor: pointer; }
.amp-type.active { background: color-mix(in srgb, var(--accent) 16%, var(--bg-soft)); color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.amp-field { display: block; margin-bottom: .5rem; }
.amp-field-label { display: block; font-size: 11px; color: var(--fg-mute); margin-bottom: .2rem; }
.amp-field input, .amp-field textarea {
  width: 100%; padding: .4rem .55rem; border-radius: var(--radius-xs);
  border: 1px solid var(--border-hi); background: var(--bg-soft); color: var(--fg); font: inherit; font-size: 12.5px;
}
.amp-actions { display: flex; justify-content: flex-end; }
.amp-save { padding: .4rem 1rem; font-size: 13px; }

/* =============================================================================
   Explore surface
============================================================================= */
.panel-sub { color: var(--fg-mute); font-size: 13px; }
.panel-tools { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.panel-body { padding: 1.1rem; }

.seg-toggle { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.seg-toggle button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--fg-dim); padding: .32rem .85rem; border-radius: 999px; cursor: pointer; transition: color .15s; }
.seg-toggle button.active { background: var(--accent); color: var(--accent-fg); }

/* matrix heatmap */
.matrix-scroll { overflow: auto; max-width: 100%; }
.matrix-grid { display: grid; gap: 3px; }
.matrix-corner, .matrix-colhead, .matrix-rowhead { font-size: 12px; }
.matrix-colhead { writing-mode: vertical-rl; transform: rotate(180deg); color: var(--fg-dim); padding: 3px 2px 5px; white-space: nowrap; text-align: right; align-self: end; letter-spacing: -.01em; }
.matrix-rowhead { color: var(--fg-dim); padding: 2px 10px 2px 0; white-space: nowrap; text-align: right; align-self: center; overflow: hidden; text-overflow: ellipsis; }
.matrix-cell { aspect-ratio: 1; min-width: 26px; border-radius: 4px; cursor: pointer; background: var(--cell-c, var(--bg-soft)); border: 1px solid transparent; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 11px; font-variant-numeric: tabular-nums; transition: outline-color .12s; }
.matrix-cell.empty { background: var(--bg-soft); cursor: default; }
.matrix-cell.dashed { border-color: color-mix(in srgb, var(--fg-mute) 50%, transparent); border-style: dashed; }
.matrix-cell.diag { background: var(--border); cursor: default; }
.matrix-cell:hover:not(.empty):not(.diag) { outline: 2px solid var(--fg); outline-offset: -1px; }
.matrix-cell.sel { outline: 2px solid var(--accent); outline-offset: -1px; }
.matrix-detail { margin-top: 1rem; padding: 1rem; background: var(--bg-soft); border-radius: var(--radius-sm); font-size: 13px; display: none; }
.matrix-detail.show { display: block; }
.matrix-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 1rem; font-size: 12.5px; line-height: 1.55; color: var(--fg-mute); align-items: center; max-width: 78ch; }

/* compound disruption */
.cd-controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.4rem; }
.cd-selected { display: flex; flex-wrap: wrap; gap: .35rem; }
.cd-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: 13px; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, var(--bg-soft)); color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.cd-pill button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; }
.cd-add { position: relative; }
.cd-menu { position: absolute; z-index: 30; top: 110%; left: 0; min-width: 220px; max-height: 260px; overflow: auto; background: var(--bg-elev); border: 1px solid var(--border-hi); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: .3rem; display: none; }
.cd-menu.show { display: block; }
.cd-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; font-size: 13px; color: var(--fg-dim); padding: .4rem .5rem; border-radius: 8px; cursor: pointer; }
.cd-menu button:hover { background: var(--bg-soft); color: var(--fg); }
.cd-presets { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: 1.2rem; }
.cd-preset { font-size: 12.5px; padding: .32rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--fg-dim); cursor: pointer; }
.cd-preset:hover { border-color: var(--border-hi); color: var(--fg); }
.cd-result-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 46px; gap: .8rem; align-items: center; padding: .3rem 0; font-size: 13.5px; }
.cd-result-label { color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.cd-result-label:hover { color: var(--accent-2); }
.cd-track { height: 14px; border-radius: 7px; background: var(--bg-soft); overflow: hidden; }
.cd-fill { height: 100%; border-radius: 7px; transition: width .45s var(--ease-out); }
.cd-num { text-align: right; color: var(--fg-dim); font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.cd-empty { color: var(--fg-mute); font-size: 13.5px; padding: 2.4rem 0; text-align: center; line-height: 1.6; }

/* citation timeline */
.ct-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; align-items: center; }
.ct-filter { font-size: 13px; padding: .45rem .7rem; border-radius: 9px; border: 1px solid var(--border-hi); background: var(--bg-soft); color: var(--fg); }
.ct-chart { overflow-x: auto; }
.ct-row { display: grid; grid-template-columns: 116px 1fr; gap: .8rem; align-items: center; border-top: 1px dashed var(--border); padding: .55rem 0; }
.ct-row-label { font-size: 12.5px; color: var(--fg-dim); text-transform: capitalize; text-align: right; }
.ct-dots { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 18px; }
.ct-dot { width: 14px; height: 14px; border-radius: 50%; cursor: pointer; border: 1px solid color-mix(in srgb, var(--fg) 20%, transparent); transition: transform .12s; }
.ct-dot:hover { transform: scale(1.25); }
.ct-axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11.5px; color: var(--fg-mute); margin-top: .7rem; padding-left: 124px; }

/* generic modal (citation detail) */
.atlas-modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 200; display: grid; place-items: center; padding: 1rem; }
.atlas-modal { background: var(--bg-elev); border: 1px solid var(--border-hi); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-width: 560px; width: 100%; max-height: 86vh; overflow: auto; padding: 1.4rem 1.5rem; }
.atlas-modal h3 { margin: 0 0 .3rem; font-size: 1.15rem; }
.atlas-modal .am-close { float: right; background: none; border: 0; font-size: 22px; color: var(--fg-mute); cursor: pointer; }
.atlas-modal p { color: var(--fg-dim); font-size: 13.5px; line-height: 1.55; }
.atlas-modal a { color: var(--accent-2); }

/* =============================================================================
   Data download surface
============================================================================= */
.data-files { display: grid; gap: 10px; margin: 1.5rem 0; }
.data-file { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.2rem; }
.data-file .df-name { font-family: var(--mono); font-weight: 700; font-size: 14px; }
.data-file .df-desc { color: var(--fg-dim); font-size: 13px; flex: 1 1 240px; }
.data-file .df-size { color: var(--fg-mute); font-size: 12px; }
.data-file .df-dl { margin-left: auto; }
.data-license { max-width: 72ch; }
.data-license h1, .data-license h2, .data-license h3 { letter-spacing: -.01em; }
.data-license p, .data-license li { color: var(--fg-dim); line-height: 1.6; }
.data-license code { background: var(--bg-soft); padding: .05rem .3rem; border-radius: 5px; font-size: .9em; }
.data-license pre { background: var(--bg-soft); padding: 1rem; border-radius: var(--radius-sm); overflow: auto; font-size: 12.5px; }

/* =============================================================================
   THE FLOW FIGURE — directional comorbidity
   -----------------------------------------------------------------------------
   Two bars on one shared 0–100% scale. Unequal bar lengths ARE the asymmetry;
   the sentence above each bar is the reading of it. Cited direction = solid
   fill; base-rate-implied direction = hatched and dashed, never solid, so a
   derived number can't be mistaken for a published one.
============================================================================= */
.flow {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  padding: .85rem 1rem .9rem;
}
.flow + .flow { margin-top: .6rem; }
.flow-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.flow-pair { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; min-width: 0; }
.flow-pair-name { color: var(--fg); text-decoration: none; }
a.flow-pair-name:hover { color: var(--accent-2); }
:root[data-theme="dark"] a.flow-pair-name:hover { color: var(--c-violet-1); }
.flow-badges { margin-left: auto; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.flow-ratio {
  font-size: 11px; font-weight: 800; letter-spacing: .02em;
  padding: .16rem .5rem; border-radius: 999px;
  color: var(--c-amber-2); background: color-mix(in srgb, var(--c-amber-1) 14%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--c-amber-1) 38%, transparent);
  white-space: nowrap;
}
:root[data-theme="dark"] .flow-ratio { color: var(--c-amber-1); }
.flow-ratio-even { color: var(--fg-mute); background: var(--bg-soft); border-color: var(--border); }

.flow-tracks { display: grid; gap: .55rem; }
.flow-track { --fl-c: var(--accent); min-width: 0; }
.flow-track:nth-child(2) { --fl-c: var(--c-cyan-1); }
.flow-track[data-kind="implied"] { --fl-c: var(--fg-mute); }
.flow-track[data-kind="definitional"] { --fl-c: var(--c-violet-2); }
:root[data-theme="dark"] .flow-track[data-kind="definitional"] { --fl-c: var(--c-violet-1); }
.flow-track[data-kind="pooled"] { --fl-c: var(--fg-mute); }

.flow-line {
  display: flex; align-items: baseline; gap: .3rem; flex-wrap: wrap;
  font-size: 13.5px; color: var(--fg-dim); line-height: 1.35;
}
.flow-line .fl-if { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--fg-mute); font-weight: 700; }
.flow-line .fl-node { color: var(--fg); font-weight: 650; text-decoration: none; }
.flow-line a.fl-node:hover { color: var(--fl-c); }
.flow-line .fl-arrow { color: var(--fl-c); font-weight: 700; }
.flow-line .fl-pct {
  font-family: var(--mono); font-size: 15px; font-weight: 700;
  color: var(--fl-c); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.flow-line .fl-tail { color: var(--fg-mute); font-size: 12.5px; }
.fl-tag {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  padding: .08rem .34rem; border-radius: 5px; color: var(--fg-mute);
  border: 1px dashed var(--border-hi); white-space: nowrap;
}
.fl-tag-def { color: var(--c-violet-2); border-color: color-mix(in srgb, var(--c-violet-1) 45%, transparent); border-style: solid; }
:root[data-theme="dark"] .fl-tag-def { color: var(--c-violet-1); }

.flow-bar {
  position: relative; height: 10px; margin-top: .3rem;
  border-radius: 5px; background: var(--bg-soft);
  border: 1px solid var(--border);
  /* quarter ticks so a length is readable without reading the number */
  background-image: linear-gradient(90deg,
    transparent 0 calc(25% - 1px), var(--border-hi) calc(25% - 1px) 25%,
    transparent 25% calc(50% - 1px), var(--border-hi) calc(50% - 1px) 50%,
    transparent 50% calc(75% - 1px), var(--border-hi) calc(75% - 1px) 75%,
    transparent 75%);
  overflow: hidden;
}
.flow-bar i {
  position: absolute; inset: 0 auto 0 0; display: block;
  border-radius: 5px 3px 3px 5px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--fl-c) 55%, transparent), var(--fl-c));
  transition: width .5s var(--ease-out);
}
.flow-bar u.fl-range {
  position: absolute; top: 50%; height: 2px; transform: translateY(-50%);
  background: color-mix(in srgb, var(--fg) 34%, transparent);
  border-left: 2px solid color-mix(in srgb, var(--fg) 44%, transparent);
  border-right: 2px solid color-mix(in srgb, var(--fg) 44%, transparent);
  text-decoration: none; box-sizing: content-box;
}
.flow-track[data-kind="implied"] .flow-bar { border-style: dashed; }
.flow-track[data-kind="implied"] .flow-bar i {
  background: repeating-linear-gradient(115deg,
    color-mix(in srgb, var(--fl-c) 52%, transparent) 0 3px,
    transparent 3px 7px);
}
.flow-track-void .flow-line { color: var(--fg-mute); font-style: italic; font-size: 12.5px; }
.flow-foot { font-size: 11px; color: var(--fg-mute); margin-top: .28rem; line-height: 1.35; }
.flow-why {
  margin: .7rem 0 0; padding-top: .6rem; border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--fg-dim); line-height: 1.5;
}
.flow-compact { padding: .6rem .75rem; }
.flow-compact .flow-foot { display: none; }
.flow-compact .flow-line { font-size: 12.5px; }

/* --- directional matrix: crosshair, implied cells, detail ----------------- */
.matrix-corner { font-size: 9.5px; color: var(--fg-mute); font-family: var(--mono); align-self: end; text-align: right; padding: 0 4px 2px 0; letter-spacing: -.02em; }
.matrix-cell.implied {
  border-color: color-mix(in srgb, var(--fg-mute) 45%, transparent); border-style: dashed;
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.14) 0 2px, transparent 2px 5px);
  color: color-mix(in srgb, #fff 70%, transparent);
}
.matrix-cell.xh-row, .matrix-cell.xh-col { outline: 1px solid color-mix(in srgb, var(--fg) 28%, transparent); outline-offset: -1px; }
.matrix-rowhead.xh-row, .matrix-colhead.xh-col { color: var(--fg); font-weight: 700; }
.matrix-legend .mx-key { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; }
.matrix-legend .mx-key-out { background: var(--c-coral-1); }
.matrix-legend .mx-key-in { background: var(--c-cyan-1); }
.matrix-detail .flow { border: 0; background: none; padding: 0; }
.matrix-detail-extra { margin-top: .7rem; padding-top: .6rem; border-top: 1px dashed var(--border); }
.matrix-detail-extra p { margin: .25rem 0; font-size: 12.5px; color: var(--fg-dim); }
.flow-edge .edge-estimates, .flow-edge .edge-caveat { margin-top: .55rem; }
.edge-list > .flow + .flow { margin-top: 0; }

/* =============================================================================
   READ — nine chapters, each a scene
   Prose in a narrow column; the figure sticks beside it for the chapter's
   length. The old collapsed-accordion Read surface is gone: a document that
   opens closed is a document nobody reads.
============================================================================= */
.atlas-read { width: 100%; }
.rd { position: relative; }

/* --- hero ---------------------------------------------------------------- */
.rd-hero {
  position: relative; min-height: min(100dvh, 900px);
  display: grid; place-items: center; overflow: hidden;
  padding: 3rem var(--pad-x) 4rem;
}
.rd-hero-bg { position: absolute; inset: 0; pointer-events: auto; }
.rd-hero-canvas {
  width: 100%; height: 100%; display: block; opacity: .5;
  -webkit-mask-image: radial-gradient(ellipse 62% 62% at 68% 50%, #000 30%, transparent 74%);
  mask-image: radial-gradient(ellipse 62% 62% at 68% 50%, #000 30%, transparent 74%);
  cursor: grab;
}
.rd-hero-inner { position: relative; max-width: var(--maxw); width: 100%; margin-inline: auto; pointer-events: none; }
.rd-hero-inner > * { pointer-events: auto; }
.rd-eyebrow {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--c-violet-1); font-weight: 600; margin-bottom: 1rem;
}
:root[data-theme="light"] .rd-eyebrow { color: var(--c-violet-2); }
.rd-title {
  font-size: clamp(2.6rem, 8.5vw, 6.2rem); line-height: .95; letter-spacing: -.045em;
  font-weight: 800; margin: 0 0 1.4rem; max-width: 16ch;
  text-wrap: balance;
}
.rd-lead { font-size: clamp(1rem, 1.5vw, 1.22rem); color: var(--fg-dim); max-width: 54ch; line-height: 1.55; margin: 0 0 2.2rem; }
.rd-counters { display: flex; flex-wrap: wrap; gap: 1.6rem 2.6rem; }
.rd-counter { display: flex; flex-direction: column; }
.rd-counter b {
  font-family: var(--mono); font-size: clamp(1.5rem, 3.2vw, 2.4rem); font-weight: 700;
  letter-spacing: -.05em; line-height: 1; font-variant-numeric: tabular-nums;
}
.rd-counter span { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--fg-mute); margin-top: .3rem; }
.rd-cue {
  margin-top: 3rem; font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--fg-mute); display: inline-flex; align-items: center; gap: .6rem;
}
.rd-cue::after {
  content: ""; width: 1px; height: 30px;
  background: linear-gradient(var(--fg-mute), transparent);
  animation: rd-cue 2.4s var(--ease) infinite;
}
@keyframes rd-cue { 0%,100% { opacity: .25; transform: scaleY(.6); transform-origin: top; } 50% { opacity: 1; transform: scaleY(1); } }

/* --- chapters ------------------------------------------------------------ */
.rd-chapter {
  display: grid;
  grid-template-columns: minmax(0, 40ch) minmax(0, 1.2fr);
  gap: clamp(1.8rem, 4vw, 3.6rem);
  max-width: var(--maxw); margin-inline: auto;
  padding: clamp(3.5rem, 9vh, 7rem) var(--pad-x);
  align-items: start;
  border-top: 1px solid var(--hairline);
}
.rd-chapter.rd-wide { grid-template-columns: minmax(0, 1fr); }
.rd-prose { min-width: 0; }
.rd-head { position: relative; margin-bottom: 1.6rem; }
.rd-num {
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .12em;
  color: var(--c-violet-1); opacity: .8; margin-bottom: .6rem;
}
:root[data-theme="light"] .rd-num { color: var(--c-violet-2); }
.rd-head h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.5rem); line-height: 1.05; letter-spacing: -.032em;
  margin: 0; text-wrap: balance;
}
.rd-deck {
  margin: .9rem 0 0; font-size: clamp(1rem, 1.35vw, 1.12rem); line-height: 1.45;
  color: var(--fg); font-weight: 500; max-width: 40ch;
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  padding-left: .85rem;
}
.rd-body p { color: var(--fg-dim); line-height: 1.72; margin: 0 0 1.1rem; font-size: 1rem; }
.rd-body h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--fg-mute); margin: 2rem 0 .7rem; }
.rd-body strong { color: var(--fg); font-weight: 650; }
.rd-body em { color: var(--fg); }
.rd-body code { font-family: var(--mono); font-size: .84em; background: var(--bg-soft); padding: .1rem .34rem; border-radius: 5px; color: var(--fg-dim); }
.rd-body ul { color: var(--fg-dim); line-height: 1.65; padding-left: 1.1rem; margin: 0 0 1.1rem; }
.rd-body li { margin: .45rem 0; }

/* --- sticky figure ------------------------------------------------------- */
.rd-figure { position: sticky; top: 78px; min-width: 0; height: min(78vh, 760px); display: flex; }
.rd-figure-inner {
  flex: 1 1 auto; min-height: 0;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.3rem 1.15rem;
  display: flex; flex-direction: column; justify-content: center;
}
.fig { display: flex; flex-direction: column; gap: .8rem; min-width: 0; flex: 1 1 auto; min-height: 0; justify-content: center; }
.fig-readout {
  font-size: 12.5px; color: var(--fg-mute); line-height: 1.5; min-height: 3em; flex: 0 0 auto;
}
.fig-svg { width: 100%; height: auto; display: block; flex: 1 1 auto; min-height: 0; max-height: 100%; }

/* constellation */
.fc-edge { fill: none; stroke: var(--accent); transition: opacity .18s, stroke .18s; }
.fc-edge.dim { opacity: .04 !important; }
.fc-edge.lit { stroke: var(--c-violet-1); opacity: .85 !important; }
.fc-dot { fill: var(--fg-dim); transition: fill .18s, r .18s; }
.fc-node { cursor: default; }
.fc-node:hover .fc-dot { fill: var(--accent); r: 6; }
.fc-label { font-size: 8.6px; fill: var(--fg-mute); font-weight: 600; letter-spacing: .01em; }
.fc-node:hover .fc-label { fill: var(--fg); }
.fc-node.dim { opacity: .3; }

/* tiers */
.ft-kinds { display: grid; gap: .5rem; grid-template-columns: 1fr 1fr; }
.ft-kind { border: 1px solid var(--border); border-radius: var(--radius-xs); padding: .6rem .7rem; background: var(--bg-soft); }
.ft-kind-n { font-family: var(--mono); font-size: 1.35rem; font-weight: 700; letter-spacing: -.04em; }
.ft-cmb .ft-kind-n { color: var(--accent); }
.ft-mech .ft-kind-n { color: var(--c-mint-1); }
.ft-kind-t { font-size: 12.5px; font-weight: 700; margin-top: .1rem; }
.ft-kind-sub { font-family: var(--mono); font-size: 9.5px; color: var(--fg-mute); margin-top: .2rem; }
.ft-kind-claim { font-size: 12px; color: var(--fg-dim); margin-top: .45rem; line-height: 1.5; }
.ft-ladder { margin-top: .3rem; }
.ft-row { display: grid; grid-template-columns: 126px 1fr 30px; gap: .6rem; align-items: center; margin-bottom: .38rem; }
.ft-track { height: 8px; background: var(--bg-soft); border-radius: 4px; overflow: hidden; }
.ft-track i { display: block; height: 100%; background: var(--fg-mute); border-radius: 4px; }
.ft-track i[data-rank="1"], .ft-track i[data-rank="2"] { background: var(--c-mint-1); }
.ft-track i[data-rank="3"], .ft-track i[data-rank="4"] { background: var(--c-amber-1); }
.ft-n { font-family: var(--mono); font-size: 11px; color: var(--fg-mute); text-align: right; }

/* asymmetry demo */
.fa-picker { display: flex; flex-wrap: wrap; gap: .25rem; }
.fa-pick {
  font-size: 10.5px; font-weight: 600; padding: .2rem .48rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--fg-mute);
}
.fa-pick:hover { color: var(--fg); }
.fa-pick.active { background: color-mix(in srgb, var(--accent) 18%, var(--bg-soft)); color: var(--fg); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.fa-stage .flow { border: 0; background: none; padding: .3rem 0 0; }

/* base rates */
.fb-list { display: flex; flex-direction: column; gap: 3px; flex: 0 1 auto; overflow: auto; }
.fb-row { display: grid; grid-template-columns: 116px 1fr 50px; gap: .6rem; align-items: center; text-decoration: none; padding: .16rem 0; }
.fb-label { font-size: 12.5px; color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-row:hover .fb-label { color: var(--fg); }
.fb-track { height: 12px; background: var(--bg-soft); border-radius: 6px; overflow: hidden; }
.fb-track i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, transparent), var(--accent)); }
.fb-num { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); text-align: right; }
.fb-none .fb-track { opacity: .35; }

/* brain figure */
.fig-brain .ws-stage { flex: 1 1 auto; min-height: 240px; height: auto; position: relative; }
.fbr-legend { display: flex; flex-wrap: wrap; gap: .25rem; }
.fbr-legend .tg-chip { font-size: 10px; padding: .1rem .4rem; }

/* overlaps */
.fig-overlaps { gap: .9rem; }
.fo-card { border: 1px solid var(--border); border-radius: var(--radius-xs); padding: .6rem .7rem; background: var(--bg-soft); }
.fo-title { font-size: 13.5px; font-weight: 700; margin-bottom: .3rem; }
.fo-svg { width: 100%; height: 88px; }
.fo-c { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: color-mix(in srgb, var(--accent) 70%, transparent); }
.fo-c2 { fill: color-mix(in srgb, var(--c-cyan-1) 20%, transparent); stroke: color-mix(in srgb, var(--c-cyan-1) 65%, transparent); }
.fo-lines { display: flex; flex-direction: column; gap: .1rem; }
.fo-line { display: flex; align-items: baseline; gap: .4rem; font-size: 11.5px; color: var(--fg-mute); }
.fo-line b { font-family: var(--mono); font-size: 13.5px; color: var(--fg); }

/* scope + exits */
.fs-card { border-left: 2px solid var(--border-hi); padding: .35rem 0 .35rem .7rem; }
.fs-t { font-size: 13.5px; font-weight: 650; color: var(--fg-dim); }
.fs-why { font-size: 12px; color: var(--fg-mute); line-height: 1.5; }
.fe-card {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .3rem 1rem;
  text-decoration: none; color: inherit; padding: .7rem .85rem;
  border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--bg-soft);
  transition: transform .14s var(--ease), border-color .14s;
}
.fe-card:hover { transform: translateX(3px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.fe-t { font-size: 15px; font-weight: 700; letter-spacing: -.015em; }
.fe-sub { grid-column: 1; font-size: 12px; color: var(--fg-mute); line-height: 1.45; }
.fe-arrow { grid-row: 1 / span 2; color: var(--accent); font-size: 18px; }

/* --- findings ------------------------------------------------------------ */
.rd-findings { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin: 1.6rem 0 0; }
.rd-finding {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elev); padding: 1.1rem 1.2rem 1.2rem;
  position: relative; overflow: hidden;
}
.rd-finding::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(var(--accent), transparent);
}
.rf-stat {
  font-family: var(--mono); font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 700;
  letter-spacing: -.05em; line-height: 1; color: var(--fg);
}
.rf-statlabel { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--c-violet-1); margin-top: .35rem; font-weight: 700; }
:root[data-theme="light"] .rf-statlabel { color: var(--c-violet-2); }
.rf-claim { font-size: 14px; font-weight: 600; color: var(--fg); line-height: 1.4; margin: .8rem 0 .5rem; }
.rf-note { font-size: 12.5px; color: var(--fg-mute); line-height: 1.55; margin: 0; }

/* --- rail ---------------------------------------------------------------- */
.rd-rail { position: fixed; left: 14px; top: 50%; transform: translateY(-50%); z-index: 30; }
.rd-rail-inner { display: flex; flex-direction: column; gap: 2px; }
.rd-dot { display: flex; align-items: center; gap: .5rem; text-decoration: none; padding: 3px 0; }
.rd-dot i { width: 18px; height: 2px; border-radius: 2px; background: var(--border-hi); transition: background .2s, width .2s; display: block; }
.rd-dot span {
  font-size: 10.5px; color: var(--fg-mute); opacity: 0; transform: translateX(-4px);
  transition: opacity .2s, transform .2s; white-space: nowrap; pointer-events: none;
}
.rd-rail:hover .rd-dot span { opacity: 1; transform: none; }
.rd-dot.active i { background: var(--accent); width: 26px; }
.rd-dot.active span { color: var(--fg); }
@media (max-width: 1180px) { .rd-rail { display: none; } }

/* --- reveal -------------------------------------------------------------- */
.rd-head, .rd-body > *, .rd-figure-inner, .rd-finding {
  opacity: 0; transform: translateY(14px);
  transition: opacity .6s var(--ease-out), transform .6s var(--ease-out);
}
.rd-head.in, .rd-body > *.in, .rd-figure-inner.in, .rd-finding.in { opacity: 1; transform: none; }
.rd-finding { transition-delay: calc(var(--i) * 60ms); }
@media (prefers-reduced-motion: reduce) {
  .rd-head, .rd-body > *, .rd-figure-inner, .rd-finding { opacity: 1; transform: none; transition: none; }
  .rd-cue::after { animation: none; }
}

@media (max-width: 940px) {
  .rd-chapter { grid-template-columns: 1fr; }
  .rd-figure { position: static; margin-top: 1.6rem; }
  .rd-hero-canvas { opacity: .3; }
}


/* =============================================================================
   SURFACES — Explore / Conditions / Mechanisms
   -----------------------------------------------------------------------------
   These share the Read surface's grammar rather than inventing a second, denser
   one: the same header scale, the same sticky-figure-beside-a-scrolling-column
   layout, the same card material and reveal. The first pass squeezed them into
   a fixed-viewport app pane with 10px type — small, cramped, and visibly a
   different product from the page next door. Type floor here is 12px; the
   working sizes are 13–15.5px like everywhere else on the site.
============================================================================= */

/* --- surface header (matches .rd-head) ----------------------------------- */
.atlas-hero { padding: clamp(2.4rem, 6vh, 4rem) 0 clamp(1.4rem, 3vh, 2rem); }
.atlas-hero .atlas-eyebrow { margin-bottom: .9rem; }
.atlas-hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.3rem); line-height: 1; letter-spacing: -.042em;
  font-weight: 800; margin: 0; text-wrap: balance;
}
.atlas-deck {
  margin: 1.1rem 0 0; font-size: clamp(1rem, 1.35vw, 1.12rem); line-height: 1.5;
  color: var(--fg-dim); font-weight: 450; max-width: 60ch;
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  padding-left: .9rem;
}
.atlas-deck b, .atlas-deck strong { color: var(--fg); font-weight: 600; }

/* --- split: content column + sticky figure (matches .rd-chapter) --------- */
.surface-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 370px);
  gap: clamp(1.6rem, 3.5vw, 3.2rem);
  align-items: start;
  padding-bottom: 4rem;
}
.surface-main { min-width: 0; }
.surface-figure { position: sticky; top: 84px; min-width: 0; }
.surface-figure-inner {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.15rem 1rem;
}

/* --- the brain panel ------------------------------------------------------ */
.ws-brain-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.ws-brain-head h2 {
  font-size: 12px; margin: 0; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--fg-mute);
}
.ws-views { margin-left: auto; display: flex; gap: 2px; background: var(--bg-soft); border-radius: 999px; padding: 3px; }
.ws-view {
  border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--fg-mute); padding: .24rem .58rem; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
}
.ws-view:hover { color: var(--fg); }
.ws-view.active { background: color-mix(in srgb, var(--accent) 22%, var(--bg-elev)); color: var(--fg); }
.ws-stage { position: relative; height: min(46vh, 390px); margin: .7rem 0 .2rem; }
.ws-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.ws-drag-hint {
  position: absolute; left: 0; bottom: 0; font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--fg-mute); opacity: .5; pointer-events: none;
}
.ws-readout { border-top: 1px solid var(--border); padding-top: .8rem; margin-top: .4rem; }
.ws-readout-empty { color: var(--fg-mute); font-size: 12.5px; margin: 0; line-height: 1.5; }
.ws-readout-title { font-size: 14px; font-weight: 700; letter-spacing: -.012em; margin-bottom: .5rem; }
.ws-readout-list { display: flex; flex-wrap: wrap; gap: .3rem; }
.ws-readout-item {
  font-size: 11.5px; font-weight: 600; padding: .18rem .5rem; border-radius: 7px;
  color: var(--tg, var(--fg-dim)); text-decoration: none; line-height: 1.4;
  background: color-mix(in srgb, var(--tg, var(--fg-mute)) 12%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--tg, var(--fg-mute)) 26%, transparent);
}
a.ws-readout-item:hover { background: color-mix(in srgb, var(--tg, var(--fg-mute)) 26%, var(--bg-soft)); }
.ws-readout-note { font-size: 12px; color: var(--fg-mute); margin: .55rem 0 0; line-height: 1.5; }
.ws-caption { font-size: 11px; line-height: 1.5; color: var(--fg-mute); margin: .9rem 0 0; opacity: .85; }

/* --- toolbar -------------------------------------------------------------- */
.surface-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem;
  padding-bottom: 1.1rem; margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--hairline);
}
.surface-tools .atlas-search { flex: 0 1 230px; font-size: 14px; padding: .5rem .95rem; }
.surface-tools .atlas-count { margin-left: auto; font-family: var(--mono); font-size: 12px; }
.ws-chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.ws-chip { cursor: pointer; user-select: none; font-size: 12px; padding: .24rem .6rem; opacity: .78; transition: opacity .15s, box-shadow .15s; }
.ws-chip:hover { opacity: 1; }
.ws-chip.on { opacity: 1; box-shadow: 0 0 0 2px color-mix(in srgb, var(--tg, var(--accent)) 40%, transparent); }
.ws-chip-n { margin-left: .3rem; opacity: .6; font-variant-numeric: tabular-nums; font-weight: 700; }
.ws-layer { flex: 0 0 auto; }
.ws-layer button { font-size: 12px; padding: .26rem .7rem; }

/* --- the map -------------------------------------------------------------- */
.mech-group { margin-bottom: 2.2rem; }
.mech-group[hidden] { display: none; }
.mech-group-head {
  display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap;
  margin-bottom: .85rem; padding-left: .8rem;
  border-left: 3px solid var(--tg, var(--accent));
}
.mg-name { font-size: 15px; font-weight: 700; letter-spacing: -.012em; color: var(--fg); }
.mg-meta { font-size: 12.5px; color: var(--fg-mute); }
.mech-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.cond-grid { grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); }
.mech-card {
  display: block; text-decoration: none; color: inherit; position: relative;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 3px solid color-mix(in srgb, var(--tg, var(--accent)) 65%, transparent);
  border-radius: var(--radius-xs); padding: .95rem 1.05rem 1rem;
  box-shadow: var(--shadow-xs);
  transition: transform .16s var(--ease), border-color .16s, box-shadow .16s;
}
.mech-card[hidden] { display: none; }
.mech-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--tg, var(--accent)) 50%, var(--border-hi));
}
.mc-label { font-weight: 650; font-size: 15.5px; line-height: 1.25; letter-spacing: -.015em; }
.mc-kind { font-size: 11.5px; color: var(--fg-mute); text-transform: uppercase; letter-spacing: .06em; margin-top: .22rem; }
.mc-kind-flag { color: var(--c-violet-2); }
:root[data-theme="dark"] .mc-kind-flag { color: var(--c-violet-1); }
.mc-meter { height: 5px; border-radius: 3px; background: var(--bg-soft); margin: .7rem 0 .55rem; overflow: hidden; }
.mc-meter i { display: block; height: 100%; border-radius: 3px; background: var(--tg, var(--accent)); }
.mc-foot { display: flex; gap: .9rem; font-size: 12px; color: var(--fg-mute); }
.mc-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: .6rem; }
.mc-dot {
  font-size: 10px; font-weight: 700; letter-spacing: .02em; line-height: 1;
  padding: .24rem .32rem; border-radius: 4px; color: var(--tg, var(--fg-dim));
  background: color-mix(in srgb, var(--tg, var(--fg-mute)) 15%, transparent);
}
.cc-rate { font-size: 12px; color: var(--fg-mute); margin-top: .7rem; }
.cc-rate b { font-family: var(--mono); font-size: 1.45rem; color: var(--fg); letter-spacing: -.045em; margin-right: .3rem; }
.cc-rate .mc-meter { margin: .45rem 0 0; }
.cc-top { font-size: 12.5px; color: var(--fg-dim); margin-top: .7rem; line-height: 1.45; }
.cc-top .cc-if { color: var(--fg-mute); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; }
.cc-top b { font-family: var(--mono); font-size: 13.5px; color: var(--accent-2); }
:root[data-theme="dark"] .cc-top b { color: var(--c-violet-1); }

/* reveal, same as Read */
.mech-card, .mech-group-head { opacity: 0; transform: translateY(10px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
.mech-card.in, .mech-group-head.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .mech-card, .mech-group-head { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 980px) {
  .surface-split { grid-template-columns: 1fr; }
  .surface-figure { position: static; order: -1; margin-bottom: 1.6rem; }
}

/* =============================================================================
   EXPLORE — three modes, full-width panes
============================================================================= */
.ex-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 1.4rem; }
.ex-mode {
  display: flex; gap: .75rem; align-items: flex-start; text-align: left;
  font: inherit; cursor: pointer; padding: .9rem 1.05rem;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-xs); color: var(--fg-dim);
  transition: background .16s, border-color .16s, color .16s, transform .16s var(--ease);
}
.ex-mode:hover { transform: translateY(-2px); color: var(--fg); border-color: var(--border-hi); }
.ex-mode.active {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-elev));
  color: var(--fg);
}
.ex-glyph { font-size: 18px; line-height: 1.05; color: var(--fg-mute); }
.ex-mode.active .ex-glyph { color: var(--accent); }
.ex-mode-t { display: flex; flex-direction: column; min-width: 0; gap: .18rem; }
.ex-mode-t b { font-size: 15px; letter-spacing: -.015em; }
.ex-mode-t span { font-size: 12px; color: var(--fg-mute); line-height: 1.4; }

.ex-pane {
  display: none; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); overflow: hidden;
  margin-bottom: 4rem;
}
.ex-pane.active { display: block; }
.ex-tools {
  padding: .85rem 1.2rem; border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  background: var(--bg-soft);
}
.ex-pane > .panel-body { padding: 1.3rem; }

/* matrix mode */
.mx-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px); gap: 1.4rem; align-items: start; }
.mx-left { min-width: 0; }
.mx-body .matrix-detail {
  display: block; margin: 0; position: sticky; top: 84px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 1.1rem; font-size: 13px;
}
.mx-hint { font-size: 13px; color: var(--fg-mute); line-height: 1.6; margin: 0; }
.mx-hint b { color: var(--fg-dim); }
@media (max-width: 1040px) { .mx-body { grid-template-columns: 1fr; } .mx-body .matrix-detail { position: static; } }

/* compound mode */
.cd-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 310px); gap: 1.4rem; align-items: start; }
.cd-pane { min-width: 0; }
.cd-brain { position: sticky; top: 84px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 1rem; }
.cd-brain .ws-stage { height: 270px; margin-top: .5rem; }
.cd-brain .ws-caption { margin-top: .7rem; }
@media (max-width: 1040px) { .cd-body { grid-template-columns: 1fr; } .cd-brain { position: static; } }
.data-files { margin-top: 1.6rem; }
.data-file { padding: 1.1rem 1.25rem; }
.data-file .df-name { font-size: 14.5px; }
.data-file .df-desc { font-size: 13.5px; }
.data-file .df-size { font-family: var(--mono); font-size: 12px; }

/* --- brain panel in a node-page aside ------------------------------------ */
.node-brain { margin-bottom: 12px; }
.node-brain .ws-stage { height: 280px; margin: .8rem 0 .2rem; }
.node-brain .ws-readout-list { margin-top: .8rem; }

/* --- base-rate band on a condition page ---------------------------------- */
.base-band { display: flex; flex-wrap: wrap; align-items: baseline; gap: .7rem 1.6rem; }
.base-big { display: flex; align-items: baseline; gap: .6rem; }
.base-big b {
  font-family: var(--mono); font-size: clamp(2rem, 4.5vw, 2.9rem); font-weight: 700;
  letter-spacing: -.055em; line-height: 1; color: var(--fg);
}
.base-big span { font-size: 11.5px; color: var(--fg-mute); text-transform: uppercase; letter-spacing: .08em; }
.base-bits { display: flex; flex-wrap: wrap; gap: .35rem; }
.base-bit {
  font-size: 12px; color: var(--fg-dim); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 7px; padding: .2rem .55rem;
  font-variant-numeric: tabular-nums;
}
.sub-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--fg-mute); margin: 1.4rem 0 .55rem; }

/* --- node page section tabs ---------------------------------------------- */
.node-tabs {
  display: flex; flex-wrap: wrap; gap: .3rem; margin: 1.8rem 0 1.4rem;
  position: sticky; top: 52px; z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  padding: .5rem 0; border-bottom: 1px solid var(--border);
}
.node-tab {
  font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .38rem .85rem; border-radius: 999px;
  border: 1px solid transparent; background: transparent; color: var(--fg-mute);
  transition: background .15s, color .15s, border-color .15s;
}
.node-tab:hover { background: var(--bg-soft); color: var(--fg); }
.node-tab.active {
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-soft));
  color: var(--fg); border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.node-tab-n { font-family: var(--mono); font-size: 10.5px; opacity: .65; }
.atlas-sec[hidden] { display: none; }
.atlas-sec > h2[hidden] { display: none; }

/* --- how to read a flow figure ------------------------------------------- */
.flow-legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: 0 0 1rem; }
.fl-legend-item { display: inline-flex; align-items: center; gap: .4rem; font-size: 11.5px; color: var(--fg-mute); cursor: help; }
.fl-legend-item i { width: 20px; height: 8px; border-radius: 4px; display: block; border: 1px solid transparent; }
.fl-legend-item[data-kind="cited"] i { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent)); }
.fl-legend-item[data-kind="implied"] i {
  border-color: var(--border-hi); border-style: dashed;
  background: repeating-linear-gradient(115deg, color-mix(in srgb, var(--fg-mute) 60%, transparent) 0 3px, transparent 3px 7px);
}
.fl-legend-item[data-kind="definitional"] i { background: var(--c-violet-2); }
:root[data-theme="dark"] .fl-legend-item[data-kind="definitional"] i { background: var(--c-violet-1); }
.fl-legend-item[data-kind="pooled"] i { background: var(--fg-mute); opacity: .6; }
.mc-desc {
  font-size: 12.5px; line-height: 1.5; color: var(--fg-dim); margin: .55rem 0 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cond-card .mc-desc { color: var(--fg-mute); font-size: 12px; -webkit-line-clamp: 2; }

/* =============================================================================
   THE CONNECTED SHELL — sub-nav arrows + in-place surface swap
============================================================================= */
.atlas-subnav-inner { gap: .6rem; }
.atlas-brand { margin-right: .4rem; }
.atlas-step {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .34rem .6rem; border-radius: 999px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--fg-mute);
  text-decoration: none; border: 1px solid var(--border);
  background: var(--bg-soft); flex: 0 0 auto;
  transition: color .15s, border-color .15s, background .15s, transform .15s var(--ease);
}
.atlas-step:hover { color: var(--fg); border-color: var(--border-hi); background: var(--bg-elev); }
.atlas-step-prev:hover { transform: translateX(-2px); }
.atlas-step-next:hover { transform: translateX(2px); }
.atlas-step .as-chev { font-size: 15px; line-height: 1; color: var(--accent); }
.atlas-step .as-label {
  max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.atlas-crumb {
  font-size: 12.5px; font-weight: 650; color: var(--fg); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 22ch;
  padding-left: .55rem; margin-left: .1rem; border-left: 1px solid var(--border-hi);
}
.atlas-tabs { flex: 0 1 auto; }
.atlas-subnav-inner .atlas-tabs { margin-right: auto; }

/* the swap itself — short enough to read as continuity, not a page load */
#atlas-app { view-transition-name: atlas-app; }
.app-leaving { opacity: 0; transform: translateY(4px); transition: opacity .09s linear, transform .09s linear; }
.app-entering { opacity: 0; transform: translateY(-4px); }
#atlas-app { transition: opacity .16s var(--ease-out), transform .16s var(--ease-out); }
@media (prefers-reduced-motion: reduce) {
  #atlas-app, .app-leaving, .app-entering { transition: none; transform: none; opacity: 1; }
}
::view-transition-old(atlas-app) { animation: atlas-out .1s var(--ease-in) both; }
::view-transition-new(atlas-app) { animation: atlas-in .2s var(--ease-out) both; }
@keyframes atlas-out { to { opacity: 0; transform: translateY(4px); } }
@keyframes atlas-in { from { opacity: 0; transform: translateY(-6px); } }

@media (max-width: 720px) {
  .atlas-step .as-label { display: none; }
  .atlas-step { padding: .34rem .5rem; }
  .atlas-crumb { display: none; }
}

/* --- browsing inside a figure -------------------------------------------- */
.fig-nav {
  display: flex; align-items: center; gap: .5rem; flex: 0 0 auto;
  padding-top: .7rem; margin-top: auto; border-top: 1px solid var(--border);
}
.fig-nav-btn {
  font: inherit; font-size: 17px; line-height: 1; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--fg-dim);
  display: grid; place-items: center;
  transition: background .15s, color .15s, border-color .15s, transform .15s var(--ease);
}
.fig-nav-btn:hover { background: var(--bg-elev); color: var(--fg); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.fig-nav-btn:active { transform: scale(.93); }
.fig-nav-label {
  font-size: 13px; font-weight: 650; color: var(--fg); letter-spacing: -.01em;
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fig-nav-count { font-family: var(--mono); font-size: 11.5px; color: var(--fg-mute); flex: 0 0 auto; }
.fig-fading { opacity: 0; transition: opacity .1s linear; }
.fa-stage { transition: opacity .22s var(--ease-out); flex: 0 0 auto; }

/* --- browsing the chapters ------------------------------------------------
   Proximity, never mandatory: chapters settle when you land near one, and free
   scrolling still works exactly as it did. */
html:has(.rd) { scroll-snap-type: y proximity; scroll-padding-top: 72px; }
.rd-chapter { scroll-snap-align: start; }
.rd-hero { scroll-snap-align: start; }
@media (prefers-reduced-motion: reduce) { html:has(.rd) { scroll-snap-type: none; } }
@media (max-width: 940px) {
  .rd-figure { height: auto; }
  html:has(.rd) { scroll-snap-type: none; }
}
