:root {
  --paper:        #ffffff;
  --paper-warm:   #fcfbf7;
  --ink:          #1c1a17;
  --ink-soft:     #4a463f;
  --ink-faint:    #8a8377;
  --hair:         #d9d3c6;   /* neatline / rules */
  --sepia:        #8a5a2b;   /* trails, historic routes */
  --sepia-deep:   #6d3f18;
  --river:        #2f6f92;   /* water features */
  --crimson:      #9b2915;   /* key markers / active */
  --gold:         #b8862b;
  --shadow:       rgba(28,26,23,0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.atlas {
  max-width: 1500px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 40px) clamp(16px, 3vw, 48px) 28px;
}

/* ---------- Masthead ---------- */
.masthead { text-align: center; margin-bottom: clamp(14px, 2vw, 26px); }
.masthead__rule {
  height: 1px; background: var(--hair);
  max-width: 640px; margin: 0 auto;
}
.masthead h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  font-size: clamp(22px, 3.4vw, 40px);
  letter-spacing: 0.01em;
  margin: 14px 0 6px;
  color: var(--ink);
}
.masthead__sub {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Stage layout ---------- */
.stage {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: clamp(18px, 2.4vw, 40px);
  align-items: start;
}

/* ---------- 100 Stories rail ---------- */
.rail__eyebrow {
  font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--sepia); font-weight: 600;
}
.rail__title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500; font-size: 30px; line-height: 1.05;
  margin: 6px 0 10px;
}
.rail__title span { color: var(--ink-faint); font-size: 19px; }
.rail__note { margin: 0 0 18px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); max-width: 34ch; }

.rail__list { list-style: none; margin: 0; padding: 0; }
.story {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 12px 6px 12px 4px;
  border-top: 1px solid var(--hair);
  cursor: pointer;
  transition: background .2s ease, padding-left .2s ease;
}
.story:last-child { border-bottom: 1px solid var(--hair); }
.story:hover { background: var(--paper-warm); padding-left: 10px; }
.story.is-active { background: var(--paper-warm); }
.story.is-active .story__num { color: var(--crimson); }
.story.is-locked { cursor: default; opacity: 0.5; }
.story.is-locked:hover { background: none; padding-left: 4px; }

.story__num {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px; font-weight: 500; color: var(--sepia);
  line-height: 1;
}
.story__body h3 {
  margin: 0 0 3px; font-size: 15px; font-weight: 600; letter-spacing: 0.005em;
}
.story__body p { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-faint); }

.rail__foot {
  margin-top: 18px; font-size: 12px; color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.rail__foot a { color: var(--sepia); text-decoration: none; border-bottom: 1px solid var(--hair); }
.rail__foot a:hover { color: var(--crimson); }

/* ---------- The plate (3:2) ---------- */
.plate {
  position: relative;
  aspect-ratio: 3 / 2;
  width: 100%;
  background: var(--paper);
  overflow: hidden;
  border-radius: 2px;
}
.plate__map { position: absolute; inset: 0; }

/* Canvas + attribution restyled to the atlas palette */
.plate__map .maplibregl-ctrl-attrib {
  background: rgba(255,255,255,0.72);
  font-size: 10px;
  font-family: "Inter", sans-serif;
}
.plate__map .maplibregl-ctrl-bottom-left { z-index: 6; }
.plate__map .maplibregl-ctrl-bottom-right { z-index: 6; }

/* Edges dissolve into the white page */
.plate__feather {
  position: absolute; inset: 0; pointer-events: none; z-index: 4;
  box-shadow: inset 0 0 70px 34px #ffffff, inset 0 0 22px 6px #ffffff;
  background:
    linear-gradient(to right,  #fff 0%, rgba(255,255,255,0) 9%, rgba(255,255,255,0) 91%, #fff 100%),
    linear-gradient(to bottom, #fff 0%, rgba(255,255,255,0) 9%, rgba(255,255,255,0) 91%, #fff 100%);
}

/* Classic double-rule neatline just inside the plate edge */
.plate__neatline {
  position: absolute; inset: 16px; pointer-events: none; z-index: 5;
  border: 1px solid var(--hair);
  box-shadow: inset 0 0 0 4px transparent, inset 0 0 0 5px var(--hair);
}

/* ---------- Story caption ---------- */
.caption {
  position: absolute;
  left: 34px; bottom: 34px; z-index: 7;
  margin: 0;
  width: min(400px, 46%);
  background: rgba(255,255,255,0.93);
  backdrop-filter: blur(3px);
  border: 1px solid var(--hair);
  box-shadow: 0 10px 34px var(--shadow);
  padding: 20px 22px 22px;
  border-radius: 2px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s ease, transform .5s ease;
}
.caption.is-in { opacity: 1; transform: none; }
.caption__num {
  font-family: "Fraunces", Georgia, serif;
  font-size: 15px; color: var(--crimson); font-weight: 600;
  letter-spacing: 0.06em;
}
.caption__kicker {
  display: inline-block; margin-left: 8px;
  font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-faint);
}
.caption__title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500; font-size: 25px; line-height: 1.12;
  margin: 8px 0 0;
}
.caption__rule {
  height: 1px; width: 46px; background: var(--sepia); margin: 12px 0 12px;
}
.caption__body {
  margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-soft);
  min-height: 3.2em;
}
.caption__body .cursor {
  display: inline-block; width: 2px; height: 1.05em; vertical-align: -0.16em;
  background: var(--sepia); margin-left: 1px; animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Layer badge (e.g. "Relief layer streaming…") */
.plate__badge {
  position: absolute; top: 30px; right: 30px; z-index: 7;
  background: rgba(28,26,23,0.86); color: #fff;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 2px;
  display: flex; align-items: center; gap: 8px;
}
.plate__badge::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 0 rgba(184,134,43,0.7);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(184,134,43,0.6); }
  70% { box-shadow: 0 0 0 8px rgba(184,134,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(184,134,43,0); }
}

/* Cartographic DOM markers */
.mk { display: grid; justify-items: center; transform: translateY(-2px); cursor: default; }
.mk__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--crimson); border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.mk__label {
  margin-top: 3px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 11.5px; font-weight: 500; color: var(--ink);
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff;
  letter-spacing: 0.02em;
}
.mk.is-water .mk__dot { background: var(--river); }
.mk.is-sepia .mk__dot { background: var(--sepia); }

/* ---------- Colophon ---------- */
.colophon {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--hair);
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  font-size: 11.5px; color: var(--ink-faint); letter-spacing: 0.02em;
}
.colophon a { color: var(--sepia); text-decoration: none; }
.colophon a:hover { color: var(--crimson); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
  .rail { order: 2; }
  .caption { width: min(420px, 70%); left: 22px; bottom: 22px; }
}
