:root {
  --paper: #f5efe5;
  --paper-deep: #e9ddcd;
  --paper-light: #fffaf1;
  --ink: #241c18;
  --ink-soft: #62544b;
  --charcoal: #292320;
  --charcoal-2: #362c28;
  --line: #d3c2ae;
  --line-dark: #8d7767;
  --terracotta: #a3442f;
  --terracotta-dark: #7c2d20;
  --terracotta-soft: #edd3c7;
  --teal: #2f6e69;
  --teal-soft: #d3e5df;
  --blue: #4d667f;
  --blue-soft: #d9e1e8;
  --violet: #705c82;
  --violet-soft: #e3dae9;
  --gold: #9a681d;
  --gold-soft: #eee0be;
  --direct: #276443;
  --direct-soft: #dceade;
  --inferred: #9a681d;
  --inferred-soft: #f2e7c9;
  --debated: #853d35;
  --debated-soft: #efd9d5;
  --focus: #1967d2;
  --header-h: 64px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  min-width: 320px;
}

button,
input,
select { font: inherit; }

button,
select,
input[type="radio"],
input[type="checkbox"],
input[type="range"] { cursor: pointer; }

button { color: inherit; }

a { color: var(--terracotta-dark); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 10000;
  padding: .7rem 1rem;
  background: #fff;
  color: #111;
  transform: translateY(-120%);
}

.skip-link:focus { transform: translateY(0); }

