:root {
  --petrol: #20393a;
  --petrol-deep: #13292a;
  --petrol-soft: #315052;
  --paper: #f3efe7;
  --paper-2: #e8e2d7;
  --ink: #172323;
  --muted: #687575;
  --yellow: #edc84b;
  --white: #fffdf8;
  --line-dark: rgba(255,255,255,.18);
  --line-light: rgba(23,35,35,.18);
  --rail-collapsed: 76px;
  --rail-expanded: 286px;
  --panel-width: clamp(410px, 36vw, 610px);
  --shadow: 0 18px 60px rgba(5,16,17,.28);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--petrol-deep);
  font-family: "Avenir Next", Avenir, "Century Gothic", "Trebuchet MS", Arial, sans-serif;
}
button, a, audio { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }
svg { display: block; }

.atlas { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--petrol-deep); }

/* Map */
.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background: var(--petrol-deep);
}
.map-viewport.is-dragging { cursor: grabbing; }
.map-stage {
  position: absolute;
  width: 8192px;
  height: 4320px;
  transform-origin: 0 0;
  will-change: transform;
  --inverse-stage-scale: 1;
}
.map-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.marker-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.marker-connector {
  transition: opacity .18s ease;
}
.marker-connector.is-hidden { opacity: 0 !important; }
.marker-line-halo,
.marker-line {
  vector-effect: non-scaling-stroke;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.marker-line-halo {
  stroke: rgba(8,21,22,.58);
  stroke-width: 3.2;
}
.marker-line {
  stroke: rgba(255,253,248,.82);
  stroke-width: 1.05;
}
.marker-trunk { opacity: .42; }
.marker-trunk .marker-line-halo { stroke-width: 2.7; }
.marker-trunk .marker-line { stroke-width: .95; }
.marker-branch { opacity: 0; }
.marker-branch.is-hovered,
.marker-branch.is-selected { opacity: 1; }
.marker-trunk.is-hovered,
.marker-trunk.is-selected { opacity: 1; }
.marker-connector.is-hovered .marker-line-halo,
.marker-connector.is-selected .marker-line-halo { stroke-width: 4.6; }
.marker-connector.is-hovered .marker-line,
.marker-connector.is-selected .marker-line { stroke: var(--yellow); stroke-width: 1.95; }
.markers-layer { position: absolute; inset: 0; }
.marker-anchor {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1.35px solid rgba(8,21,22,.95);
  border-radius: 50%;
  background: var(--yellow);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(var(--inverse-stage-scale));
  transform-origin: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.38);
  z-index: 3;
  transition: opacity .18s ease, box-shadow .18s ease, transform .18s ease;
}
.marker-anchor.is-hidden { opacity: 0 !important; }
.marker-anchor.group-anchor {
  width: 10px;
  height: 10px;
  opacity: .92;
}
.marker-anchor.precise-anchor { opacity: 0; }
.marker-anchor.precise-anchor.is-hovered,
.marker-anchor.precise-anchor.is-selected { opacity: 1; }
.marker-anchor.is-hovered,
.marker-anchor.is-selected {
  box-shadow: 0 0 0 4px rgba(237,200,75,.26), 0 1px 5px rgba(0,0,0,.45);
}
.marker {
  --category-mark: var(--petrol-deep);
  position: absolute;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1.5px solid rgba(11,25,26,.92);
  border-radius: 50%;
  background: var(--white);
  color: var(--petrol-deep);
  cursor: pointer;
  transform: translate(-50%, -50%) scale(var(--inverse-stage-scale));
  transform-origin: center;
  box-shadow: 0 5px 18px rgba(0,0,0,.3);
  z-index: 4;
  transition: opacity .2s ease;
}
.marker.is-hidden { opacity: 0; pointer-events: none; }
.marker.is-muted { opacity: .38; }
.marker.is-selected { opacity: 1; }
.marker:hover, .marker:focus-visible { z-index: 30; }
.marker-core {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.marker:hover .marker-core,
.marker:focus-visible .marker-core { transform: scale(1.12); }
.marker.is-selected .marker-core { transform: scale(1.14); background: var(--yellow); }
.marker svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.marker-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  display: inline-block;
  width: max-content;
  min-width: 0;
  max-width: 220px;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: break-word;
  padding: 7px 9px 6px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  background: rgba(15,37,38,.96);
  color: #fff;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(0,0,0,.24);
  transition: opacity .15s ease, transform .15s ease;
}
.marker-tooltip small { display: block; width: max-content; max-width: 100%; margin-top: 2px; color: rgba(255,255,255,.64); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.marker:hover .marker-tooltip,
.marker:focus-visible .marker-tooltip { opacity: 1; transform: translateX(-50%) translateY(0); }

.marker.tooltip-left .marker-tooltip {
  left: auto;
  right: calc(100% + 11px);
  top: 50%;
  bottom: auto;
  transform: translateX(4px) translateY(-50%);
  text-align: right;
}
.marker.tooltip-left:hover .marker-tooltip,
.marker.tooltip-left:focus-visible .marker-tooltip { transform: translateX(0) translateY(-50%); }
.marker.tooltip-right .marker-tooltip {
  left: calc(100% + 11px);
  right: auto;
  top: 50%;
  bottom: auto;
  transform: translateX(-4px) translateY(-50%);
}
.marker.tooltip-right:hover .marker-tooltip,
.marker.tooltip-right:focus-visible .marker-tooltip { transform: translateX(0) translateY(-50%); }
.marker.tooltip-center .marker-tooltip,
.marker.tooltip-above .marker-tooltip {
  left: 50%;
  right: auto;
  top: auto;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px);
  text-align: left;
}
.marker.tooltip-center:hover .marker-tooltip,
.marker.tooltip-center:focus-visible .marker-tooltip,
.marker.tooltip-above:hover .marker-tooltip,
.marker.tooltip-above:focus-visible .marker-tooltip {
  transform: translateX(-50%) translateY(0);
}
.marker.tooltip-below .marker-tooltip {
  left: 50%;
  right: auto;
  top: calc(100% + 10px);
  bottom: auto;
  transform: translateX(-50%) translateY(-4px);
  text-align: left;
}
.marker.tooltip-below:hover .marker-tooltip,
.marker.tooltip-below:focus-visible .marker-tooltip {
  transform: translateX(-50%) translateY(0);
}

