/* Custom styles on top of Pico.css */

[x-cloak] { display: none !important; }

article {
  margin-bottom: 1rem;
}

article header {
  margin-bottom: 0.5rem;
}

mark {
  padding: 0.1em 0.4em;
  font-size: 0.8em;
  border-radius: 0.2em;
}

details summary {
  cursor: pointer;
}

fieldset {
  margin-bottom: 0.5rem;
}

/* Page layout
   Mobile: results on top, filter below (so user sees the map first).
   Desktop (>=768px): filter sidebar left, results main area right. */
.page-layout {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  grid-template-areas:
    "results"
    "filter";
  margin-top: 1rem;
}

.filter-sidebar { grid-area: filter; }
.results { grid-area: results; }

@media (min-width: 768px) {
  .page-layout {
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-areas: "filter results";
    align-items: start;
  }
}

/* Filter sidebar — plain div, no collapse */

.filter-sidebar fieldset {
  margin: 0 0 1rem 0;
  border: 0;
  padding: 0;
}

.filter-sidebar fieldset legend {
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding: 0;
  font-size: 0.95rem;
}

.filter-sidebar fieldset label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.2rem 0;
  cursor: pointer;
}

.filter-sidebar fieldset label.facet-zero {
  opacity: 0.4;
}

.filter-sidebar fieldset label input[type="checkbox"] {
  margin: 0;
  flex: 0 0 auto;
}

.filter-sidebar fieldset label small {
  margin-left: 0.15rem;
}

.filter-sidebar fieldset label .info-icon {
  margin-left: auto;
}

.filter-sidebar > .filter-panel > button {
  width: 100%;
  margin: 0;
}

/* Date-range fieldset uses block labels (different from checkbox labels) */
.filter-sidebar fieldset.date-range label {
  display: block;
  margin-bottom: 0.5rem;
}

.filter-sidebar fieldset.date-range input[type="date"] {
  width: 100%;
  margin-top: 0.2rem;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  font-size: 0.95em;
  color: var(--pico-muted-color);
  cursor: help;
  margin-left: 0.15em;
  user-select: none;
}

.info-icon:hover,
.info-icon:focus {
  color: var(--pico-primary);
  outline: none;
}

[data-tooltip] {
  border-bottom: none !important;
}

footer {
  margin-top: 3rem;
  padding-bottom: 2rem;
}

.format-dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  margin-right: 0.25em;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.view-toggle {
  margin: 1rem 0 0.5rem;
  display: flex;
  gap: 0.5rem;
}

.view-toggle button {
  flex: 0 1 auto;
  margin: 0;
}

/* No focus ring on view-toggle buttons — the active state is already shown
   via the primary/outline class swap, so the outline is redundant noise. */
.view-toggle button,
.view-toggle button:hover,
.view-toggle button:focus,
.view-toggle button:focus-visible,
.view-toggle button:active,
.bottom-nav button,
.bottom-nav button:hover,
.bottom-nav button:focus,
.bottom-nav button:focus-visible,
.bottom-nav button:active {
  box-shadow: none !important;
  outline: none !important;
  --pico-box-shadow: none;
}

/* Desktop view-toggle: inline above results; hidden on mobile */
@media (max-width: 767px) {
  .view-toggle-desktop {
    display: none;
  }
}

/* Mobile fixed bottom nav (separate element, lives outside the grid) */
.bottom-nav {
  display: none;
}

@media (max-width: 767px) {
  .bottom-nav {
    /* All !important — defending against any Pico/Alpine override */
    display: flex !important;
    gap: 0.5rem !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: auto !important;
    top: auto !important;
    width: 100vw !important;
    max-width: 100vw !important;
    box-sizing: border-box !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 0.5rem 0.75rem !important;
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom)) !important;
    background: var(--pico-card-background-color);
    border-top: 1px solid var(--pico-muted-border-color);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.12);
  }

  .bottom-nav button {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    padding: 0.5rem;
  }

  body {
    padding-bottom: 5rem;
  }
}

/* Form submit area: spacing from consent + compact button.
   Use the same flex pattern as .view-toggle so the button gets its
   intrinsic width and isn't stretched by Pico's form flex column. */
.form-actions {
  margin-top: 2rem;
  display: flex;
  gap: 0.5rem;
}

.form-actions button {
  flex: 0 1 auto;
  width: auto;
  margin: 0;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

#map {
  height: 600px;
  width: 100%;
  border-radius: 0.5rem;
  z-index: 0;
}

/* Pico.css' link styles interfere with Leaflet's zoom buttons —
   restore Leaflet's expected sizing for the +/- controls. */
.leaflet-bar a,
.leaflet-bar a:hover,
.leaflet-bar a:focus {
  width: 30px;
  height: 30px;
  line-height: 30px;
  padding: 0;
  text-align: center;
  font-size: 22px;
  font-weight: bold;
  display: block;
  color: #333;
  background-color: #fff;
  text-decoration: none;
  border-bottom: 1px solid #ccc;
}

