/*
 * Map page base: theme tokens, page reset, the 3D stage with its CSS sky layers
 * (day, dusk, night with stars and moon) and the floating name tags.
 * HUD panels, toolbar and the phone layout are in hud.css.
 */
/* Layout: full-bleed 3D stage; a HUD floats over it — title card + places list
   on the left, info card on the right (bottom sheet on phones), toolbar at the bottom.
   Palette: pearl paper, kohl ink, Laad Bazaar lac-red accent, Deccan granite neutrals. */
:root {
  --paper: #fbf7ee;
  --panel: rgba(251, 247, 238, 0.94);
  --ink: #2a2320;
  --muted: #6d6259;
  --line: #2a2320;
  --accent: #b3243f;
  --accent-ink: #fff8f0;
  --chip: #efe6d4;
  --sky-day-top: #8fd3f7;
  --sky-day-bottom: #e8f6ff;
  --sky-night-top: #0d1030;
  --sky-night-bottom: #3a2a5c;
  --sky-dusk-top: #5b5fa8;
  --sky-dusk-middle: #f29aa6;
  --sky-dusk-bottom: #ffc58a;
  --moon: #fff4d8;
  --font-display: "Pixelify Sans", "Courier New", monospace;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --font-telugu: "Noto Sans Telugu", "Nirmala UI", "Gautami", sans-serif;
  --pixel-shadow: 3px 3px 0 var(--line);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d1a24;
    --panel: rgba(29, 26, 36, 0.93);
    --ink: #f3ece0;
    --muted: #b5aa9b;
    --line: #0b0a0f;
    --accent: #ff7a93;
    --accent-ink: #1d1a24;
    --chip: #2c2836;
    color-scheme: dark;
  }
}
/* The dark panels: on a dark-mode device, and for everyone at night (data-map-time, set by ui.js), so the
   panels don't glare against the dark city. */
:root[data-theme="dark"],
:root[data-map-time="night"] {
  --paper: #1d1a24;
  --panel: rgba(29, 26, 36, 0.93);
  --ink: #f3ece0;
  --muted: #b5aa9b;
  --line: #0b0a0f;
  --accent: #ff7a93;
  --accent-ink: #1d1a24;
  --chip: #2c2836;
  color-scheme: dark;
}

/* Author styles such as display:flex would otherwise override the hidden attribute (tags, tool buttons). */
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

/* Sky layers behind the transparent canvas: day, then dusk and night fading in over it.
   --dusk and --night (0..1) are set by js/lighting.js as the time of day eases. */
.stage { position: fixed; inset: 0; --dusk: 0; --night: 0; }
.sky, .sky-dusk, .sky-night { position: absolute; inset: 0; }
.sky { background: linear-gradient(180deg, var(--sky-day-top), var(--sky-day-bottom)); }
.sky-dusk {
  opacity: var(--dusk);
  background:
    radial-gradient(ellipse 60% 40% at 18% 92%, rgba(255, 214, 140, 0.85), transparent 70%),
    linear-gradient(180deg, var(--sky-dusk-top) 0%, var(--sky-dusk-middle) 55%, var(--sky-dusk-bottom) 100%);
}
.sky-night {
  opacity: var(--night);
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-night-top), var(--sky-night-bottom));
}
/* Three star tiles of different sizes overlap into a field that never visibly repeats. */
.sky-stars, .sky-stars::after {
  position: absolute;
  inset: 0 0 35% 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 140px 90px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 80px 150px, #ffe9b0 50%, transparent 51%),
    radial-gradient(1px 1px at 190px 20px, #dfe8ff 50%, transparent 51%);
  background-size: 230px 170px;
  -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent);
  mask-image: linear-gradient(180deg, #000 40%, transparent);
}
.sky-stars::after {
  content: "";
  inset: 0;
  background-size: 317px 211px;
  background-position: 90px 40px;
  animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 1; } }
.sky-moon {
  position: absolute;
  top: 9%;
  right: 14%;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 38%, var(--moon) 0 55%, #e8dcbc 75%, #d6c8a4 100%);
  box-shadow: 0 0 24px 8px rgba(255, 244, 216, 0.35), 0 0 80px 30px rgba(170, 180, 255, 0.18);
}
.sky-moon::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 7px;
  left: 24px;
  top: 26px;
  border-radius: 50%;
  background: rgba(190, 176, 140, 0.55);
  box-shadow: -12px -12px 0 -1px rgba(190, 176, 140, 0.45), 4px -16px 0 -2px rgba(190, 176, 140, 0.4);
}
/* Tonight's phase: the unlit part of the disc, drawn over the moon and its craters (js/live-sky.js).
   The moon gets its own stacking context, or the shade's z-index would lift it above the map canvas
   whenever the night sky is fully opaque (opacity 1 makes no stacking context of its own). */
.sky-moon { isolation: isolate; }
.sky-moon-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}
.scene-canvas.is-pixelated { image-rendering: pixelated; }
.scene-canvas.is-hovering { cursor: pointer; }

.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.place-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  font: 600 12px/1 var(--font-display);
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 5px 7px 4px;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  cursor: pointer;
  will-change: transform;
}
.place-label::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 8px;
  height: 8px;
  background: var(--panel);
  border-right: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  transform: translateX(-50%) rotate(45deg);
}
.place-label:hover, .place-label.is-hovered { z-index: 2; background: var(--chip); }
.place-label.is-selected { z-index: 3; background: var(--accent); color: var(--accent-ink); }
.place-label.is-selected::after { background: var(--accent); }
.place-label:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.area-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  border: 0;
  background: none;
  padding: 2px 4px;
  cursor: pointer;
  font: 700 13px/1 var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fffaf0;
  text-shadow: 0 0 3px #2a2320, 0 0 6px #2a2320, 1px 1px 0 #2a2320;
  will-change: transform;
}
.area-label:hover { color: #ffd9e0; }
/* Metro station tags: a small white pill with an "M" roundel, under the landmark tags in weight. */
.station-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 2px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fffaf0;
  color: #2a2320;
  font: 600 11px/1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
  will-change: transform;
}
.station-label::before {
  content: "M";
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #2a2320;
  color: #fffaf0;
  font: 700 9px/1 var(--font-body);
}
.station-label.is-transit-only { display: none; }
.labels.is-transit .station-label.is-transit-only { display: inline-flex; }
.labels.is-hidden .station-label,
.labels.is-hidden .area-label,
.labels.is-hidden .place-label:not(.is-selected),
.labels.is-crowded .place-label:not(.is-selected) { display: none; }
