/* zimnicea-1877: a Russian staff plan by lamplight. System type only. */
:root {
  --paper: #f4efe2; --paper2: #faf7ee; --ink: #1c2733; --ink-soft: #3d4c5c;
  --line: #c9bfa8; --brass: #8a5c14; --brass-hi: #e0a83f; --river: #2e6f9e;
  --ottoman: #8a2f2b; --card: #faf7ee; --stage: #e9e1cd; --shadow: rgba(28, 39, 51, .18);
  --serif: "Iowan Old Style", Charter, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, "Segoe UI", sans-serif;
}
[data-theme="dark"] {
  --paper: #0e151c; --paper2: #141d26; --ink: #e9e2d2; --ink-soft: #b7ad99;
  --line: #3a4753; --brass: #e0a83f; --brass-hi: #f2c66d; --river: #7fb3d9;
  --ottoman: #d98880; --card: #141d26; --stage: #0a1118; --shadow: rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.125rem; line-height: 1.65;
}
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.block { padding: 3.5rem 0 1rem; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); margin: .6rem 0 1rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 .8rem; }
h3 { font-size: 1.15rem; margin: 0 0 .4rem; }
a { color: var(--brass); }
[data-theme="dark"] a { color: var(--brass-hi); }
.anchor { color: inherit; text-decoration: none; }
.anchor:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--brass-hi); outline-offset: 2px; }

/* topbar + rail */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: .9rem;
  padding: .55rem 1.25rem; background: var(--paper); border-bottom: 1px solid var(--line);
  font-family: var(--sans); font-size: .95rem;
}
.topbar .home { color: var(--ink); text-decoration: none; font-weight: 700; }
.topnav { display: flex; gap: .2rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--ink-soft); text-decoration: none; padding: .6rem .4rem; white-space: nowrap; }
.topnav a:hover { color: var(--ink); }
.mobile-nav { display: none; position: relative; }
.mobile-nav summary { color: var(--ink); cursor: pointer; list-style: none; padding: .6rem .4rem; white-space: nowrap; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav summary::after { content: " ▾"; }
.mobile-nav[open] summary::after { content: " ▴"; }
.mobile-nav summary:focus-visible { outline: 3px solid var(--brass-hi); outline-offset: 2px; }
.mobile-nav nav { position: absolute; top: calc(100% + .25rem); left: 0; width: max-content; max-width: calc(100vw - 1.2rem); padding: .35rem; display: grid; background: var(--card); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 2px 10px var(--shadow); z-index: 60; }
.mobile-nav nav a { display: block; padding: .7rem .85rem; color: var(--ink); text-decoration: none; line-height: 1.25; white-space: nowrap; }
.mobile-nav nav a:hover { color: var(--brass); }
.topbar .spacer { flex: 1; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: .15rem .7rem; text-decoration: none; color: var(--ink); }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 999px; width: 2.4rem; height: 2.4rem; cursor: pointer; color: var(--ink); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; vertical-align: middle; }
.rail {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%); z-index: 40;
  display: flex; flex-direction: column; gap: .35rem; padding: .6rem .5rem;
  font-family: var(--sans); font-size: .78rem;
}
.rail a { color: var(--ink-soft); text-decoration: none; padding: .1rem .3rem; border-left: 2px solid transparent; }
.rail a.on { color: var(--ink); border-left-color: var(--brass); }
.rail .boat { width: 10px; height: 10px; margin: .3rem 0 0 .3rem; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--brass); }
@media (max-width: 70rem) { .rail { display: none; } }

/* hero */
.hero { padding-top: 2.5rem; }
.kicker { font-family: var(--sans); font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin: 0; }
.deck { font-size: 1.25rem; max-width: 44rem; }
.figure-line { font-family: var(--sans); font-weight: 700; letter-spacing: .04em; color: var(--brass); }
.hero-fig { margin: 1.5rem 0 0; }
figure { margin: 2rem 0; }
figure img { width: 100%; height: auto; display: block; border: 1px solid var(--line); }
figcaption { font-family: var(--sans); font-size: .92rem; color: var(--ink-soft); margin-top: .5rem; max-width: 60rem; }
.lede { font-size: 1.2rem; max-width: 46rem; }
.unknown { border-left: 3px solid var(--brass); padding-left: 1rem; font-style: italic; max-width: 46rem; }
.note { color: var(--ink-soft); }

