/* Santa Tracker — festive, mobile-first viewer */
:root {
  --green-900: #0b2e22;
  --green-800: #14532d;
  --green-700: #1b5e38;
  --red-700: #9b1c1c;
  --red-600: #c41e3a;
  --gold-200: #f8e7a0;
  --gold-400: #d4af37;
  --gold-600: #a8871c;
  --cream: #faf6eb;
  --ink: #14201b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --header-h: 4.6rem;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--green-900);
  color: var(--cream);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---- Header ---- */
.header {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  background:
    linear-gradient(180deg, #1a3d2c 0%, var(--green-900) 100%);
  border-bottom: 3px solid var(--gold-400);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  padding: 0.55rem 0.9rem 0.65rem;
  text-align: center;
}

.header h1 {
  font-family: Cinzel, Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: clamp(1.35rem, 5.4vw, 1.85rem);
  letter-spacing: 0.12em;
  color: var(--gold-200);
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.45), 0 2px 0 #6b4e0b;
  line-height: 1.15;
}

.header .tagline {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e8d9a8;
  opacity: 0.92;
}

/* ---- Map stage ---- */
/* Map fills the remaining viewport under the header */
.map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #1a2a22;
  z-index: 1;
}

.leaflet-container {
  font-family: inherit;
  background: #1a2a22;
}

.leaflet-control-attribution {
  background: rgba(11, 46, 34, 0.82) !important;
  color: #d9d0b8 !important;
  font-size: 10px;
  max-width: calc(100vw - 8rem);
}
.leaflet-control-attribution a { color: var(--gold-200) !important; }

/* ---- Overlays on the map ---- */
.status-pill {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(11, 46, 34, 0.92);
  border: 1px solid var(--gold-400);
  box-shadow: var(--shadow);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: calc(100vw - 1.5rem);
}

.status-pill .dot {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: #7a7a7a;
  box-shadow: 0 0 0 0 rgba(196, 30, 58, 0.5);
  flex: 0 0 auto;
}

.status-pill.live .dot {
  background: #3dcc6f;
  animation: pulse 1.6s ease-out infinite;
}

.status-pill.stale .dot,
.status-pill.waiting .dot {
  background: #e2b044;
}

.status-pill.stale {
  border-color: #e2b044;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 204, 111, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(61, 204, 111, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 204, 111, 0); }
}

.info-card {
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 1.55rem;
  z-index: 15;
  background: linear-gradient(180deg, rgba(20, 83, 45, 0.96), rgba(11, 46, 34, 0.96));
  border: 1px solid var(--gold-400);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.7rem 0.85rem 0.8rem;
  color: var(--cream);
}

.info-card h2 {
  font-family: Cinzel, Georgia, serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--gold-200);
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.info-card ul {
  list-style: none;
  font-size: 0.84rem;
  line-height: 1.45;
}

.info-card li + li { margin-top: 0.1rem; }

.info-card .note {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #e8d9a8;
  opacity: 0.9;
}

.stale-banner {
  display: none;
  margin-bottom: 0.45rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: rgba(155, 28, 28, 0.88);
  border: 1px solid #f8e7a0;
  font-size: 0.8rem;
  line-height: 1.35;
}

.stale-banner.visible { display: block; }

.stale-banner.waiting-banner {
  background: rgba(20, 83, 45, 0.92);
  border: 1px solid var(--gold-400);
}

/* ---- Santa marker ---- */
.santa-marker {
  background: transparent;
  border: 0;
  overflow: visible;
}

.leaflet-marker-icon.santa-marker {
  overflow: visible;
}

.santa-marker img {
  width: 120px;
  height: 60px;
  filter:
    drop-shadow(0 2px 3px rgba(0, 0, 0, 0.65))
    drop-shadow(0 0 6px rgba(248, 231, 160, 0.55));
  /* Origin sits under the sleigh, so a horizontal flip keeps Santa on the GPS point. */
  transform-origin: 17.86% 87.14%;
  transition: transform 0.45s ease;
}

/* ---- Snow ---- */
.snow {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  overflow: hidden;
}

.snowflake {
  position: absolute;
  top: -12px;
  color: #fff;
  opacity: 0.75;
  animation-name: fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.6);
}

@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(360deg); }
}

/* Keep Leaflet controls above the card but below pills */
.leaflet-top.leaflet-right { top: 0.35rem; }

@media (min-width: 640px) {
  .info-card {
    left: auto;
    width: 22rem;
    right: 0.9rem;
    bottom: 1.7rem;
  }
  .status-pill { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .snowflake, .status-pill.live .dot, .santa-marker img {
    animation: none !important;
    transition: none !important;
  }
}
