:root {
  color-scheme: dark;
  --ink: #11130f;
  --paper: #e9e4d8;
  --muted: #9e9d93;
  --line: rgba(233, 228, 216, .22);
  --oxide: #d95d39;
  --sea: #365963;
  --panel: rgba(17, 19, 15, .86);
}

* { box-sizing: border-box; }
html, body, .atlas-shell, #map { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--ink); color: var(--paper); font-family: "Libre Franklin", sans-serif; }
button, input { font: inherit; }
button { color: inherit; }

.atlas-shell { position: relative; isolation: isolate; }
#map { position: absolute; inset: 0; filter: saturate(.38) contrast(1.12) brightness(.72); }
.grain { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .15; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E"); mix-blend-mode: overlay; }
.timeline-playing .grain { opacity: 0; }
.timeline-playing .population-meter, .timeline-playing .recent-passage-item, .timeline-playing .timeline-panel { backdrop-filter: none; }
.masthead { position: absolute; z-index: 4; top: 0; left: 0; right: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 26px; padding: 24px 30px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(17,19,15,.88), rgba(17,19,15,0)); }
.wordmark { color: var(--paper); text-decoration: none; font: 600 30px/1 "Fraunces", Georgia, serif; letter-spacing: -.08em; }
.wordmark span { color: var(--oxide); font-style: italic; }
.masthead-tagline { margin: 0; color: var(--muted); font: 11px/1.3 "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }
.source-button { cursor: pointer; border: 0; background: transparent; padding: 6px 0; font: 500 11px "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }
.source-button span, .record-source span { color: var(--oxide); }

.map-status { position: absolute; z-index: 4; top: 92px; left: 30px; display: flex; align-items: center; gap: 8px; color: var(--muted); font: 10px "DM Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.status-pip { width: 7px; height: 7px; background: var(--oxide); border-radius: 50%; box-shadow: 0 0 0 4px rgba(217,93,57,.17); }
.population-meter { position: absolute; z-index: 4; top: 30px; right: 30px; min-width: 164px; padding: 9px 11px 8px; border-left: 2px solid #78a7b7; background: var(--panel); backdrop-filter: blur(12px); }.population-meter p { margin: 0 0 3px; color: var(--muted); font: 8px/1 "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }.population-meter output { display: inline; font: 500 15px/1 "Fraunces", Georgia, serif; letter-spacing: -.035em; }.population-meter a { margin-left: 5px; color: var(--oxide); font: 8px "DM Mono", monospace; letter-spacing: .04em; text-decoration: none; text-transform: uppercase; }
.recent-passage-log { position: absolute; z-index: 4; top: 30px; left: 30px; display: grid; gap: 6px; width: min(380px, calc(100vw - 60px)); pointer-events: none; }
.recent-passage-item { width: max-content; max-width: 100%; overflow: hidden; display: flex; align-items: baseline; gap: 8px; padding: 5px 9px 6px 10px; cursor: pointer; pointer-events: auto; border-left: 2px solid var(--oxide); background: rgba(17, 19, 15, .72); color: var(--paper); box-shadow: 0 7px 22px rgba(0,0,0,.22); backdrop-filter: blur(10px); font: 500 12px/1.2 "Libre Franklin", sans-serif; white-space: nowrap; animation: recent-passage-in .26s ease-out both; }
.recent-passage-year { flex: 0 0 auto; color: rgba(233, 228, 216, .46); font: 9px/1 "DM Mono", monospace; letter-spacing: .04em; }
.recent-passage-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.recent-passage-item:hover, .recent-passage-item:focus-visible { background: rgba(17, 19, 15, .9); color: #fff8ea; outline: 1px solid rgba(233, 228, 216, .42); outline-offset: 2px; }
.recent-passage-item.leaving { pointer-events: none; animation: recent-passage-out .36s ease-in both; }
.legend-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 12px 14px 11px; border-right: 1px solid var(--line); background: rgba(10, 12, 9, .22); }
.eyebrow { margin: 0 0 11px; color: var(--muted); font: 10px/1 "DM Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.layer-control { display: grid; grid-template-columns: 15px 12px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; cursor: pointer; font-size: 12px; }
.layer-control input { appearance: none; width: 12px; height: 12px; border: 1px solid var(--muted); margin: 0; }
.layer-control input:checked { border-color: var(--paper); background: var(--paper); box-shadow: inset 0 0 0 3px var(--ink); }
.layer-swatch { width: 11px; height: 11px; display: block; }
.layer-swatch.borders { border: 1px solid var(--paper); }
.layer-swatch.war { background: var(--oxide); transform: rotate(45deg); }
.event-swatch { transform: rotate(45deg); }
.language-toggle { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 6px; margin: 5px 0 9px; padding: 8px 0 10px; border-top: 1px solid rgba(233, 228, 216, .14); border-bottom: 1px solid rgba(233, 228, 216, .14); }
.language-toggle span { color: var(--muted); font: 9px "DM Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.language-toggle button { cursor: pointer; border: 1px solid rgba(233, 228, 216, .24); background: transparent; color: var(--muted); padding: 4px 7px; font: 9px "DM Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.language-toggle button.active { border-color: var(--paper); background: var(--paper); color: var(--ink); }
.language-toggle button:focus-visible { outline: 1px solid var(--oxide); outline-offset: 2px; }
#event-layers { min-height: 0; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding-right: 3px; scrollbar-color: rgba(233,228,216,.36) transparent; scrollbar-width: thin; }
#event-layers::-webkit-scrollbar { width: 7px; }
#event-layers::-webkit-scrollbar-thumb { background: rgba(233,228,216,.28); }
.add-event-button { flex: 0 0 auto; width: 100%; margin-top: 8px; padding: 8px 0; cursor: pointer; border: 1px dashed rgba(233, 228, 216, .38); background: transparent; color: var(--paper); font: 10px "DM Mono", monospace; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.add-event-button span { display: inline-grid; place-items: center; width: 22px; color: var(--oxide); font-size: 16px; vertical-align: middle; }
.add-event-button:hover, .add-event-button:focus-visible { border-color: var(--oxide); outline: none; }
.add-event-button:disabled { cursor: wait; opacity: .48; }
.layer-control small { color: var(--muted); font: 9px "DM Mono", monospace; }
.legend-note { margin: 9px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; }

.timeline-panel { position: absolute; z-index: 4; left: 30px; right: 30px; bottom: 32px; height: 25dvh; max-height: 25dvh; display: grid; grid-template-columns: 218px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(12px); }.timeline-workbench { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 10px 14px 9px; }
.timeline-header { display: flex; align-items: end; justify-content: space-between; }
.timeline-header .eyebrow { margin-bottom: 3px; }
#year-output { display: block; font: 500 27px/.9 "Fraunces", Georgia, serif; letter-spacing: -.055em; }
.year-jump-button { display: block; }.year-jump-button button { display: block; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; cursor: text; }
.year-jump-button:hover #year-output, .year-jump-button button:focus-visible #year-output { color: var(--oxide); }.year-jump-button button:focus-visible { outline: 1px solid var(--oxide); outline-offset: 4px; }
#year-jump-input { width: 142px; border: 0; border-bottom: 1px solid var(--oxide); border-radius: 0; background: transparent; color: var(--paper); padding: 0 0 2px; font: 500 25px/.95 "Fraunces", Georgia, serif; letter-spacing: -.055em; outline: none; }
.timeline-actions { display: flex; gap: 4px; }.timeline-action { cursor: pointer; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); background: transparent; font: 14px/1 "DM Mono", monospace; }.play-button { padding-left: 2px; font-size: 10px; }.timeline-action:hover, .timeline-action:focus-visible { border-color: var(--oxide); color: var(--oxide); outline: none; }
.track-timeline-shell { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; margin-top: 7px; padding: 6px 8px 5px; border: 1px solid rgba(233, 228, 216, .14); background: rgba(233, 228, 216, .035); }.track-timeline-meta { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--muted); font: 8px/1 "DM Mono", monospace; letter-spacing: .045em; text-transform: uppercase; }.track-timeline-meta output { color: var(--paper); }.track-timeline-meta span { flex: 1 1 auto; }.track-zoom-buttons { flex: 0 0 auto; display: flex; gap: 4px; }.track-zoom-buttons button { cursor: pointer; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 12px/1 "DM Mono", monospace; }.track-zoom-buttons button:hover, .track-zoom-buttons button:focus-visible { border-color: var(--oxide); color: var(--oxide); outline: none; }.track-timeline-scroll { min-height: 0; flex: 1 1 auto; display: flex; align-items: flex-start; margin-top: 5px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: rgba(233,228,216,.36) transparent; scrollbar-width: thin; }.track-timeline-scroll::-webkit-scrollbar { width: 7px; }.track-timeline-scroll::-webkit-scrollbar-thumb { background: rgba(233,228,216,.28); }.track-timeline-shell svg { display: block; flex: 1 1 auto; min-width: 0; width: 100%; min-height: 108px; touch-action: none; cursor: crosshair; }
.track-timeline-labels { flex: 0 0 auto; width: 96px; border-right: 1px solid rgba(233, 228, 216, .1); }.track-label-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 8px 0 2px; overflow: hidden; }.track-label-row .track-label { overflow: hidden; color: #9e9d93; font: 11px "DM Mono", monospace; letter-spacing: .02em; white-space: nowrap; text-overflow: ellipsis; }.track-label-row .track-count { flex: 0 0 auto; color: #686960; font: 10px "DM Mono", monospace; }
.legend-toggle { display: none; position: absolute; z-index: 6; top: 18px; left: 18px; cursor: pointer; width: 36px; height: 36px; border: 1px solid var(--line); background: var(--panel); backdrop-filter: blur(12px); color: var(--paper); font-size: 16px; }.legend-toggle:hover, .legend-toggle:focus-visible { border-color: var(--oxide); outline: none; }
.track-lane { fill: rgba(233, 228, 216, .035); stroke: rgba(233, 228, 216, .1); stroke-width: 1; vector-effect: non-scaling-stroke; }.track-event { opacity: .86; cursor: pointer; }.track-event:hover { opacity: 1; filter: brightness(1.35); }.track-event.inactive { opacity: .14; }.track-event.selected { opacity: 1; stroke: #f5e7d4; stroke-width: 2; vector-effect: non-scaling-stroke; filter: brightness(1.2); }.track-playhead { stroke: #f5e7d4; stroke-width: 1.2; vector-effect: non-scaling-stroke; }.track-playhead-cap { fill: #f5e7d4; }.track-tick { stroke: rgba(233, 228, 216, .14); stroke-width: 1; vector-effect: non-scaling-stroke; }
.speed-control { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }.speed-control > span { margin-right: 4px; color: var(--muted); font: 9px "DM Mono", monospace; letter-spacing: .06em; }.speed-button { min-width: 30px; cursor: pointer; border: 1px solid var(--line); background: transparent; padding: 3px 5px; color: var(--muted); font: 9px "DM Mono", monospace; }.speed-button:hover, .speed-button:focus-visible { border-color: var(--paper); color: var(--paper); outline: none; }.speed-button.active { border-color: var(--oxide); color: var(--paper); background: rgba(217,93,57,.18); }
.timeline-note { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.35; }

.record-card, .data-desk { position: absolute; z-index: 5; top: 142px; right: 30px; width: min(370px, calc(100vw - 60px)); padding: 24px; background: #e9e4d8; color: var(--ink); box-shadow: 12px 12px 0 rgba(0,0,0,.22); animation: card-in .32s both ease-out; }
.record-card .eyebrow, .data-desk .eyebrow { color: #706e65; }
.record-card h1, .data-desk h2 { margin: 0 0 8px; font: 600 30px/.95 "Fraunces", Georgia, serif; letter-spacing: -.06em; }
.record-card p, .data-desk p { font-size: 12px; line-height: 1.55; }
.record-dates { margin: 0 0 17px !important; color: #706e65; font: 10px "DM Mono", monospace !important; text-transform: uppercase; }
.close-card, .close-desk { position: absolute; top: 11px; right: 14px; cursor: pointer; border: 0; background: transparent; color: #706e65; font-size: 23px; }
.record-facts { display: grid; grid-template-columns: 1fr 1.2fr; gap: 5px 12px; margin: 18px 0; padding: 13px 0; border-top: 1px solid #c8c3b9; border-bottom: 1px solid #c8c3b9; font-size: 11px; }
.record-facts dt { color: #706e65; }.record-facts dd { margin: 0; text-align: right; }
.record-source { color: var(--ink); font: 10px "DM Mono", monospace; text-decoration: none; text-transform: uppercase; }
.catalog-link { display: inline-block; margin-top: 2px; color: var(--ink); font: 10px "DM Mono", monospace; text-decoration: none; text-transform: uppercase; }.catalog-link span { color: var(--oxide); }
.data-desk { width: min(410px, calc(100vw - 60px)); }.data-desk h2 { font-size: 28px; }.desk-summary { border-top: 1px solid #c8c3b9; padding-top: 14px; color: #706e65; font: 10px/1.5 "DM Mono", monospace !important; }
.event-dialog { width: min(480px, calc(100vw - 36px)); max-height: min(760px, calc(100vh - 36px)); padding: 25px; overflow: auto; border: 0; background: #e9e4d8; color: var(--ink); box-shadow: 14px 14px 0 rgba(0,0,0,.26); }
.event-dialog::backdrop { background: rgba(7, 9, 6, .72); backdrop-filter: blur(3px); }
.event-dialog h2 { margin: 0 0 7px; font: 600 30px/.95 "Fraunces", Georgia, serif; letter-spacing: -.06em; }
.dialog-intro { margin: 0 0 18px; color: #706e65; font-size: 12px; line-height: 1.5; }
.event-dialog form > label, .form-split > label { display: grid; gap: 5px; margin-bottom: 12px; color: #706e65; font: 10px "DM Mono", monospace; letter-spacing: .04em; text-transform: uppercase; }
.event-dialog input, .event-dialog select, .event-dialog textarea { width: 100%; border: 1px solid #c8c3b9; border-radius: 0; background: rgba(255,255,255,.28); padding: 8px 9px; color: var(--ink); font: 12px/1.35 "Libre Franklin", sans-serif; }
.event-dialog textarea { resize: vertical; min-height: 76px; }.event-dialog input:focus, .event-dialog select:focus, .event-dialog textarea:focus { border-color: var(--oxide); outline: 1px solid var(--oxide); }
.form-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.form-split > label { min-width: 0; }
.form-error { min-height: 16px; margin: 0 0 10px; color: #a3311b; font-size: 11px; line-height: 1.4; }.submit-event { width: 100%; cursor: pointer; border: 0; padding: 11px 12px; background: var(--ink); color: var(--paper); font: 500 10px "DM Mono", monospace; letter-spacing: .06em; text-align: left; text-transform: uppercase; }.submit-event span { float: right; color: var(--oxide); font-size: 16px; line-height: .6; }.submit-event:hover, .submit-event:focus-visible { background: var(--oxide); outline: none; }.submit-event:hover span, .submit-event:focus-visible span { color: var(--paper); }
.attribution { position: absolute; z-index: 4; right: 30px; bottom: 15px; color: rgba(233,228,216,.65); font: 9px "DM Mono", monospace; }.attribution a { color: inherit; }
.maplibregl-ctrl-bottom-right { right: 22px !important; bottom: 31px !important; }.maplibregl-ctrl-group { background: var(--panel) !important; border: 1px solid var(--line) !important; border-radius: 0 !important; }.maplibregl-ctrl-group button { filter: invert(1) grayscale(1); }
.map-event-tooltip .maplibregl-popup-content { min-width: 150px; padding: 9px 10px 8px; border: 1px solid rgba(233,228,216,.35); border-radius: 0; background: #11130f; color: var(--paper); box-shadow: 5px 5px 0 rgba(0,0,0,.24); }.map-event-tooltip .maplibregl-popup-tip { border-top-color: #11130f; border-bottom-color: #11130f; }.map-event-tooltip strong, .map-event-tooltip span { display: block; }.map-event-tooltip strong { font: 600 13px/1.15 "Fraunces", Georgia, serif; letter-spacing: -.025em; }.map-event-tooltip span { margin-top: 4px; color: var(--muted); font: 8px/1.25 "DM Mono", monospace; letter-spacing: .035em; text-transform: uppercase; }
.transient-map-event-tooltip { pointer-events: none; }.transient-map-event-tooltip .maplibregl-popup-content { min-width: 0; max-width: 150px; padding: 5px 7px 5px; box-shadow: 3px 3px 0 rgba(0,0,0,.22); }.transient-map-event-tooltip strong { max-width: 132px; overflow: hidden; font-size: 10px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }.transient-map-event-tooltip span { margin-top: 2px; font-size: 7px; line-height: 1.1; }
@keyframes card-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes recent-passage-in { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes recent-passage-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-7px); } }
@media (max-width: 720px) { .masthead { grid-template-columns: auto auto; padding: 18px; }.masthead-tagline { display: none; }.source-button { justify-self: end; }.map-status { top: 74px; left: 18px; }.population-meter { top: 104px; right: 18px; }.recent-passage-log { top: 18px; left: 18px; width: min(330px, calc(100vw - 36px)); }.recent-passage-item { font-size: 11px; }.timeline-panel { left: 18px; right: 18px; bottom: 19px; grid-template-columns: minmax(126px, .78fr) minmax(0, 1.22fr); }.legend-panel { padding: 12px; }.legend-note { display: none; }.timeline-workbench { padding: 12px; }.track-timeline-meta span { display: none; }.track-timeline-labels { width: 76px; }.timeline-note { display: none; }.attribution { display: none; }.record-card, .data-desk { top: 154px; right: 18px; width: calc(100vw - 36px); }.record-card h1 { font-size: 26px; }.event-dialog { width: calc(100vw - 28px); padding: 21px; }.form-split { grid-template-columns: 1fr; gap: 0; } }
@media (max-width: 480px) { .population-meter { top: 14px; right: 14px; min-width: 0; padding: 7px 9px 6px; }.recent-passage-log { top: 60px; left: 14px; right: 14px; width: auto; }.legend-toggle { display: grid; place-items: center; }.timeline-panel { left: 10px; right: 10px; bottom: 10px; height: 34dvh; max-height: 34dvh; grid-template-columns: 1fr; }.legend-panel { position: absolute; z-index: 7; top: 0; left: 0; bottom: 0; width: min(78vw, 280px); max-height: none; border-right: 1px solid var(--line); background: #0c0e0a; box-shadow: 10px 0 26px rgba(0,0,0,.4); transform: translateX(-100%); transition: transform .2s ease-out; }.legend-panel.open { transform: translateX(0); }.timeline-workbench { padding: 10px 12px; }#year-output { font-size: 22px; }.timeline-action { width: 32px; height: 32px; }.speed-button { min-width: 34px; padding: 6px 5px; }.track-zoom-buttons button { width: 26px; height: 26px; }.record-card, .data-desk { top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; max-height: 60dvh; overflow-y: auto; } }
