/* Ivo Research dashboard — self-contained archival theme (no external CDN). */
:root {
  --paper: #f6f1e7;
  --paper-2: #fffdf8;
  --ink: #23201b;
  --ink-soft: #5c554a;
  --line: #ddd3c2;
  --accent: #7a2e2e;      /* oxblood */
  --accent-2: #2f5d62;    /* deep teal */
  --gold: #b08534;
  --k: #7a2e2e;           /* cluster K highlight */
  --ok: #3f6f3f;
  --warn: #9a6a1f;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); }

/* Header */
header.site {
  background: linear-gradient(180deg, #2a2520, #211d18);
  color: #f2ead9;
  padding: 22px 0 18px;
  border-bottom: 3px solid var(--gold);
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 22px; }
.headwrap { display: flex; align-items: center; gap: 20px; }
.ivo-headshot-link {
  display: block; flex: 0 0 auto; border-radius: 50%; line-height: 0;
  outline-offset: 4px;
}
.ivo-headshot {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover; object-position: center top;
  border: 2px solid var(--gold); box-shadow: 0 1px 5px rgba(0,0,0,.45);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ivo-headshot-link:hover .ivo-headshot,
.ivo-headshot-link:focus-visible .ivo-headshot { transform: scale(1.045); box-shadow: 0 0 0 3px rgba(176,133,52,.25), 0 2px 8px rgba(0,0,0,.5); }
.headtext { min-width: 0; }
header.site h1 { font-family: var(--serif); font-size: 27px; margin: 0; letter-spacing: .3px; }
header.site .sub { color: #c8bda6; font-size: 13.5px; margin-top: 3px; }
.badge {
  display: inline-block; font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase;
  background: var(--accent); color: #fff; padding: 3px 9px; border-radius: 999px; vertical-align: middle;
  margin-left: 10px; font-weight: 700;
}
.stamp { color: #9a9081; font-size: 11.5px; margin-top: 8px; font-family: var(--mono); }

/* Nav */
nav.tabs { background: var(--paper-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
nav.tabs .wrap { display: flex; gap: 4px; align-items: stretch; flex-wrap: nowrap; }
nav.tabs .wrap > a, .nav-more { flex: 0 0 auto; }
nav.tabs a {
  color: var(--ink-soft); text-decoration: none;
  padding: 13px 14px; font-size: 14px; font-weight: 600; border-bottom: 2.5px solid transparent;
}
nav.tabs a:hover { color: var(--ink); }
nav.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-more { position: relative; color: var(--ink-soft); }
.nav-more summary {
  list-style: none; cursor: pointer; padding: 13px 30px 13px 14px; font-size: 14px; font-weight: 600;
  border-bottom: 2.5px solid transparent; position: relative; white-space: nowrap;
}
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: '▾'; position: absolute; right: 13px; top: 13px; font-size: 11px; }
.nav-more[open] summary, .nav-more.active summary { color: var(--accent); border-bottom-color: var(--accent); }
.nav-more[open] summary::after { transform: rotate(180deg); }
.nav-menu {
  position: absolute; z-index: 20; top: calc(100% + 1px); right: 0; min-width: 205px;
  padding: 7px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 0 0 10px 10px;
  box-shadow: var(--shadow);
}
.nav-menu a { display: block; padding: 9px 11px; border: 0; border-radius: 7px; font-size: 13px; }
.nav-menu a:hover, .nav-menu a.active { background: #f4ede0; border: 0; }

main { padding: 26px 0 60px; }
.breadcrumb { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.breadcrumb a { color: var(--accent-2); text-decoration: none; }
.divider { font-family: var(--serif); font-size: 13px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--ink-soft); border-bottom: 1px solid var(--line); padding-bottom: 6px; margin: 30px 0 14px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f6efe1; }
.rollup { font-family: var(--mono); font-size: 12px; background:#eef0ec; padding:1px 6px; border-radius:5px; color:#4a4a3f; }
.cl-head { display:flex; align-items:baseline; gap:12px; flex-wrap:wrap; margin-bottom:4px; }
.cl-head h2 { font-family: var(--serif); font-size:24px; margin:0; }
.cl-meta { display:flex; gap:18px; flex-wrap:wrap; color:var(--ink-soft); font-size:13px; margin:6px 0 16px; }
.hyp { background:#fbf7ee; border:1px solid var(--line); border-left:4px solid var(--accent-2); border-radius:0 10px 10px 0;
  padding:12px 16px; font-size:13.5px; color:var(--ink); white-space:pre-wrap; margin-bottom:18px; }

/* legend */
.legend { display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:12px; }
.legend .item { background:var(--paper-2); border:1px solid var(--line); border-radius:10px; padding:12px 14px; }
.legend .item .h { font-weight:700; font-family:var(--serif); font-size:15px; margin-bottom:3px; }
.legend .item .h .pill { margin-left:6px; }
.legend .item p { margin:0; font-size:12.5px; color:var(--ink-soft); }

/* tree-connection network */
.bridges { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:18px; }
.bridge { background:var(--paper-2); border:1px solid var(--line); border-radius:12px; padding:8px 10px 12px; box-shadow:var(--shadow); }
.bridge h4 { font-family:var(--serif); margin:6px 4px 0; font-size:16px; }
.bridge .sub { color:var(--ink-soft); font-size:12px; margin:0 4px 4px; }
.bridge svg { width:100%; height:230px; display:block; }
.net-edge { stroke:#c9bfa9; stroke-width:1.4; }
.net-mrca { fill:#fbf0d6; stroke:var(--gold); stroke-width:2.5; }
.net-node { stroke:#fff; stroke-width:1.5; }
.net-node.pat { fill:var(--accent-2); } .net-node.mat { fill:var(--gold); }
.net-node.both { fill:#8a7b5a; } .net-node.unk { fill:#b9b1a0; }
.net-label { font-size:9.5px; fill:var(--ink); font-family:var(--sans); }
.net-mrca-label { font-size:11px; font-weight:700; fill:var(--accent); font-family:var(--serif); text-anchor:middle; }
.noise { color:var(--ink-soft); font-size:12.5px; }
.noise .pill { margin:2px 4px 2px 0; background:#efefe9; color:#777; }
h2.section { font-family: var(--serif); font-size: 22px; margin: 4px 0 4px; }
p.lede { color: var(--ink-soft); margin: 0 0 20px; max-width: 70ch; }
ol.howto { max-width: 78ch; padding-left: 22px; margin: 4px 0 8px; }
ol.howto li { margin-bottom: 12px; line-height: 1.6; }
ol.howto li b { color: var(--ink); }

/* Cluster registry: full-width narrative over compact, aligned details. */
p.clusters-intro { max-width: none; }
.cluster-list { padding: 0; overflow: hidden; }
.cluster-summary { padding: 18px 20px 17px; border-bottom: 1px solid var(--line); }
.cluster-summary:last-child { border-bottom: 0; }
.cluster-summary:hover { background: #fbf8f1; }
.cluster-summary-head { display: flex; align-items: baseline; gap: 11px; }
.cluster-summary-code {
  flex: 0 0 auto; min-width: 30px;
  font: 800 12px/1 var(--mono); color: var(--accent);
}
.cluster-summary-link, .cluster-summary-title {
  font-family: var(--serif); font-size: 17px; font-weight: 700; line-height: 1.35;
}
.cluster-summary-link { color: var(--ink); text-decoration: none; }
.cluster-summary-link:hover, .cluster-summary-link:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.cluster-summary-description {
  max-width: none; margin: 7px 0 13px 41px;
  color: var(--ink-soft); font-size: 12.75px; line-height: 1.5;
}
.cluster-summary-details {
  display: grid;
  grid-template-columns: 64px 126px minmax(130px,1fr) minmax(315px,2.5fr) 64px 90px;
  gap: 10px 12px;
  margin: 0 0 0 41px; padding-top: 11px;
  border-top: 1px solid #ebe3d7;
  align-items: start;
}
.cluster-summary-details > div { min-width: 0; }
.cluster-summary-details dt {
  margin: 0 0 5px;
  color: #7a7165; font-size: 9.5px; font-weight: 800;
  letter-spacing: .65px; line-height: 1.25; text-transform: uppercase;
}
.cluster-summary-details dd { margin: 0; font-size: 12.5px; line-height: 1.45; }
.cluster-summary-details .kseg-cell { min-width: 0; line-height: 1.85; }
.cluster-summary-number { font: 700 13px/1.6 var(--mono); }
@media (max-width: 900px) {
  .cluster-summary-details { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cluster-summary-segments { grid-column: span 2; }
}
@media (max-width: 560px) {
  .cluster-summary { padding: 16px 15px; }
  .cluster-summary-description, .cluster-summary-details { margin-left: 0; }
  .cluster-summary-description { margin-top: 9px; }
  .cluster-summary-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cluster-summary-segments { grid-column: 1 / -1; }
}

/* Ivo's Story: tracked evidence and reconstruction */
.story-controls {
  --story-thumb-size: 18px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1fr);
  gap: 24px;
  align-items: center;
  padding: 13px 18px;
  margin-bottom: 12px;
  background: #fffefb;
  border-color: #e8dfd1;
  box-shadow: 0 1px 2px rgba(0,0,0,.025), 0 5px 15px rgba(0,0,0,.025);
}
.story-level-head { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline; }
.story-level-head > span { grid-row: 1 / span 2; font-family: var(--mono); font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .5px; }
.story-level-head > b { font-family: var(--serif); font-size: 20px; }
.story-level-head > small { color: var(--ink-soft); }
.story-slider-wrap { min-width: 0; }
.story-slider-rail { position: relative; height: 20px; }
.story-slider-rail::before {
  content: '';
  position: absolute; z-index: 0;
  left: calc(var(--story-thumb-size) / 2); right: calc(var(--story-thumb-size) / 2); top: 8px;
  height: 3px; border-radius: 999px; background: #ded6ca;
}
.story-slider-stops {
  position: absolute; z-index: 1; pointer-events: none;
  left: calc(var(--story-thumb-size) / 2); right: calc(var(--story-thumb-size) / 2); top: 2px;
  height: 15px;
}
.story-slider-stops i {
  position: absolute; top: 0;
  width: 15px; height: 15px;
  border: 2px solid #b9ad9c; border-radius: 50%;
  background: #fff;
  transform: translateX(-50%);
  box-shadow: 0 0 0 2px #fffefb;
}
.story-slider-stops i:nth-child(1) { left: 0; }
.story-slider-stops i:nth-child(2) { left: 33.333%; }
.story-slider-stops i:nth-child(3) { left: 66.667%; }
.story-slider-stops i:nth-child(4) { left: 100%; }
#storySlider {
  appearance: none;
  position: absolute; z-index: 2; inset: 0;
  width: 100%; height: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
#storySlider::-webkit-slider-runnable-track {
  height: 3px; border-radius: 999px; background: transparent;
}
#storySlider::-moz-range-track {
  height: 3px; border: 0; border-radius: 999px; background: transparent;
}
#storySlider::-webkit-slider-thumb {
  appearance: none;
  width: var(--story-thumb-size); height: var(--story-thumb-size);
  margin-top: -7.5px;
  border: 2px solid #fffefb; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(86,32,32,.35), 0 1px 4px rgba(0,0,0,.24);
}
#storySlider::-moz-range-thumb {
  width: var(--story-thumb-size); height: var(--story-thumb-size);
  border: 2px solid #fffefb; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(86,32,32,.35), 0 1px 4px rgba(0,0,0,.24);
}
#storySlider:focus-visible { outline: 2px solid rgba(122,46,46,.35); outline-offset: 4px; border-radius: 999px; }
.story-scale {
  position: relative;
  height: 27px;
  margin: 0 calc(var(--story-thumb-size) / 2);
  font-size: 10px; color: #8a8175; line-height: 1.2;
}
.story-scale span {
  position: absolute; top: 0;
  width: max-content;
  text-align: center;
  transform: translateX(-50%);
}
.story-scale span:nth-child(1) { left: 0; }
.story-scale span:nth-child(2) { left: 33.333%; }
.story-scale span:nth-child(3) { left: 66.667%; }
.story-scale span:nth-child(4) { left: 100%; }
.story-scale span.active { color: var(--accent); font-weight: 800; }
.story-legend { display: flex; flex-wrap: wrap; gap: 9px 16px; margin: 10px 0 16px; font-size: 12px; }
.story-legend span::before { content: ''; display: inline-block; width: 18px; margin-right: 6px; vertical-align: 3px; border-bottom: 3px solid currentColor; }
.story-legend .story-fact { color: #246a53; }
.story-legend .story-inference { color: #2f5d8a; }
.story-legend .story-hypothesis { color: #9a6a1f; }
.story-legend .story-reconstruction { color: #795889; }
.story-legend .story-reconstruction::before { border-bottom-style: dashed; }
.story-warning { position: sticky; top: 49px; z-index: 4; border: 2px solid #9a6a1f; background: #fff3df; color: #68470f; border-radius: 9px; padding: 10px 14px; margin: 12px 0; box-shadow: var(--shadow); }
.story-fiction-label { font-family: var(--mono); font-weight: 800; font-size: 12px; letter-spacing: 1px; color: #fff; background: #6a3f74; padding: 8px 12px; border-radius: 7px; margin: 10px 0 14px; text-align: center; }
.story-version { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; }
.story-version button { font: inherit; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.story-version button.active { color: #fff; background: #6a3f74; border-color: #6a3f74; }
.story-layout { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(250px, .9fr); gap: 18px; align-items: start; }
.story-paper { padding: clamp(20px, 4vw, 42px); }
.story-paper > h3 { font-size: 24px; margin-bottom: 18px; }
.story-prose { font-family: var(--serif); font-size: 17px; line-height: 1.85; }
.story-prose p { margin: 0 0 1.25em; }
.story-claim { appearance: none; display: inline; font: inherit; line-height: inherit; color: inherit; text-align: inherit; padding: 0 1px; margin: 0; background: transparent; border: 0; border-bottom: 2px solid; cursor: help; }
.story-claim:hover, .story-claim:focus, .story-claim.story-active { outline: 0; border-radius: 2px; }
.story-claim.story-fact { border-color: #278064; background: linear-gradient(transparent 82%, #bde1d5 82%); }
.story-claim.story-inference { border-color: #3a6ea5; background: linear-gradient(transparent 82%, #c9dcf0 82%); }
.story-claim.story-hypothesis { border-color: #b07a20; background: linear-gradient(transparent 82%, #f1deb7 82%); }
.story-claim.story-reconstruction { border-color: #795889; border-bottom-style: dashed; color: #584a5d; background: linear-gradient(transparent 84%, #e7d9eb 84%); }
.story-claim.story-active { box-shadow: 0 0 0 3px rgba(176,133,52,.18); }
.story-comment { position: sticky; top: 74px; font-size: 12.5px; line-height: 1.55; border-left: 4px solid var(--gold); }
.story-comment-tier { display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px; padding-bottom: 2px; border-bottom: 3px solid; }
.story-comment-tier.story-fact { color: #246a53; }
.story-comment-tier.story-inference { color: #2f5d8a; }
.story-comment-tier.story-hypothesis { color: #9a6a1f; }
.story-comment-tier.story-reconstruction { color: #795889; border-bottom-style: dashed; }
.story-comment-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px; color: var(--ink-soft); margin-bottom: 4px; }
.story-comment ul { padding-left: 17px; margin: 5px 0 0; }
.story-comment li { margin-bottom: 5px; }
@media (max-width: 780px) {
  .story-controls { grid-template-columns: 1fr; gap: 10px; }
  .story-layout { grid-template-columns: 1fr; }
  .story-comment { position: static; order: -1; }
  .story-warning { top: 88px; }
}

/* Ivo's photographs */
.photo-intro { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.photo-intro .lede { margin-bottom: 0; }
.photo-hint { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); white-space: nowrap; }
.photo-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px;
  max-width: 860px; margin: 18px auto 0;
}
.photo-card {
  margin: 0; overflow: hidden; background: var(--paper-2); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.photo-compare {
  position: relative; height: clamp(235px, 30vh, 315px); overflow: hidden; background: #201d19;
  outline: none; cursor: zoom-in;
}
.photo-compare:focus-visible { box-shadow: inset 0 0 0 3px var(--gold); }
.photo-compare img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
}
.photo-colorized { opacity: 0; transition: opacity .28s ease; }
.photo-compare:hover .photo-colorized,
.photo-compare:focus .photo-colorized,
.photo-compare.show-color .photo-colorized { opacity: 1; }
.photo-state {
  position: absolute; z-index: 2; top: 10px; left: 10px; padding: 4px 8px; border-radius: 999px;
  color: #fff; background: rgba(31,27,22,.78); font: 700 10px/1.2 var(--mono); letter-spacing: .4px;
  text-transform: uppercase; pointer-events: none;
}
.photo-state-color { display: none; }
.photo-compare:hover .photo-state-original,
.photo-compare:focus .photo-state-original,
.photo-compare.show-color .photo-state-original { display: none; }
.photo-compare:hover .photo-state-color,
.photo-compare:focus .photo-state-color,
.photo-compare.show-color .photo-state-color { display: inline; }
.photo-toggle {
  position: absolute; z-index: 3; right: 10px; bottom: 10px; border: 1px solid rgba(255,255,255,.7);
  border-radius: 999px; padding: 6px 10px; color: #fff; background: rgba(31,27,22,.82);
  font: 700 11px var(--sans); cursor: pointer;
}
.photo-toggle:hover, .photo-toggle:focus-visible { background: var(--accent); outline: 2px solid #fff; outline-offset: 2px; }
.photo-card figcaption { padding: 10px 13px 12px; font-family: var(--serif); font-size: 14px; line-height: 1.35; }
.photo-card figcaption small { display: block; margin-top: 3px; color: var(--ink-soft); font: 11px/1.35 var(--sans); }
.photo-lightbox {
  width: min(82vw, 1180px); height: 82vh; max-width: none; max-height: none; padding: 0;
  overflow: hidden; color: #fff; background: #201d19; border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.photo-lightbox::backdrop { background: rgba(18,16,13,.82); backdrop-filter: blur(3px); }
.photo-lightbox-panel { position: relative; display: grid; grid-template-rows: minmax(0,1fr) auto; height: 100%; }
.photo-lightbox-close {
  position: absolute; z-index: 4; top: 12px; right: 12px; width: 42px; height: 42px; padding: 0;
  border: 1px solid rgba(255,255,255,.7); border-radius: 50%; color: #fff; background: rgba(31,27,22,.86);
  font: 300 30px/36px var(--sans); cursor: pointer;
}
.photo-lightbox-close:hover, .photo-lightbox-close:focus-visible {
  background: var(--accent); outline: 2px solid #fff; outline-offset: 2px;
}
.photo-lightbox-image {
  position: relative; min-height: 0; width: 100%; padding: 0; overflow: hidden; border: 0;
  color: #fff; background: #201d19; cursor: pointer;
}
.photo-lightbox-image:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.photo-lightbox-image img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
}
.photo-lightbox-colorized { opacity: 0; transition: opacity .28s ease; }
.photo-lightbox-image.show-color .photo-lightbox-colorized { opacity: 1; }
.photo-lightbox-state, .photo-lightbox-hint {
  position: absolute; z-index: 2; padding: 6px 10px; border-radius: 999px; color: #fff;
  background: rgba(31,27,22,.82); pointer-events: none;
}
.photo-lightbox-state {
  top: 14px; left: 14px; font: 700 10px/1.2 var(--mono); letter-spacing: .4px; text-transform: uppercase;
}
.photo-lightbox-hint { right: 14px; bottom: 14px; font: 700 11px/1.2 var(--sans); }
.photo-lightbox-caption {
  padding: 12px 18px 14px; border-top: 1px solid rgba(255,255,255,.14); background: #29251f;
  font: 17px/1.3 var(--serif);
}
.photo-lightbox-caption small { display: block; margin-top: 3px; color: #c8bda6; font: 12px/1.35 var(--sans); }
@media (max-width: 640px) {
  .wrap { padding-left: 14px; padding-right: 14px; }
  header.site { padding: 16px 0 14px; }
  .headwrap { gap: 13px; }
  .ivo-headshot { width: 73px; height: 73px; }
  header.site h1 { font-size: 23px; }
  header.site .sub { font-size: 12.5px; line-height: 1.35; }
  .badge { font-size: 8.5px; padding: 2px 6px; margin-left: 4px; }
  .stamp { font-size: 10.5px; margin-top: 6px; }
  nav.tabs .wrap { gap: 3px; padding-left: 7px; padding-right: 7px; }
  nav.tabs a { padding: 11px 5px; font-size: 11.5px; }
  .nav-more summary { padding: 11px 18px 11px 5px; font-size: 11.5px; }
  .nav-more summary::after { right: 5px; top: 11px; }
  .nav-menu { right: 0; min-width: 190px; }
  .photo-grid { grid-template-columns: 1fr; max-width: 480px; }
  .photo-compare { height: min(65vh, 420px); }
  .photo-hint { white-space: normal; }
  .photo-lightbox { width: 94vw; height: 88vh; }
  .photo-lightbox-close { top: 9px; right: 9px; width: 40px; height: 40px; }
  .photo-lightbox-state { top: 11px; left: 11px; }
  .photo-lightbox-hint { right: 11px; bottom: 11px; }
}

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin: 8px 0 26px; }
.card { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.card .num { font-family: var(--serif); font-size: 30px; line-height: 1; }
.card .lab { color: var(--ink-soft); font-size: 12.5px; margin-top: 7px; text-transform: uppercase; letter-spacing: .5px; }
.card.accent { border-left: 4px solid var(--accent); }

/* Panels */
.panel { background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 22px; }
.panel h3 { font-family: var(--serif); margin: 0 0 6px; font-size: 18px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-soft); cursor: pointer; user-select: none; white-space: nowrap; }
tr:hover td { background: #fbf7ee; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* Pills */
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; }
.pill.k { background: #f3e3e3; color: var(--k); border-color: #e6c9c9; }
.pill.cl { background: #eef0ec; color: #4a4a3f; border-color: var(--line); }
.pill.pat { background: #e7eef0; color: var(--accent-2); }
.pill.mat { background: #f1ece3; color: var(--warn); }
.pill.unk { background: #efefe9; color: #777; }
.pill.ivo-pat { background:#e8e6f4; color:#4c3b8f; border-color:#d4ceed; }
.pill.ivo-mat { background:#e4f0eb; color:#27654f; border-color:#c9e0d6; }
.pill.ivo-unk { background:#efefe9; color:#68645c; border-color:#ddd8cc; }
.pill.ivo-ex { background:#f3e6e6; color:var(--k); border-color:#e6c9c9; }
.pill.hard-ex.no { background:#f2f0ea; color:#6e695f; border-color:#ddd8cc; font-weight:600; }
.pill.hard-ex.yes { background:#7a2e2e; color:#fff; border-color:#642424; }
.pill.yline { background:#302b3f; color:#fff; border-color:#302b3f; white-space:nowrap; }
.pill.conf-high { background: #e3efe3; color: var(--ok); }
.pill.conf-medium { background: #fff3df; color: var(--warn); }
.pill.conf-low { background: #f3e6e6; color: var(--k); }

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.controls input, .controls select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); }
.muted { color: var(--ink-soft); }
.mono { font-family: var(--mono); }

/* chr8q track */
.track-wrap { margin-top: 8px; }
.track-axis { position: relative; height: 18px; margin: 0 0 4px 200px; color: var(--ink-soft); font-size: 10.5px; font-family: var(--mono); }
.track-axis span { position: absolute; transform: translateX(-50%); }
.track-row { display: grid; grid-template-columns: 200px 1fr; align-items: center; gap: 8px; margin: 3px 0; }
.track-row .lbl { font-size: 12px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-row .lane { position: relative; height: 16px; background: #efe9dc; border-radius: 4px; }
.seg { position: absolute; top: 2px; height: 12px; border-radius: 3px; background: var(--accent-2); opacity: .85; }
.seg.k { background: var(--k); }
.seg.stan { background: var(--k); outline: 2px solid var(--gold); opacity: 1; }
.track-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); margin-top: 12px; }
.track-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }

/* Spine timeline */
.spine { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.gen { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--paper-2); }
.gen .yr { font-family: var(--serif); font-size: 17px; color: var(--accent); }
.gen .nm { font-size: 13px; font-weight: 600; }
.gen .pl { font-size: 11.5px; color: var(--ink-soft); }
.gen.hi { border-color: var(--gold); box-shadow: 0 0 0 2px #f0e4c6 inset; }

.callout { border-left: 4px solid var(--gold); background: #fbf5e7; padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 14px 0; font-size: 14px; }
iframe.map { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
iframe.map.geomap { height: 900px; }
footer { color: var(--ink-soft); font-size: 12px; border-top: 1px solid var(--line); padding: 18px 0; margin-top: 30px; }
@media (max-width: 640px) {
  .track-row, .track-axis { margin-left: 0; }
  .track-row { grid-template-columns: 120px 1fr; }
  .track-row .lbl { font-size: 10.5px; }
}

/* Static cluster maps (Geography tab): regional overview + Dubrovnik inset */
.balkans-panel { padding: 14px 14px 16px; position: relative; }
.balkans-wrap { position: relative; }
.balkans-svg { width: 100%; height: auto; display: block; background: #dce6ea;
  border: 1px solid var(--line); border-radius: 10px; }
.balkans-blob { cursor: pointer; transition: fill-opacity .12s, stroke-width .12s; }
.balkans-blob:hover, .balkans-blob.bk-hi { fill-opacity: 0.5 !important; stroke-width: 4.5 !important; }
.bk-title { font-family: var(--serif); font-size: 21px; fill: var(--ink); }
.bk-subt { font-family: var(--sans); font-size: 12px; fill: var(--ink-soft); letter-spacing: .2px; }
.bk-country { font-family: var(--sans); fill: #7e7868; letter-spacing: 2px; text-anchor: middle; opacity: .8; font-weight: 700; }
.bk-redlbl { font-family: var(--sans); font-size: 12px; font-weight: 700; fill: #c0392b; }
.bk-city circle { fill: #3a352c; stroke: #fff; stroke-width: 1.2; }
.bk-city-t { font-family: var(--sans); font-size: 12.5px; fill: #211d18; font-weight: 700;
  paint-order: stroke; stroke: #f1f4ee; stroke-width: 3px; stroke-linejoin: round; }
.bk-place circle { fill: #6a6253; }
.bk-place-t { font-family: var(--sans); font-size: 10.5px; fill: #3a352c; font-weight: 600;
  paint-order: stroke; stroke: #f1f4ee; stroke-width: 2.6px; stroke-linejoin: round; }
.bk-island { font-family: var(--serif); font-size: 11px; font-style: italic; fill: #5b7378; text-anchor: middle;
  paint-order: stroke; stroke: #dce6ea; stroke-width: 2.4px; stroke-linejoin: round; }
.bk-island-grp { font-size: 9.5px; opacity: .6; }
/* sea/region tier: italic small-caps, no dot (Pelješac, Konavle) */
.bk-region { font-family: var(--sans); font-size: 11px; font-style: italic; font-weight: 700; letter-spacing: 1.5px;
  fill: #6f7d5e; text-anchor: middle; opacity: .82; paint-order: stroke; stroke: #edefe1; stroke-width: 2.6px; stroke-linejoin: round; }
.bk-offframe { font-family: var(--sans); font-size: 10.5px; font-weight: 700; fill: #9a3b2e; }
.bk-badge-t { font-family: var(--serif); font-size: 14px; font-weight: 700; fill: #fff; text-anchor: middle; }
.balkans-tip { position: absolute; z-index: 20; max-width: 250px; background: #23201b; color: #f2ead9;
  border: 1px solid var(--gold); border-radius: 8px; padding: 9px 11px; font-size: 12px; line-height: 1.45;
  pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.bt-h { font-family: var(--serif); font-size: 13px; font-weight: 700; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.bt-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.bt-row { margin-top: 2px; }
.bt-row b { color: #d8c79c; font-weight: 600; }
.bt-db { color: #9a9081; font-size: 11px; }
.bt-hyp { margin-top: 6px; color: #cfc7b6; font-style: italic; border-top: 1px solid #3a352c; padding-top: 5px; }
.balkans-foot { margin-top: 14px; }
.balkans-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.bl-item { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: var(--paper-2);
  cursor: default; transition: box-shadow .12s, border-color .12s; }
.bl-item.bl-hi { border-color: var(--gold); box-shadow: 0 0 0 2px #f0e4c6 inset; }
.bl-hd { font-size: 12.5px; color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bl-sw { width: 13px; height: 13px; border-radius: 3px; background: var(--sw); border: 1.5px solid var(--sw); display: inline-block; flex: 0 0 auto; }
.bl-sw-dash { background: transparent; border-style: dashed; }
.bl-tier { font-size: 9px; font-weight: 700; letter-spacing: .5px; padding: 1px 5px; border-radius: 999px; background: #efe9dc; color: #6a6253; margin-left: auto; }
.bl-high { background: #e3efe3; color: var(--ok); }
.bl-medium { background: #fff3df; color: var(--warn); }
.bl-hypothesis { background: #f3e6e6; color: var(--k); }
.bl-anc { margin-top: 6px; font-size: 10.5px; color: var(--ink-soft); line-height: 1.5; }
.balkans-stamp { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); text-align: right; margin-top: 10px; }
.balkans-note { font-size: 12px; color: var(--ink-soft); margin: 12px 0 0; line-height: 1.5; max-width: 90ch; }

/* Match profile page */
.net-clickable { cursor: pointer; }
.net-clickable:hover { stroke: var(--gold); stroke-width: 3; }
.seg-tbl { margin-top: 12px; }
.ov-wrap { margin: 6px 0 4px; }
.ov-row { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 8px; margin: 4px 0; }
.ov-lbl { font-size: 11.5px; font-family: var(--mono); color: var(--ink-soft); text-align: right; }
.ov-lanewrap { width: 100%; }
.ov-lane { position: relative; height: 15px; background: #efe9dc; border-radius: 4px; min-width: 6%; }
.ov-seg { position: absolute; top: 2px; height: 11px; border-radius: 3px; opacity: .9; }
.ov-seg.ov-pile { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,.25) 0 3px, transparent 3px 6px); }
.ov-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); margin: 12px 0 4px; }
.ov-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.icw-list { display: flex; flex-wrap: wrap; gap: 7px; }
.icw-chip { display: inline-block; font-size: 12px; padding: 4px 9px; border-radius: 999px; background: #eef0ec;
  border: 1px solid var(--line); color: var(--accent-2); text-decoration: none; }
.icw-chip:hover { background: #e2e7e0; }
.icw-chip.nolink { color: var(--ink-soft); cursor: default; }
.icw-chip b { font-family: var(--mono); font-size: 11px; }

/* ---- cluster_geography markers on the Balkans map ---- */
.geo-mk { cursor: help; }
.geo-mk.geo-doc:hover { filter: brightness(1.12); }
.geo-mk.geo-hyp:hover { fill-opacity: .3; }
.geo-mk-t { font-family: var(--serif); font-size: 11px; font-weight: 600; fill: #2b2b2b;
  paint-order: stroke; stroke: #f1f4ee; stroke-width: 2.6px; stroke-linejoin: round; }
.geo-mk-t-hyp { font-style: italic; fill: #7a2e2e; }
.geo-mk-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft);
  margin: 12px 0 2px; align-items: center; }
.geo-mk-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---- geographic support line on cluster detail ---- */
.geo-support { margin: 10px 0 4px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.geo-support > b { color: var(--ink-soft); margin-right: 2px; }
.geo-chip { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper-2); cursor: help; }
.geo-chip i { font-style: normal; color: var(--ink-soft); font-size: 11px; }
.geo-chip-documented_anchor { border-color: #bcd4bc; background: #eef6ee; }
.geo-chip-hypothesis { border: 1px dashed var(--accent); background: #f7eeee; color: var(--accent); }
.geo-chip-segment_inferred { border-color: var(--line); opacity: .85; }
.geo-support-note { flex-basis: 100%; font-size: 11.5px; margin-top: 2px; }

/* Coverage / Data Gaps page */
.cov { border-left: 4px solid var(--line); }
.cov-absent { border-left-color: var(--accent-2); }
.cov-lowqual { border-left-color: var(--warn); }
.cov-solid { border-left-color: var(--ok); }
.cov-prose { border-left-color: var(--gold); }
th.cov-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.cov-sort:hover { color: var(--ink); text-decoration: underline; }
.cov h3 { display: flex; align-items: center; gap: 9px; }
.cov-count { font-family: var(--mono); font-size: 12px; background: #efefe9; color: #666;
  border-radius: 999px; padding: 1px 9px; font-weight: 700; }
.cov-guarded td { opacity: .65; }
.pill.cov-guard { background: #efefe9; color: #8a6d3b; border-color: #e2d9c4; }

/* Provenance breakdown (cluster detail) */
.prov-box { margin: 12px 0 6px; font-size: 13px; }
.prov-box > b { color: var(--ink-soft); margin-right: 4px; }
.prov-bar { display: inline-flex; width: 220px; height: 12px; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line); vertical-align: middle; margin-left: 4px; }
.prov-seg { height: 100%; }
.prov-t1 { background: #5a8f5a; }
.prov-t2 { background: #d8a24a; }
.prov-t3 { background: #cdb89a; }
.prov-legend { font-size: 11.5px; color: var(--ink-soft); margin-top: 5px;
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.prov-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: 3px; vertical-align: middle; }
.prov-key.prov-t1 { background: #5a8f5a; }
.prov-key.prov-t2 { background: #d8a24a; }
.prov-key.prov-t3 { background: #cdb89a; }

/* ---- Segments page ---- */
.seg-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-soft);
  margin: 4px 0 8px; align-items: center; }
.seg-leg-item { display: inline-flex; align-items: center; gap: 6px; }
.seg-leg-item i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.seg-leg-hatch { background-image: repeating-linear-gradient(45deg, #c0392b66 0 2px, #f3d9d2 2px 5px);
  border: 1px solid #c0392b55; }

.chapter-cards { display: grid; gap: 10px; margin-bottom: 8px; }
.chapter { border: 1px solid var(--line); border-left: 4px solid var(--cl, var(--line)); border-radius: 9px;
  background: var(--paper-2); overflow: hidden; }
.chapter > summary { cursor: pointer; padding: 11px 13px; list-style: none; display: flex; align-items: center;
  gap: 9px; flex-wrap: wrap; font-size: 14px; }
.chapter > summary::-webkit-details-marker { display: none; }
.chapter > summary::before { content: '▸'; color: var(--ink-soft); font-size: 12px; transition: transform .12s; }
.chapter[open] > summary::before { transform: rotate(90deg); }
.chapter-chr { font-family: var(--mono); font-size: 11px; font-weight: 700; color: #fff; padding: 2px 7px;
  border-radius: 5px; flex: 0 0 auto; }
.chapter-meta { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); }
.chapter-body { padding: 4px 15px 15px; border-top: 1px solid var(--line); }
.chapter-finding { font-size: 13.5px; line-height: 1.55; color: var(--ink); margin: 11px 0; }
.chapter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 6px; }
@media (max-width: 640px) { .chapter-grid { grid-template-columns: 1fr; } }
.chapter-grid h5, .chapter-recent h5 { font-family: var(--serif); font-size: 12px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--ink-soft); margin: 0 0 6px; }
.seg-people { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-person { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: #eef0ec;
  border: 1px solid var(--line); color: var(--accent-2); text-decoration: none; }
.seg-person:hover { background: #e2e7e0; }
.seg-person.nolink { color: var(--ink-soft); cursor: default; }
.seg-person b { font-family: var(--mono); font-size: 11px; }
.mrca { font-size: 13px; line-height: 1.5; }
.mrca-caveat { font-size: 11.5px; color: var(--ink-soft); font-style: italic; margin-top: 5px;
  border-left: 2px solid var(--line); padding-left: 8px; }
.chapter-recent { margin-top: 14px; }
.anc-chip { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 6px;
  background: #f0ece2; color: var(--ink-soft); margin: 2px 0; }
.chapter-foot { margin-top: 13px; font-family: var(--mono); font-size: 11px; color: var(--ink-soft);
  border-top: 1px dashed var(--line); padding-top: 8px; }

.seg-mapwrap { padding: 8px 4px; }
.seg-scroll { position: relative; overflow-x: auto; }
.seg-svg { display: block; min-width: 760px; max-width: 100%; height: auto; }
.seg-chrlbl { font-family: var(--mono); font-size: 10.5px; fill: var(--ink-soft); dominant-baseline: middle; }
.seg-backbone { fill: #e7e0d0; stroke: #d2c9b6; stroke-width: .7; }
.seg-block { cursor: crosshair; }
.seg-block.seg-cl:hover { stroke: #23201b; stroke-width: 1.1; }
.seg-block.seg-un { opacity: .32; }
.seg-block.seg-un:hover { opacity: .7; }
.seg-block.seg-pile { stroke: #b04a3a; stroke-width: .6; stroke-dasharray: 2 1.5; }
/* Ivo-side triangulation markers (chr6/12/17, Nana+Peter+Zuta) — always visible */
.seg-ivotri { fill: #f4c430; fill-opacity: .28; stroke: #b8860b; stroke-width: 1.4; }
.seg-ivotri-mark { fill: #b8860b; }
/* Peter overlay — hidden by default; shown when #segMap has .peter-on */
.peter-seg-group { display: none; }
#segMap.peter-on .peter-seg-group { display: inline; }
.peter-hatch { fill: url(#peterHatch); stroke: #5b46c9; stroke-width: .5; stroke-opacity: .4; }
.peter-overlap { fill: none; stroke: #4a2fb0; stroke-width: 2; }
.peter-toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600;
  color: #4a2fb0; background: #efeafb; border: 1px solid #d3c9f2; border-radius: 7px; padding: 6px 11px; cursor: pointer; }
.peter-caption { font-size: 12px; margin: 6px 0 10px; line-height: 1.5; }
.seg-leg-ivotri { background: #f4c430; border: 1.4px solid #b8860b; }
.seg-leg-peter { background-image: repeating-linear-gradient(45deg, #5b46c9aa 0 2px, #efeafb 2px 5px); }
.seg-tip { max-width: 320px; }
.bt-mrca { margin-top: 5px; border-top: 1px solid #3a352c; padding-top: 5px; }
.tt-caveat { font-size: 10.5px; color: #b8af9d; font-style: italic; margin-top: 3px; }
.tt-cl { font-family: var(--mono); font-size: 10px; background: #3a352c; padding: 0 4px; border-radius: 4px; }
.tt-warn { color: #e0a96b; }

/* ---- coordinate-verified triangulation marker on shared-matches chips ---- */
.icw-chip.icw-tg { border: 2px solid var(--accent-2); font-weight: 600; background: #eef4f4; }
.icw-chip.icw-tg:hover { background: #e1eeee; }
.tg-mark { color: var(--accent-2); font-weight: 700; }
.tg-legend { display: inline-block; margin-left: 6px; padding-left: 8px; border-left: 1px solid var(--line);
  color: var(--ink-soft); font-size: 12px; }

/* ---- Clusters table: key chromosomes & segments column ---- */
.kseg-cell { line-height: 2; min-width: 180px; }
.kseg { display: inline-block; font-size: 11.5px; font-family: var(--mono); padding: 2px 7px; margin: 1px 2px;
  border-radius: 6px; background: #f0ece2; color: var(--ink-soft); white-space: nowrap; }
.kseg-tg { background: #eef4f4; border: 1.5px solid var(--accent-2); color: var(--accent-2); font-weight: 600; }
.kseg-mb { opacity: .8; }
.kseg-tag { opacity: .7; font-size: 10.5px; }
.kseg-tg .kseg-tag { opacity: .9; }
