/* ============================================
   ATLAS MAP — interactive map pages under /atlas/ and the gallery.
   The printed maps' system on screen: Haust paper, EB Garamond for geography,
   Roboto Condensed for what happened, numbered black notes, a neatline.
   Standalone: does not load editorial.css (the map page has no site chrome).
   ============================================ */
:root {
  --paper: #F6F8FA;
  --mist: #E8EDF2;
  --land: #F1ECDA;
  --water: #C6DCDF;
  --fissure: #1F1D18;
  --basalt: #3E3B34;
  --lichen: #6B6156;
  --rowan: #B95A1F;
  --silfra: #405664;
  --silfra-teal: #2F6B73;
  --label-water: #2A5D64;
  --overcast: #AEC0D1;
  --chart-grid: #C9D4DE;
  --tag: #E9CB80;
  --serif: 'EB Garamond', 'Hoefler Text', Garamond, Georgia, serif;
  --cond: 'Roboto Condensed', 'Avenir Next Condensed', 'Arial Narrow', sans-serif;
  --panel-w: 400px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--fissure);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--silfra-teal); }
a:hover { color: var(--rowan); }
::selection { background: var(--rowan); color: var(--paper); }
:focus-visible { outline: 2px solid var(--rowan); outline-offset: 2px; }

/* ---------- map page layout ---------- */
.am { display: flex; height: 100vh; height: 100dvh; }
.am-panel {
  width: var(--panel-w); flex: 0 0 var(--panel-w);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 26px 32px;
  border-right: 1px solid var(--silfra);
  box-shadow: 3px 0 0 -2px var(--rowan);
  background: var(--paper);
  position: relative; z-index: 2;
}
.am-map-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--water); }
/* the neatline: a dark rule, a gap, a rowan hairline, as on the plates */
.am-neat {
  position: absolute; inset: 10px; pointer-events: none; z-index: 1;
  border: 1px solid var(--silfra);
  box-shadow: inset 0 0 0 3px rgba(246, 248, 250, 0.55), inset 0 0 0 4px var(--rowan);
}

.am-top {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 10px; margin-bottom: 18px;
  border-bottom: 1px solid var(--fissure);
  font-family: var(--cond); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.am-top a { color: var(--basalt); text-decoration: none; }
.am-top a:hover { color: var(--rowan); }
.am-logo { font-family: var(--serif); font-size: 1.15rem; letter-spacing: 0.02em; text-transform: none; font-weight: 600; }
.am-logo span { color: var(--rowan); }

.am-kicker {
  font-family: var(--cond); font-weight: 600; font-size: 0.74rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--rowan);
}
.am-panel h1 {
  font-family: var(--serif); font-weight: 400; font-size: 2.05rem; line-height: 1.06;
  margin: 6px 0 4px;
}
.am-dates { font-family: var(--serif); font-style: italic; color: var(--basalt); margin: 0 0 14px; font-size: 1.05rem; }
.am-dek { font-size: 1.04rem; line-height: 1.5; color: var(--basalt); margin: 0 0 18px; }

.am-modes {
  display: flex; gap: 0; margin: 0 0 12px;
  border: 1px solid var(--silfra);
}
.am-mode {
  flex: 1; padding: 8px 6px; border: 0; background: transparent; cursor: pointer;
  font-family: var(--cond); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--silfra);
}
.am-mode + .am-mode { border-left: 1px solid var(--silfra); }
.am-mode.is-active { background: var(--fissure); color: var(--paper); }

.am-slider { margin: 4px 0 10px; }
.am-slider-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--cond); }
.am-slider-label { font-weight: 700; font-size: 1.05rem; }
.am-slider-note { color: var(--lichen); font-size: 0.86rem; }
.am-slider-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.am-play {
  flex: 0 0 30px; height: 30px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--fissure); color: var(--paper); font-size: 0.72rem; line-height: 30px; padding: 0;
}
#am-range { flex: 1; accent-color: var(--silfra-teal); }
.am-ticks { display: flex; justify-content: space-between; margin-left: 40px; font-family: var(--cond); font-size: 0.7rem; color: var(--lichen); }

.am-caption { font-family: var(--cond); font-size: 0.86rem; line-height: 1.45; color: var(--basalt); margin: 4px 0 12px; }

