/* Public live map (portal/live_map.html). The light look follows the site's colours;
   the night look darkens only the map and the panels that sit on it. Overlays keep
   their z-index inside .lm-stage so menus and sheets stay above the map. */

.lm {
  --lm-panel: var(--md-sys-color-surface, #fdf7ff);
  --lm-panel-border: var(--md-sys-color-outline-variant, #cac4cf);
  --lm-ink: var(--md-sys-color-on-surface, #1c1b20);
  --lm-muted: var(--md-sys-color-on-surface-variant, #48454e);
  --lm-accent: var(--md-sys-color-primary, #673bdd);
  --lm-live: #d93025;
  position: relative;
  color: var(--lm-ink);
}

.lm--night {
  --lm-panel: rgba(16, 18, 31, 0.9);
  --lm-panel-border: rgba(255, 255, 255, 0.16);
  --lm-ink: #eceaf4;
  --lm-muted: #b3b0c2;
  --lm-accent: #b9a2ff;
  --lm-live: #ff6b5f;
}

.lm-stage {
  position: relative;
  isolation: isolate;
  height: calc(100vh - 140px);
  min-height: 480px;
  overflow: hidden;
  background: var(--md-sys-color-surface-container, #f2ecf4);
}

.lm--night .lm-stage {
  background: radial-gradient(circle at 50% 45%, #10183a 0%, #07080f 70%);
}

.lm-canvas {
  position: absolute;
  inset: 0;
}

.lm--night .maplibregl-ctrl-group,
.lm--night .maplibregl-ctrl-attrib {
  background: rgba(16, 18, 31, 0.85);
  color: var(--lm-muted);
}

.lm--night .maplibregl-ctrl-group button .maplibregl-ctrl-icon {
  filter: invert(1);
}

.lm--night .maplibregl-ctrl-attrib a {
  color: var(--lm-muted);
}

/* Floating controls */
.lm-layers,
.lm-time {
  position: absolute;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  max-width: calc(100% - 32px);
}

.lm-layers {
  top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.lm-time {
  bottom: 24px;
  padding: 4px;
  border-radius: 999px;
  background: var(--lm-panel);
  border: 1px solid var(--lm-panel-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
}

.lm-chip,
.lm-time__btn {
  font: inherit;
  cursor: pointer;
  color: var(--lm-ink);
}

.lm-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 12px;
  border: 1px solid var(--lm-panel-border);
  background: var(--lm-panel);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

.lm-chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--lm-c);
  box-shadow: 0 0 8px var(--lm-c);
}

.lm-chip[aria-pressed="false"] {
  opacity: 0.5;
}

.lm-chip[aria-pressed="false"] i {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--lm-c);
}

.lm-chip__count {
  font-weight: 500;
  color: var(--lm-muted);
}

.lm-time__btn {
  border: 0;
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--lm-muted);
}

.lm-time__btn[aria-pressed="true"] {
  background: var(--lm-accent);
  color: var(--md-sys-color-on-primary, #fff);
}

.lm--night .lm-time__btn[aria-pressed="true"] {
  color: #1c1238;
}

.lm-time__btn.is-live::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-inline-end: 7px;
  border-radius: 50%;
  background: var(--lm-live);
  box-shadow: 0 0 6px var(--lm-live);
  vertical-align: 1px;
}

.lm-chip:focus-visible,
.lm-time__btn:focus-visible,
.lm-pin:focus-visible,
.lm-card__close:focus-visible {
  outline: 3px solid var(--lm-accent);
  outline-offset: 2px;
}

/* Pins */
.lm-pin {
  position: relative;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--lm-c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 12px var(--lm-c);
  cursor: pointer;
  color: #fff;
  font: 700 10px/1 var(--md-ref-typeface-plain, system-ui, sans-serif);
}

.lm-pin.has-count {
  width: 24px;
  height: 24px;
}

.lm-pin.is-live::before,
.lm-pin.is-live::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 2px solid var(--lm-c);
  animation: lm-pulse 1.8s ease-out infinite;
  pointer-events: none;
}

.lm-pin.is-live::after {
  inset: -17px;
  animation-delay: 0.6s;
}

@keyframes lm-pulse {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(1.25); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lm-pin.is-live::before,
  .lm-pin.is-live::after {
    animation: none;
    opacity: 0.45;
  }
}

/* Live now panel (on the map on wide screens, under it on phones) */
.lm-panel {
  position: absolute;
  z-index: 2;
  top: 72px;
  left: 16px;
  width: 300px;
  max-height: calc(100% - 170px);
  overflow: auto;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--lm-panel);
  border: 1px solid var(--lm-panel-border);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
}

.lm-panel__kicker {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--lm-accent);
}

.lm-panel__title {
  margin: 2px 0 10px;
  font-family: var(--pub-font-heading, var(--md-ref-typeface-brand));
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 400;
}

.lm-panel__heading {
  margin: 0;
  font-family: var(--md-ref-typeface-plain, system-ui, sans-serif);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lm-muted);
}

.lm-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.lm-list__item a {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--lm-panel-border);
  color: inherit;
  text-decoration: none;
  line-height: 1.35;
  font-size: 0.875rem;
}

