/* ====== ATLAS / MAP VIEW ====== */

.atlas {
  max-width: 1200px;
  margin: 16px auto 0;
  position: relative;
}

.atlas-head {
  text-align: center;
  padding: 8px 0 20px;
  position: relative;
}

.atlas-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.32em;
  color: rgba(255,184,107,0.7);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.atlas-eyebrow::before,
.atlas-eyebrow::after {
  content: '—';
  margin: 0 14px;
  color: rgba(255,184,107,0.35);
  letter-spacing: 0;
}

.atlas-title {
  font-family: 'Instrument Serif', serif;
  font-size: 5.5rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.01em;
  color: rgba(255,255,255,0.96);
  line-height: 0.95;
}

.atlas-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.38);
  margin-top: 16px;
  text-transform: uppercase;
}

.atlas-plate {
  position: relative;
  margin: 0 8px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(60,40,20,0.35), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(20,30,60,0.25), transparent 60%),
    linear-gradient(180deg, #070707, #0c0a08);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.02),
    0 40px 80px -30px rgba(0,0,0,0.9);
}

.atlas-plate::before,
.atlas-plate::after {
  content: '';
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(255,184,107,0.08);
}
.atlas-plate::before { inset: 4px; }
.atlas-plate::after {
  inset: 0;
  box-shadow: 0 0 40px rgba(255,184,107,0.04) inset;
  border-color: transparent;
}

.atlas-corner {
  position: absolute;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: rgba(255,184,107,0.5);
  pointer-events: none;
  text-transform: uppercase;
}
.atlas-corner.tl { top: 12px; left: 18px; }
.atlas-corner.tr { top: 12px; right: 18px; }
.atlas-corner.bl { bottom: 12px; left: 18px; }
.atlas-corner.br { bottom: 12px; right: 18px; }

#world-map {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 500;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.graticule {
  fill: none;
  stroke: rgba(255,255,255,0.055);
  stroke-width: 0.5;
  stroke-dasharray: 1 3;
}

.sphere {
  fill: none;
  stroke: rgba(255,184,107,0.18);
  stroke-width: 0.6;
}

.country {
  fill: rgba(255,255,255,0.022);
  stroke: rgba(255,255,255,0.22);
  stroke-width: 0.5;
  stroke-linejoin: round;
}

.dot-group { cursor: pointer; }

.dot-pulse {
  fill: none;
  stroke: #ffb86b;
  stroke-width: 1;
  transform-origin: center;
  transform-box: fill-box;
  animation: atlas-pulse 2.6s cubic-bezier(0.2, 0.6, 0.2, 1) infinite;
  pointer-events: none;
}
.dot-group:nth-child(3n) .dot-pulse { animation-delay: -0.8s; }
.dot-group:nth-child(5n) .dot-pulse { animation-delay: -1.6s; }
.dot-group:nth-child(7n) .dot-pulse { animation-delay: -2.2s; }

@keyframes atlas-pulse {
  0%   { transform: scale(1);   opacity: 0.55; }
  80%  { transform: scale(3.2); opacity: 0; }
  100% { transform: scale(3.2); opacity: 0; }
}

.dot-core {
  fill: #ffb86b;
  stroke: #fff4dd;
  stroke-width: 0.4;
  filter: drop-shadow(0 0 6px rgba(255,184,107,0.85));
  transform-origin: center;
  transform-box: fill-box;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), fill 0.25s;
}

.dot-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  fill: rgba(255,244,221,0);
  text-anchor: middle;
  pointer-events: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: fill 0.25s;
}
.dot-label-bg {
  fill: rgba(0,0,0,0);
  transition: fill 0.25s;
}

/* `.hovering` is applied by JS to the dot nearest the cursor (nearest-neighbor
   pointer handler on the SVG), so users get hover feedback for clustered pins
   even when the cursor isn't directly over the small dot circle. */
