/* ═══════════════════════════════════════════════════════
   PEUTINGERIANA DACIA — Parchment, red roads, eleven names
   ═══════════════════════════════════════════════════════ */

/* ── Fonts ──────────────────────────────────────────── */
@font-face {
  font-family: 'Cormorant';
  src: url('/peutingeriana-dacia/assets/fonts/Cormorant.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens: light ──────────────────────────────────── */
:root {
  --paper:    #f3ecdc;
  --surface:  #e7dabd;
  --surface-2:#d9c8a4;
  --stone:    #c2b091;

  --ink:      #1c1710;
  --ink-2:    #3d3425;
  --ink-3:    #5d5342;
  --ink-4:    #7d7361;

  --accent:   #8b4513;
  --accent-bg:#f0dfc2;

  --revived:  #1b5e3e;
  --revived-bg:#d8e8de;
  --lost:     #8b1a1a;
  --lost-bg:  #f0d4d4;
  --shifted:  #4a3b8c;
  --shifted-bg:#e4dff5;

  --road:     #a33b1f;
  --water:    #2a5b7c;
  --water-bg: #d6e6f0;

  --focus:    #4a7a9c;
  --border:   rgba(28,23,16,.14);

  --bar-h:    2.75rem;
  --measure:  38rem;
  --gap:      clamp(1.5rem, 3vw, 3rem);

  --font-display: 'Cormorant', 'Georgia', 'Times New Roman', serif;
  --font-body:    'Georgia', 'Times New Roman', serif;
  --font-mono:    'SFMono-Regular', 'Consolas', monospace;
}

/* ── Tokens: dark ───────────────────────────────────── */
[data-theme="dark"] {
  --paper:    #12100b;
  --surface:  #1d1912;
  --surface-2:#292219;
  --stone:    #3d3527;

  --ink:      #eee5d2;
  --ink-2:    #d1c7b1;
  --ink-3:    #b1a691;
  --ink-4:    #918671;

  --accent:   #d4915a;
  --accent-bg:#2a1e10;

  --revived:  #7cc8a0;
  --revived-bg:#162a20;
  --lost:     #e89090;
  --lost-bg:  #2a1616;
  --shifted:  #b8a8e8;
  --shifted-bg:#1e1a30;

  --road:     #d4694e;
  --water:    #6aadcc;
  --water-bg: #142430;

  --focus:    #6aadcc;
  --border:   rgba(238,229,210,.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:    #12100b;
    --surface:  #1d1912;
    --surface-2:#292219;
    --stone:    #3d3527;
    --ink:      #eee5d2;
    --ink-2:    #d1c7b1;
    --ink-3:    #b1a691;
    --ink-4:    #918671;
    --accent:   #d4915a;
    --accent-bg:#2a1e10;
    --revived:  #7cc8a0;
    --revived-bg:#162a20;
    --lost:     #e89090;
    --lost-bg:  #2a1616;
    --shifted:  #b8a8e8;
    --shifted-bg:#1e1a30;
    --road:     #d4694e;
    --water:    #6aadcc;
    --water-bg: #142430;
    --focus:    #6aadcc;
    --border:   rgba(238,229,210,.12);
  }
}

/* ── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 1rem + .22vw, 1.17rem);
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; display: block; }

/* ── Focus ──────────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Layout ─────────────────────────────────────────── */
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }
.wide { max-width: 56rem; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: .5rem;
  height: var(--bar-h);
  padding: 0 clamp(.75rem, 2vw, 1.25rem);
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: .85rem;
  letter-spacing: .02em;
}
.topbar .home { color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.topbar .home:hover { color: var(--ink); }
.topnav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  color: var(--ink-3); text-decoration: none; white-space: nowrap;
  padding: .25rem .5rem; border-radius: 4px;
}
.topnav a:hover { color: var(--ink); background: var(--surface); }
.topnav a[aria-current="true"] { color: var(--ink); font-weight: 600; }
.spacer { flex: 1; }
.chip {
  color: var(--ink-3); text-decoration: none; white-space: nowrap;
  padding: .2rem .6rem; border-radius: 4px;
  font-size: .8rem;
}
.chip:hover { color: var(--ink); background: var(--surface); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 50%;
  border: none; background: none; color: var(--ink-3);
  cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--ink); background: var(--surface); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }

