:root {
  color-scheme: dark;
  --ink: #070c12;
  --space: #050a10;
  --panel: #0c131b;
  --panel-2: #111a24;
  --panel-3: #16212d;
  --line: rgba(239, 230, 210, 0.11);
  --line-strong: rgba(239, 230, 210, 0.22);
  --text: #efe6d2;
  --text-2: #d6ccb6;
  --muted: #a89f8c;
  --faint: #756e60;
  --gold: #e2b04a;
  --gold-soft: rgba(226, 176, 74, 0.14);
  --display: 'Marcellus', 'Iowan Old Style', 'Palatino Linotype', Palatino, serif;
  --serif: 'Alegreya', 'Iowan Old Style', Georgia, serif;
  --sans: 'Alegreya Sans', 'Gill Sans', 'Segoe UI', system-ui, sans-serif;
  --panel-w: 430px;
  --tl-h: clamp(270px, 34vh, 340px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--text); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--text); text-decoration-color: rgba(226, 176, 74, 0.5); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--gold); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-w);
  grid-template-rows: auto minmax(0, 1fr) var(--tl-h);
  height: 100vh;
  height: 100dvh;
}

/* header */
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--space); min-width: 0; }
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; min-width: 0; }
.brand b { font-family: var(--display); font-weight: 400; font-size: 22px; letter-spacing: 0.08em; white-space: nowrap; }
.brand span { color: var(--muted); font-size: 14px; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: 4px; }
.nav a { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: 14.5px; color: var(--muted); border: 1px solid transparent; white-space: nowrap; }
.nav a[aria-current="page"] { color: var(--text); border-color: var(--line-strong); }
.nav a:hover { color: var(--text); }
.search { position: relative; margin-left: auto; width: min(330px, 34vw); }
.search input { width: 100%; height: 36px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); padding: 0 14px 0 36px; font: 15px var(--sans); }
.search input::placeholder { color: var(--faint); }
.search svg { position: absolute; left: 12px; top: 10px; width: 16px; height: 16px; fill: var(--muted); pointer-events: none; }
.results { position: absolute; top: 42px; left: 0; right: 0; z-index: 30; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px; list-style: none; margin: 0; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5); max-height: 60vh; overflow: auto; }
.results li button { all: unset; box-sizing: border-box; display: flex; gap: 10px; align-items: center; width: 100%; padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.results li button[aria-selected="true"], .results li button:hover { background: var(--panel-3); }
.results .kind { font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); min-width: 64px; }
.results .nm { font-size: 15px; }
.results .yr { margin-left: auto; color: var(--faint); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* map */
.mapwrap { grid-column: 1; grid-row: 2; position: relative; min-height: 0; overflow: hidden; background: var(--space); }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
#map.pointer { cursor: pointer; }
.when { position: absolute; left: 18px; top: 14px; pointer-events: none; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 0.9); max-width: calc(100% - 90px); }
.when .eyebrow { font-size: 12.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.when .year { font-family: var(--display); font-size: 58px; line-height: 1; letter-spacing: 0.02em; font-variant-numeric: lining-nums; }
.when .year small { font-size: 24px; color: var(--gold); margin-left: 8px; letter-spacing: 0.1em; }
.when .ch { font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--text-2); margin-top: 2px; }
.mapbtns { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.mapbtns button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line-strong); background: rgba(12, 19, 27, 0.86); cursor: pointer; display: grid; place-items: center; }
.mapbtns button:hover { border-color: var(--gold); }
.mapbtns svg { width: 16px; height: 16px; fill: var(--text); }
.tip { position: fixed; z-index: 40; pointer-events: none; background: rgba(9, 14, 20, 0.95); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; font-size: 14px; max-width: 280px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.tip b { display: block; font-size: 15px; }
.tip span { color: var(--muted); font-size: 13px; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; font-size: 14px; }

/* timeline */
.tlwrap { grid-column: 1; grid-row: 3; position: relative; border-top: 1px solid var(--line); background: #060b11; display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.tlbar { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tlbar button, .tlbar select { height: 30px; min-width: 30px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); font: 500 13.5px var(--sans); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.tlbar button:hover, .tlbar select:hover { border-color: var(--gold); }
.tlbar button[aria-pressed="true"] { background: var(--gold-soft); border-color: rgba(226, 176, 74, 0.6); }
.tlbar svg { width: 14px; height: 14px; fill: currentColor; }
.tlbar .hint { color: var(--faint); font-size: 13px; margin-left: auto; }
#tl { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

/* panel */
.panel { grid-column: 2; grid-row: 2 / 4; border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.pn { padding: 18px 20px 40px; }
.crumbs { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; min-height: 30px; }
.back { all: unset; cursor: pointer; font-size: 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; padding: 4px 8px 4px 4px; border-radius: 6px; }
.back:hover { color: var(--text); background: var(--panel-2); }
.back svg { width: 14px; height: 14px; fill: currentColor; }
.eyebrow2 { font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin: 0 0 4px; }
.pn h2 { font-family: var(--display); font-weight: 400; font-size: 29px; line-height: 1.15; margin: 0 0 4px; text-wrap: balance; }
.pn .range { color: var(--muted); font-size: 14.5px; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.lede { font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--text-2); margin: 0 0 16px; }
.pn h3 { font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 22px 0 8px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 14px; margin: 0 0 14px; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.keys { margin: 0 0 12px; padding-left: 18px; }
.keys li { margin: 3px 0; }
/* images: always shown whole, never cropped */
.fig { margin: 4px 0 14px; }
.shot { all: unset; box-sizing: border-box; display: block; width: 100%; position: relative; border-radius: 8px; background: var(--panel-2); cursor: zoom-in; overflow: hidden; }
.shot img { display: block; margin: 0 auto; width: min(100%, calc(var(--hmax, 340px) * var(--r))); height: auto; aspect-ratio: var(--r); }
.shot:focus-visible, .gi:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.shot::after, .gi::after { content: ''; position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(7, 12, 18, 0.72) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23efe6d2' d='M4 4h6v2H7.4l4.3 4.3-1.4 1.4L6 7.4V10H4zm16 0v6h-2V7.4l-4.3 4.3-1.4-1.4L16.6 6H14V4zM4 20v-6h2v2.6l4.3-4.3 1.4 1.4L7.4 18H10v2zm16 0h-6v-2h2.6l-4.3-4.3 1.4-1.4 4.3 4.3V14h2z'/%3E%3C/svg%3E") center / 15px no-repeat; opacity: 0; transition: opacity .15s; pointer-events: none; }
.shot:hover::after, .shot:focus-visible::after { opacity: 1; }
.fig figcaption { font-size: 13.5px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.fig figcaption .cred, .cred { display: block; font-size: 12px; color: var(--faint); margin-top: 2px; }
.cred a { color: var(--faint); }
.gal { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 16px; }
.gal::after { content: ''; flex-grow: 1000000; }
.fig + .gal { margin-top: -6px; }
.ch-lead { --hmax: 260px; }
.gi { all: unset; box-sizing: border-box; position: relative; display: block; min-width: 0; border-radius: 6px; overflow: hidden; background: var(--panel-2); cursor: zoom-in; }
.gi img { display: block; width: 100%; height: 100%; object-fit: contain; transition: transform .25s, opacity .2s; }
.gi:hover img { transform: scale(1.03); }
.gi::after { width: 22px; height: 22px; right: 5px; bottom: 5px; background-size: 12px; }
.gi:hover::after, .gi:focus-visible::after { opacity: 1; }
.gal-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gal-h span { font-size: 12.5px; color: var(--faint); letter-spacing: 0; text-transform: none; font-weight: 400; }
body:has(dialog.lb[open]) { overflow: hidden; }

/* lightbox */
.lb { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(4, 7, 11, 0.96); color: var(--text); overflow: hidden; }
.lb::backdrop { background: rgba(0, 0, 0, 0.55); }
.lb[open] { display: block; }
.lb-fig { margin: 0; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.lb-stage { min-height: 0; display: flex; align-items: center; justify-content: center; padding: 58px 72px 10px; touch-action: pan-y pinch-zoom; }
.lb-stage img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 4px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); background: var(--panel-2); }
.lb-cap { max-width: 860px; margin: 0 auto; padding: 8px 24px calc(18px + env(safe-area-inset-bottom, 0px)); text-align: center; }
.lb-cap p { margin: 0; }
#lb-text { font-family: var(--serif); font-size: 18px; line-height: 1.45; color: var(--text); text-wrap: pretty; }
.lb-cap .cred { font-size: 13px; margin-top: 6px; }
.lb-btn { all: unset; box-sizing: border-box; position: absolute; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; background: rgba(17, 26, 36, 0.85); border: 1px solid var(--line-strong); }
.lb-btn:hover { border-color: var(--gold); }
.lb-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.lb-btn svg { width: 22px; height: 22px; fill: var(--text); }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-close { right: 14px; top: 10px; width: 40px; height: 40px; }
.lb-count { position: absolute; left: 18px; top: 20px; font-size: 13px; letter-spacing: 0.12em; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
  .lb-stage { padding: 56px 6px 6px; }
  .lb-prev, .lb-next { top: auto; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: none; width: 40px; height: 40px; }
  .lb-cap { padding: 6px 60px calc(16px + env(safe-area-inset-bottom, 0px)); }
  #lb-text { font-size: 16px; }
}
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.chip { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 13.5px; line-height: 1.2; }
.chip:hover { border-color: var(--gold); }
.chip:focus-visible { outline: 2px solid var(--gold); }
.chip i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px; border: 1px solid var(--line-strong); font-size: 14px; }
.btn:hover { border-color: var(--gold); }
.btn:focus-visible { outline: 2px solid var(--gold); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { border-color: var(--line-strong); }
.btn svg { width: 14px; height: 14px; fill: currentColor; }
.btn.primary { background: var(--gold-soft); border-color: rgba(226, 176, 74, 0.55); }

.evlist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.evlist > li { border-bottom: 1px solid var(--line); }
.evrow { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px 2px; align-items: start; }
.evrow:hover .t { color: #fff; }
.evrow:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 6px; }
.evrow .th { width: 64px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--panel-2); display: block; }
.evrow .meta { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.evrow .meta i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.evrow .t { font-family: var(--serif); font-weight: 700; font-size: 17px; line-height: 1.25; }
.evrow .x { color: var(--muted); font-size: 14.5px; line-height: 1.4; }
.evlist li.future .evrow { opacity: 0.55; }
.evlist li.now .evrow .t::after { content: ' ●'; color: var(--gold); font-size: 11px; vertical-align: 2px; }
.evmore { padding: 0 2px 14px 0; }
.evmore p { margin: 0 0 8px; color: var(--text-2); font-size: 15.5px; }
.evlist li.open .evrow .x { display: none; }

details.sec { border-top: 1px solid var(--line); }
details.sec > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 11px 0; font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: '+'; font-size: 18px; letter-spacing: 0; color: var(--faint); }
details.sec[open] > summary::after { content: '–'; }
details.sec > div { padding: 0 0 12px; }
.era { border-top: 1px solid var(--line); padding: 10px 0; }
.era b { display: block; font-size: 12.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.era.cur b { color: var(--gold); }
.era p { margin: 0; font-size: 15px; color: var(--text-2); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; font-size: 13.5px; color: var(--text-2); }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.legend svg { width: 11px; height: 11px; fill: #0b1016; stroke: #0b1016; }
.note { font-size: 13.5px; color: var(--faint); }
.pn hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

@media (max-width: 1180px) { :root { --panel-w: 380px; } .brand span { display: none; } }
@media (max-width: 900px) {
  :root { --tl-h: 300px; }
  .app { display: block; height: auto; }
  .top { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; }
  .search { order: 3; width: 100%; margin-left: 0; }
  .mapwrap { height: 56vh; min-height: 320px; }
  .tlwrap { height: var(--tl-h); }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .pn { padding: 18px 16px 48px; }
  .when .year { font-size: 42px; }
  .when .year small { font-size: 18px; }
  .when .ch { font-size: 17px; }
  .tlbar .hint { display: none; }
}
@media (max-width: 420px) { .brand b { font-size: clamp(15px, 5.2vw, 22px); letter-spacing: 0.05em; } }
@media (pointer: coarse) { #map, #tl { touch-action: pan-y; } }
.jump { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 35; display: none; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; border: 1px solid rgba(226, 176, 74, 0.6); background: rgba(12, 19, 27, 0.95); color: var(--text); font: 600 15px var(--sans); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); cursor: pointer; }
@media (max-width: 900px) { .jump.show { display: inline-flex; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.pn p.body { font-size: 15.5px; line-height: 1.6; color: var(--text-2); margin: 0 0 12px; }