.am-legend { margin: 0 0 22px; padding: 12px 14px; background: #FBFBF8; border: 1px solid var(--fissure); }
.am-leg-group + .am-leg-group { margin-top: 12px; }
.am-leg-title { font-family: var(--cond); font-weight: 700; font-size: 0.8rem; margin: 0 0 6px; letter-spacing: 0.02em; }
.am-leg-fills, .am-leg-lines { list-style: none; margin: 0; padding: 0; font-family: var(--cond); font-size: 0.82rem; }
.am-leg-fills li, .am-leg-lines li { display: flex; align-items: center; gap: 8px; padding: 1.5px 0; }
.am-leg-fills .sw { width: 22px; height: 14px; flex: 0 0 22px; border: 0.5px solid var(--basalt); }
.am-leg-fills .ct { margin-left: auto; color: var(--lichen); font-size: 0.76rem; }
.am-leg-circles text { font-family: var(--cond); font-size: 11px; fill: var(--basalt); }
.am-leg-note { font-family: var(--cond); font-style: italic; font-size: 0.72rem; color: var(--lichen); margin: 2px 0 0; }

.am-h2 {
  font-family: var(--cond); font-weight: 700; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase;
  margin: 0 0 8px; padding-top: 12px; border-top: 1px solid var(--fissure);
  display: flex; justify-content: space-between; align-items: baseline;
}
.am-overview {
  border: 0; background: none; cursor: pointer; padding: 0;
  font-family: var(--cond); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--silfra-teal);
}
.am-notes ol { list-style: none; margin: 0 0 20px; padding: 0; }
.am-note-btn {
  display: grid; grid-template-columns: 26px 1fr; gap: 0 10px; width: 100%; text-align: left;
  border: 0; background: none; padding: 7px 6px 7px 0; cursor: pointer; color: inherit; font: inherit;
  border-bottom: 1px dotted var(--overcast);
}
.am-note-btn:hover .am-note-head { color: var(--rowan); }
.am-note.is-active .am-note-btn { background: linear-gradient(90deg, rgba(185, 90, 31, 0.08), transparent); }
.am-dot {
  width: 22px; height: 22px; border-radius: 50%; background: var(--fissure); color: #FBFBF8;
  font-family: var(--cond); font-weight: 700; font-size: 0.78rem; line-height: 22px; text-align: center;
  grid-row: span 2; margin-top: 1px;
}
.am-note.is-active .am-dot { background: var(--rowan); }
.am-note-head { font-family: var(--cond); font-weight: 700; font-size: 0.9rem; }
.am-note-text { font-family: var(--serif); font-size: 0.98rem; line-height: 1.4; color: var(--basalt); }
.am-note-src { padding: 0 0 6px 36px; font-family: var(--cond); font-size: 0.72rem; border-bottom: 1px dotted var(--overcast); margin-top: -1px; }
.am-note:has(.am-note-src) .am-note-btn { border-bottom: 0; }