/* ── Sections ───────────────────────────────────────── */
section { scroll-margin-top: calc(var(--bar-h) + 1rem); }
.block { padding: var(--gap) 0; }
.block + .block { border-top: 1px solid var(--border); }

/* ── Typography ─────────────────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 1.35rem + 3.3vw, 3.9rem);
  line-height: 1.08;
  font-weight: 400;
  letter-spacing: -.01em;
  color: var(--ink);
}
h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.2rem);
  line-height: 1.15;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 1rem;
}
h2 .anchor { color: inherit; text-decoration: none; }
h2 .anchor:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.kicker {
  font-family: var(--font-display);
  font-size: .95rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .5rem;
}
.deck {
  font-size: clamp(1.08rem, 1rem + .35vw, 1.28rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 34rem;
}
.lede {
  font-size: 1.08rem;
  color: var(--ink-2);
  margin-bottom: 1.5rem;
}
.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1em; }

/* ── Hero ───────────────────────────────────────────── */
.hero {
  padding: clamp(3rem, 8vw, 7rem) 0 clamp(2rem, 5vw, 4rem);
  text-align: center;
}
.hero-text { margin-bottom: clamp(2rem, 4vw, 3.5rem); }
.hero h1 { margin-bottom: 1rem; }

/* ── Traced strip ───────────────────────────────────── */
.strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 56rem;
  text-align: left;
}
.strip-scroll { overflow-x: auto; padding: clamp(.75rem, 2vw, 1.25rem); }
.strip svg { display: block; min-width: 60rem; width: 100%; height: auto; }
.strip .road-line { fill: none; stroke: var(--road); stroke-width: 3; }
.strip .road-line.ghost { stroke-dasharray: 7 6; opacity: .55; }
.strip .dist {
  font-family: var(--font-display);
  font-size: 13px;
  fill: var(--ink-3);
  text-anchor: middle;
}
.strip .st { cursor: pointer; }
.strip .st circle.halo { fill: transparent; }
.strip .st circle.dot { stroke-width: 2.5; }
.strip .st text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  text-anchor: middle;
}
.strip .st .mapname { font-size: 12.5px; font-weight: 400; font-style: italic; }
.strip .st.v-revived circle.dot { fill: var(--revived-bg); stroke: var(--revived); }
.strip .st.v-revived text { fill: var(--revived); }
.strip .st.v-shifted circle.dot { fill: var(--shifted-bg); stroke: var(--shifted); }
.strip .st.v-shifted text { fill: var(--shifted); }
.strip .st.v-lost circle.dot { fill: var(--lost-bg); stroke: var(--lost); }
.strip .st.v-lost text { fill: var(--lost); }
.strip .st.active circle.halo { fill: var(--accent-bg); }
.strip .st.dim { opacity: .28; }
.strip-cap {
  padding: 1rem clamp(1rem, 3vw, 2rem);
  font-size: .88rem;
  color: var(--ink-3);
  border-top: 1px solid var(--border);
}

/* ── Filters ────────────────────────────────────────── */
.filters {
  display: flex; flex-wrap: wrap; gap: .5rem;
  margin: 1rem 0 1.5rem;
}
.filters button {
  font-family: var(--font-display);
  font-size: .9rem;
  padding: .35rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
}
.filters button:hover { border-color: var(--ink-4); }
.filters button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.filters button .n { opacity: .65; }