.dot-group:hover .dot-core,
.dot-group.hovering .dot-core { fill: #fff4dd; transform: scale(1.35); }
.dot-group:hover .dot-label,
.dot-group.hovering .dot-label { fill: rgba(255,244,221,0.95); }
.dot-group:hover .dot-label-bg,
.dot-group.hovering .dot-label-bg { fill: rgba(10,8,6,0.85); }

.dot-group.selected .dot-core {
  fill: #fff4dd;
  stroke: #ffb86b;
  stroke-width: 1.2;
  transform: scale(1.55);
  filter: drop-shadow(0 0 10px rgba(255,244,221,0.9));
}
.dot-group.selected .dot-label { fill: #ffb86b; }
.dot-group.selected .dot-label-bg { fill: rgba(10,8,6,0.9); }

/* Single-label rule: hover takes precedence over selection. When the user
   is hovering any pin, the selected pin's label hides — its enlarged glow
   stays as the persistent "this is selected" marker. Without this, clicking
   Bay Area and then moving the cursor toward the panel would surface a
   second label on Southern California (or whatever pin the cursor passed),
   making it unclear which pin is actually active. */
.dots:has(.dot-group.hovering) .dot-group.selected:not(.hovering) .dot-label {
  fill: rgba(255,244,221,0);
}
.dots:has(.dot-group.hovering) .dot-group.selected:not(.hovering) .dot-label-bg {
  fill: rgba(0,0,0,0);
}

.atlas-legend {
  margin-top: 16px;
  padding: 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.32);
  text-transform: uppercase;
  flex-wrap: wrap;
  gap: 12px;
}

.atlas-legend .legend-scale {
  display: flex;
  align-items: center;
  gap: 18px;
}

.legend-dot {
  display: inline-block;
  border-radius: 50%;
  background: #ffb86b;
  box-shadow: 0 0 8px rgba(255,184,107,0.7);
  margin-right: 6px;
  vertical-align: -1px;
}
.legend-dot.sm { width: 6px; height: 6px; }
.legend-dot.md { width: 9px; height: 9px; }
.legend-dot.lg { width: 13px; height: 13px; }

/* Selection + filtered gallery */
.selection-panel {
  max-width: 1200px;
  margin: 40px auto 0;
  text-align: center;
  padding: 0 24px;
  min-height: 120px;
}

.selection-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: rgba(255,184,107,0.45);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.selection-rule::before,
.selection-rule::after {
  content: '';
  flex: 1;
  max-width: 160px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,184,107,0.35), transparent);
}

.selection-empty {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 1.3rem;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.02em;
}

.selection-title {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 2.6rem;
  color: rgba(255,255,255,0.95);
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.selection-meta {
  margin-top: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
}

.selection-meta .dot-sep { color: rgba(255,184,107,0.55); margin: 0 10px; }

/* Sub-location section header inside the filtered gallery.
   Non-sticky on purpose — the sub-location rail (see subloc-rail.css) is
   the persistent "where am I" indicator on desktop, mirroring how the
   year-rail works for date view. The header here is just a visual separator
   between sub-galleries, like the date view's `.section-header` for years. */
.subloc-section-header {
  color: rgba(255,255,255,0.45);
  font-family: Roboto, sans-serif;
  font-weight: 300;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 28px 4px 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,184,107,0.18);
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.subloc-section-header .subloc-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: rgba(255,184,107,0.7);
}
/* First sub-section sits closer to the selection panel above. */
.subloc-section-header:first-child { padding-top: 8px; }

.dot-count-badge-bg {
  fill: rgba(10,8,6,0.92);
  stroke: rgba(255,184,107,0.55);
  stroke-width: 0.6;
}
.dot-count-badge-text {
  fill: #ffb86b;
  font-family: 'JetBrains Mono', monospace;
  font-size: 7px;
  font-weight: 400;
  text-anchor: middle;
  dominant-baseline: central;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.reset-btn {
  display: inline-block;
  margin-top: 16px;
  background: none;
  border: 1px solid rgba(255,184,107,0.25);
  color: rgba(255,184,107,0.8);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  padding: 7px 18px;
  cursor: pointer;
  border-radius: 20px;
  text-transform: uppercase;
  transition: all 0.2s;
}
.reset-btn:hover {
  color: #fff4dd;
  border-color: #ffb86b;
  background: rgba(255,184,107,0.08);
}

.filtered-gallery {
  max-width: 1400px;
  margin: 20px auto 0;
  padding: 0 24px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.filtered-gallery.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1024px) {
  .atlas-title { font-size: 4rem; }
}

@media (max-width: 600px) {
  .atlas-title { font-size: 3rem; }
  .atlas-eyebrow { font-size: 0.58rem; letter-spacing: 0.22em; }
  .atlas-eyebrow::before, .atlas-eyebrow::after { margin: 0 8px; }
  .atlas-sub { font-size: 0.6rem; letter-spacing: 0.14em; }
  .atlas-plate { padding: 10px; margin: 0 4px; }
  .atlas-corner { font-size: 0.55rem; }
  .atlas-corner.tl, .atlas-corner.tr { top: 8px; }
  .atlas-corner.bl, .atlas-corner.br { bottom: 8px; }
  .atlas-corner.tl, .atlas-corner.bl { left: 10px; }
  .atlas-corner.tr, .atlas-corner.br { right: 10px; }
  .atlas-legend { font-size: 0.58rem; letter-spacing: 0.12em; }
  .atlas-legend .legend-scale { gap: 12px; }
  .selection-title { font-size: 1.8rem; }
  .selection-meta { font-size: 0.62rem; letter-spacing: 0.14em; }
  .selection-rule { font-size: 0.58rem; letter-spacing: 0.2em; gap: 10px; }
}
