/* Minimal, quiet, and intentionally restrained.
   The map is designed as a small act of remembrance rather than a reference atlas. */

:root {
  --paper: #ffffff;
  --ink: #1f1f1f;
  --quiet: #8a8a8a;
  --boundary: #d7d7d7;
  --country-fill: #ffffff;
  --face: #fff2a8;
  --face-stroke: #111111;
  --deceased-tear: #5f87a7;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-shell {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.map-header {
  text-align: center;
  padding: clamp(1rem, 2.6vw, 2rem) 1rem 0.35rem;
  z-index: 20;
}

.map-header h1 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.035em;
  font-size: clamp(2rem, 5vw, 4.7rem);
  line-height: 0.98;
}


.map-frame {
  position: relative;
  width: 100%;
  min-height: 68vh;
  overflow: hidden;
  background: var(--paper);
}

.map-subtitle {
  position: absolute;
  left: 50%;
  bottom: clamp(1.1rem, 3vw, 2.1rem);
  transform: translateX(-50%);
  z-index: 25;
  margin: 0;
  width: min(92vw, 54rem);
  text-align: center;
  color: #555;
  font-size: clamp(0.92rem, 1.6vw, 1.14rem);
  line-height: 1.4;
  pointer-events: none;
}

#map {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 68vh;
  cursor: grab;
  touch-action: none;
  background: var(--paper);
}

#map:active {
  cursor: grabbing;
}

.country {
  fill: var(--country-fill);
  stroke: var(--boundary);
  stroke-width: 0.58px;
  vector-effect: non-scaling-stroke;
}

.sphere {
  fill: var(--paper);
  stroke: none;
}

.friend-marker {
  cursor: pointer;
  opacity: 0;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.12));
}

.friend-marker circle.face-bg {
  fill: var(--face);
  stroke: var(--face-stroke);
  stroke-width: 1.15;
}

.friend-marker .feature-line {
  fill: none;
  stroke: var(--face-stroke);
  stroke-width: 1.25;
  stroke-linecap: round;
}

.friend-marker .eye {
  fill: var(--face-stroke);
}

.friend-marker .tear {
  fill: var(--deceased-tear);
  stroke: none;
}

.friend-marker:focus,
.friend-marker:focus-visible {
  outline: none;
}

.friend-marker.is-cluster {
  cursor: pointer;
}


.popup.cluster-popup {
  pointer-events: auto;
}

.cluster-options {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.cluster-option {
  width: 100%;
  border: 1px solid #e1e1e1;
  border-radius: 999px;
  background: #fff;
  padding: 0.48rem 0.75rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.cluster-option:hover,
.cluster-option:focus-visible {
  border-color: #bdbdbd;
  outline: none;
}

.stage-control {
  position: relative;
  display: inline-block;
  margin: clamp(0.62rem, 1.4vw, 0.9rem) auto 0;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.stage-control.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.stage-control select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.78rem 2.8rem 0.78rem 1rem;
  min-width: 15.5rem;
  border: 1px solid #d8d8d8;
  border-radius: 999px;
  background:
    linear-gradient(45deg, transparent 50%, #444 50%) calc(100% - 1.18rem) 50% / 0.38rem 0.38rem no-repeat,
    linear-gradient(135deg, #444 50%, transparent 50%) calc(100% - 0.86rem) 50% / 0.38rem 0.38rem no-repeat,
    rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow);
  font: inherit;
  font-size: 0.94rem;
  outline: none;
}

.stage-control select:focus {
  border-color: #aaa;
}

.popup {
  position: absolute;
  z-index: 50;
  max-width: min(19rem, calc(100vw - 2rem));
  padding: 0.95rem 1rem;
  border: 1px solid #e1e1e1;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  color: var(--ink);
  transform: translate(-50%, calc(-100% - 1rem));
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.popup.is-visible {
  opacity: 1;
}

.popup h2 {
  margin: 0 0 0.56rem;
  font-weight: 550;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.popup p {
  margin: 0.24rem 0;
  font-size: 0.88rem;
  line-height: 1.35;
}

.popup .status {
  margin-top: 0.58rem;
  color: #3f3f3f;
}

.popup .thoughts {
  margin-top: 0.72rem;
  font-style: italic;
  color: #444;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 60;
  background: rgba(255,255,255,0.85);
  color: #777;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: opacity 450ms ease;
  pointer-events: none;
}

.loading.is-hidden {
  opacity: 0;
}


.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

@media (max-width: 700px) {
  .map-header {
    padding-top: 1rem;
  }

  .map-frame,
  #map {
    min-height: 72vh;
  }

  .map-subtitle {
    bottom: 0.9rem;
  }

  .stage-control select {
    min-width: 13.5rem;
    font-size: 0.88rem;
  }
}
