/* Santa Tracker: homepage feature + live map pages.
   Follows the theme: square corners, theme navy (#184a7d) boxes, Bootstrap buttons from the theme. */

.gatc-st-home,
.gatc-st-tracker {
  --st-navy: #184a7d;
  --st-night: #0e2748;
  --st-live: #6af874; /* theme $success */
}

.gatc-st-sr {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.gatc-st-home [hidden],
.gatc-st-tracker [hidden] { display: none !important; }

/* Status line (shared): dot + text */
.gatc-st-pill {
  display: flex; align-items: center; gap: 8px;
  margin: 0; color: #fff; font-size: .9375rem; font-weight: 700; line-height: 1.4;
}
.gatc-st-dot {
  position: relative; flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, .5);
}
.gatc-st-pill[data-state="live"] .gatc-st-dot { background: var(--st-live); }
.gatc-st-pill[data-state="live"] .gatc-st-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--st-live); animation: gatc-st-ping 1.6s ease-out infinite;
}
@keyframes gatc-st-ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }

/* ---------------------------------------------------------------------
 * Homepage feature: full-width photo with a navy box, like the Oakleaf sections
 * ------------------------------------------------------------------- */

.gatc-st-home { position: relative; overflow: hidden; background: var(--st-night); }
.gatc-st-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 30% 50%;
  transform-origin: 30% 50%;
  animation: gatc-st-zoom 40s ease-in-out infinite alternate;
}
@keyframes gatc-st-zoom { to { transform: scale(1.08); } }

.gatc-st-snow { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.gatc-st-snow i {
  position: absolute; top: -10px; display: block; border-radius: 50%; background: #fff;
  box-shadow: 0 0 4px rgba(255, 255, 255, .7);
  animation: gatc-st-fall linear infinite;
}
@keyframes gatc-st-fall { to { transform: translate(var(--drift), 110vh); } }

.gatc-st-home .container { position: relative; z-index: 2; }
.gatc-st-box h2,
.gatc-st-box h3 { color: #fff; }

.gatc-st-areas { margin: 0; padding: 0; list-style: none; border-top: 1px solid rgba(255, 255, 255, .35); }
.gatc-st-areas li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 24px; align-items: center;
  margin: 0; padding: 20px 0; border-bottom: 1px solid rgba(255, 255, 255, .35);
}
.gatc-st-areas li::before { display: none; } /* theme list bullets */
.gatc-st-areas h3 { grid-column: 1; margin: 0; font-size: 1.375rem; line-height: 1.25; }
.gatc-st-areas .gatc-st-pill { grid-column: 1; }
.gatc-st-areas .btn { grid-column: 2; grid-row: 1 / span 2; white-space: nowrap; }

@media (max-width: 575.98px) {
  .gatc-st-areas li { grid-template-columns: minmax(0, 1fr); }
  .gatc-st-areas .btn { grid-column: 1; grid-row: auto; margin-top: 10px; white-space: normal; }
}

.gatc-st-motion {
  display: block; margin: 16px 0 0; padding: 4px 0; min-height: 24px;
  border: 0; background: none; color: #fff;
  font: inherit; font-size: .875rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.gatc-st-motion:focus-visible,
.gatc-st-areas .btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: none; }

/* "Pause snow" stops the snow (and the slow photo zoom); the live dot and Santa's pulse keep going. */
.gatc-st-home.is-paused .gatc-st-snow i,
.gatc-st-home.is-paused .gatc-st-photo,
.gatc-st-tracker.is-paused .gatc-st-snow i { animation-play-state: paused; }

/* ---------------------------------------------------------------------
 * Live map page
 * ------------------------------------------------------------------- */

.gatc-st-tracker { margin: 24px 0 40px; }
.gatc-st-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 32px;
  padding: 12px 24px; background: var(--st-navy); color: #fff;
}
@media (min-width: 768px) {
  .gatc-st-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; }
}
.gatc-st-facts { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0; }
.gatc-st-facts div { min-width: 90px; }
.gatc-st-facts dt { margin: 0; color: rgba(255, 255, 255, .85); font-size: .875rem; font-weight: 400; }
.gatc-st-facts dd { margin: 0; font-size: 1.0625rem; font-weight: 700; }
.gatc-st-centre { margin-left: auto; }
.gatc-st-centre:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: none; }

