/*
  Monochrome dark map. Near-black base, neutral grays, one off-white
  accent used sparingly for active/selected state and "happening now"
  emphasis. No color-coding by hue; event type is read from marker icon
  shape, not color.

  Theme tokens and reset live in base.css, shared with event.php. This
  file only holds the map SPA's own fixed, non-scrolling viewport and
  the chrome drawn on top of it.
*/

html, body {
  height: 100%;
}

body {
  container-type: inline-size;
  container-name: shell;
  overflow: hidden;
}

#map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
}

/* MapLibre attribution control: keep it, but let it recede into the UI */
.maplibregl-ctrl-attrib {
  background: rgb(12 12 13 / 0.6) !important;
  color: var(--text-dim) !important;
}
.maplibregl-ctrl-attrib a {
  color: var(--text-dim) !important;
}

/* ---------- Top bar ---------- */

#topbar {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  padding: clamp(0.75rem, 2vw, 1.25rem) clamp(0.75rem, 3vw, 2rem);
  background: linear-gradient(to bottom, rgb(12 12 13 / 0.92), rgb(12 12 13 / 0));
  pointer-events: none;
}

#topbar > * {
  pointer-events: auto;
}

#filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  flex: 1;
  min-width: 0;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.filter-pill {
  appearance: none;
  border: 1px solid var(--line);
  background: rgb(24 24 27 / 0.85);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  text-transform: lowercase;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.75rem;
  min-height: 2.25rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.filter-pill.is-active {
  border-color: var(--accent);
  color: var(--bg);
  background: var(--accent);
  font-weight: 600;
}

.filter-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Genre dropdown: native <details>, no library ---------- */

.dropdown {
  position: relative;
}

.dropdown > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgb(24 24 27 / 0.85);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  padding: 0.4rem 0.75rem;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
}

.dropdown > summary::-webkit-details-marker {
  display: none;
}

.dropdown > summary:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.dropdown[open] > summary {
  border-color: var(--accent);
  color: var(--text);
}

.dropdown-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 220px;
  max-height: min(50dvh, 360px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  padding: 0.4rem;
  display: grid;
  gap: 0.1rem;
  z-index: 30;
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  min-height: 2.25rem;
}

.dropdown-option:hover {
  background: var(--surface-2);
}

/* ---------- Templates ---------- */

template {
  display: none;
}

/* ---------- Status line: transient loading/empty state only, no counts ---------- */

#status {
  position: fixed;
  inset-block-end: 0.75rem;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 9;
  margin: 0;
  padding: 0.35rem 0.9rem;
  background: rgb(24 24 27 / 0.85);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  pointer-events: none;
}

#status:empty {
  display: none;
}

/* ---------- Venue popup: compact, anchored to the marker on the map ---------- */

.maplibregl-popup-content {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.4);
  max-height: min(60vh, 420px);
  overflow-y: auto;
}

.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
  border-top-color: var(--surface);
}
.maplibregl-popup-anchor-top .maplibregl-popup-tip {
  border-bottom-color: var(--surface);
}
.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: var(--surface);
}
.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: var(--surface);
}

.maplibregl-popup-close-button {
  top: 0.5rem;
  right: 0.5rem;
  width: 1.6rem;
  height: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: transparent;
  font-size: 0;
}

.maplibregl-popup-close-button:hover {
  background: var(--line);
}

.maplibregl-popup-close-button::before,
.maplibregl-popup-close-button::after {
  content: "";
  position: absolute;
  width: 0.8rem;
  height: 2px;
  border-radius: 1px;
  background: var(--text-dim);
}

.maplibregl-popup-close-button::before {
  transform: rotate(45deg);
}

.maplibregl-popup-close-button::after {
  transform: rotate(-45deg);
}

.maplibregl-popup-close-button:hover::before,
.maplibregl-popup-close-button:hover::after {
  background: var(--text);
}

.popup-venue {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.3rem 2.5rem 0.6rem 0.5rem;
}

.popup-event-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  max-width: 220px;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  font: inherit;
}

.popup-event-link:hover,
.popup-event-link:focus-visible {
  background: var(--surface-2);
}

.popup-event-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.popup-event-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
}
