/* The home page: a winding highway with a door at every stop. */
.calendar-page {
  background: #dbe6f4;
  overflow-x: hidden;
}

.map-header {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 1.6rem 1rem 0.6rem;
  background: var(--sky-top);
}
.map-header h1 {
  font-size: clamp(2rem, 7vw, 3.4rem);
  color: var(--gold);
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
}
.map-header__route { margin-top: 0.2rem; font-style: italic; letter-spacing: 0.04em; }
.map-header__countdown {
  display: inline-block;
  margin-top: 0.7rem;
  padding: 0.35em 1.1em;
  color: #ffe9a8;
  background: rgba(244, 199, 82, 0.14);
  border: 1px solid rgba(244, 199, 82, 0.6);
  border-radius: 999px;
}

.map {
  position: relative;
  width: min(100%, 680px);
  margin: 0 auto;
}
.map > svg { display: block; width: 100%; height: auto; overflow: visible; }

/* Scenery animation. */
.map .twinkle { animation: twinkle 3.5s ease-in-out infinite; }
.map .bulb    { animation: twinkle 1.5s ease-in-out infinite; }
.map .bulb:nth-child(3n + 1) { animation-delay: -0.5s; }
.map .bulb:nth-child(3n + 2) { animation-delay: -1s; }
.map .aurora  { animation: aurora 9s ease-in-out infinite alternate; }

/* Doors. Position and width are set from the map layout. */
.tile {
  position: absolute;
  z-index: 2;
  display: block;
  aspect-ratio: 3 / 4;
  font-family: inherit;
  color: var(--cream);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 50% 50% 6px 6px / 36% 36% 6px 6px;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
}
.tile svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 6px rgba(10, 20, 50, 0.45));
}

.map-header__letter {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  font-size: 0.85rem;
  color: var(--cream);
  text-decoration: none;
  padding: 0.3em 0.8em;
  background: rgba(7, 13, 36, 0.55);
  border: 1px solid rgba(253, 246, 227, 0.45);
  border-radius: 999px;
}
.map-header__letter:hover { filter: brightness(1.2); }
@media (max-width: 560px) { .map-header { padding-top: 2.8rem; } }

/* The satchel link in the header. */
.map-header__satchel {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-top: 0.6rem;
  padding: 0.3em 1em 0.3em 0.6em;
  color: #3a2606;
  font-weight: bold;
  text-decoration: none;
  background: var(--gold);
  border-radius: 999px;
}
.map-header__satchel[hidden] { display: none; }
.map-header__satchel svg { width: 1.6em; height: 1.6em; }

/* Label across the bottom of the door. */
.tile__state {
  position: absolute;
  left: 50%;
  bottom: 8%;
  translate: -50% 0;
  white-space: nowrap;
  font-size: clamp(0.55rem, 1.9vw, 0.8rem);
  color: var(--cream);
  background: rgba(10, 12, 30, 0.78);
  border: 1px solid rgba(244, 199, 82, 0.7);
  border-radius: 999px;
  padding: 0.15em 0.7em;
}

.tile--ready { animation: glow 2.4s ease-in-out infinite; }
.tile--ready .tile__state { color: #3a2606; background: var(--gold); font-weight: bold; }
.tile--ready:hover, .tile--opened:hover { transform: translateY(-4px) scale(1.04); }
.tile--ready .bulb { animation: twinkle 1.5s ease-in-out infinite; }
.tile--ready .bulb--1 { animation-delay: -0.5s; }
.tile--ready .bulb--2 { animation-delay: -1s; }
.tile--opened { filter: sepia(0.25) brightness(1.1); }
.tile--locked { filter: saturate(0.75) brightness(0.78); cursor: default; }
.tile--locked .lights { opacity: 0.45; }
.tile.is-shaking { animation: shake 0.45s; }

/* Morgan's car, driving to the latest stop. */
.car {
  position: absolute;
  z-index: 3;
  translate: -50% -100%;
  pointer-events: none;
}
.car svg { display: block; width: 100%; height: auto; overflow: visible; }
.car--west svg { transform: scaleX(-1); }

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(244, 199, 82, 0.5)); }
  50% { filter: drop-shadow(0 0 16px rgba(255, 214, 100, 1)); }
}
@keyframes twinkle { 50% { opacity: 0.3; } }
@keyframes aurora { to { opacity: 0.55; transform: translateX(25px); } }
@keyframes shake {
  20%, 60% { transform: translateX(-5px) rotate(-2deg); }
  40%, 80% { transform: translateX(5px) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile--ready, .tile .bulb, .tile.is-shaking,
  .map .twinkle, .map .bulb, .map .aurora { animation: none; transition: none; }
}