.am-chart { margin: 0 0 20px; }
.am-chart-plot > svg { width: 100%; height: auto; display: block; background: #EEF1F3; }
.am-chart-plot .grid { stroke: var(--chart-grid); stroke-width: 0.6; }
.am-chart-plot .axis, .am-chart-plot .tick { stroke: var(--basalt); stroke-width: 0.8; }
.am-chart-plot text { font-family: var(--cond); font-size: 10px; fill: var(--basalt); }
.am-chart-plot .yl { text-anchor: end; }
.am-chart-plot .xl { text-anchor: middle; }
.am-chart-plot .bar:hover { fill: var(--rowan); }
.am-chart-plot .end { font-weight: 700; font-size: 10.5px; }
.am-chart-key { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 0; padding: 0; font-family: var(--cond); font-size: 0.78rem; }
.am-chart-key li { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.am-chart-plot .val { text-anchor: middle; font-weight: 700; font-size: 9.5px; }
.am-lbl.halo .t { text-shadow: 0 0 2px #FBFBF8, 0 0 3px #FBFBF8, 0 0 4px #FBFBF8, 0 0 6px #FBFBF8; }
.am-leg-ramp { height: 12px; border: 0.5px solid var(--basalt); }
.am-leg-ramp-labels { display: flex; justify-content: space-between; font-family: var(--cond); font-size: 0.76rem; color: var(--basalt); margin-top: 2px; }
.am-tip-note { margin-top: 5px; font-size: 0.74rem; font-style: italic; color: var(--lichen); max-width: 260px; }
.am-chart-note { font-family: var(--cond); font-style: italic; font-size: 0.74rem; color: var(--lichen); margin: 6px 0 0; }

.am-quote {
  margin: 0 0 20px; padding: 0 0 0 14px; border-left: 2px solid var(--rowan);
  font-family: var(--serif); font-style: italic; font-size: 1.15rem; line-height: 1.35;
}
.am-quote cite { display: block; font-style: normal; font-family: var(--cond); font-size: 0.78rem; color: var(--lichen); margin-top: 4px; }

.am-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.am-btn {
  display: inline-block; padding: 8px 12px; border: 1px solid var(--fissure); text-decoration: none;
  font-family: var(--cond); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fissure);
}
.am-btn:hover { background: var(--fissure); color: var(--paper); }
.am-btn.primary { background: var(--fissure); color: var(--paper); }
.am-btn.primary:hover { background: var(--rowan); border-color: var(--rowan); }
.am-sources { font-family: var(--cond); font-size: 0.74rem; line-height: 1.45; color: var(--lichen); margin: 0 0 12px; }
.am-imprint {
  font-family: var(--cond); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--basalt);
  padding-top: 8px; border-top: 1px solid var(--fissure);
}

/* ---------- on the map ---------- */
.am-tip {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none;
  min-width: 190px; max-width: 280px; padding: 9px 11px;
  background: #FBFBF8; border: 1px solid var(--fissure); box-shadow: 2px 2px 0 rgba(31, 29, 24, 0.12);
  font-family: var(--cond);
}
.am-tip-title { font-family: var(--serif); font-size: 1.12rem; line-height: 1.1; }
.am-tip-sub { font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lichen); margin-bottom: 5px; }
.am-tip table { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.am-tip th { text-align: left; font-weight: 400; color: var(--basalt); padding: 1px 10px 1px 0; }
.am-tip td { text-align: right; font-weight: 700; white-space: nowrap; }

.am-lbl { pointer-events: none; white-space: nowrap; transition: opacity 0.2s; }
.am-lbl.is-off { opacity: 0; visibility: hidden; }
.am-lbl .t { display: inline-block; text-shadow: 0 0 2px var(--paper), 0 0 3px var(--paper), 0 0 4px rgba(246, 248, 250, 0.8); }
.am-lbl-country .t { font-family: var(--serif); font-size: 16px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--basalt); opacity: 0.72; }
.am-lbl-neighbour .t { font-family: var(--serif); font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--basalt); opacity: 0.62; }
.am-lbl-province .t { font-family: var(--serif); font-size: 14px; letter-spacing: 0.1em; color: var(--basalt); }
.am-lbl-lake .t { font-family: var(--serif); font-style: italic; font-size: 13px; letter-spacing: 0.06em; color: var(--label-water); text-shadow: none; }
.am-lbl-biglake .t { font-family: var(--serif); font-style: italic; font-size: 16px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--label-water); text-shadow: none; }
.am-lbl-river .t { font-family: var(--serif); font-style: italic; font-size: 12.5px; letter-spacing: 0.08em; color: var(--label-water); }
.am-lbl-ocean .t { font-family: var(--serif); font-style: italic; font-size: 15px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--label-water); text-shadow: none; }
.am-lbl-region .t { font-family: var(--serif); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--basalt); opacity: 0.8; }
.am-lbl-event .t { font-family: var(--cond); font-weight: 700; font-size: 13px; color: var(--fissure); }
.am-lbl-place { display: flex; align-items: center; gap: 4px; }
.am-lbl-place i { width: 5px; height: 5px; border-radius: 50%; background: var(--fissure); box-shadow: 0 0 0 1px var(--land); flex: 0 0 5px; }
.am-lbl-place .t { font-family: var(--cond); font-weight: 600; font-size: 12.5px; color: var(--fissure); }
.am-lbl-tag .t {
  font-family: var(--cond); font-weight: 700; font-size: 11px; padding: 1px 5px;
  background: var(--tag); color: var(--fissure); border: 0.5px solid var(--fissure); text-shadow: none;
}

.am-badge {
  width: 24px; height: 24px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 1.5px solid #FBFBF8; background: var(--fissure); color: #FBFBF8;
  font-family: var(--cond); font-weight: 700; font-size: 12.5px; line-height: 21px; text-align: center;
  box-shadow: 0 1px 3px rgba(31, 29, 24, 0.35);
  transition: transform 0.15s, background 0.15s;
}
.am-badge:hover { transform: scale(1.12); }
.am-badge.is-active { background: var(--rowan); transform: scale(1.22); }

