:root {
  --night: #13213F;
  --night-2: #1C2E54;
  --night-3: #2A4170;
  --snow: #F7F8FB;
  --frost: #B9C4DA;
  --amber: #F5B83D;
  --red: #E0334B;
  --pine: #3FA37A;
  --bulb-off: #33466F;
  --bg: var(--night);
  --surface: var(--night-2);
  --line: var(--night-3);
  --text: var(--snow);
  --muted: var(--frost);
  --accent: var(--amber);
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", system-ui, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #F4F6FA;
    --surface: #FFFFFF;
    --line: #D4DAE6;
    --text: #13213F;
    --muted: #4A5878;
    --accent: #A86A00;
    --bulb-off: #D4DAE6;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* components set display; hidden must still win */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.55 var(--body);
}
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; z-index: 2000; background: var(--surface); padding: 8px 12px; }

main, .masthead, .foot { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---------- masthead */
.masthead { display: flex; align-items: flex-start; gap: 14px; padding-top: 16px; }
.logo { width: 100px; height: 100px; flex: none; }
.masthead-text { min-width: 0; }
.masthead h1 {
  font: 800 clamp(1.5rem, 6.4vw, 2.3rem)/1.05 var(--display);
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
.kicker { margin: 4px 0 0; font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.when { margin: 6px 0 0; font-weight: 700; font-size: 1.05rem; line-height: 1.3; color: var(--text); white-space: pre-line; }

/* ---------- live hero */
.live { margin-top: 24px; }
.status-row { display: flex; align-items: center; gap: 16px; margin: 0 0 12px; }
.strand-box { flex: 1; min-width: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  margin: 0; padding: 3px 12px 3px 10px;
  border-radius: 999px;
  font-weight: 700; font-size: 0.9rem;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line);
}
.badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.badge[data-state="live"] { color: var(--snow); background: var(--red); border-color: var(--red); }
.badge[data-state="live"]::before { background: var(--snow); animation: blink 1.6s ease-in-out infinite; }
.badge[data-state="stale"] { color: var(--amber); border-color: var(--amber); }
.badge[data-state="finished"] { color: var(--pine); border-color: var(--pine); }

.headline {
  font: 800 clamp(1.5rem, 5vw, 2.15rem)/1.15 var(--display);
  letter-spacing: -0.01em;
  margin: 0;
  max-width: 28ch;
  text-wrap: balance;
}
.subline { margin: 8px 0 0; color: var(--muted); max-width: 60ch; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- where the front is: one card with a street sign in it */
.where {
  margin: 4px 0 0;
  padding: 14px 14px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.where-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin: 0 2px 10px;
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}
.where-town { color: var(--text); text-align: right; }
.sign {
  display: flex; flex-direction: column;
  padding: 14px 20px 16px;
  background: #1F6E43;              /* street-sign green, the same in light and dark */
  color: #FFFFFF;
  border-radius: 10px;
  box-shadow: inset 0 0 0 4px #1F6E43, inset 0 0 0 6px #FFFFFF;
}
.sign-street {
  font: 800 clamp(1.9rem, 8vw, 2.6rem)/1.1 var(--display);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.sign-cross { margin-top: 2px; font: 700 clamp(1.1rem, 4.5vw, 1.35rem)/1.25 var(--body); }
.where.stale .sign { background: #5B6780; box-shadow: inset 0 0 0 4px #5B6780, inset 0 0 0 6px #FFFFFF; }
.where-next {
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 12px 2px 14px;
  font-size: 1.1rem;
}
.next-label {
  font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.next-name { flex: 1; min-width: 0; font-weight: 700; }

/* ---------- string of lights */
.strand {
  position: relative;
  display: flex; justify-content: space-between; align-items: flex-start;
  margin: 0;
  padding-top: 6px;
  height: 34px;
}
.strand::before { /* the wire */
  content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 10px;
  border-bottom: 2px solid var(--line);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
.bulb {
  position: relative;
  width: 11px; height: 17px;
  border-radius: 50% 50% 46% 46% / 40% 40% 60% 60%;
  background: var(--bulb-off);
  margin-top: 8px;
  transition: background 0.6s, box-shadow 0.6s;
}
.bulb::before { /* socket */
  content: ""; position: absolute; top: -5px; left: 2px; width: 7px; height: 6px;
  border-radius: 2px; background: var(--line);
}
.bulb:nth-child(4n+1).on { --c: var(--red); }
.bulb:nth-child(4n+2).on { --c: var(--amber); }
.bulb:nth-child(4n+3).on { --c: var(--pine); }
.bulb:nth-child(4n+4).on { --c: #7FB2FF; }
.bulb.on { background: var(--c); box-shadow: 0 0 10px 2px color-mix(in srgb, var(--c) 60%, transparent); }
.bulb.here { animation: twinkle 1.2s ease-in-out infinite alternate; }
.strand-ends {
  display: flex; justify-content: space-between;
  font-size: 0.75rem; color: var(--muted); margin-top: 0;
}

/* ---------- map */
.map-wrap { position: relative; margin-top: 18px; }
#map {
  height: min(62vh, 520px);
  min-height: 340px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.updated { margin: 8px 0 0; font-size: 0.9rem; color: var(--muted); }

#map:has(.map-missing) { height: auto; min-height: 0; padding: 16px; }
.map-missing { margin: 0 0 12px; color: var(--muted); }

/* map (MapLibre) */
.maplibregl-map { font: inherit; border-radius: 14px; }
.maplibregl-popup-content { background: var(--night); color: var(--snow); border-radius: 8px; padding: 10px 14px; line-height: 1.4; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
.maplibregl-popup-tip { border-top-color: var(--night) !important; border-bottom-color: var(--night) !important; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.map-wrap .maplibregl-ctrl-bottom-right { bottom: 0; }
.map-legend {
  position: absolute; z-index: 2; right: 10px; bottom: 30px;   /* above the map credits line */
  margin: 0; padding: 8px 12px; list-style: none;
  display: flex; flex-direction: column; gap: 4px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line); border-radius: 10px;
  font-weight: 700; font-size: 0.85rem; line-height: 1.2;
  pointer-events: none;
}
.map-legend li { display: flex; align-items: center; gap: 8px; }
.map-legend li > span:first-child { width: 18px; display: inline-grid; place-items: center; flex: none; }
.legend-front { height: 14px; width: 14px !important; border-radius: 50%; background: var(--pine); border: 2px solid var(--snow); box-sizing: border-box; }
.legend-santa { font-size: 16px; }
.legend-line { height: 6px; border-radius: 3px; background: #E0334B; box-shadow: 0 0 6px rgb(224 51 75 / 0.6); }
.legend-star { font-size: 18px; color: var(--amber); -webkit-text-stroke: 1px #FFFFFF; }
#map:has(.map-missing) ~ .map-legend { display: none; }
.maplibregl-marker:has(.me-pin) { z-index: 4; }
.maplibregl-marker:has(.flag) { z-index: 1; }
.flag { color: var(--text); cursor: pointer; line-height: 0; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.45)); }
.flag svg { display: block; }
.unit-pin { display: grid; place-items: center; }
.unit-pin .dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--pine); border: 3px solid var(--snow);
  box-shadow: 0 0 0 0 rgba(63, 163, 122, 0.6);
  animation: ping 2s ease-out infinite;
}
.unit-pin.santa .dot {   /* Santa is a little emoji instead of a dot */
  width: auto; height: auto; border: 0; border-radius: 0; background: none;
  font-size: 26px; line-height: 1; box-shadow: none; animation: none;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.5));
}
.unit-pin.stale .dot { background: #6B7894; animation: none; box-shadow: none; }
.unit-pin.santa.stale .dot { background: none; filter: grayscale(1) opacity(0.6); }
.stop-pin {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--night); border: 3px solid var(--amber);
}
.me-pin { width: 28px; height: 28px; filter: drop-shadow(0 1px 3px rgb(0 0 0 / 0.5)); }
.me-pin path { fill: var(--amber); stroke: #FFFFFF; stroke-width: 1.6; stroke-linejoin: round; }

/* ---------- your spot */
.spot-ask {
  display: block; width: 100%; margin: 14px 0 0; padding: 14px 18px;
  font: 700 1.1rem var(--body);
  border-radius: 12px; border: 0;
  background: var(--amber); color: var(--night);
  cursor: pointer;
}
.spot {
  display: block; width: 100%; margin: 14px 0 0; padding: 12px 14px;
  font: inherit; color: inherit; text-align: left;
  background: none; border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 10px;
  cursor: pointer;
}
.spot-head { display: flex; justify-content: space-between; align-items: baseline; }
.spot-label { font-weight: 700; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.spot-change { color: var(--accent); font-weight: 700; text-decoration: underline; }
.spot-name { display: block; margin-top: 2px; font-weight: 700; font-size: 1.15rem; }
.spot-eta { display: block; margin-top: 2px; font-size: 1.05rem; white-space: pre-line; }

/* ---------- the spot picker: full screen, big targets */
body.picker-open { overflow: hidden; }
.picker {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; flex-direction: column;
  background: var(--bg);
}
.picker[hidden] { display: none; }
.picker-bar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 760px; width: 100%; margin: 0 auto; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
}
.picker-back, .picker-close {
  min-width: 48px; min-height: 48px; padding: 0 12px;
  font: 700 1.1rem var(--body); color: var(--text);
  background: none; border: 0; border-radius: 10px; cursor: pointer;
}
.picker-close { margin-left: auto; font-size: 1.4rem; }
.picker-body {
  flex: 1; overflow-y: auto;
  max-width: 760px; width: 100%; margin: 0 auto; padding: 4px 16px 40px;
  padding-bottom: max(40px, env(safe-area-inset-bottom));
}
.picker-title { font: 800 clamp(1.6rem, 6vw, 2rem)/1.15 var(--display); margin: 0 0 18px; }
.picker-title:focus { outline: none; }
.picker-note { margin: -6px 0 18px; color: var(--muted); font-size: 1.05rem; }
.picker-or { margin: 4px 0 14px; text-align: center; color: var(--muted); }
.picker-msg {
  margin: 0 0 18px; padding: 12px 14px; border-radius: 10px;
  background: var(--surface); border-left: 4px solid var(--amber); font-weight: 700;
}
.big-btn {
  display: block; width: 100%; min-height: 60px; margin: 0 0 12px; padding: 14px 18px;
  font: 700 1.2rem var(--body); color: var(--text); text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer;
}
.big-btn.primary { background: var(--amber); color: var(--night); border-color: var(--amber); text-align: center; }
.big-btn.primary + .picker-note { margin-top: -4px; text-align: center; }
.big-btn:disabled { opacity: 0.7; cursor: progress; }
.picker-town { font: 800 1.3rem var(--display); color: var(--accent); margin: 26px 0 8px; }
.picker-on {
  margin: 20px 0 8px;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.street-btn { display: flex; flex-direction: column; gap: 2px; min-height: 56px; margin-bottom: 8px; }
.street-hint { font-weight: 400; font-size: 0.95rem; color: var(--muted); }
.link-btn {
  min-height: 0; margin-top: 24px; text-align: center;
  background: none; border: 0; color: var(--accent); text-decoration: underline; font-size: 1.05rem;
}

/* ---------- ideas for next year */
.feedback { margin-top: 48px; }
.feedback h2 { font: 800 1.6rem/1.2 var(--display); margin: 0 0 4px; }
.fb-note { margin: 0 0 12px; color: var(--muted); }
#fb-text {
  display: block; width: 100%; padding: 12px;
  font: inherit; font-size: 1.05rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  resize: vertical;
}
.fb-send {
  margin-top: 10px; padding: 12px 22px;
  font: 700 1.05rem var(--body); color: var(--night);
  background: var(--amber); border: 0; border-radius: 10px; cursor: pointer;
}
.fb-send:disabled { opacity: 0.7; cursor: progress; }
.fb-msg { margin: 0; font-weight: 700; }

/* ---------- info */
.info { margin-top: 56px; }
.info h2 {
  font: 800 1.6rem/1.2 var(--display);
  margin: 0 0 6px;
}
.info-grid { display: grid; gap: 0; }
.info-item { border-top: 1px solid var(--line); }
.info-item:last-child { border-bottom: 1px solid var(--line); }
.info-item summary {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 52px; padding: 10px 2px;
  font: 800 1.1rem var(--display); cursor: pointer; list-style: none;
}
.info-item summary::-webkit-details-marker { display: none; }
.info-item summary::after {   /* a chevron that turns when open */
  content: ""; flex: none; width: 10px; height: 10px; margin-right: 6px;
  border-right: 3px solid var(--accent); border-bottom: 3px solid var(--accent);
  transform: rotate(45deg) translateY(-3px); transition: transform 0.15s;
}
.info-item[open] summary::after { transform: rotate(225deg) translateY(-3px); }
.info-item p { margin: 0; padding: 0 2px 16px; max-width: 64ch; }

/* ---------- footer */
.foot { margin-top: 56px; padding-bottom: 40px; color: var(--muted); }
.foot p { margin: 0 0 6px; max-width: 64ch; }
.foot-small { font-size: 0.85rem; }

@keyframes blink { 50% { opacity: 0.3; } }
@keyframes twinkle { from { filter: brightness(0.75); } to { filter: brightness(1.35); } }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(63, 163, 122, 0.6); }
  100% { box-shadow: 0 0 0 18px rgba(63, 163, 122, 0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* "Español" / "English" link under the date */
.lang-link { display: inline-block; margin-top: 4px; padding: 4px 0; font-weight: 700; font-size: 0.95rem; }