.leaflet-bar a:hover {
  background-color: #f4f4f4;
}

/* Calendar view */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.calendar-header strong {
  font-size: 1.2rem;
  text-transform: capitalize;
}

.calendar-header button {
  width: auto;
  padding: 0.4rem 0.8rem;
  margin: 0;
  font-size: 1.2rem;
  line-height: 1;
}

.calendar-today {
  width: auto !important;
  padding: 0.3rem 0.8rem !important;
  margin: 0 0 0.75rem 0 !important;
  font-size: 0.85rem !important;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--pico-muted-border-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.3rem;
  overflow: hidden;
}

.calendar-weekday {
  background: var(--pico-card-background-color);
  padding: 0.4rem 0.3rem;
  font-weight: 600;
  text-align: center;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  text-transform: uppercase;
}

.calendar-day {
  background: var(--pico-background-color);
  min-height: 90px;
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow: hidden;
}

.calendar-day.other-month {
  opacity: 0.35;
}

.calendar-day.is-today {
  background: var(--pico-card-background-color);
  outline: 2px solid var(--pico-primary);
  outline-offset: -2px;
}

.calendar-day .day-num {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--pico-muted-color);
  margin-bottom: 0.1rem;
}

.calendar-day .event-chip {
  display: block;
  font-size: 0.7rem;
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  line-height: 1.3;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.calendar-day .event-chip:hover {
  opacity: 0.85;
}

@media (max-width: 767px) {
  /* Mobile: dots instead of text chips — 7-col grid is too narrow for names.
     Day cells switch from flex-column to block so dots flow inline and wrap. */
  .calendar-day {
    min-height: 56px;
    padding: 0.2rem;
    display: block;
  }
  .calendar-weekday {
    font-size: 0.7rem;
    padding: 0.3rem 0.1rem;
  }
  .calendar-day .day-num {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 0.2rem;
  }
  .calendar-day .event-chip {
    display: inline-block;
    width: 9px;
    height: 9px;
    padding: 0;
    margin: 1px;
    border-radius: 50%;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.2);
    vertical-align: middle;
  }
}

.leaflet-popup-content {
  margin: 0.5rem 0.75rem;
  line-height: 1.4;
}

.leaflet-popup-content a {
  font-weight: 600;
}

@media (max-width: 768px) {
  #map {
    height: 420px;
  }
}

/* Top navigation — keep all items vertically centered on one baseline */

.top-nav ul {
  align-items: center;
}

.top-nav ul > li {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem;
}

.top-nav ul > li > a,
.top-nav ul > li > details {
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.top-nav ul > li > details > summary {
  margin: 0;
  padding: 0;
  line-height: inherit;
  display: inline-flex;
  align-items: center;
}

/* Language switcher — compact DE/EN, active part bold */
.lang-switch {
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.lang-switch strong {
  font-weight: 700;
}

/* Hamburger dropdown */
.menu-dropdown {
  margin: 0;
}

.menu-dropdown > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.6rem;
  margin: 0;
  line-height: 1;
  cursor: pointer;
  list-style: none;
}

/* Remove Pico's caret arrow from the hamburger summary */
.menu-dropdown > summary::after,
.menu-dropdown > summary::-webkit-details-marker {
  display: none !important;
  content: "" !important;
  background: none !important;
}

.menu-dropdown > summary::marker {
  content: "";
}

.icon-hamburger {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
  color: currentColor;
}

/* Anchor the hamburger menu to the right edge of the summary so it doesn't
   overflow off-screen. Pico positions the panel absolute by default — we
   only flip its anchor from left:0 to right:0. */
.menu-dropdown {
  position: relative;
}

.top-nav .menu-dropdown > summary + ul,
.menu-dropdown > summary + ul {
  position: absolute;
  right: 0;
  left: auto;
  min-width: 14rem;
  max-width: calc(100vw - 1rem);
}

/* Formats dropdown: text link styling for the summary (not a button) */
.formats-dropdown > summary {
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.formats-dropdown > summary::after {
  /* Keep Pico's caret indicator; just tighten spacing */
  margin-left: 0.3em;
}

.formats-dropdown ul {
  min-width: 16rem;
}

.formats-dropdown ul a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Hide on mobile what the hamburger replaces? — we WANT Events + Formats
   visible at all sizes; only collapse them inside the hamburger if they
   don't fit. Keep them visible by default. */

/* Formats overview page */
.formats-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .formats-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.format-card {
  margin: 0;
}

.format-card header {
  margin-bottom: 0.25rem;
}

.format-card header h2 {
  margin-bottom: 0.1rem;
  font-size: 1.3rem;
}

.format-card header h2 a {
  text-decoration: none;
}

.format-card header h2 a:hover {
  text-decoration: underline;
}

.format-card footer {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
  font-size: 0.9rem;
}