/* stories */
.story-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.stage { position: sticky; top: 5rem; align-self: start; height: calc(100vh - 6rem); min-height: 30rem; background: var(--stage); border: 1px solid var(--line); overflow: hidden; }
.stage svg.map, .stage svg.plan { width: 100%; height: 100%; display: block; }
.steps { display: flex; flex-direction: column; gap: 1.2rem; padding-bottom: 30vh; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1.1rem 1.25rem; box-shadow: 0 2px 10px var(--shadow); }
.step p { margin: .4rem 0 0; }
.step.on { border-color: var(--brass); }
@media (max-width: 60rem) {
  .topnav { display: none; }
  .mobile-nav { display: block; }
  .story-grid { grid-template-columns: 1fr; }
  .stage { position: sticky; top: 4.6rem; height: 46vh; min-height: 20rem; order: -1; }
  .steps { padding-bottom: 10vh; }
}
@media (max-height: 740px) and (min-width: 60rem) { .stage { height: calc(100vh - 6rem); min-height: 24rem; } }

/* region map */
.water { fill: var(--river); opacity: .28; stroke: none; }
.danube { fill: none; stroke: var(--river); stroke-width: 1000; stroke-linecap: round; opacity: .85; }
.olt { fill: none; stroke: var(--river); stroke-width: 300; opacity: .7; }
.dot circle, .approx circle { r: 1600px; fill: var(--brass); stroke: var(--paper); stroke-width: 500; }
.approx circle { fill: var(--paper); fill-opacity: .35; stroke-dasharray: 2200 1400; }
.dot, .approx { opacity: 0; transition: opacity .4s; }
.dot.show, .approx.show { opacity: 1; }
.lab { font-family: var(--sans); font-size: 4200px; letter-spacing: .06em; text-transform: uppercase; fill: var(--ink); text-shadow: 0 0 6px var(--paper), 0 0 6px var(--paper); }
.extra { opacity: 0; transition: opacity .4s; }
.extra.show { opacity: 1; }
.ex-line { fill: none; stroke: var(--brass); stroke-width: 700; stroke-dasharray: 2400 1600; opacity: .9; }
.ex-arrow { stroke: var(--ottoman); stroke-width: 900; }
.ex-head { fill: var(--ottoman); r: 1400px; }
.ex-ring { fill: none; stroke: var(--brass); stroke-width: 600; stroke-dasharray: 1400 900; }
.ex-tick { stroke: var(--ottoman); stroke-width: 900; fill: none; }
.scalebar line { stroke: var(--ink); stroke-width: 425; }
.scalebar text { font-family: var(--sans); font-size: 3800px; fill: var(--ink); }