.lm-list__item a:hover .lm-list__title {
  text-decoration: underline;
}

.lm-list__title {
  font-weight: 500;
}

.lm-list__meta {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--lm-muted);
}

.lm-list__empty {
  padding: 8px 0;
  font-size: 0.875rem;
  color: var(--lm-muted);
}

.lm-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--lm-c);
}

.lm-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-inline-end: 5px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lm-live);
}

.lm-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--lm-live);
}

/* A long-running event: labelled, but it does not pulse like live news. */
.lm-ongoing {
  margin-inline-end: 5px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
}
[dir="rtl"] :is(.lm-live, .lm-ongoing) { text-transform: none; letter-spacing: 0; }

/* Place card */
.lm-card {
  position: absolute;
  z-index: 3;
  top: 72px;
  right: 60px;
  width: 320px;
  max-height: calc(100% - 170px);
  overflow: auto;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--lm-panel);
  border: 1px solid var(--lm-panel-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(12px);
}

.lm-card:focus {
  outline: none;
}

.lm-chip[hidden],
.lm-card[hidden] {
  display: none;
}

.lm-card__close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--lm-muted);
  cursor: pointer;
}

.lm-card__title {
  margin: 0 32px 2px 0;
  font-family: var(--pub-font-heading, var(--md-ref-typeface-brand));
  font-size: 1.375rem;
  line-height: 1.2;
  font-weight: 400;
}

.lm-card__meta {
  margin: 0 0 6px;
  font-size: 0.8125rem;
  color: var(--lm-muted);
}

.lm-card__all {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--lm-panel-border);
  color: var(--lm-accent);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.lm-note,
.lm-preview {
  position: absolute;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  bottom: 84px;
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--lm-panel);
  border: 1px solid var(--lm-panel-border);
  font-size: 0.8125rem;
  color: var(--lm-muted);
  white-space: nowrap;
}

.lm-preview {
  top: auto;
  bottom: auto;
  top: 64px;
  background: #fff4e5;
  border-color: #f0b46b;
  color: #6b3d00;
}

.lm-note[hidden] {
  display: none;
}

.lm--no-map .lm-canvas,
.lm--no-map .lm-layers,
.lm--no-map .lm-time {
  display: none;
}

.lm--no-map .lm-stage {
  height: auto;
  min-height: 0;
  padding: 16px;
}

.lm--no-map .lm-note {
  position: static;
  transform: none;
  white-space: normal;
}

@media (max-width: 760px) {
  .lm-stage {
    height: 62vh;
    min-height: 380px;
  }

  .lm-layers {
    top: 10px;
    left: 0;
    right: 0;
    transform: none;
    max-width: none;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 0 12px;
    scrollbar-width: none;
  }

  .lm-chip {
    flex: none;
    padding: 6px 10px;
    font-size: 0.8125rem;
  }

  .lm-time {
    bottom: 14px;
  }

  .lm-time__btn {
    padding: 7px 9px;
    font-size: 0.8125rem;
  }

  .lm-note {
    bottom: 64px;
    white-space: normal;
    width: calc(100% - 32px);
    text-align: center;
    border-radius: 12px;
  }

  .lm-card {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 64px;
    width: auto;
    max-height: 60%;
  }

  .lm-panel {
    position: static;
    width: auto;
    max-height: none;
    margin: 0;
    border-radius: 0;
    border: 0;
    border-top: 1px solid var(--lm-panel-border);
    box-shadow: none;
    background: var(--md-sys-color-surface, #fdf7ff);
    color: var(--md-sys-color-on-surface, #1c1b20);
    padding: 16px;
  }

  /* Under the map the list sits on the page, so it takes the site's colours. */
  .lm--night .lm-panel {
    --lm-panel-border: var(--md-sys-color-outline-variant, #cac4cf);
    --lm-ink: var(--md-sys-color-on-surface, #1c1b20);
    --lm-muted: var(--md-sys-color-on-surface-variant, #48454e);
    --lm-accent: var(--md-sys-color-primary, #673bdd);
    --lm-live: #d93025;
  }
}