/* ── Name cards ─────────────────────────────────────── */
.cards {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1rem;
}
.card {
  padding: 1.25rem 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper);
  scroll-margin-top: calc(var(--bar-h) + 1rem);
}
.card.match { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card.hidden { display: none; }
.lede.gap-top { margin-top: var(--gap); }
.card .from {
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 600;
}
.card .onmap {
  display: block;
  font-size: .82rem;
  color: var(--ink-3);
  margin-top: .1rem;
}
.card .arrow { color: var(--ink-4); margin: 0 .5rem; }
.card .to {
  font-size: 1.15rem;
  font-style: italic;
}
.card .verdict {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: .5rem 0;
  font-size: .88rem;
  font-weight: 600;
}
.card .dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.card.v-revived .dot { background: var(--revived); }
.card.v-revived .verdict { color: var(--revived); }
.card.v-revived .from { color: var(--revived); }
.card.v-lost .dot { background: var(--lost); }
.card.v-lost .verdict { color: var(--lost); }
.card.v-lost .from { color: var(--lost); }
.card.v-shifted .dot { background: var(--shifted); }
.card.v-shifted .verdict { color: var(--shifted); }
.card.v-shifted .from { color: var(--shifted); }
.card .why {
  font-size: .92rem;
  color: var(--ink-2);
  line-height: 1.55;
}
.card .why i { font-style: italic; }
.card .leg {
  font-size: .82rem;
  color: var(--ink-3);
  margin-top: .5rem;
}

.legend {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  font-size: .85rem;
  color: var(--ink-3);
  margin: 1rem 0;
}
.legend li { display: flex; align-items: center; gap: .35rem; }
.legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend .v-revived .dot { background: var(--revived); }
.legend .v-lost .dot { background: var(--lost); }
.legend .v-shifted .dot { background: var(--shifted); }
.tally {
  font-size: .9rem;
  color: var(--ink-3);
  margin-bottom: .5rem;
}

/* ── Split layout ───────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
@media (min-width: 50rem) {
  .split { grid-template-columns: 1fr 1fr; }
}
.split .side { display: flex; flex-direction: column; gap: 1.5rem; }

/* ── Figures ────────────────────────────────────────── */
.fig { margin: 1.5rem 0 0; }
.fig.tight { margin-top: 0; }
.fig img { border-radius: 6px; }
.fig figcaption {
  font-size: .85rem;
  color: var(--ink-3);
  margin-top: .5rem;
  line-height: 1.45;
}
.fig .cr { font-size: .78rem; display: block; margin-top: .25rem; }
.fig .cr a { color: var(--ink-4); }
.fig.portrait img { max-width: min(26rem, 100%); margin: 0 auto; }

/* ── Facts DL ───────────────────────────────────────── */
.facts {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.facts dt {
  font-family: var(--font-display);
  font-size: .85rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: .75rem;
}
.facts dt:first-child { margin-top: 0; }
.facts dd { margin-left: 0; color: var(--ink-2); }

/* ── Sources ────────────────────────────────────────── */
.srcs {
  padding: 0;
  list-style: none;
}
.srcs li {
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  color: var(--ink-2);
}
.srcs li:last-child { border-bottom: none; }
.srcs a { word-break: break-all; }

/* ── Footer ─────────────────────────────────────────── */
.foot {
  padding: 2rem 0;
  text-align: center;
  font-size: .85rem;
  color: var(--ink-4);
  border-top: 1px solid var(--border);
}
.foot a { color: var(--ink-3); }
.foot p + p { margin-top: .25rem; }

/* ── Rail (desktop reading rail) ────────────────────── */
.rail {
  display: none;
}
@media (min-width: 90rem) {
  .rail {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 90;
    font-family: var(--font-display);
    font-size: .72rem;
    letter-spacing: .04em;
  }
  .rail a {
    display: flex; align-items: center; gap: .5rem;
    color: var(--ink-4); text-decoration: none;
    padding: .3rem .5rem;
    border-radius: 4px;
    flex-direction: row-reverse;
  }
  .rail a:hover { color: var(--ink-2); }
  .rail a[aria-current="true"] { color: var(--ink); }
  .rail a[aria-current="true"] i {
    background: var(--accent);
  }
  .rail i {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--stone);
    display: block;
    flex-shrink: 0;
  }
}

/* ── Reduced motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
  html { scroll-behavior: auto; }
}

/* ── Not found ──────────────────────────────────────── */
.notfound { padding-top: 4rem; text-align: center; }

/* ── Print ──────────────────────────────────────────── */
@media print {
  .topbar, .rail, .icon-btn { display: none; }
  body { font-size: 11pt; }
  section { break-inside: avoid; }
}
