/* The city map's own layer: canvas, names over it and the district card, and how the section sets
   its intro over the map. Scoped under #city. */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,500;0,600;0,700;1,500&display=swap');

#city .city-map-stage {
  --city-ink: rgb(222 208 182);
  --city-ink-dim: rgb(222 208 182 / 0.62);
  --city-water: rgb(150 172 184 / 0.8);
  --city-sodium: #ffb257;
  --city-ember: #ff6b3d;
  --city-condensed: 'Barlow Condensed', 'Big Shoulders Text', 'Arial Narrow', sans-serif;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #050403;
  touch-action: pan-y;
  container-type: size;
}
#city .city-map-stage.is-pointing { cursor: pointer; }
/* The map never ends in a straight cut: its foot dissolves into the page below it. */
#city .city-map { border-bottom: 0; }
#city .city-map-stage::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 72px;
  background: linear-gradient(180deg, transparent, var(--ink, #0d0b09));
  pointer-events: none;
}
#city .city-map-canvas { display: block; width: 100%; height: 100%; }

#city .city-map-labels { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
#city .city-map-label {
  position: absolute;
  top: 0;
  left: 0;
  font: 600 13px/1 var(--city-condensed);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--city-ink-dim);
  /* A small dark halo behind every name, so roads and rail never run through the letters. */
  padding: 4px 7px 3px;
  border-radius: 3px;
  background: rgb(6 5 4 / 0.72);
  box-shadow: 0 0 10px 4px rgb(6 5 4 / 0.5);
  transition: opacity 0.3s ease, visibility 0.3s;
}
#city .city-map-label.is-hidden { opacity: 0; visibility: hidden; }
#city .city-map-label.is-district { color: var(--city-ink); font-size: 14px; }
#city .city-map-label.is-water { font: italic 500 16px/1 var(--city-condensed); letter-spacing: 0.08em; text-transform: none; color: var(--city-water); }
#city .city-map-label.is-terrain { font-style: italic; color: var(--city-ink-dim); }
#city .city-map-label.is-route, #city .city-map-label.is-landmark { color: rgb(222 208 182 / 0.5); letter-spacing: 0.12em; }
/* The El's name, in the rust of the line it names. */
#city .city-map-label.is-spine { color: rgb(222 150 104 / 0.88); letter-spacing: 0.14em; }

#city .city-map-label.is-built {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 8px;
  row-gap: 4px;
  color: var(--city-sodium);
  padding: 6px 10px 5px 8px;
  text-shadow: 0 0 10px rgb(255 140 40 / 0.35);
}
#city .city-map-label-pulse {
  grid-row: span 2;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--city-sodium);
  box-shadow: 0 0 0 0 rgb(255 178 87 / 0.6);
  animation: city-map-pulse 3s ease-out infinite;
}
#city .city-map-label-name { font-size: 19px; font-weight: 700; letter-spacing: 0.1em; }
#city .city-map-label-note { font-size: 13px; font-weight: 500; letter-spacing: 0.14em; color: rgb(255 178 87 / 0.75); }

#city .city-map-card {
  position: absolute;
  top: 0;
  left: 0;
  width: min(300px, calc(100% - 16px));
  padding: 14px 16px 15px;
  background: rgb(10 8 6 / 0.9);
  border: 1px solid rgb(222 208 182 / 0.16);
  border-left: 2px solid var(--city-ember);
  backdrop-filter: blur(6px);
  color: var(--city-ink);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 1;
}
#city .city-map-card.is-shown { opacity: 1; }
#city .city-map-card-kicker { margin: 0; font: 600 13px/1.2 var(--city-condensed); letter-spacing: 0.16em; text-transform: uppercase; color: var(--city-ink-dim); }
#city .city-map-card-name { margin: 6px 0 0; font: 700 26px/1 var(--city-condensed); letter-spacing: 0.04em; text-transform: uppercase; }
#city .city-map-card-hook { margin: 8px 0 0; font-size: 15px; line-height: 1.45; color: rgb(222 208 182 / 0.86); }
#city .city-map-card-status { margin: 10px 0 0; font: 600 13px/1 var(--city-condensed); letter-spacing: 0.16em; text-transform: uppercase; }
#city .city-map-card-status.is-smoke { color: var(--city-ember); }
#city .city-map-card-status.is-open { color: var(--city-sodium); }
#city .city-map-card:has(.is-open) { border-left-color: var(--city-sodium); }

#city .city-map-legend {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 10px 14px;
  border: 1px solid rgb(222 208 182 / 0.22);
  background: rgb(5 4 3 / 0.6);
  font: 600 13px/1.35 var(--city-condensed);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--city-ink-dim);
  pointer-events: none;
  z-index: 1;
}
#city .city-map-legend p { margin: 0; }
#city .city-map-legend-title { color: var(--city-ink); margin-bottom: 4px; }
#city .city-map-legend-row::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; }
#city .city-map-legend-row.is-open::before { background: var(--city-sodium); box-shadow: 0 0 8px var(--city-sodium); }
#city .city-map-legend-row.is-smoke::before { background: var(--city-ember); opacity: 0.7; }

/* On a wide screen the intro sits over the map's dark north-west corner, so the map is the section's
   first image; the camera frames the city in the rest of the stage. */
@media (min-width: 1200px) {
  #city { display: grid; grid-template-columns: minmax(0, 1fr); padding-top: 0; }
  #city > .section-inner:first-child { grid-area: 1 / 1; z-index: 2; align-self: start; padding-top: clamp(2.5rem, 7vh, 5rem); pointer-events: none; }
  #city > .city-figure { grid-area: 1 / 1; position: relative; margin: 0; }
  #city > .city-figure::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 62%;
    height: 72%;
    background: radial-gradient(ellipse 100% 100% at 0 0, rgb(5 4 3 / 0.88) 0%, rgb(5 4 3 / 0.55) 45%, transparent 75%);
    pointer-events: none;
  }
  #city .city-intro { max-width: 31rem; pointer-events: auto; text-shadow: 0 0 14px #050403, 0 0 3px #050403; }
  #city .city-intro .signboard { font-size: clamp(3rem, 5vw, 5.25rem); }
  #city .city-map { aspect-ratio: auto; height: max(40rem, min(100svh, 62vw)); max-height: none; border-top: 0; }
}
/* On a phone or a portrait tablet the map is tall (3:4) and opens close on Ginti Nagar's lit corner. */
@media (max-width: 960px) {
  #city .city-map { aspect-ratio: 3 / 4; max-height: 88svh; }
}

/* On a small map the legend would cover the city it describes; the caption below says the same. */
@container (max-width: 640px) {
  #city .city-map-legend { display: none; }
}

@keyframes city-map-pulse {
  0% { box-shadow: 0 0 0 0 rgb(255 178 87 / 0.65); }
  70%, 100% { box-shadow: 0 0 0 14px rgb(255 178 87 / 0); }
}
@media (prefers-reduced-motion: reduce) {
  #city .city-map-label-pulse { animation: none; }
}