.app-header {
  height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(190px, 260px) minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 1rem;
  padding: 0 1rem;
  color: #fff8ef;
  background: var(--charcoal);
  border-bottom: 3px solid var(--terracotta);
  position: sticky;
  top: 0;
  z-index: 2000;
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-bowl {
  width: 46px;
  height: 30px;
  fill: none;
  stroke: #d9795e;
  stroke-width: 2.4;
  stroke-linecap: round;
  flex: 0 0 auto;
}

.brand span { min-width: 0; }
.brand strong { display: block; font-size: 1.18rem; letter-spacing: .04em; }
.brand small { display: block; color: #d9c9bc; font: 500 .67rem/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }

.view-tabs {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

.view-tabs::-webkit-scrollbar { display: none; }

.view-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #d9c9bc;
  padding: 0 .72rem;
  font: 600 .78rem/1 var(--sans);
  white-space: nowrap;
}

.view-tabs button:hover { color: #fff; background: rgba(255,255,255,.05); }
.view-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: #e49076; background: rgba(255,255,255,.07); }

.header-actions { display: flex; align-items: center; gap: .45rem; }

.header-button {
  min-height: 36px;
  border: 1px solid #76635a;
  border-radius: 4px;
  padding: .45rem .72rem;
  background: var(--charcoal-2);
  color: #fff8ef;
  font: 600 .74rem/1 var(--sans);
}

.header-button:hover { border-color: #e6b19f; }

.mobile-only { display: none; }

.status-banner {
  position: fixed;
  z-index: 2500;
  top: calc(var(--header-h) + .75rem);
  left: 50%;
  max-width: min(92vw, 720px);
  transform: translateX(-50%);
  padding: .65rem 1rem;
  background: #fff4dc;
  border: 1px solid #aa7625;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(45,31,24,.16);
  color: #573b10;
  font: 600 .8rem/1.35 var(--sans);
}

#main-content { min-height: calc(100dvh - var(--header-h)); }

.app-view { min-height: calc(100dvh - var(--header-h)); }
.app-view:focus { outline: none; }

.atlas-view {
  display: grid;
  grid-template-columns: 292px minmax(360px, 1fr) 366px;
  height: calc(100dvh - var(--header-h));
  overflow: hidden;
}

.layer-panel,
.detail-panel {
  min-width: 0;
  overflow-y: auto;
  background: var(--paper-light);
  scrollbar-color: var(--line-dark) transparent;
}

.layer-panel { border-right: 1px solid var(--line); padding: 1rem; }
.detail-panel { border-left: 1px solid var(--line); padding: 1.1rem; }

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .75rem;
}

.panel-heading h1,
.panel-heading h2 { margin: .12rem 0 0; font-size: 1.32rem; line-height: 1.05; }

.eyebrow {
  margin: 0;
  color: var(--terracotta-dark);
  font: 700 .64rem/1.3 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.question-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  margin: .8rem 0 1rem;
}

.question-presets button,
.inline-action,
.inline-actions button,
.network-toolbar button,
.process-step,
.compare-dock button,
#open-comparison,
#clear-comparison {
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  background: transparent;
  padding: .48rem .58rem;
  color: var(--ink);
  font: 600 .72rem/1.25 var(--sans);
}

.question-presets button { text-align: left; min-height: 52px; }
.question-presets button:hover,
.question-presets button.is-active,
.inline-action:hover,
.inline-actions button:hover,
.network-toolbar button:hover,
.network-toolbar button[aria-pressed="true"] { background: var(--terracotta-soft); border-color: var(--terracotta); }

.filter-section {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: .8rem 0;
}

.filter-section legend,
.filter-section > label:first-child,
.search-section > label {
  display: block;
  margin: 0 0 .48rem;
  color: var(--ink-soft);
  font: 700 .68rem/1.2 var(--sans);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.filter-section > label:not(:first-child),
.filter-section fieldset label,
.layer-filters label,
.status-filters label,
.production-filters label,
.context-filters label {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 32px;
  font: 500 .76rem/1.25 var(--sans);
}

.filter-section input[type="checkbox"],
.filter-section input[type="radio"] { width: 16px; height: 16px; accent-color: var(--terracotta); flex: 0 0 auto; }
.filter-section input:disabled + span,
.filter-section input:disabled ~ * { opacity: .48; }
.basemap-filter small,
.filter-note { display: block; margin: .42rem 0 0; color: var(--ink-soft); font: 500 .64rem/1.4 var(--sans); }

.layer-filters output { margin-left: auto; color: var(--ink-soft); }

.search-wrap { position: relative; }

.search-wrap input {
  width: 100%;
  min-height: 42px;
  padding: .55rem 2.2rem .55rem .65rem;
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 500 .8rem/1.2 var(--sans);
}

.search-wrap button {
  position: absolute;
  right: .25rem;
  top: .22rem;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  font-size: 1.1rem;
}

.search-results {
  position: absolute;
  z-index: 2100;
  width: calc(100% - 2rem);
  max-height: min(50vh, 340px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line-dark);
  box-shadow: 0 12px 28px rgba(45,31,24,.2);
}

.search-result {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: .6rem;
  text-align: left;
}

.search-result:hover,
.search-result[aria-selected="true"] { background: var(--terracotta-soft); }
.search-result strong { display: block; font: 700 .78rem/1.25 var(--sans); }
.search-result span { color: var(--ink-soft); font: 500 .68rem/1.3 var(--sans); }

.range-value { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; font: 700 .74rem/1.2 var(--sans); }
.range-value span { color: var(--ink-soft); }
.range-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
input[type="range"] { width: 100%; accent-color: var(--terracotta); }

select {
  width: 100%;
  min-height: 38px;
  padding: .45rem .55rem;
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 600 .76rem/1.2 var(--sans);
}

.legend-mark { width: 13px; height: 13px; display: inline-block; flex: 0 0 auto; border: 2px solid currentColor; background: currentColor; }
.legend-mark.circle { border-radius: 50%; }
.legend-mark.square { border-radius: 1px; }
.legend-mark.diamond { transform: rotate(45deg) scale(.8); }
.legend-mark.triangle { clip-path: polygon(50% 0,100% 100%,0 100%); }
.legend-mark.hex { clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); }
.legend-mark.ring { border-radius: 50%; background: transparent; border-style: double; border-width: 3px; }
.legend-mark.terracotta { color: var(--terracotta); }
.legend-mark.teal { color: var(--teal); }
.legend-mark.blue { color: var(--blue); }
.legend-mark.violet { color: var(--violet); }
.legend-mark.gold { color: var(--gold); }

.line-key { width: 22px; height: 0; border-top: 2px solid var(--ink); flex: 0 0 auto; }
.line-key.dashed { border-top-style: dashed; }
.line-key.dotted { border-top-style: dotted; }
.dare-key { width: 12px; height: 12px; display: inline-block; flex: 0 0 auto; border: 2px solid #274f5b; border-radius: 50%; background: #f5ead2; }
.dare-radius-key { width: 18px; height: 12px; display: inline-block; flex: 0 0 auto; border: 1px dashed #274f5b; border-radius: 50%; background: rgba(123,166,174,.12); }
.status-dot { width: 11px; height: 11px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: var(--direct); }
.status-dot.probable { background: transparent; border: 2px dashed var(--inferred); }
.status-dot.contextual { background: #fff; border: 2px solid var(--gold); }

.results-heading { display: flex; align-items: center; justify-content: space-between; margin: .5rem 0; }
.results-heading h2 { margin: 0; font-size: .92rem; }
.results-heading output { min-width: 28px; padding: .12rem .35rem; border-radius: 999px; background: var(--terracotta-soft); color: var(--terracotta-dark); text-align: center; font: 700 .7rem/1.2 var(--sans); }

.place-list { display: grid; gap: .28rem; padding-bottom: 2rem; }

.place-list button {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .55rem;
  align-items: center;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  padding: .48rem .4rem;
  text-align: left;
}

.place-list button:hover,
.place-list button[aria-current="true"] { background: #efe5d8; border-left-color: var(--terracotta); }
.place-list .record-copy { min-width: 0; }
.place-list strong { display: block; overflow: hidden; text-overflow: ellipsis; font: 700 .75rem/1.25 var(--sans); white-space: nowrap; }
.place-list small { display: block; color: var(--ink-soft); font: 500 .64rem/1.25 var(--sans); }
.record-unmapped { opacity: .78; }

.map-stage { position: relative; min-width: 0; background: var(--paper-deep); overflow: hidden; }

#map {
  width: 100%;
  height: 100%;
  background-color: #e9dfcf;
  background-image:
    linear-gradient(rgba(119,96,75,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(119,96,75,.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.55), transparent 60%);
  background-size: 72px 72px, 72px 72px, auto;
}

#map.basemap-physical { background-color: #d4dddc; background-image: none; }
#map.basemap-geographical { background-color: #e6e0d0; background-image: none; }
#map.basemap-paper {
  background-color: #e9dfcf;
  background-image:
    linear-gradient(rgba(119,96,75,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(119,96,75,.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.55), transparent 60%);
}

.leaflet-container { font-family: var(--sans); }
.leaflet-control-attribution { font-size: 9px; background: rgba(255,250,241,.82) !important; }
.leaflet-control-zoom a { color: var(--ink) !important; background: var(--paper-light) !important; }
.leaflet-tooltip.atlas-tooltip { border: 0; border-radius: 3px; background: var(--charcoal); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.22); padding: .45rem .55rem; font: 600 .72rem/1.3 var(--sans); }
.leaflet-tooltip.atlas-tooltip::before { border-top-color: var(--charcoal); }

.interpretive-key {
  position: absolute;
  z-index: 800;
  top: .75rem;
  left: .75rem;
  max-width: 360px;
  background: rgba(255,250,241,.94);
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  box-shadow: 0 5px 18px rgba(45,31,24,.15);
  font: 500 .72rem/1.4 var(--sans);
}

.interpretive-key summary { padding: .52rem .65rem; cursor: pointer; font-weight: 800; color: var(--terracotta-dark); }
.interpretive-key p { margin: 0; padding: 0 .65rem .65rem; }

.map-legend {
  position: absolute;
  z-index: 800;
  left: .75rem;
  bottom: .75rem;
  max-width: min(420px, calc(100% - 1.5rem));
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .7rem;
  padding: .5rem .65rem;
  background: rgba(255,250,241,.94);
  border: 1px solid var(--line-dark);
  border-radius: 4px;
  box-shadow: 0 5px 18px rgba(45,31,24,.15);
  font: 600 .64rem/1.25 var(--sans);
}

.legend-item { display: flex; align-items: center; gap: .35rem; }

.atlas-marker { background: none !important; border: 0 !important; }
.atlas-marker .marker-shell { width: 32px; height: 32px; display: grid; place-items: center; position: relative; }
.atlas-marker .marker-shape { width: 15px; height: 15px; display: block; border: 2px solid #fff8ef; background: var(--terracotta); box-shadow: 0 1px 5px rgba(45,31,24,.5); }
.atlas-marker.kind-centre .marker-shape { border-radius: 50%; background: var(--terracotta); }
.atlas-marker.kind-workshop .marker-shape { border-radius: 1px; background: var(--terracotta); }
.atlas-marker.kind-infrastructure .marker-shape { width: 18px; height: 16px; clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%); background: var(--teal); }
.atlas-marker.kind-movement .marker-shape { transform: rotate(45deg); background: var(--violet); }
.atlas-marker.kind-distribution .marker-shape { width: 18px; height: 17px; clip-path: polygon(50% 0,100% 100%,0 100%); background: var(--gold); }
.atlas-marker.kind-provenance .marker-shape { width: 18px; height: 18px; border: 4px double var(--blue); border-radius: 50%; background: rgba(255,248,239,.82); }
.atlas-marker.kind-comparator .marker-shape { transform: rotate(45deg); background: var(--blue); border-style: double; }
.atlas-marker.production-probable .marker-shape { border-style: dashed; border-color: #4c3429; }
.atlas-marker.production-not-demonstrated-locally .marker-shape { background: #fff8ef; border-color: var(--gold); box-shadow: inset 0 0 0 2px #fff8ef, 0 1px 5px rgba(45,31,24,.35); }
.atlas-marker.is-selected .marker-shape { box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 0 0 7px var(--ink); }
.atlas-marker.is-approximate .marker-shell::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 2px dashed currentColor;
  border-radius: 50%;
  color: var(--debated);
  opacity: .8;
}

.detail-content .lead { color: var(--ink-soft); font-size: 1.02rem; line-height: 1.5; }
.detail-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 .9rem; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: .18rem .45rem; border: 1px solid var(--line-dark); border-radius: 999px; background: #fff; color: var(--ink-soft); font: 700 .62rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .04em; }
.badge.sigillata { background: var(--terracotta-soft); color: var(--terracotta-dark); border-color: #cc9682; }
.badge.brick { background: var(--blue-soft); color: #324a61; border-color: #92a5b5; }

.evidence-band { margin: .72rem 0; padding: .72rem .78rem; border-left: 4px solid; background: #fff; }
.evidence-band strong { display: block; margin-bottom: .26rem; font: 800 .7rem/1.2 var(--sans); letter-spacing: .07em; text-transform: uppercase; }
.evidence-band p { margin: 0; color: var(--ink-soft); font: 500 .76rem/1.45 var(--sans); }
.evidence-band ul { margin: .35rem 0 0; padding-left: 1.1rem; }
.evidence-band li { margin: .25rem 0; font: 500 .76rem/1.42 var(--sans); }
.evidence-band.direct { border-color: var(--direct); background: var(--direct-soft); }
.evidence-band.inferred { border-color: var(--inferred); background: var(--inferred-soft); }
.evidence-band.debated { border-color: var(--debated); background: var(--debated-soft); }
.does-not-prove { margin: .85rem 0; padding: .75rem; border: 1px solid var(--terracotta); background: #fff8f3; font: 700 .76rem/1.42 var(--sans); }
.detail-cases { display: grid; gap: .4rem; }
.detail-cases button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: .55rem; font: 700 .74rem/1.3 var(--sans); }
.detail-cases button:hover { border-color: var(--terracotta); background: var(--terracotta-soft); }
.precision-note { margin: .6rem 0; color: var(--ink-soft); font: 500 .7rem/1.4 var(--sans); }
.record-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin: .7rem 0; }
.record-facts div { min-width: 0; padding: .45rem .5rem; border: 1px solid var(--line); background: rgba(255,255,255,.7); }
.record-facts dt { color: var(--ink-soft); font: 700 .58rem/1.2 var(--sans); letter-spacing: .05em; text-transform: uppercase; }
.record-facts dd { margin: .18rem 0 0; font: 650 .7rem/1.3 var(--sans); }
.granular-grid { display: grid; gap: .45rem; margin: .75rem 0; }
.granular-card { border: 1px solid var(--line); border-radius: 3px; background: rgba(255,255,255,.74); padding: .55rem .62rem; }
.granular-card h3,
.place-sources h3 { margin: 0 0 .35rem; color: var(--terracotta-dark); font: 800 .66rem/1.2 var(--sans); letter-spacing: .05em; text-transform: uppercase; }
.granular-card ul { margin: 0; padding-left: 1rem; }
.granular-card li { margin: .22rem 0; font: 500 .69rem/1.35 var(--sans); }
.card-caution { margin: .42rem 0 0; padding-top: .4rem; border-top: 1px solid var(--line); color: var(--ink-soft); font: 650 .63rem/1.35 var(--sans); }
.place-sources { margin: .75rem 0; padding: .6rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.place-sources p { margin: .3rem 0; }

.reading-view,
.reader-view { min-height: calc(100dvh - var(--header-h)); padding: clamp(1.25rem, 3vw, 3rem); overflow: auto; }

.view-intro { max-width: 920px; margin: 0 auto 1.8rem; }
.view-intro h1 { margin: .2rem 0 .6rem; font-size: clamp(2rem, 4vw, 3.4rem); line-height: .98; letter-spacing: -.025em; }
.view-intro > p:last-child { max-width: 760px; color: var(--ink-soft); font-size: 1.08rem; line-height: 1.55; }
.split-intro { display: flex; align-items: end; justify-content: space-between; gap: 2rem; max-width: 1120px; }
.split-intro > div { max-width: 780px; }
.split-intro > label { width: min(300px, 100%); color: var(--ink-soft); font: 700 .72rem/1.4 var(--sans); }

.case-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.case-card { min-width: 0; border: 1px solid var(--line); background: var(--paper-light); padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.case-card:hover { border-color: var(--terracotta); box-shadow: 0 5px 18px rgba(45,31,24,.08); }
.case-card h2 { margin: 0; font-size: 1.22rem; line-height: 1.1; }
.case-card p { margin: 0; color: var(--ink-soft); line-height: 1.4; }
.case-card .case-question { color: var(--ink); font-style: italic; }
.case-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: auto; }
.case-actions button { border: 1px solid var(--line-dark); border-radius: 4px; background: transparent; padding: .4rem .55rem; font: 700 .68rem/1.2 var(--sans); }
.case-actions button:hover { background: var(--terracotta-soft); }

.case-dossier { max-width: 1000px; margin: 2rem auto 6rem; scroll-margin-top: 1rem; }
.case-dossier:empty { display: none; }
.dossier-header { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; padding-bottom: 1rem; border-bottom: 2px solid var(--terracotta); }
.dossier-header h2 { margin: .2rem 0; font-size: clamp(1.8rem, 3vw, 2.7rem); line-height: 1; }
.dossier-question { color: var(--ink-soft); font-style: italic; }
.dossier-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.dossier-grid .evidence-band { margin: 0; }
.dossier-source { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.dossier-source button { border: 0; background: transparent; color: var(--terracotta-dark); text-decoration: underline; font: 700 .72rem/1.4 var(--sans); }

.compare-dock {
  position: fixed;
  z-index: 1200;
  left: 50%;
  bottom: 1rem;
  width: min(880px, calc(100% - 2rem));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .8rem;
  align-items: center;
  padding: .65rem .8rem;
  background: var(--charcoal);
  color: #fff8ef;
  border: 1px solid #836c60;
  box-shadow: 0 8px 30px rgba(35,27,23,.3);
  font-family: var(--sans);
}
.compare-dock > div:first-child { display: grid; }
.compare-dock span { color: #d9c9bc; font-size: .68rem; }
.compare-pins { display: flex; gap: .35rem; min-width: 0; overflow-x: auto; }
.compare-pin { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; padding: .3rem .45rem; border: 1px solid #79665d; border-radius: 999px; font-size: .68rem; }
.compare-pin button { border: 0; color: #fff; padding: 0 .1rem; }
.compare-dock > button { color: #fff8ef; border-color: #a68b7c; }
.compare-dock > button:disabled { opacity: .45; cursor: not-allowed; }

.network-toolbar,
.model-caption,
.network-graph,
.table-wrap { max-width: 1120px; margin-inline: auto; }
.network-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; margin-bottom: .7rem; font: 700 .72rem/1.3 var(--sans); }
.network-toolbar label { display: flex; align-items: center; gap: .55rem; }
.network-toolbar select { width: auto; min-width: 220px; background: var(--paper-light); }
.model-caption { margin-bottom: .7rem; color: var(--ink-soft); font-size: 1rem; font-style: italic; }
.network-graph { min-height: 480px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,250,241,.5); overflow-x: auto; }
.network-graph svg { display: block; width: 100%; min-width: 760px; height: 480px; }
.network-lane { fill: rgba(141,119,103,.07); }
.network-lane-label { fill: var(--ink-soft); font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .08em; }
.network-edge { fill: none; stroke: var(--ink-soft); stroke-width: 2; }
.network-edge.inferred { stroke-dasharray: 7 5; }
.network-edge.hypothesis { stroke-dasharray: 2 6; }
.network-edge-label { fill: var(--ink-soft); font: 600 10px var(--sans); text-anchor: middle; paint-order: stroke; stroke: var(--paper-light); stroke-width: 4px; }
.network-node { cursor: pointer; }
.network-node rect { fill: var(--paper-light); stroke: var(--ink); stroke-width: 1.6; }
.network-node.status-inferred rect { stroke-dasharray: 6 4; }
.network-node.status-hypothesis rect { stroke-dasharray: 2 5; }
.network-node text { fill: var(--ink); font: 700 12px var(--sans); text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.network-node:hover rect,
.network-node:focus rect { fill: var(--terracotta-soft); stroke: var(--terracotta-dark); stroke-width: 3; }

.table-wrap { margin-top: 1rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--paper-light); font-family: var(--sans); }
caption { padding: .55rem 0; color: var(--ink-soft); text-align: left; font-weight: 700; }
th, td { border-bottom: 1px solid var(--line); padding: .58rem .65rem; text-align: left; vertical-align: top; font-size: .74rem; line-height: 1.35; }
th { color: var(--ink-soft); font-size: .64rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:hover { background: #f0e5d7; }

.process-steps { max-width: 1180px; margin: 2rem auto; display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: .45rem; position: relative; }
.process-steps::before { content: ""; position: absolute; left: 3%; right: 3%; top: 32px; border-top: 2px solid var(--line-dark); z-index: 0; }
.process-step { position: relative; z-index: 1; min-height: 110px; display: grid; align-content: start; gap: .35rem; padding: .65rem; background: var(--paper-light); text-align: left; }
.process-step::before { content: attr(data-number); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--charcoal); color: #fff; font: 800 .68rem/1 var(--sans); }
.process-step strong { font-size: .72rem; line-height: 1.25; }
.process-step span { color: var(--ink-soft); font-size: .62rem; line-height: 1.3; }
.process-step[aria-pressed="true"] { border-color: var(--terracotta); background: var(--terracotta-soft); }
.process-detail { max-width: 920px; margin: 0 auto; display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,.6fr); gap: 1rem; }
.process-detail h2 { margin: .2rem 0; font-size: 2rem; }
.process-detail p { line-height: 1.55; }
.process-related { background: var(--paper-light); border: 1px solid var(--line); padding: 1rem; }
.process-related h3 { margin-top: 0; font-size: 1rem; }
.process-related button { display: block; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: .55rem 0; text-align: left; color: var(--terracotta-dark); font: 700 .74rem/1.3 var(--sans); }

.timeline-chart { max-width: 1120px; margin: 1rem auto; overflow-x: auto; }
.timeline-chart svg { display: block; width: 100%; min-width: 820px; height: auto; background: rgba(255,250,241,.45); border-block: 1px solid var(--line); }
.timeline-axis { stroke: var(--line-dark); }
.timeline-grid { stroke: var(--line); stroke-width: 1; }
.timeline-tick { fill: var(--ink-soft); font: 600 10px var(--sans); text-anchor: middle; }
.timeline-lane-label { fill: var(--ink); font: 700 11px var(--sans); }
.timeline-bar { fill: var(--terracotta); cursor: pointer; }
.timeline-bar.brick { fill: var(--blue); }
.timeline-bar.fuzzy { stroke: var(--gold); stroke-width: 3; stroke-dasharray: 4 3; }
.timeline-bar:hover,
.timeline-bar:focus { stroke: var(--ink); stroke-width: 3; }
.timeline-bar-label { fill: #fff; font: 700 10px var(--sans); pointer-events: none; }

.reader-view { display: grid; grid-template-columns: 220px minmax(0, 760px); justify-content: center; gap: clamp(2rem, 5vw, 5rem); }
.reader-nav { align-self: start; position: sticky; top: calc(var(--header-h) + 1.25rem); display: grid; gap: .35rem; padding: 1rem 0; border-block: 1px solid var(--line); }
.reader-nav a { padding: .25rem 0; color: var(--ink-soft); text-decoration: none; font: 600 .72rem/1.3 var(--sans); }
.reader-nav a:hover { color: var(--terracotta-dark); }
.reader-article { min-width: 0; }
.reader-article > header { margin-bottom: 4rem; }
.reader-article h1 { margin: .3rem 0 .8rem; font-size: clamp(2.5rem, 6vw, 5rem); line-height: .93; letter-spacing: -.04em; }
.reader-article .standfirst { color: var(--ink-soft); font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.55; }
.reader-article section { margin: 0 0 4.5rem; scroll-margin-top: calc(var(--header-h) + 1rem); }
.reader-article h2 { margin: .2rem 0 .8rem; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.02; }
.reader-article section > p:not(.chapter-number) { font-size: 1.08rem; line-height: 1.75; }
.chapter-number { margin: 0; color: var(--terracotta); font: 800 .72rem/1 var(--sans); letter-spacing: .12em; }
.reader-article blockquote { margin: 2rem 0; padding: 1rem 1.2rem; border-left: 5px solid var(--terracotta); background: var(--paper-light); font-size: 1.35rem; line-height: 1.45; font-style: italic; }
.source-ref { border: 0; background: transparent; color: var(--terracotta-dark); padding: 0 .08rem; text-decoration: underline; font: 700 .72rem/1 var(--sans); }
.source-ref:hover { background: var(--terracotta-soft); }
.inline-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.thesis-bands { display: grid; grid-template-columns: repeat(3,1fr); gap: .6rem; margin-top: 1.5rem; }
.thesis-bands div { padding: .8rem; border-top: 4px solid; background: var(--paper-light); }
.thesis-bands div:nth-child(1) { border-color: var(--direct); }
.thesis-bands div:nth-child(2) { border-color: var(--inferred); }
.thesis-bands div:nth-child(3) { border-color: var(--debated); }
.thesis-bands strong { display: block; margin-bottom: .3rem; font: 800 .68rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: .05em; }
.thesis-bands span { color: var(--ink-soft); font-size: .78rem; line-height: 1.35; }

.evidence-section,
.method-note { max-width: 1120px; margin: 0 auto 3rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding-bottom: .7rem; margin-bottom: 1rem; }
.section-heading h2 { margin: .15rem 0 0; font-size: 1.65rem; }
.section-heading > p { max-width: 440px; margin: 0; color: var(--ink-soft); text-align: right; line-height: 1.4; }
.comparison-chart { min-height: 520px; overflow-x: auto; background: rgba(255,250,241,.5); }
.comparison-chart svg { width: 100%; min-width: 760px; height: 520px; display: block; }
.plot-grid { stroke: var(--line); }
.plot-axis { stroke: var(--ink); stroke-width: 1.5; }
.plot-label { fill: var(--ink-soft); font: 600 11px var(--sans); }
.plot-title { fill: var(--ink); font: 800 12px var(--sans); }
.plot-point { fill: var(--terracotta-soft); stroke: var(--terracotta-dark); cursor: pointer; }
.plot-point.brick { fill: var(--blue-soft); stroke: var(--blue); }
.plot-point:hover,
.plot-point:focus { fill: var(--gold-soft); stroke: var(--ink); }
.plot-point-label { fill: var(--ink); font: 700 11px var(--sans); pointer-events: none; paint-order: stroke; stroke: var(--paper-light); stroke-width: 4px; }
.comparison-note { min-height: 58px; margin-top: .7rem; padding: .7rem; border-left: 4px solid var(--terracotta); background: var(--paper-light); color: var(--ink-soft); font: 600 .78rem/1.4 var(--sans); }
.comparison-matrix { overflow-x: auto; }
.matrix-empty { padding: 1rem; border: 1px dashed var(--line-dark); color: var(--ink-soft); text-align: center; }
.matrix-table th:first-child { min-width: 170px; }
.matrix-table td { min-width: 220px; }
.matrix-attested { color: var(--direct); font-weight: 700; }
.matrix-inferred { color: var(--inferred); font-weight: 700; }
.matrix-debated { color: var(--debated); font-weight: 700; }

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.two-column h2 { margin-top: .15rem; }
.glossary-list { display: grid; gap: .6rem; }
.glossary-list details { border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.glossary-list summary { cursor: pointer; color: var(--terracotta-dark); font-weight: 700; font-style: italic; }
.glossary-list p { color: var(--ink-soft); line-height: 1.45; }
.text-link { font: 700 .76rem/1.4 var(--sans); }
.source-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.source-card { border: 1px solid var(--line); background: var(--paper-light); padding: .8rem; }
.source-card h3 { margin: .1rem 0 .4rem; font-size: 1rem; }
.source-card p { margin: .3rem 0; color: var(--ink-soft); line-height: 1.4; }
.source-card button,
.source-card a { font: 700 .7rem/1.3 var(--sans); }
.method-note { padding: 1rem 1.2rem; border: 1px solid var(--gold); background: var(--gold-soft); }
.method-note p { margin-bottom: 0; line-height: 1.5; }

.source-drawer {
  position: fixed;
  z-index: 3000;
  top: var(--header-h);
  right: 0;
  width: min(460px, 92vw);
  height: calc(100dvh - var(--header-h));
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--paper-light);
  border-left: 1px solid var(--line-dark);
  box-shadow: -12px 0 30px rgba(45,31,24,.2);
  transform: translateX(102%);
  transition: transform .22s ease;
}
.source-drawer.is-open { transform: translateX(0); }
.source-close { float: right; width: 40px; height: 40px; border: 1px solid var(--line-dark); border-radius: 50%; background: transparent; font-size: 1.4rem; }
.source-drawer h2 { margin: .25rem 0 .6rem; font-size: 1.55rem; }
.source-drawer p { line-height: 1.5; }
.source-drawer .source-citation { color: var(--ink-soft); font-family: var(--sans); }
.source-drawer a { overflow-wrap: anywhere; font: 700 .76rem/1.4 var(--sans); }
.drawer-scrim { position: fixed; z-index: 2900; inset: var(--header-h) 0 0; background: rgba(35,27,23,.42); }

.icon-button { width: 40px; height: 40px; border: 1px solid var(--line-dark); border-radius: 50%; background: transparent; font-size: 1.3rem; }
.map-buttons { position: absolute; z-index: 850; right: .6rem; bottom: .6rem; gap: .4rem; }
.map-buttons button { min-height: 44px; border: 1px solid var(--line-dark); border-radius: 4px; background: var(--paper-light); padding: .5rem .7rem; font: 700 .74rem/1 var(--sans); }
.noscript { margin: 1rem; padding: 1rem; border: 1px solid var(--debated); background: var(--debated-soft); }

@media (max-width: 1180px) {
  .app-header { grid-template-columns: minmax(170px, 220px) minmax(0,1fr) auto; gap: .4rem; }
  .view-tabs button { padding-inline: .55rem; }
  .mobile-only { display: inline-flex; align-items: center; justify-content: center; }
  .atlas-view { grid-template-columns: 1fr; position: relative; }
  .layer-panel,
  .detail-panel {
    position: absolute;
    z-index: 1500;
    top: 0;
    bottom: 0;
    width: min(390px, 92vw);
    box-shadow: 0 0 30px rgba(45,31,24,.24);
    transition: transform .22s ease;
  }
  .layer-panel { left: 0; transform: translateX(-103%); }
  .detail-panel { right: 0; transform: translateX(103%); }
  .layer-panel.is-open,
  .detail-panel.is-open { transform: translateX(0); }
  .map-buttons { display: flex; }
}

@media (max-width: 900px) {
  :root { --header-h: 58px; }
  .app-header { grid-template-columns: 160px minmax(0,1fr) auto; padding-inline: .6rem; }
  .brand-bowl { width: 36px; }
  .brand small { display: none; }
  .view-tabs button { font-size: .72rem; padding-inline: .5rem; }
  .header-actions #open-method { display: none; }
  .case-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .process-steps { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .process-steps::before { display: none; }
  .reader-view { grid-template-columns: 1fr; }
  .reader-nav { position: static; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .thesis-bands { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .app-header { grid-template-columns: 128px minmax(0,1fr) auto; gap: .25rem; }
  .brand { gap: .35rem; }
  .brand-bowl { display: none; }
  .brand strong { font-size: 1rem; }
  .view-tabs button { padding-inline: .65rem; }
  .header-actions #open-layers,
  .header-actions #open-details { display: none; }
  .reading-view,
  .reader-view { padding: 1.15rem; }
  .view-intro h1 { font-size: 2.3rem; }
  .split-intro,
  .section-heading { display: grid; align-items: start; }
  .section-heading > p { text-align: left; }
  .case-grid { grid-template-columns: 1fr; }
  .dossier-header,
  .dossier-grid,
  .process-detail,
  .two-column,
  .source-list { grid-template-columns: 1fr; }
  .compare-dock { grid-template-columns: 1fr auto; }
  .compare-dock > div:first-child { grid-column: 1 / -1; }
  .process-steps { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .reader-nav { grid-template-columns: 1fr; }
  .reader-article h1 { font-size: 2.8rem; }
  .interpretive-key { right: .55rem; left: .55rem; top: .55rem; max-width: none; }
  .atlas-map .leaflet-top.leaflet-right { top: 145px; }
  .map-legend { display: none; }
  .map-buttons { bottom: .55rem; }
}

@media (max-width: 420px) {
  .app-header { grid-template-columns: 96px minmax(0,1fr); }
  .header-actions { display: none; }
  .brand strong { font-size: .88rem; }
  .question-presets { grid-template-columns: 1fr; }
  .process-steps { grid-template-columns: 1fr; }
  .process-step { min-height: auto; grid-template-columns: 30px 1fr; }
  .process-step span { grid-column: 2; }
  .compare-dock { bottom: .4rem; width: calc(100% - .8rem); }
}

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

@media (forced-colors: active) {
  .marker-shape,
  .legend-mark,
  .timeline-bar,
  .plot-point { forced-color-adjust: none; }
}
