/* Atlas of Ages — old-book palette, neo-classical dress */
:root {
  --paper: #f4ebd4;
  --paper-2: #ebdfc0;
  --paper-3: #dfcfa6;
  --ink: #2a2018;
  --ink-2: #5a4631;
  --ink-3: #8a7556;
  --rule: #b9a278;
  --leather: #45201a;
  --leather-2: #2f1410;
  --gilt: #d2ad5a;
  --gilt-dim: #a8843a;
  --history: #7b2d26;   /* oxblood */
  --myth: #2f4a6d;      /* lapis */
  --earth: #3d6b56;     /* verdigris */
  --sea: #d6dacb;
  --serif: "Cormorant Garamond", "EB Garamond", Garamond, "Palatino Linotype", Georgia, serif;
  --caps: Cinzel, "Trajan Pro", "Cormorant Garamond", Georgia, serif;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .26 0 0 0 0 .12 0 0 0 .11 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  height: 100dvh; overflow: hidden;
  background: var(--paper-2) var(--noise);
  color: var(--ink);
  font: 500 18px/1.45 var(--serif);
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--caps); font-weight: 600; margin: 0; letter-spacing: .06em; }

/* ---------- Masthead: a leather cover with gilt lettering ---------- */
.masthead {
  flex: none; display: flex; align-items: center; gap: 18px;
  padding: 9px 20px;
  background: linear-gradient(180deg, var(--leather), var(--leather-2)) , var(--leather);
  background-image: var(--noise), linear-gradient(180deg, var(--leather), var(--leather-2));
  color: var(--gilt);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { font-size: 30px; line-height: 1; color: var(--gilt); }
.brand h1 { font-size: 22px; letter-spacing: .2em; text-transform: uppercase; white-space: nowrap; }
.brand-sub { margin: 0; font-style: italic; font-size: 15px; color: #c9b182; white-space: nowrap; }
.filters { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.layers { display: flex; gap: 8px; }
.shelf-btn {
  padding: 7px 13px 6px; background: transparent; color: var(--gilt);
  border: 1px solid var(--gilt-dim); border-radius: 2px; box-shadow: inset 0 0 0 2px var(--leather), inset 0 0 0 3px rgba(210, 173, 90, .35);
  font: 600 12.5px/1 var(--caps); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
}
.shelf-btn::before { content: "❧ "; }
.shelf-btn:hover { color: #f0d48a; border-color: var(--gilt); }
.shelf-btn.on, .shelf-btn[aria-expanded="true"] { background: var(--gilt); color: var(--leather-2); box-shadow: none; }

/* The shelf: threads and themes, opened from the masthead */
.shelf {
  position: absolute; z-index: 3000; width: min(410px, calc(100vw - 16px)); max-height: calc(100dvh - 96px); overflow: auto;
  padding: 14px 16px 16px; color: var(--ink);
  background: var(--paper) var(--noise); border: 1px solid var(--ink-2);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--rule), 0 12px 30px rgba(30, 12, 0, .45);
}
.shelf h3 { font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 3px; }
.shelf h3 ~ h3 { margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--rule); }
.shelf-hint { margin: 0 0 9px; font-style: italic; font-size: 15px; line-height: 1.3; color: var(--ink-2); }
.shelf-thread {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; align-items: center; width: 100%; text-align: left;
  background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--leather); border-radius: 1px;
  padding: 6px 10px 7px; margin-bottom: 6px;
}
.shelf-thread b { font: 600 19px/1.2 var(--serif); }
.shelf-thread span { grid-column: 1; font-style: italic; font-size: 15px; line-height: 1.25; color: var(--ink-2); }
.shelf-thread i { grid-column: 2; grid-row: 1 / span 2; font: 600 10px/1 var(--caps); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.shelf-thread:hover { background: #fff8e6; }
.shelf-thread.on { background: var(--leather); border-color: var(--leather); color: var(--gilt); }
.shelf-thread.on span, .shelf-thread.on i { color: #c9b182; }
.shelf-themes { display: flex; flex-wrap: wrap; gap: 6px; }
.shelf > .link { display: block; margin-top: 13px; font-size: 16px; }

/* Tags: the threads and themes of an entry, and the theme list on the shelf */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.tag {
  background: none; border: 1px solid var(--rule); border-radius: 2px; padding: 4px 8px 3px;
  font: 600 10.5px/1.25 var(--caps); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2);
}
.tag i { font-style: normal; margin-left: 6px; opacity: .6; }
.tag:hover { background: var(--paper-3); color: var(--ink); }
.tag.on { background: var(--ink-2); border-color: var(--ink-2); color: var(--paper); }
.tag.thread { border-color: var(--gilt-dim); color: var(--leather); }
.tag.thread.on { background: var(--leather); border-color: var(--leather); color: var(--gilt); }
.layer-btn {
  --c: var(--history);
  display: flex; align-items: center; gap: 7px;
  padding: 5px 13px 5px 10px;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--gilt-dim); border-radius: 2px;
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3px var(--rule);
  font: 600 12.5px/1 var(--caps); letter-spacing: .12em; text-transform: uppercase;
  transition: opacity .15s, background .15s;
}
.layer-btn.myth { --c: var(--myth); }
.layer-btn.earth { --c: var(--earth); }
.layer-btn svg { width: 15px; height: 15px; fill: var(--c); }
.layer-btn[aria-pressed="false"] { background: transparent; color: #b59d6f; box-shadow: none; border-style: dashed; }
.layer-btn[aria-pressed="false"] svg { fill: none; stroke: #b59d6f; stroke-width: 1.4; }
.about-btn {
  background: none; border: 0; color: var(--gilt);
  font-style: italic; font-size: 17px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
  white-space: nowrap;
}
.about-btn:hover { color: #f0d48a; }

.meander {
  flex: none; height: 13px;
  background-color: var(--leather-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='13'%3E%3Cpath d='M0 11.5H18M15.5 11.5V2.5H3.5V8.5H11.5V5.5H7.5' fill='none' stroke='%23b8923f' stroke-width='1.1'/%3E%3C/svg%3E");
  border-bottom: 1px solid #1c0b08;
}

/* ---------- Stage ---------- */
.stage {
  flex: 1; min-height: 0; position: relative;
  display: grid; grid-template-columns: var(--split, 53%) 12px minmax(0, 1fr);
  padding: 12px;
}
.time-panel { grid-column: 1; grid-row: 1; }
.splitter { grid-column: 2; grid-row: 1; }
.map-panel { grid-column: 3; grid-row: 1; }
.panel {
  position: relative; min-width: 0; min-height: 0;
  background: var(--paper) var(--noise);
  border: 1px solid var(--ink-2);
  outline: 1px solid var(--rule); outline-offset: 3px;
  box-shadow: 0 2px 10px rgba(50, 30, 10, .22);
}
.splitter { cursor: col-resize; position: relative; }
.splitter::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 46px; transform: translate(-50%, -50%);
  border-left: 1px solid var(--ink-3); border-right: 1px solid var(--ink-3);
}
.icon-btn, .map-tools button, .check {
  background: var(--paper); border: 1px solid var(--ink-3); border-radius: 2px;
  font: 600 11.5px/1 var(--caps); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2);
  padding: 6px 9px; min-height: 28px;
}
.icon-btn { min-width: 30px; font-size: 15px; padding: 3px 6px; }
.icon-btn:hover, .map-tools button:hover { background: var(--paper-3); color: var(--ink); }

/* ---------- Map ---------- */
#map { position: absolute; inset: 0; background: var(--sea) var(--noise); font: inherit; }
.map-vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 650;
  box-shadow: inset 0 0 70px rgba(70, 45, 15, .28), inset 0 0 0 5px var(--paper), inset 0 0 0 6px var(--ink-2);
}
.compass { position: absolute; right: 18px; bottom: 22px; width: 92px; height: 92px; color: var(--ink-2); opacity: .75; z-index: 660; pointer-events: none; }
/* the row spans the map so that the filter pills can wrap onto a line of their own when it is narrow */
.map-tools { position: absolute; top: 16px; right: 16px; left: 16px; z-index: 900; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; align-items: center; pointer-events: none; }
.map-tools > * { pointer-events: auto; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--history); margin: 0; }
/* pills: what the map is currently limited to (a thread, a theme, a span of years) */
.map-tools .pill { background: var(--leather); color: var(--gilt); border: 1px solid var(--gilt-dim); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-tools button.pill:hover, .map-tools span.pill button:hover { background: #5b2a22; color: var(--gilt); }
.map-tools span.pill { display: inline-flex; border-radius: 2px; }
.map-tools span.pill button { background: none; border: 0; border-radius: 0; color: inherit; overflow: hidden; text-overflow: ellipsis; }
.map-tools span.pill button + button { flex: none; border-left: 1px solid var(--gilt-dim); }
.map-note { position: absolute; left: 16px; top: 16px; z-index: 900; max-width: 60%; background: var(--paper); border: 1px solid var(--ink-3); padding: 6px 10px; font-size: 15px; font-style: italic; }

.leaflet-container { font-family: var(--serif); }
.leaflet-bar { border: 1px solid var(--ink-3) !important; border-radius: 2px; box-shadow: none !important; margin: 0 0 18px 16px !important; }
.leaflet-bar a { background: var(--paper); color: var(--ink-2); border-bottom-color: var(--rule); font-family: var(--caps); }
.leaflet-bar a:hover { background: var(--paper-3); color: var(--ink); }
.leaflet-control-scale { margin: 0 0 22px 16px !important; }
.leaflet-control-scale-line { background: transparent; border-color: var(--ink-2); color: var(--ink-2); font: italic 13px var(--serif); text-shadow: none; }

.map-label { color: var(--ink-2); white-space: nowrap; text-align: center; pointer-events: none; text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper); }
.map-label span { display: inline-block; transform: translate(-50%, -50%); }
.map-label.sea span { font: italic 500 16px var(--serif); letter-spacing: .32em; color: #5f7074; text-shadow: none; opacity: .85; }
.map-label.land span { font: 600 10.5px var(--caps); letter-spacing: .16em; text-transform: uppercase; opacity: .62; }

.ev-marker { --c: var(--history); cursor: pointer; transition: transform .15s; }
.ev-marker.myth { --c: var(--myth); }
.ev-marker.earth { --c: var(--earth); }
.ev-marker svg { width: 100%; height: 100%; overflow: visible; fill: var(--c); stroke: var(--paper); stroke-width: 1.6; paint-order: stroke; filter: drop-shadow(0 1px 1px rgba(40, 20, 0, .45)); transition: transform .15s; transform-origin: center; }
.ev-marker:hover svg { transform: scale(1.35); }
.ev-marker.sel svg { transform: scale(1.75); stroke: var(--gilt); stroke-width: 2.2; }
.ev-marker.sel::after {
  content: ""; position: absolute; inset: -9px; border: 1.5px solid var(--c); border-radius: 50%;
  animation: ring 1.8s ease-out infinite;
}
@keyframes ring { from { transform: scale(.5); opacity: .9; } to { transform: scale(1.7); opacity: 0; } }
/* Crowded marks: a numbered roundel that opens into a disc with the marks set apart */
.cl-icon { overflow: visible; }
.cl { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.cl-core {
  position: absolute; left: -14px; top: -14px; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  border: 1px solid var(--paper); box-shadow: 0 1px 3px rgba(40, 20, 0, .55); cursor: pointer;
  display: grid; place-items: center; transition: transform .2s, opacity .15s;
}
.cl-core b { display: grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; background: var(--paper); color: var(--ink); font: 600 10.5px/1 var(--caps); }
.cl-core:hover { transform: scale(1.12); }
.cl.has-sel .cl-core { box-shadow: 0 0 0 2px var(--gilt), 0 0 0 3px var(--leather), 0 1px 4px rgba(40, 20, 0, .55); }
.cl.open .cl-core { transform: scale(.4); opacity: 0; pointer-events: none; }
.cl-disc {
  position: absolute; left: calc(var(--R) * -1); top: calc(var(--R) * -1); width: calc(var(--R) * 2); height: calc(var(--R) * 2);
  border-radius: 50%; background: rgba(244, 235, 212, .93); border: 1px solid var(--ink-2);
  box-shadow: inset 0 0 0 3px rgba(244, 235, 212, .93), inset 0 0 0 4px var(--rule), 0 5px 18px rgba(40, 20, 0, .38);
  transform: scale(.12); opacity: 0; pointer-events: none;
  transition: transform .22s cubic-bezier(.2, .8, .3, 1), opacity .14s;
}
.cl.open .cl-disc { transform: scale(1); opacity: 1; pointer-events: auto; }
.cl-legs { position: absolute; left: 0; top: 0; overflow: visible; opacity: 0; pointer-events: none; transition: opacity .18s; }
.cl-legs line { stroke: var(--ink-2); stroke-width: .9; stroke-dasharray: 2 2.5; }
.cl-legs circle { fill: var(--ink); }
.cl.open .cl-legs { opacity: .9; transition-delay: .1s; }
.cl-node {
  --c: var(--history); position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center; opacity: 0; pointer-events: none;
  transform: translate(var(--tx), var(--ty)) scale(.3);
  transition: transform .24s cubic-bezier(.2, .8, .3, 1), opacity .14s;
}
.cl-node.myth { --c: var(--myth); } .cl-node.earth { --c: var(--earth); }
.cl.open .cl-node { transform: translate(var(--x), var(--y)); opacity: 1; pointer-events: auto; }
.cl-node svg { width: 17px; height: 17px; overflow: visible; fill: var(--c); stroke: var(--paper); stroke-width: 1.6; paint-order: stroke; filter: drop-shadow(0 1px 1px rgba(40, 20, 0, .45)); transition: transform .12s; }
.cl-node:hover, .cl-node:focus-visible { z-index: 3; outline: none; }
.cl-node:hover svg, .cl-node:focus-visible svg { transform: scale(1.4); }
.cl-node.sel svg { stroke: var(--gilt); stroke-width: 2.2; transform: scale(1.5); }
.cl-tip {
  display: none; position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; text-align: left; pointer-events: none;
  background: var(--paper); border: 1px solid var(--ink-2); color: var(--ink); font: 500 15px/1.2 var(--serif); padding: 4px 9px; box-shadow: 0 2px 6px rgba(40, 20, 0, .3);
}
.cl-tip b { font-weight: 600; } .cl-tip i { display: block; font-size: 13px; color: var(--ink-2); }
.cl-node:hover .cl-tip, .cl-node:focus-visible .cl-tip { display: block; }

.ev-tip { background: var(--paper); border: 1px solid var(--ink-2); border-radius: 1px; color: var(--ink); font: 500 15px/1.2 var(--serif); padding: 4px 9px; box-shadow: 0 2px 6px rgba(40, 20, 0, .3); }
.ev-tip b { font-weight: 600; }
.ev-tip i { display: block; font-size: 13px; color: var(--ink-2); }
.ev-tip::before { display: none; }

/* ---------- Timeline ---------- */
.time-panel { display: flex; flex-direction: column; }
.timeline-block { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.tl-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px 7px; border-bottom: 1px solid var(--rule); }
.tl-title { min-width: 0; }
.tl-title h2 { font-size: 15px; letter-spacing: .26em; text-transform: uppercase; }
.tl-title p { margin: 1px 0 0; font-style: italic; font-size: 15.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-tools { display: flex; gap: 5px; }
.tl-wrap { flex: 1; min-height: 0; position: relative; }
.tl-scroll { position: absolute; inset: 0; overflow: auto; cursor: grab; scrollbar-color: var(--ink-3) var(--paper-2); outline-offset: -2px; }
.tl-scroll.dragging { cursor: grabbing; user-select: none; }
.tl-canvas { position: relative; min-height: 100%; }
.tl-grid { position: absolute; inset: 0; pointer-events: none; }
.tl-grid i { position: absolute; top: 0; bottom: 0; border-left: 1px solid rgba(138, 117, 86, .18); }
.tl-grid i.major { border-left-color: rgba(138, 117, 86, .42); }
.tl-top { position: sticky; top: 0; z-index: 6; background: var(--paper-2) var(--noise); border-bottom: 1px solid var(--ink-2); }
.tl-eras { position: relative; height: 22px; border-bottom: 1px solid var(--rule); }
.era { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--ink-2); font: 600 10px/22px var(--caps); letter-spacing: .2em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.era:nth-child(even) { background: rgba(138, 117, 86, .13); }
.era span { position: sticky; left: 10px; padding: 0 10px; display: inline-block; }
.tl-axis { position: relative; height: 24px; }
.tick { position: absolute; top: 0; height: 100%; border-left: 1px solid var(--ink-3); padding-left: 5px; font: italic 500 13.5px/26px var(--serif); color: var(--ink-2); white-space: nowrap; }
.tick.minor { height: 6px; border-left-color: var(--rule); }

.lane { --c: var(--history); position: relative; border-bottom: 1px solid var(--rule); background: linear-gradient(rgba(123, 45, 38, .045), rgba(123, 45, 38, .045)); }
.lane.myth { --c: var(--myth); background: linear-gradient(rgba(47, 74, 109, .05), rgba(47, 74, 109, .05)); }
.lane.earth { --c: var(--earth); background: linear-gradient(rgba(61, 107, 86, .055), rgba(61, 107, 86, .055)); }
.lane-label { position: sticky; left: 0; z-index: 3; display: flex; align-items: center; justify-content: center; width: 22px; height: 100%; overflow: hidden; color: var(--paper); background: var(--c); box-shadow: 1px 0 0 var(--paper), 3px 0 5px rgba(40, 20, 0, .18); }
.lane-label b { writing-mode: vertical-rl; transform: rotate(180deg); font: 600 9.5px/1 var(--caps); letter-spacing: .2em; text-transform: uppercase; white-space: nowrap; }
.chip {
  position: absolute; width: 172px; height: 26px; text-align: left;
  background: var(--paper); border: 1px solid var(--rule); border-left: 3px solid var(--c); border-radius: 1px;
  padding: 0 8px; box-shadow: 0 1px 0 rgba(60, 40, 10, .14); z-index: 2;
  transition: background .12s, transform .12s;
}
.chip::before { content: ""; position: absolute; left: -6px; top: -5px; width: 7px; height: 7px; background: var(--c); border: 1px solid var(--paper); transform: rotate(45deg); }
.chip:hover { background: #fff8e6; transform: translateY(-1px); z-index: 4; }
.chip-date { display: none; position: absolute; left: -3px; top: 100%; padding: 3px 8px 2px; background: var(--ink); color: var(--paper); font: 600 9.5px/1.3 var(--caps); letter-spacing: .08em; white-space: nowrap; pointer-events: none; }
.chip:hover .chip-date, .chip:focus-visible .chip-date, .chip.sel .chip-date { display: block; }
.chip-title { display: block; font-size: 15.5px; font-weight: 600; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.sel { background: var(--c); border-color: var(--c); color: var(--paper); z-index: 5; }
.chip.sel .chip-date { background: var(--c); color: #f3e3b5; }
.chip.contested .chip-title::after { content: " ⚖"; font-size: 12px; opacity: .8; }
.span { position: absolute; height: 3px; background: var(--c); opacity: .45; z-index: 1; }

.tl-edge {
  background: var(--leather); color: var(--gilt); border: 1px solid var(--gilt-dim);
  font: italic 500 14.5px/1 var(--serif); padding: 0 10px; min-height: 28px; border-radius: 2px; white-space: nowrap;
}
.tl-edge:hover { background: #5b2a22; }
.tl-edge:disabled { background: transparent; color: var(--ink-3); border-color: var(--rule); cursor: default; opacity: .7; }
#edgeR { margin-right: 8px; }
.tl-empty { position: absolute; inset: 60px 0 0; display: grid; place-content: center; text-align: center; font-style: italic; color: var(--ink-2); pointer-events: none; }
.tl-empty p { margin: 0; } .tl-empty .small { font-size: 15px; color: var(--ink-3); }
[hidden] { display: none !important; }

/* ---------- Year-range bar and brush ---------- */
.tl-range { flex: none; display: flex; align-items: baseline; gap: 8px; padding: 3px 14px 4px; border-bottom: 1px solid var(--rule); background: rgba(138, 117, 86, .08); font-style: italic; font-size: 15px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.tl-range.on { background: rgba(210, 173, 90, .3); color: var(--ink); }
.tl-range b { font: 600 12px/1 var(--caps); letter-spacing: .08em; font-style: normal; }
.tl-range #rangeText { overflow: hidden; text-overflow: ellipsis; }
.tl-range .link { flex: none; font-size: 15px; }
.tl-axis { cursor: col-resize; touch-action: none; }
.tl-brush { position: absolute; top: 0; bottom: 0; z-index: 1; pointer-events: none; background: rgba(210, 173, 90, .2); border-left: 1px solid var(--gilt-dim); border-right: 1px solid var(--gilt-dim); }
.tl-brush-axis { position: absolute; top: 0; bottom: 0; background: rgba(168, 132, 58, .4); pointer-events: none; }
.brush-h { position: absolute; top: 0; bottom: 0; width: 9px; margin-left: -4px; z-index: 2; background: var(--leather); border: 1px solid var(--gilt-dim); border-radius: 1px; cursor: ew-resize; }
.chip.dim, .span.dim { opacity: .3; }
.chip.dim:hover, .chip.dim.sel { opacity: 1; }

/* ---------- Reading pane: docks beneath the chronicle and never covers the map ---------- */
.time-panel { padding-bottom: var(--sheet-px, 0px); }
.map-panel { isolation: isolate; }
.sheet {
  grid-column: 1; grid-row: 1; align-self: end; z-index: 30;
  height: var(--sheet-h, 46%); min-height: 46px; max-height: 100%; min-width: 0;
  display: flex; flex-direction: column; color: var(--ink);
  background: var(--paper) var(--noise);
  border: 1px solid var(--ink-2); border-top: 3px double var(--ink-2);
  box-shadow: 0 -10px 24px rgba(40, 20, 0, .2);
  animation: sheet-in .24s cubic-bezier(.2, .75, .3, 1) both;
}
.sheet.peek { height: 46px !important; }
.sheet.peek .reader { display: none; }
.sheet.dragging { user-select: none; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-bar { flex: none; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 8px 0 12px; background: var(--paper-2) var(--noise); border-bottom: 1px solid var(--rule); cursor: ns-resize; touch-action: none; user-select: none; }
.sheet.peek .sheet-bar { border-bottom: 0; cursor: pointer; }
.sheet-grip { flex: none; width: 18px; height: 5px; border-top: 1px solid var(--ink-3); border-bottom: 1px solid var(--ink-3); }
.sheet-sum { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; white-space: nowrap; overflow: hidden; font: 600 11.5px/1 var(--caps); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.sheet-sum .badge { flex: none; }
.sheet-sum .sheet-date { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sheet:not(.peek) .sheet-sum .sheet-date { flex: 1; }
.sheet-sum .sheet-title { display: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 600 17.5px/1.3 var(--serif); letter-spacing: 0; text-transform: none; color: var(--ink); }
.sheet.peek .sheet-title { display: block; }
.sheet-tools { flex: none; display: flex; gap: 4px; }
.sheet-tools .icon-btn:disabled { opacity: .35; cursor: default; }
.reader { flex: 1; overflow: auto; min-height: 0; padding: 18px 30px 30px; scrollbar-color: var(--ink-3) var(--paper-2); }
.reader-inner { max-width: 660px; margin: 0 auto; }
.kicker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font: 600 11.5px/1 var(--caps); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.badge { --c: var(--history); background: var(--c); color: var(--paper); padding: 4px 9px 3px; }
.badge.myth { --c: var(--myth); } .badge.earth { --c: var(--earth); }
.badge.thread { --c: var(--leather); color: var(--gilt); }
.reader h2 { font-size: 27px; line-height: 1.15; letter-spacing: .03em; margin: 10px 0 4px; font-weight: 600; }
.place { margin: 0 0 12px; font-style: italic; color: var(--ink-2); }
.link { background: none; border: 0; padding: 0; color: var(--history); font-style: italic; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link:hover { color: var(--ink); }
.orn { text-align: center; color: var(--ink-3); letter-spacing: .6em; margin: 4px 0 8px; font-size: 14px; }
.entry-body p { margin: 0 0 .7em; font-size: 19.5px; line-height: 1.42; text-align: justify; hyphens: auto; }
.entry-body p + p { text-indent: 1.3em; }
.entry-body p:first-child::first-letter { float: left; font: 600 3.25em/.82 var(--caps); padding: 4px 7px 0 0; color: var(--history); }
.reader section { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--rule); }
.reader h3 { font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.reader ol, .reader ul { margin: 0; padding-left: 1.25em; }
.reader li { font-size: 16.5px; line-height: 1.32; margin-bottom: 4px; }
.reader ul { list-style: "❧  "; }
/* scoped to the reader: timeline chips also carry a .contested class */
.reader .contested { background: rgba(165, 124, 27, .1); border: 1px solid var(--gilt-dim); padding: 12px 14px; }
.reader .contested > p { margin: 0 0 8px; font-style: italic; font-size: 17px; }
.view { margin-top: 8px; }
.view h4 { margin: 0 0 3px; font: 600 16.5px/1.25 var(--serif); font-variant: small-caps; letter-spacing: .04em; }
/* what the followed thread says of an entry, and how that is read now */
.reader .thread-note { background: rgba(69, 32, 26, .055); border: 1px solid var(--rule); border-left: 3px solid var(--leather); padding: 11px 15px 6px; }
.thread-note h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: var(--leather); }
.thread-note h3 ~ h3 { margin-top: 12px; padding-top: 10px; border-top: 1px dotted var(--rule); }
.thread-note .cite { font: italic 500 15px/1.2 var(--serif); letter-spacing: 0; text-transform: none; color: var(--ink-2); text-align: right; }
.thread-note p { margin: 0 0 .6em; font-size: 18.5px; line-height: 1.4; text-align: justify; hyphens: auto; }
/* a thread's own page */
.thread-page .kicker { margin-top: 4px; }
.reader .thread-list { list-style: none; padding: 0; }
.reader .thread-list li { margin: 0; }
.thread-list button { --c: var(--history); display: flex; align-items: baseline; gap: 9px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px dotted var(--rule); padding: 5px 2px 4px; }
.thread-list button.myth { --c: var(--myth); } .thread-list button.earth { --c: var(--earth); }
.thread-list button:hover { background: rgba(210, 173, 90, .2); }
.thread-list svg { flex: none; width: 11px; height: 11px; fill: var(--c); position: relative; top: 1px; }
.thread-list .tl-t { flex: 1; min-width: 0; font-size: 17.5px; font-weight: 600; line-height: 1.25; }
.thread-list .tl-d { flex: none; font: 600 10px/1.3 var(--caps); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); text-align: right; max-width: 38%; }
.thread-list .tl-c { flex: none; width: 6.2em; font-style: italic; font-size: 14.5px; color: var(--ink-3); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-leave { margin: 18px 0 0; text-align: center; }
.entry-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 20px; padding-top: 10px; border-top: 3px double var(--ink-2); }
.entry-nav button { background: none; border: 0; padding: 0; text-align: left; font-style: italic; font-size: 16.5px; color: var(--ink-2); max-width: 48%; }
.entry-nav button:last-child { text-align: right; margin-left: auto; }
.entry-nav button:hover { color: var(--history); }
.entry-nav small { display: block; font: 600 10px/1.5 var(--caps); letter-spacing: .18em; text-transform: uppercase; font-style: normal; }

.intro h2 { text-align: center; letter-spacing: .2em; text-transform: uppercase; font-size: 21px; }
.intro p { font-size: 18.5px; text-align: justify; hyphens: auto; margin: 0 0 .7em; }
.intro .legend { display: grid; gap: 6px; margin: 12px 0; padding: 0; list-style: none; }
.intro .legend li { display: flex; gap: 10px; align-items: baseline; font-size: 17.5px; }
.intro .legend svg { flex: none; width: 15px; height: 15px; position: relative; top: 2px; }
.intro .legend .history svg { fill: var(--history); } .intro .legend .myth svg { fill: var(--myth); } .intro .legend .earth svg { fill: var(--earth); }
.intro .fine { font-size: 16px; font-style: italic; color: var(--ink-2); }

/* ---------- Modes ---------- */
.stage.mode-map, .stage.mode-time { grid-template-columns: minmax(0, 1fr); }
.mode-map .splitter, .mode-time .splitter, .mode-time .map-panel, .mode-map .time-panel { display: none; }
.mode-map .map-panel, .mode-time .time-panel { grid-column: 1; grid-row: 1; }
/* with the map full-screen the pane becomes a drawer down its right-hand side */
.mode-map .sheet { align-self: stretch; justify-self: end; width: min(450px, calc(100% - 28px)); height: auto !important; margin: 58px 14px 14px 0; border-top: 1px solid var(--ink-2); box-shadow: 0 6px 24px rgba(40, 20, 0, .35); }
.mode-map .sheet.peek { align-self: start; height: 46px !important; }
.mode-map .sheet-bar { cursor: pointer; }
.mode-map .sheet-grip { display: none; }

@media (max-width: 860px) {
  body { font-size: 17px; }
  .masthead { flex-wrap: wrap; gap: 8px 12px; padding: 8px 12px; }
  .brand-sub { display: none; }
  .brand h1 { font-size: 17px; letter-spacing: .14em; }
  .brand-mark { font-size: 22px; }
  .filters { margin-left: 0; order: 3; width: 100%; gap: 6px; }
  .layers { flex: 1; gap: 5px; min-width: 0; }
  .layer-btn { flex: 1; justify-content: center; gap: 4px; padding: 6px 2px; font-size: 10.5px; letter-spacing: .06em; }
  .shelf-btn { padding: 7px 8px 6px; font-size: 10.5px; letter-spacing: .06em; }
  .thread-list .tl-c { display: none; }
  .thread-note p { font-size: 17.5px; }
  .about-btn { margin-left: auto; font-size: 15px; }
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 12px 40%; padding: 8px; }
  .time-panel { grid-column: 1; grid-row: 1; }
  .splitter { grid-column: 1; grid-row: 2; }
  .map-panel { grid-column: 1; grid-row: 3; }
  .stage.mode-map, .stage.mode-time { grid-template-rows: minmax(0, 1fr); }
  .splitter { cursor: default; }
  .splitter::after { display: none; }
  .tl-head { padding: 6px 10px; gap: 8px; }
  .tl-title h2 { font-size: 13px; }
  .tl-title p { font-size: 14px; }
  #tlOut, #tlIn { display: none; }
  .tl-edge { padding: 0 7px; font-size: 13.5px; }
  #edgeR { margin-right: 2px; }
  .compass { width: 60px; height: 60px; right: 12px; bottom: 14px; }
  .check span { display: none; }
  .reader { padding: 14px 16px 24px; }
  .reader h2 { font-size: 23px; }
  .sheet { grid-row: 1 / -1; height: var(--sheet-h, 62%); }
  .time-panel { padding-bottom: 0; }
  .mode-map .sheet { margin: 52px 8px 8px 0; width: calc(100% - 16px); }
  .tl-range { padding: 3px 10px 4px; font-size: 14px; }
  .tl-range .hint-long { display: none; }
  .sheet.peek .sheet-date { display: none; }
  .sheet-bar { gap: 8px; padding: 0 6px 0 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .ev-marker.sel::after { animation: none; }
  .sheet { animation: none; }
  .cl-disc, .cl-node, .cl-legs, .cl-core { transition: none; }
  * { scroll-behavior: auto !important; transition: none !important; }
}