.maplibregl-ctrl-group { border-radius: 0 !important; box-shadow: none !important; border: 1px solid var(--fissure); }
.maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { margin: 14px; }
.maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 6px 6px 0 0; }
.maplibregl-ctrl-scale {
  background: rgba(251, 251, 248, 0.85); border-color: var(--fissure); color: var(--fissure);
  font-family: var(--cond); font-size: 11px;
}
.maplibregl-ctrl-attrib { font-family: var(--cond); font-size: 11px; background: rgba(251, 251, 248, 0.85) !important; }

/* ---------- small screens: map on top, the panel reads below ---------- */
@media (max-width: 860px) {
  /* the map stays pinned on top while the panel scrolls under it, so a note or the slider is always seen working */
  .am { display: flex; flex-direction: column; height: auto; }
  .am-map-wrap { order: -1; position: sticky; top: 0; height: 52vh; height: 52svh; flex: 0 0 auto; z-index: 3;
    border-bottom: 1px solid var(--silfra); box-shadow: 0 3px 0 -2px var(--rowan); }
  .am-panel { width: auto; overflow: visible; border-right: 0; box-shadow: none; border-top: 1px solid var(--silfra); padding: 16px 16px 32px; }
  .am-panel h1 { font-size: 1.7rem; }
  .am-neat { inset: 6px; }
  .am-lbl-country .t { font-size: 11px; letter-spacing: 0.18em; }
  .am-badge { width: 20px; height: 20px; font-size: 11px; line-height: 17px; }
}

/* ============================================
   GALLERY — /atlas/
   ============================================ */
.gal { max-width: 1240px; margin: 0 auto; padding: 22px 24px 64px; }
.gal-top { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 10px; border-bottom: 1px solid var(--fissure);
  font-family: var(--cond); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; }
.gal-top nav { display: flex; gap: 20px; }
.gal-top a { color: var(--basalt); text-decoration: none; }
.gal-top a:hover { color: var(--rowan); }
.gal-head { padding: 48px 0 28px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: end; }
.gal-head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1.02; margin: 8px 0 0; }
.gal-head h1 em { font-style: italic; }
.gal-head p { font-size: 1.15rem; line-height: 1.5; color: var(--basalt); margin: 0; }
.gal-rule { height: 0; border: 0; border-top: 1px solid var(--rowan); box-shadow: 0 4px 0 -2px var(--silfra); width: 4.5rem; margin: 0 0 32px; }
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 36px 28px; list-style: none; margin: 0; padding: 0; }
.gal-card a.gal-img {
  display: block; padding: 8px; background: #fff; border: 1px solid var(--overcast);
  box-shadow: 0 1px 0 var(--overcast), 0 10px 24px -14px rgba(31, 29, 24, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.gal-card a.gal-img:hover { transform: translateY(-2px); box-shadow: 0 1px 0 var(--overcast), 0 16px 30px -14px rgba(31, 29, 24, 0.45); }
.gal-card img { display: block; width: 100%; height: auto; aspect-ratio: 1.545; object-fit: cover; object-position: center; }
.gal-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 12px; }
.gal-card h2 { font-family: var(--serif); font-weight: 400; font-size: 1.45rem; line-height: 1.1; margin: 0; }
.gal-card h2 a { color: var(--fissure); text-decoration: none; }
.gal-card h2 a:hover { color: var(--rowan); }
.gal-tag {
  flex: 0 0 auto; font-family: var(--cond); font-weight: 600; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 3px 7px; border: 1px solid var(--fissure); color: var(--fissure); white-space: nowrap;
}
.gal-tag.live { background: var(--fissure); color: var(--paper); }
.gal-sub { font-family: var(--cond); font-size: 0.84rem; color: var(--lichen); margin: 4px 0 6px; }
.gal-sub .kind { color: var(--rowan); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.74rem; }
.gal-cap { font-size: 1rem; line-height: 1.45; color: var(--basalt); margin: 0 0 8px; }
.gal-links { display: flex; gap: 14px; font-family: var(--cond); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
.gal-links a { text-decoration: none; font-weight: 600; }
.gal-foot { margin-top: 56px; padding-top: 12px; border-top: 1px solid var(--fissure); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-family: var(--cond); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--basalt); }
@media (max-width: 760px) {
  .gal { padding: 16px 16px 48px; }
  .gal-head { grid-template-columns: 1fr; gap: 16px; padding: 32px 0 20px; }
  .gal-grid { grid-template-columns: 1fr; }
}