.gatc-st-mapwrap { position: relative; isolation: isolate; } /* keeps Leaflet's z-indexes under the theme header */
.gatc-st-map { height: clamp(380px, 65vh, 680px); background: #dfe7ef; }
.gatc-st-map:focus-visible { outline: 3px solid var(--st-navy); outline-offset: -3px; }

/* Small, quiet map credit (the OpenStreetMap credit must stay visible). */
.gatc-st-map .leaflet-control-attribution { padding: 0 5px; background: rgba(255, 255, 255, .85); color: #333; font-size: 11px; }
.gatc-st-map .leaflet-control-attribution a { color: #1a4d80; }

/* Winter look while it snows: icy tiles. "Pause snow" brings back the normal map. */
.gatc-st-tracker.has-snow .leaflet-tile-pane { filter: saturate(.4) sepia(.2) hue-rotate(175deg) brightness(1.05); }

/* Snow and a frosty edge over the map (Leaflet panes sit at 400), under the controls (1000). */
.gatc-st-mapwrap .gatc-st-snow {
  z-index: 500; box-shadow: inset 0 0 70px rgba(255, 255, 255, .8);
}
.gatc-st-tracker:not(.has-snow) .gatc-st-snow { display: none; }
.gatc-st-mapwrap .gatc-st-snow i { box-shadow: 0 0 2px 1px rgba(24, 74, 125, .45); }
.gatc-st-tracker .gatc-st-motion { margin: 10px 0 0 auto; color: var(--st-navy); }
.gatc-st-tracker .gatc-st-motion:focus-visible { outline: 3px solid var(--st-navy); outline-offset: 3px; }

/* Full screen button, styled like Leaflet's zoom buttons */
.gatc-st-full {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border: 0; border-radius: 2px; background: #fff; color: var(--st-navy); cursor: pointer;
}
.gatc-st-full:hover { background: #f4f4f4; }
.gatc-st-full:focus-visible { outline: 3px solid var(--st-navy); outline-offset: 2px; }

/* Full screen: native (:fullscreen) or the fixed fallback (.is-full) */
.gatc-st-tracker:fullscreen,
.gatc-st-tracker.is-full {
  display: flex; flex-direction: column; margin: 0; background: #fff;
}
.gatc-st-tracker.is-full { position: fixed; inset: 0; z-index: 100000; }
.gatc-st-tracker:fullscreen .gatc-st-mapwrap,
.gatc-st-tracker.is-full .gatc-st-mapwrap { display: flex; flex: 1; min-height: 0; }
.gatc-st-tracker:fullscreen .gatc-st-map,
.gatc-st-tracker.is-full .gatc-st-map { flex: 1; height: auto; }
.gatc-st-tracker:fullscreen .gatc-st-motion,
.gatc-st-tracker.is-full .gatc-st-motion { margin: 6px 16px 8px auto; }
.gatc-st-tracker:fullscreen .gatc-st-debug,
.gatc-st-tracker.is-full .gatc-st-debug { display: none; }

.gatc-st-offline {
  position: absolute; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 24px;
  background: rgba(14, 39, 72, .6);
}
.gatc-st-offline-card { max-width: 440px; padding: 32px; text-align: center; background: var(--st-navy); color: #fff; }
.gatc-st-offline-card p { margin: 0; color: #fff; }
.gatc-st-offline-icon { display: block; margin-bottom: 12px; font-size: 48px; line-height: 1; }
.gatc-st-offline-card .gatc-st-offline-title { margin-bottom: 8px; font-size: 1.375rem; font-weight: 700; }

/* Marker */
.leaflet-marker-icon.gatc-st-marker { background: none; border: 0; }
.gatc-st-marker-santa {
  position: absolute; inset: 0; display: grid; place-items: center;
  line-height: 1; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .45));
}
.gatc-st-marker.is-west .gatc-st-marker-santa svg { transform: scaleX(-1); }
.gatc-st-marker-ring {
  position: absolute; inset: 16px; border-radius: 50%;
  background: rgba(200, 16, 46, .25); border: 2px solid rgba(200, 16, 46, .7);
  animation: gatc-st-ring 2.4s ease-out infinite;
}
.gatc-st-marker-ring-2 { animation-delay: 1.2s; }
@keyframes gatc-st-ring { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.9); opacity: 0; } }
.leaflet-marker-icon.gatc-st-marker:focus-visible { outline: 3px solid var(--st-navy); outline-offset: 2px; }

/* Christmas popup: red card with a candy-cane border */
.gatc-st-popup .leaflet-popup-content-wrapper {
  border: 5px solid transparent; border-radius: 0;
  background:
    linear-gradient(#b3202a, #b3202a) padding-box,
    repeating-linear-gradient(45deg, #fff 0 7px, #e23744 7px 14px) border-box;
  color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.gatc-st-popup .leaflet-popup-tip { background: #b3202a; }
.gatc-st-popup .leaflet-popup-content { margin: 12px 22px; text-align: center; font-size: 15px; line-height: 1.4; }
.gatc-st-popup p { margin: 0; color: #fff; }
.gatc-st-popup .gatc-st-popup-title { margin-bottom: 4px; font-size: 22px; font-weight: 700; white-space: nowrap; }
.gatc-st-popup strong { display: block; font-size: 17px; }
.gatc-st-popup a.leaflet-popup-close-button { top: 6px; right: 6px; color: #fff; }

/* Field test panel (editors only) */
.gatc-st-debug { margin-top: 16px; padding: 12px 16px; border: 1px dashed #8a9bb0; font-size: .875rem; }
.gatc-st-debug summary { cursor: pointer; font-weight: 700; }
.gatc-st-debug dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 16px; margin: 10px 0; }
.gatc-st-debug dl div { display: contents; }
.gatc-st-debug dt { font-weight: 700; }
.gatc-st-debug dd { margin: 0; overflow-wrap: anywhere; }
.gatc-st-debug ol { margin: 0; padding-left: 0; list-style: none; font: 12px/1.6 Consolas, monospace; }
.gatc-st-debug ol li::before { display: none; }

@media (max-width: 575.98px) {
  /* Phones: status + button on one row, facts as "Label value" lines below, so the map starts higher. */
  .gatc-st-bar { gap: 8px 12px; padding: 10px 16px 12px; }
  .gatc-st-centre { padding: 6px 12px; font-size: .9375rem; }
  .gatc-st-facts { order: 1; flex-basis: 100%; flex-direction: column; gap: 2px; }
  .gatc-st-facts div { display: flex; gap: 6px; align-items: baseline; }
}

@media (prefers-reduced-motion: reduce) {
  .gatc-st-home *,
  .gatc-st-tracker *,
  .gatc-st-home *::after,
  .gatc-st-tracker *::after { animation: none !important; transition: none !important; }
}