.map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: none; /* Keep the uniform sea free from gradient banding. */
  z-index: 2;
}
.map-instruction {
  position: absolute;
  left: calc(var(--rail-collapsed) + 18px);
  bottom: 18px;
  z-index: 3;
  margin: 0;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 4px;
  background: rgba(15,37,38,.76);
  color: rgba(255,255,255,.78);
  font-size: 11px;
  line-height: 1.3;
  backdrop-filter: blur(8px);
  transition: opacity .25s ease, left .25s ease;
}
.atlas.panel-open .map-instruction { opacity: .3; }
.map-attribution {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 3;
  margin: 0;
  color: rgba(255,255,255,.68);
  font-size: 8px;
  line-height: 1.35;
  text-align: right;
  text-shadow: 0 1px 3px rgba(0,0,0,.85);
  pointer-events: none;
  transition: right .32s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
}
.atlas.panel-open .map-attribution { right: calc(var(--panel-width) + 12px); }

/* Left rail */
.atlas-rail {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--rail-collapsed);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,.14);
  background: rgba(23,53,54,.91);
  color: #fff;
  backdrop-filter: blur(16px);
  box-shadow: 8px 0 30px rgba(5,16,17,.12);
  transition: width .28s cubic-bezier(.2,.8,.2,1), background .2s ease;
}
.atlas-rail:hover,
.atlas-rail:focus-within,
.atlas-rail.is-expanded { width: var(--rail-expanded); background: rgba(23,53,54,.97); }
.rail-top { flex: 0 0 auto; border-bottom: 1px solid var(--line-dark); }
.back-link {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 23px;
  color: rgba(255,255,255,.76);
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease;
}
.back-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.back-link svg { flex: 0 0 28px; width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.back-link span { opacity: 0; transform: translateX(-4px); transition: opacity .16s ease, transform .2s ease; }
.atlas-rail:hover .back-link span,
.atlas-rail:focus-within .back-link span,
.atlas-rail.is-expanded .back-link span { opacity: 1; transform: none; }
.atlas-brand {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 20px 22px;
  white-space: nowrap;
}
.brand-name { color: var(--yellow); font-size: 10px; letter-spacing: .19em; text-transform: uppercase; }
.brand-title { font-size: 22px; line-height: 1.1; letter-spacing: -.035em; opacity: 0; transform: translateX(-4px); transition: opacity .16s ease, transform .2s ease; }
.atlas-rail:hover .brand-title,
.atlas-rail:focus-within .brand-title,
.atlas-rail.is-expanded .brand-title { opacity: 1; transform: none; }

.rail-filters { flex: 1 1 auto; padding: 12px 0; }
.rail-bottom { flex: 0 0 auto; padding: 10px 0 max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line-dark); }
.rail-action {
  position: relative;
  width: 100%;
  min-height: 55px;
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 0;
  padding: 0 18px 0 0;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.78);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease;
}
.rail-action::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  background: var(--yellow);
  transform: scaleY(0);
  transition: transform .18s ease;
}
.rail-action:hover { color: #fff; background: rgba(255,255,255,.055); }
.rail-action.is-active { color: #fff; background: rgba(255,255,255,.08); }
.rail-action.is-active::before { transform: scaleY(1); }
.action-icon { width: 76px; display: grid; place-items: center; }
.action-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.all-icon { grid-template-columns: repeat(2, 6px); grid-template-rows: repeat(2, 6px); justify-content: center; align-content: center; gap: 3px; }
.all-icon i { width: 6px; height: 6px; border: 1px solid currentColor; border-radius: 50%; }
.action-label { min-width: 0; display: flex; flex-direction: column; justify-content: center; line-height: 1.12; opacity: 0; transform: translateX(-4px); transition: opacity .16s ease, transform .2s ease; }
.action-label small { margin-top: 3px; color: rgba(255,255,255,.52); font-size: 9px; font-weight: 400; letter-spacing: .015em; }
.action-count { min-width: 24px; color: rgba(255,255,255,.47); font-size: 11px; text-align: right; opacity: 0; transition: opacity .16s ease; }
.atlas-rail:hover .action-label,
.atlas-rail:focus-within .action-label,
.atlas-rail.is-expanded .action-label,
.atlas-rail:hover .action-count,
.atlas-rail:focus-within .action-count,
.atlas-rail.is-expanded .action-count { opacity: 1; transform: none; }
.secondary-action { min-height: 48px; font-size: 13px; }
.secondary-action::before { display: none; }

/* Zoom controls */
.map-controls {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: right .32s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
}
.atlas.panel-open .map-controls { right: calc(var(--panel-width) + 18px); }
.map-controls button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: rgba(15,37,38,.8);
  color: #fff;
  font-size: 23px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  transition: background .18s ease, color .18s ease;
}
.map-controls button:hover { background: var(--yellow); color: var(--ink); }
.map-controls svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Detail panel */
.detail-panel {
  position: absolute;
  z-index: 40;
  inset: 0 0 0 auto;
  width: var(--panel-width);
  background: var(--paper);
  box-shadow: var(--shadow);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform .34s cubic-bezier(.2,.8,.2,1), visibility 0s linear .34s;
}
.detail-panel.is-open { transform: translateX(0); visibility: visible; transition-delay: 0s; }
.panel-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(23,35,35,.2);
  border-radius: 50%;
  background: rgba(243,239,231,.9);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(5px);
}
.panel-close:hover { background: var(--yellow); border-color: var(--yellow); }
.panel-close svg, .overlay-close svg, .image-dialog-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.panel-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 46px; scrollbar-color: rgba(32,57,58,.35) transparent; }
.sheet-handle { display: none; }
.panel-hero {
  position: relative;
  width: 100%;
  min-height: 250px;
  display: grid;
  place-items: center;
  margin: 0;
  overflow: hidden;
  background: var(--paper-2);
}
.panel-hero img { display: block; width: 100%; max-height: 54vh; object-fit: contain; cursor: zoom-in; }
.panel-hero.audio-hero { min-height: 238px; padding: 54px 34px 28px; background: var(--petrol); color: #fff; }
.audio-wave { width: 100%; height: 70px; display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 22px; opacity: .88; }
.audio-wave i { width: 3px; min-height: 8px; border-radius: 3px; background: var(--yellow); }
.audio-hero audio { width: 100%; accent-color: var(--yellow); }
.panel-copy { padding: 30px 34px 0; }
.panel-topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.category-label { display: inline-flex; align-items: center; gap: 8px; color: var(--petrol); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.category-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); }
.trace-id { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.trace-title { margin: 0; max-width: 92%; font-size: clamp(34px, 3.3vw, 50px); line-height: .98; font-weight: 400; letter-spacing: -.045em; }
.trace-place { margin: 12px 0 24px; color: var(--muted); font-size: 13px; }
.trace-description { margin: 0 0 28px; font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.62; }
.meta-list { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; padding: 22px 0; border-top: 1px solid var(--line-light); border-bottom: 1px solid var(--line-light); }
.meta-item span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .11em; }
.meta-item strong { display: block; font-size: 12px; line-height: 1.45; font-weight: 500; }
.keywords { display: flex; flex-wrap: wrap; gap: 7px; margin: 22px 0 0; }
.keyword { padding: 6px 9px; border: 1px solid var(--line-light); border-radius: 999px; color: #526061; font-size: 10px; }
.credit-block { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line-light); }
.credit { margin: 0; color: #445252; font-size: 11px; line-height: 1.55; }
.rights { margin: 8px 0 0; color: #7a8585; font-size: 10px; line-height: 1.5; }
.source-note { margin: 18px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; }
.panel-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--petrol);
  border-radius: 999px;
  background: transparent;
  color: var(--petrol);
  text-decoration: none;
  font-size: 11px;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.panel-action.primary { background: var(--petrol); color: #fff; }
.panel-action:hover { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }

/* Information overlays */
.atlas-overlay {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  visibility: hidden;
  opacity: 0;
  transition: opacity .22s ease, visibility 0s linear .22s;
}
.atlas-overlay.is-open { visibility: visible; opacity: 1; transition-delay: 0s; }
.overlay-backdrop { position: absolute; inset: 0; border: 0; background: rgba(6,18,19,.72); cursor: default; backdrop-filter: blur(5px); }
.overlay-card {
  position: relative;
  width: min(650px, 92vw);
  max-height: 84vh;
  overflow-y: auto;
  padding: 42px 44px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.overlay-close { position: absolute; top: 14px; right: 14px; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-light); border-radius: 50%; background: transparent; cursor: pointer; }
.overlay-close:hover { background: var(--yellow); border-color: var(--yellow); }
.overlay-kicker { margin: 0 0 8px; color: var(--petrol); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.overlay-title { margin: 0 0 20px; font-size: clamp(34px, 5vw, 54px); line-height: 1; font-weight: 400; letter-spacing: -.045em; }
.overlay-copy { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.65; }
.legend-list { display: grid; gap: 12px; margin-top: 26px; }
.legend-item { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 14px; padding-top: 12px; border-top: 1px solid var(--line-light); }
.legend-marker { width: 38px; height: 38px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; background: #fff; }
.legend-marker svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.legend-item strong { display: block; margin-bottom: 2px; font-size: 13px; font-weight: 500; }
.legend-item span { color: var(--muted); font-size: 12px; line-height: 1.45; }

/* Image lightbox */
.image-dialog { max-width: none; max-height: none; width: 100vw; height: 100vh; margin: 0; padding: 0; border: 0; background: transparent; }
.image-dialog::backdrop { background: rgba(5,16,17,.92); }
.image-dialog-inner { width: 100%; height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 30px; background: rgba(5,16,17,.94); }
.image-dialog-inner img { max-width: 94vw; max-height: 84vh; object-fit: contain; }
.image-dialog-inner p { margin: 12px 0 0; color: rgba(255,255,255,.75); font-size: 11px; }
.image-dialog-close { position: absolute; top: 18px; right: 18px; z-index: 2; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; background: rgba(5,16,17,.5); color: #fff; cursor: pointer; }
.image-dialog-close:hover { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }

/* Tablet / mobile bottom-sheet */
@media (max-width: 820px) {
  :root { --rail-collapsed: 0px; }
  .atlas-rail {
    inset: auto 10px max(10px, env(safe-area-inset-bottom)) 10px;
    width: auto;
    height: 60px;
    flex-direction: row;
    overflow: visible;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    background: rgba(23,53,54,.92);
    box-shadow: 0 12px 30px rgba(5,16,17,.28);
    transition: none;
  }
  .atlas-rail:hover, .atlas-rail:focus-within, .atlas-rail.is-expanded { width: auto; background: rgba(23,53,54,.94); }
  .rail-top {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: auto;
    height: 48px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 7px;
    background: rgba(23,53,54,.9);
    backdrop-filter: blur(12px);
  }
  .back-link { width: 48px; height: 46px; padding: 0 10px; }
  .back-link svg { width: 26px; height: 26px; }
  .back-link span { display: none; }
  .atlas-brand { min-height: 46px; padding: 0 14px 0 2px; gap: 1px; }
  .brand-name { font-size: 8px; }
  .brand-title { opacity: 1; transform: none; font-size: 15px; }
  .rail-filters { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); padding: 0; }
  .rail-action { min-height: 58px; height: 58px; grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .rail-action::before { left: 11px; right: 11px; top: auto; bottom: 0; width: auto; height: 3px; transform: scaleX(0); }
  .rail-action.is-active::before { transform: scaleX(1); }
  .action-icon { width: auto; }
  .action-icon svg { width: 22px; height: 22px; }
  .action-label, .action-count { display: none; }
  .rail-bottom {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    display: flex;
    gap: 6px;
    padding: 0;
    border: 0;
  }
  .rail-bottom .rail-action { width: 46px; height: 46px; min-height: 46px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; background: rgba(23,53,54,.9); }
  .rail-bottom .action-icon svg { width: 20px; height: 20px; }
  .map-controls { top: 70px; right: 10px; }
  .atlas.panel-open .map-controls { right: 10px; opacity: .55; }
  .map-controls button { width: 36px; height: 36px; }
  .map-instruction { left: 10px; bottom: 82px; font-size: 10px; }
  .atlas.panel-open .map-instruction { opacity: 0; }

  .detail-panel {
    inset: auto 0 0 0;
    width: 100%;
    height: min(84vh, 760px);
    border-radius: 15px 15px 0 0;
    transform: translateY(102%);
    visibility: visible;
    transition: transform .32s cubic-bezier(.2,.8,.2,1);
    touch-action: none;
  }
  .detail-panel.is-open.sheet-peek { transform: translateY(52%); }
  .detail-panel.is-open.sheet-full { transform: translateY(0); }
  .sheet-handle { display: grid; place-items: center; height: 30px; cursor: ns-resize; touch-action: none; }
  .sheet-handle span { width: 42px; height: 4px; border-radius: 999px; background: rgba(23,35,35,.25); }
  .panel-close { top: 10px; right: 12px; width: 34px; height: 34px; }
  .panel-scroll { padding-top: 0; touch-action: pan-y; }
  .panel-hero { min-height: 210px; }
  .panel-hero img { max-height: 43vh; }
  .panel-hero.audio-hero { min-height: 210px; padding: 46px 22px 22px; }
  .panel-copy { padding: 25px 20px 92px; }
  .trace-title { max-width: 88%; font-size: clamp(31px, 9vw, 44px); }
  .trace-description { font-size: 17px; }
  .meta-list { grid-template-columns: 1fr; gap: 15px; }
  .overlay-card { padding: 38px 24px 30px; }
  .image-dialog-inner { padding: 18px; }
}

@media (max-width: 440px) {
  .atlas-brand { display: none; }
  .rail-top { border-radius: 50%; }
  .map-instruction { max-width: calc(100vw - 90px); }
  .overlay-copy { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Mobile header sits outside the bottom filter rail so it remains stable. */
.mobile-header { display: none; }

/* Collapsed desktop brand: monogram instead of clipped text. */
.atlas-brand::before {
  content: "HER";
  color: var(--yellow);
  font-size: 10px;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.atlas-rail:hover .atlas-brand::before,
.atlas-rail:focus-within .atlas-brand::before,
.atlas-rail.is-expanded .atlas-brand::before { display: none; }
.atlas-rail:not(:hover):not(:focus-within):not(.is-expanded) .brand-name,
.atlas-rail:not(:hover):not(:focus-within):not(.is-expanded) .brand-title { display: none; }

@media (max-width: 820px) {
  .rail-top, .rail-bottom { display: none; }
  .mobile-header {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    left: 10px;
    right: 10px;
    z-index: 34;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    pointer-events: none;
  }
  .mobile-back,
  .mobile-secondary button {
    min-height: 44px;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(23,53,54,.9);
    color: #fff;
    backdrop-filter: blur(12px);
    box-shadow: 0 6px 18px rgba(5,16,17,.16);
    pointer-events: auto;
  }
  .mobile-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 13px 0 9px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 12px;
  }
  .mobile-back svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.5; }
  .mobile-secondary { display: flex; gap: 6px; }
  .mobile-secondary button { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border-radius: 50%; cursor: pointer; }
  .mobile-secondary svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
  .detail-panel.sheet-peek .panel-hero { height: 170px; min-height: 170px; }
  .detail-panel.sheet-peek .panel-hero img { width: 100%; height: 100%; max-height: none; object-fit: contain; }
  .detail-panel.sheet-peek .panel-hero.audio-hero { height: 170px; min-height: 170px; padding: 35px 22px 16px; }
  .detail-panel.sheet-peek .audio-wave { height: 46px; margin-bottom: 10px; }
}

/* V05 corrected: two-scale navigation and clustered traces */
.view-badge {
  position: absolute;
  top: 18px;
  left: calc(var(--rail-collapsed) + 18px);
  z-index: 18;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 4px;
  background: rgba(15,37,38,.9);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(5,16,17,.16);
}
.view-badge {
  appearance: none;
  font-family: inherit;
  text-align: left;
}
.badge-back-icon {
  display: none;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.view-badge:disabled { cursor: default; opacity: 1; }
.mode-project .badge-back-icon { display: block; }
.mode-project .view-badge { cursor: pointer; }
.mode-project .view-badge:hover,
.mode-project .view-badge:focus-visible { background: rgba(23,53,54,.98); border-color: rgba(255,255,255,.42); }

.territory-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity .28s ease;
}
.territory-zone {
  position: absolute;
  left: 42.1%;
  top: 35.2%;
  width: 27.2%;
  height: 47.2%;
  border: 1.5px dashed rgba(255,255,255,.76);
  background: rgba(231,235,228,.035);
  cursor: pointer;
  pointer-events: auto;
  transition: background .22s ease, border-color .22s ease;
}
.territory-zone:hover,
.territory-zone:focus-visible {
  background: rgba(235,239,232,.16);
  border-color: rgba(255,255,255,.96);
  outline: none;
}
.territory-heading {
  position: absolute;
  left: 18px;
  top: 16px;
  min-width: 360px;
  padding-left: 14px;
  color: #fff;
  text-align: left;
  text-shadow: 0 2px 8px rgba(5,16,17,.82);
  transform: scale(var(--inverse-stage-scale));
  transform-origin: top left;
}
.territory-heading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1px;
  width: 3px;
  height: 38px;
  background: var(--yellow);
}
.territory-heading h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.08;
  letter-spacing: -.01em;
}
.territory-heading p {
  margin: 8px 0 0;
  color: rgba(255,255,255,.82);
  font-size: 12px;
}
.territory-layers {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  color: rgba(255,255,255,.82);
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: .01em;
}
.territory-layers span { display: block; }
.territory-layers strong { color: #fff; font-weight: 700; }
.territory-explore {
  position: absolute;
  left: 50%;
  top: 50%;
  min-width: 144px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(23,52,53,.62);
  border-radius: 3px;
  background: #f3db72;
  color: #173435;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .03em;
  box-shadow: 0 9px 25px rgba(5,16,17,.18);
  transform: translate(-50%, -50%) scale(var(--inverse-stage-scale));
  transform-origin: center;
  transition: background .18s ease, box-shadow .18s ease;
}
.territory-zone:hover .territory-explore,
.territory-zone:focus-visible .territory-explore { background: #f7e493; box-shadow: 0 11px 30px rgba(5,16,17,.25); }

.mode-project .territory-layer { opacity: 0; pointer-events: none; }
.mode-overview .marker-lines,
.mode-overview .markers-layer { opacity: 0; pointer-events: none; }
.mode-project .marker-lines,
.mode-project .markers-layer { opacity: 1; }
.marker-lines,
.markers-layer { transition: opacity .28s ease; }

.rail-territories { flex: 1 1 auto; padding: 12px 0; }
.mode-project .rail-territories { display: none; }
.mode-overview .rail-filters { display: none; }
.mode-project .rail-filters { display: block; }
.mode-overview .rail-bottom { display: block; }

/* Expandable place nodes — V08a: gerarchia più leggera e hit area accessibile */
.group-cluster {
  position: absolute;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%) scale(var(--inverse-stage-scale));
  transform-origin: center;
  z-index: 3;
}
.group-cluster.is-expanded { z-index: 20; }
.group-cluster.is-hidden { opacity: 0; pointer-events: none; }
.group-node {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--petrol-deep);
  cursor: pointer;
  transform: translate(-50%, -50%);
  box-shadow: none;
  z-index: 2;
}
.group-node::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 1.25px solid rgba(11,25,26,.88);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 4px 13px rgba(0,0,0,.27);
  transform: translate(-50%, -50%);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.group-node:hover::before,
.group-node:focus-visible::before,
.group-node.is-expanded::before,
.group-node.is-selected::before {
  transform: translate(-50%, -50%) scale(1.08);
  background: #f7e493;
  box-shadow: 0 0 0 3px rgba(237,200,75,.18), 0 5px 16px rgba(0,0,0,.29);
}
.group-toggle {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: -1px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}
.group-expansion {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(.96);
  transform-origin: center;
  transition: opacity .16s ease, transform .22s cubic-bezier(.2,.8,.2,1), visibility 0s linear .22s;
}
.group-cluster.is-expanded .group-expansion {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  transition-delay: 0s;
}
.group-line {
  position: absolute;
  top: -.5px;
  height: 1.5px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 0 0 1px rgba(8,21,22,.48);
  z-index: 1;
}
.group-stem {
  position: absolute;
  width: 0;
  margin-left: -1px;
  border-left: 2px dotted rgba(255,255,255,.92);
  background: transparent;
  filter: drop-shadow(0 0 1px rgba(8,21,22,.7));
  z-index: 1;
  transition: opacity .16s ease;
}
.group-stem.is-filtered { opacity: 0; }
.group-cluster .group-marker {
  position: absolute;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(.92);
  z-index: 4;
  transition: opacity .16s ease, transform .2s ease;
}
.group-cluster.is-expanded .group-marker { transform: translate(-50%, -50%) scale(1); }
.group-marker.is-filtered,
.isolated-marker.is-filtered { opacity: 0 !important; pointer-events: none !important; }
.group-node.is-hovered::before,
.group-node.is-selected::before { background: #f7e493; }

@media (max-width: 820px) {
  .map-attribution { right: 8px; bottom: 76px; max-width: 56vw; font-size: 7px; }
  .atlas.panel-open .map-attribution { right: 8px; opacity: .35; }
  .view-badge {
    top: max(66px, calc(env(safe-area-inset-top) + 62px));
    left: 10px;
    max-width: calc(100vw - 20px);
    font-size: 10px;
  }
  .territory-zone { left: 37.5%; top: 34%; width: 33%; height: 49%; }
  .territory-heading { min-width: 280px; left: 12px; top: 12px; }
  .territory-heading h1 { font-size: 16px; }
  .territory-heading p { font-size: 11px; }
  .mode-overview .rail-filters,
  .mode-overview .rail-territories { display: none; }
  .mode-project .rail-territories { display: none; }
}
.mode-project .territory-zone { pointer-events: none; visibility: hidden; }
.mode-overview .territory-zone { visibility: visible; }


/* V09_rev01 — scheda affiancata e mappa ancora interattiva */
@media (min-width: 821px) {
  .map-viewport {
    right: 0;
    transition: right .34s cubic-bezier(.2,.8,.2,1);
  }

  .atlas.panel-open .map-viewport {
    right: var(--panel-width);
  }

  .detail-panel {
    border-left: 1px solid rgba(23,35,35,.14);
  }
}

/* Su tablet verticale e smartphone la scheda diventa una vista a tutto schermo. */
@media (max-width: 820px) {
  .atlas.panel-open .map-viewport { right: 0; }

  .detail-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    transform: translateY(102%);
  }

  .detail-panel.is-open.sheet-peek,
  .detail-panel.is-open.sheet-full {
    transform: translateY(0);
  }

  .sheet-handle { display: none; }
  .panel-close {
    top: max(10px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }
  .panel-scroll { height: 100%; }
}

/* The preview and detail share the original map stage and coordinate system. */
.map-detail { opacity: 0; }
.map-stage.is-map-ready .map-detail { opacity: 1; }
.map-stage.is-map-ready .map-preview { visibility: hidden; }

/* Credits stay in their own green footer, outside the geographic viewport. */
:root { --atlas-footer-height: 32px; }
.map-viewport { bottom: var(--atlas-footer-height); }
.map-instruction { bottom: 10px; }
.map-attribution {
  left: var(--rail-collapsed);
  right: 0;
  bottom: 0;
  height: var(--atlas-footer-height);
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 14px;
  background: var(--petrol-deep);
  color: rgba(255,253,248,.88);
  font-size: 10.5px;
  line-height: 1.35;
  white-space: nowrap;
  text-shadow: none;
}
.atlas.panel-open .map-attribution { right: var(--panel-width); opacity: 1; }
@media (min-width: 821px) and (max-width: 1200px) {
  .atlas.panel-open .map-attribution { white-space: normal; font-size: 9px; }
}
@media (max-width: 820px) {
  :root { --atlas-footer-height: 48px; }
  .map-attribution,
  .atlas.panel-open .map-attribution {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    justify-content: center;
    padding: 5px 12px;
    font-size: 9px;
    white-space: normal;
    text-align: center;
    opacity: 1;
  }
  .atlas-rail { bottom: calc(var(--atlas-footer-height) + max(10px, env(safe-area-inset-bottom))); }
  .map-instruction { bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 820px) {
  /* Overview controls already exist in the mobile header. */
  .mode-overview .atlas-rail { display: none; }
  .mode-overview .map-instruction { bottom: 10px; }
}

/* The entrance is a fixed territorial overview; navigation starts at Esplora. */
.atlas:not(.mode-project) .map-controls { display: none; }
.mode-overview .map-viewport { cursor: default; }