/* 1879 plan redraw */
.p-bank { fill: none; stroke: var(--ink); stroke-width: 26; stroke-linecap: round; }
.p-island { fill: var(--paper2); stroke: var(--ink); stroke-width: 18; }
.p-stream { fill: none; stroke: var(--river); stroke-width: 20; }
.p-bridge { fill: none; stroke: var(--brass); stroke-width: 30; stroke-dasharray: 90 60; }
.stage.bridged .p-bridge { stroke-dasharray: none; }
.p-route { fill: none; stroke: var(--brass); stroke-width: 14; stroke-dasharray: 8 46; stroke-linecap: round; opacity: .85; }
.p-point circle, .p-town circle { r: 28px; fill: var(--brass); }
.p-town circle { r: 40px; }
.p-bar { stroke: var(--ink); stroke-width: 44; }
.plab { font-family: var(--sans); font-size: 88px; letter-spacing: .05em; fill: var(--ink-soft); text-shadow: 0 0 6px var(--stage), 0 0 6px var(--stage); }
.plab.dim { fill: var(--brass); font-weight: 700; }
.turn { r: 46px; fill: var(--brass-hi); stroke: #3a2a08; stroke-width: 10; opacity: 0; }
.turn.sent { opacity: 1; }
.turn.ashore { fill: var(--river); }

/* dispatcher + curve */
.dispatch { position: absolute; left: .7rem; bottom: .7rem; right: .7rem; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .7rem .9rem; font-family: var(--sans); font-size: .95rem; }
.d-clock { font-weight: 700; }
.d-load { color: var(--ink-soft); font-size: .85rem; margin: .1rem 0 .2rem; }
.d-next { color: var(--ink-soft); font-size: .85rem; font-style: italic; margin: 0 0 .5rem; min-height: 1.2em; }
.d-btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.d-btns button { min-height: 44px; padding: .4rem .9rem; border: 1px solid var(--brass); border-radius: 6px; background: var(--paper); color: var(--ink); font-size: .95rem; cursor: pointer; }
.d-btns button.turn-btn { background: var(--brass); color: #fff; border-color: var(--brass); }
[data-theme="dark"] .d-btns button.turn-btn { color: #14100a; }
.d-btns button:disabled { opacity: .45; cursor: default; }
.d-count { margin-top: .4rem; color: var(--ink-soft); }
.d-miles { display: none; }
.curve { position: absolute; right: .7rem; top: .7rem; width: min(46%, 20rem); background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.cg { stroke: var(--line); stroke-width: 1; }
.cl { font-family: var(--sans); font-size: 13px; fill: var(--ink-soft); }
.cl.r { text-anchor: end; }
.cplan { stroke: var(--ink-soft); stroke-width: 2; stroke-dasharray: 6 4; }
.cmark { fill: var(--brass); opacity: .25; }
.cmark.hit { opacity: 1; }
.skip { position: absolute; left: .7rem; top: .7rem; font-family: var(--sans); font-size: .85rem; background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .7rem; }
@media (max-width: 60rem) {
  .dispatch { font-size: .8rem; padding: .4rem .5rem; }
  .d-load, .d-next { font-size: .78rem; }
  .d-btns button { min-height: 40px; padding: .3rem .6rem; font-size: .85rem; }
  .curve { width: 38%; }
}
@media (max-height: 740px) and (min-width: 60rem) {
  .curve { width: 15rem; }
  .dispatch { font-size: .85rem; padding: .5rem .7rem; }
  .d-btns button { min-height: 40px; }
}

/* lanes */
.lanes { width: 100%; height: auto; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.lg { stroke: var(--line); stroke-width: 1; }
.ll { font-family: var(--sans); font-size: 15px; fill: var(--ink-soft); }
.ll.r { text-anchor: end; }
.lane-line { stroke: var(--line); stroke-width: 1; }
.lane-dot { fill: var(--brass); }
.lane.hollow .lane-dot { fill: var(--card); stroke: var(--brass); stroke-width: 3; }
.lane-means { fill: var(--ottoman); }
.cursor { stroke: var(--ink); stroke-width: 2; }
.lanes-ui { display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.lanes-ui .play { min-height: 44px; padding: .4rem 1rem; border: 1px solid var(--brass); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; }
.lanes-read { flex: 1; min-width: 16rem; }
.lanes-tab { border-collapse: collapse; }
.lanes-tab th, .lanes-tab td { border: 1px solid var(--line); padding: .3rem .6rem; text-align: left; font-size: .95rem; }

/* ledger + sources */
.ledger { list-style: none; padding: 0; max-width: 46rem; }
.ledger li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.ledger .ln { font-family: var(--sans); font-weight: 700; color: var(--brass); margin-right: .8rem; }
.srcs { padding-left: 1.2rem; max-width: 56rem; }
.srcs li { margin-bottom: .7rem; }
.src-h { font-family: var(--sans); font-size: 1rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-top: 2rem; }
.share-block { padding-bottom: 4rem; }

/* images per theme */
.th-d { display: none; }
[data-theme="dark"] .th-d { display: block; }
[data-theme="dark"] .th-l { display: none; }

@media (prefers-reduced-motion: reduce) {
  .dot, .approx, .extra { transition: none; }
}
html:not(.js) .d-btns, html:not(.js) .lanes-ui .play { display: none; }
html:not(.js) .d-miles { display: block; list-style: none; padding: 0; margin: .5rem 0 0; columns: 2; font-size: .85rem; }
html:not(.js) .cmark { opacity: 1; }
html:not(.js) .dot, html:not(.js) .approx, html:not(.js) .extra { opacity: 1; }
footer.site { border-top: 1px solid var(--line); padding: 2rem 0 4rem; font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); }


/* share row (standards/v2/tools/share_row.py) */
.share-row{display:flex;flex-wrap:wrap;gap:.35rem;align-items:center}
.share-row .lab{font-size:.95rem;margin-inline-end:.3rem}
.share-row a,.share-row button{display:inline-grid;place-items:center;flex:none;width:2.5rem;height:2.5rem;padding:0;border-radius:50%;border:1px solid var(--sr-line,color-mix(in srgb,currentColor 28%,transparent));background:transparent;color:var(--sr-ink,inherit);text-decoration:none;cursor:pointer;font:inherit;transition:color .15s,border-color .15s}
.share-row a:hover,.share-row button:hover,.share-row a:focus-visible,.share-row button:focus-visible{color:var(--sr-acc,inherit);border-color:var(--sr-acc,currentColor)}
.share-row [hidden]{display:none}
@media (pointer:coarse){.share-row a,.share-row button{width:2.75rem;height:2.75rem}}
@media (max-width:30rem){.share-row .lab{flex-basis:100%;margin:0 0 .15rem}}
.share-status{font-size:.92rem;color:var(--sr-ok,inherit);min-height:1.2em;margin:.4rem 0 0}
.share-status:empty{display:none}
.share-field{display:block;width:100%;max-width:36rem;margin-top:.4rem;font:inherit;font-size:.9rem}
