/* =========================================================
   SwissUp - Design system
   Couleurs : rouge suisse (#DA291C / #FF3B30) sur blanc neige
   Typographie : Space Grotesk (titres) + Inter (corps)
========================================================= */
:root {
  --swiss-red: #da291c;
  --swiss-red-soft: #ff5b4a;
  --swiss-red-deep: #a3120a;
  --swiss-red-glow: rgba(218, 41, 28, 0.18);
  --white: #ffffff;
  --snow: #fafafc;
  --snow-2: #f3f4f8;
  --ink: #1a1a1f;
  --ink-soft: #4a4a55;
  --ink-mute: #8a8a96;
  --line: #e6e6ee;
  --line-soft: #f0f0f6;

  --cat-expo: #6c5ce7;
  --cat-festival: #e84393;
  --cat-sport: #00b894;
  --cat-gastronomie: #f59f00;
  --cat-autre: #74809a;

  --cat-expo-bg: rgba(108, 92, 231, 0.12);
  --cat-festival-bg: rgba(232, 67, 147, 0.12);
  --cat-sport-bg: rgba(0, 184, 148, 0.12);
  --cat-gastronomie-bg: rgba(245, 159, 0, 0.12);
  --cat-autre-bg: rgba(116, 128, 154, 0.12);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --shadow-sm: 0 2px 8px rgba(20, 20, 40, 0.04);
  --shadow-md: 0 12px 28px -10px rgba(20, 20, 40, 0.12);
  --shadow-lg: 0 28px 64px -20px rgba(20, 20, 40, 0.18);
  --shadow-red: 0 18px 36px -16px rgba(218, 41, 28, 0.45);

  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  /* Spring-like, balanced both directions. Used for sheets/modals so the
     entry feels alive AND the exit doesn't snap back too hard. */
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  /* Softer-than-out — used for fades / micro-feedback, no overshoot. */
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);
  /* Subtle anticipation curve for tap "press" effect. */
  --ease-press: cubic-bezier(0.4, 0, 0.6, 1);
}

/* Respect users who explicitly request reduced motion: shorten everything
   and remove bounce/overshoot. We never disable transitions entirely
   because the UI relies on `transform` keyframes for sheets / modals. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }
html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 8% -10%, rgba(218, 41, 28, 0.08), transparent 60%),
    radial-gradient(900px 600px at 110% 12%, rgba(218, 41, 28, 0.05), transparent 60%),
    linear-gradient(180deg, #fbfbfd 0%, #f4f4f8 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: -0.01em;
  font-weight: 700;
  margin: 0;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

a {
  color: var(--swiss-red);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s var(--ease-out);
}
a:hover { border-bottom-color: var(--swiss-red); }

/* ====== LAYOUT ====== */
.app-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 32px 28px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand__logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: white;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.03);
  transition: transform 0.4s var(--ease-bounce);
}
.brand:hover .brand__logo { transform: rotate(-6deg) scale(1.05); }
.brand h1 { font-size: 22px; font-weight: 800; line-height: 1; }
.brand__subtitle { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-mute); letter-spacing: 0.02em; }

/* ====== VIEW SWITCH (3 tabs) ====== */
.view-switch {
  position: relative;
  display: inline-flex;
  padding: 5px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.view-switch__btn {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: color 0.3s var(--ease-out);
  white-space: nowrap;
}

.view-switch__btn.is-active { color: white; }
.view-switch__btn svg { flex-shrink: 0; }

.view-switch__pill {
  position: absolute;
  z-index: 1;
  top: 5px;
  bottom: 5px;
  left: 0;
  background: linear-gradient(135deg, var(--swiss-red) 0%, var(--swiss-red-soft) 100%);
  border-radius: 999px;
  box-shadow: var(--shadow-red);
  transition: transform 0.45s var(--ease-bounce), width 0.45s var(--ease-bounce);
}

/* ====== GENERIC CARD ====== */
.glass-card {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(20, 20, 50, 0.05);
}

.app-main { flex: 1; position: relative; }

/* Direction-aware view entrance: app.js sets --view-dx (+/-36px) on the
   incoming view so it slides from the side it lives on in the tab order. */
.view { display: none; animation: viewSlideIn 0.55s var(--ease-spring); }
.view.is-active { display: block; }

@keyframes viewSlideIn {
  0%   { opacity: 0; transform: translate(var(--view-dx, 0px), 16px) scale(0.995); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

@keyframes viewIn {
  0%   { opacity: 0; transform: translateY(18px) scale(0.99); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

/* ====== CATEGORY ICONS / BADGES ====== */
.cat-icon { display: inline-block; vertical-align: middle; }
.cat-icon--expo { color: var(--cat-expo); }
.cat-icon--festival { color: var(--cat-festival); }
.cat-icon--sport { color: var(--cat-sport); }
.cat-icon--gastronomie { color: var(--cat-gastronomie); }
.cat-icon--autre { color: var(--cat-autre); }

.cat-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--cat-autre-bg);
}
.cat-badge--expo { background: var(--cat-expo-bg); }
.cat-badge--festival { background: var(--cat-festival-bg); }
.cat-badge--sport { background: var(--cat-sport-bg); }
.cat-badge--gastronomie { background: var(--cat-gastronomie-bg); }
.cat-badge .cat-icon { width: 18px; height: 18px; }

/* ============================================================
   CALENDAR VIEW
============================================================ */
.calendar-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

/* Desktop: 50/50 split — the day's events on the LEFT (vertical 3-column
   card grid), the calendar + stats on the RIGHT. The events panel is
   height-locked to the right column (contain:size breaks the "content
   grows the row" cycle) and scrolls internally. */
@media (min-width: 1101px) {
  .calendar-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "events calendar"
      "events stats";
    grid-template-rows: auto auto;
    align-items: stretch;
  }
  .calendar-card { grid-area: calendar; }
  .calendar-side { grid-area: stats; }
  .calendar-layout > .day-detail {
    grid-area: events;
    contain: size;
    min-height: 560px;
    overflow: hidden;
  }
  /* Vertical scrolling 3-column card grid. The `.calendar-layout`
     prefix beats the base horizontal-rail rules defined further down
     in this stylesheet (same media-free specificity would lose). */
  .calendar-layout .day-detail__list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px 14px 2px;
    cursor: default;
  }
  .calendar-layout .day-detail__list > .event-card {
    width: auto;
    min-height: 250px;
  }
  /* "Show more" spans the full grid width at the bottom of the list. */
  .calendar-layout .day-detail__list > .sheet-more {
    grid-column: 1 / -1;
    width: 100%;
    flex: none;
  }
  .calendar-layout .day-detail__list::-webkit-scrollbar { width: 6px; height: auto; }
}

.calendar-card { padding: 28px; }

.calendar-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.calendar-card__title {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.calendar-card__title h2 {
  font-size: 26px;
  text-transform: capitalize;
  background: linear-gradient(135deg, var(--ink) 0%, var(--swiss-red) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}
/* Quick "page reacted" pulse on every month-nav click. */
.calendar-card__title h2.is-pulsing {
  animation: labelPulse 0.5s var(--ease-spring);
}
@keyframes labelPulse {
  0%   { transform: translateY(0)     scale(1);   opacity: 1; }
  40%  { transform: translateY(-4px)  scale(1.05); opacity: 0.7; }
  100% { transform: translateY(0)     scale(1);   opacity: 1; }
}

.cal-nav-btn {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: var(--ink-soft);
  background: var(--snow);
  transition: all 0.25s var(--ease-out);
}
.cal-nav-btn:hover {
  background: var(--swiss-red);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-red);
}

.cal-today-btn {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--swiss-red);
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--swiss-red-glow);
  transition: all 0.25s var(--ease-out);
}
.cal-today-btn:hover { background: var(--swiss-red); color: white; }

.calendar-card__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.calendar-card__weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 6px 0;
}

.calendar-card__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-day {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: var(--snow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 8px 6px 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition:
    transform 0.25s var(--ease-spring),
    background 0.25s var(--ease-soft),
    box-shadow 0.25s var(--ease-soft),
    color 0.25s var(--ease-soft),
    border-color 0.25s var(--ease-soft);
  border: 1px solid transparent;
  overflow: hidden;
  animation: dayPop 0.5s var(--ease-spring) backwards;
}
@media (hover: hover) {
  .cal-day:hover:not(.is-empty) {
    transform: translateY(-3px) scale(1.02);
    background: white;
    border-color: var(--line);
    box-shadow: var(--shadow-md);
    z-index: 2;
  }
}
.cal-day:active:not(.is-empty) {
  transform: scale(0.94);
  transition-duration: 0.08s;
}
.cal-day.is-empty { background: transparent; cursor: default; }
.cal-day.is-other-month { color: var(--ink-mute); opacity: 0.5; }
.cal-day.is-today {
  background: linear-gradient(135deg, var(--swiss-red) 0%, var(--swiss-red-soft) 100%);
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow-red);
}
.cal-day.is-today:hover {
  background: linear-gradient(135deg, var(--swiss-red-deep) 0%, var(--swiss-red) 100%);
}
.cal-day.is-selected {
  border-color: var(--swiss-red);
  background: white;
  color: var(--ink);
  box-shadow: 0 0 0 3px var(--swiss-red-glow), var(--shadow-md);
}
.cal-day.is-selected.is-today {
  background: linear-gradient(135deg, var(--swiss-red) 0%, var(--swiss-red-soft) 100%);
  color: white;
  border-color: white;
  box-shadow: 0 0 0 3px var(--swiss-red-glow), var(--shadow-red);
}

/* Clean cell design: the day number on top, the event count as a soft
   red pill at the bottom. No category icons — that detail belongs to the
   event cards, not the grid. */
.cal-day { justify-content: space-between; }
.cal-day__num { font-size: 15px; font-weight: 600; line-height: 1; margin-top: 2px; }
.cal-day__count {
  align-self: center;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--swiss-red);
  background: var(--swiss-red-glow);
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.25;
}
.cal-day.is-today .cal-day__count { color: var(--swiss-red); background: rgba(255, 255, 255, 0.92); }
.cal-day.is-selected .cal-day__count { background: var(--swiss-red); color: white; }

@keyframes dayPop {
  0%   { opacity: 0; transform: scale(0.82) translateY(4px); }
  60%  { opacity: 1; transform: scale(1.02) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ====== SIDE (calendar) ====== */
.calendar-side { display: flex; flex-direction: column; gap: 18px; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.stat {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.3s var(--ease-out);
}
.stat:hover { transform: translateY(-3px); }

.stat:first-child {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--swiss-red) 0%, var(--swiss-red-soft) 100%);
  color: white;
  box-shadow: var(--shadow-red);
}
.stat:first-child .stat__label { color: rgba(255, 255, 255, 0.85); }

/* The "active events" stat is a real button: click = jump to today's
   events in the day panel. Button reset + affordance chevron. */
.stat--action {
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.stat--action:active { transform: translateY(-1px) scale(0.985); }
.stat__go {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.55;
  transition: transform 0.25s var(--ease-out), opacity 0.2s;
}
.stat--action:hover .stat__go { transform: translateY(-50%) translateX(3px); opacity: 1; }

.stat__value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
.stat__label { font-size: 12px; color: var(--ink-mute); font-weight: 500; letter-spacing: 0.02em; }

/* Desktop: left half of the calendar view — the selected day's events in
   a vertical 3-column card grid (see the ≥1101px layout block above).
   Mobile (≤1100px): becomes a bottom sheet with a horizontal card rail. */
.day-detail {
  padding: 22px 22px 12px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.day-detail__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.day-detail__header > div:first-of-type { flex: 1 1 auto; min-width: 0; }

.day-detail__date {
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 600;
  text-transform: capitalize;
}
.day-detail__count { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }

.day-detail__bigday {
  font-family: "Space Grotesk", sans-serif;
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--swiss-red) 0%, var(--swiss-red-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Horizontal card rail (same recipe as canton panel / search rows). */
.day-detail__list {
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: row;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.day-detail__list::-webkit-scrollbar { height: 6px; }
.day-detail__list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.day-detail__list > .event-card {
  flex: 0 0 300px;
  width: 300px;
}

.day-detail__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--snow);
  cursor: pointer;
  transition:
    transform 0.25s var(--ease-spring),
    background 0.25s var(--ease-soft),
    box-shadow 0.25s var(--ease-soft);
  animation: itemIn 0.5s var(--ease-spring) backwards;
}

@keyframes itemIn {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* Hover lift only on real pointer devices — keeps the mobile tap snappy. */
@media (hover: hover) {
  .day-detail__item:hover {
    background: white;
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
  }
}
/* Tactile press feedback. */
.day-detail__item:active {
  transform: scale(0.98);
  transition-duration: 0.1s;
}

.day-detail__info { flex: 1; min-width: 0; }

.day-detail__title {
  font-weight: 600;
  font-size: 13.5px;
  margin: 0 0 3px;
  color: var(--ink);
}

.day-detail__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-mute);
  flex-wrap: wrap;
}

.day-detail__canton {
  font-weight: 700;
  color: var(--swiss-red);
  background: var(--swiss-red-glow);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.day-detail__empty {
  color: var(--ink-mute);
  font-size: 13px;
  text-align: center;
  padding: 40px 16px;
  line-height: 1.5;
  list-style: none;
  width: 100%;
  margin: 0;
}

/* ============================================================
   MAP VIEW
============================================================ */
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.map-card { padding: 28px; position: relative; }

/* Desktop: same 50/50 split as the calendar view — the selected canton's
   events on the LEFT (vertical 3-column card grid), the map on the RIGHT.
   The events panel is height-locked to the map card (contain:size breaks
   the "content grows the row" cycle) and scrolls internally. */
@media (min-width: 1101px) {
  .map-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "events map";
    align-items: stretch;
  }
  /* The "Aller à" dropdown overflows the map card to the left, over the
     events panel — keep the map card painted on top of its sibling. */
  .map-card {
    grid-area: map;
    z-index: 2;
    display: flex;
    flex-direction: column;
  }
  .map-stage { flex: 1 1 auto; }
  .map-layout > .canton-panel {
    grid-area: events;
    z-index: 1;
    contain: size;
    min-height: 560px;
    overflow: hidden;
  }
  /* Vertical scrolling 3-column card grid (overrides the horizontal
     rail recipe defined below — hence the .map-layout prefix). */
  .map-layout .canton-panel__body {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 8px 14px 2px;
    cursor: default;
  }
  .map-layout .canton-panel__body > .event-card {
    width: auto;
    min-height: 250px;
  }
  .map-layout .canton-panel__body > .sheet-more {
    grid-column: 1 / -1;
    width: 100%;
    flex: none;
  }
  .map-layout .canton-panel__body::-webkit-scrollbar { width: 6px; height: auto; }
  /* Empty state fills the whole panel and centres its message. */
  .map-layout .canton-panel__empty {
    grid-column: 1 / -1;
    align-self: center;
    padding: 80px 24px;
  }
}

.map-card__header {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
/* Title block pushes the "Aller à" picker + funnel icon to the right,
   grouped together as one compact control cluster. */
.map-card__header > div:first-child { margin-right: auto; }

.map-card__header h2 { font-size: 22px; }

.map-card__subtitle { margin: 4px 0 0; font-size: 13px; color: var(--ink-mute); max-width: 480px; }

/* (The old "Faible → Élevé" heat legend was removed: the bubble sizes and
   counts already tell the story, and the header stays cleaner without it.) */

.map-stage {
  position: relative;
  width: 100%;
  /* The events panel moved below the map as a carousel, so the map can
     breathe: it now scales with the viewport instead of a fixed 600px. */
  height: clamp(540px, 62vh, 780px);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #eef1f5;
}

/* Leaflet root fills the stage. */
.leaflet-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #eef1f5;
}
.leaflet-container { font: inherit; background: #eef1f5; }
.leaflet-container a { color: var(--swiss-red); }

/* City marker pin (one per city, shows the event count). */
.city-pin-wrap { background: none; border: 0; }
.city-pin {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--swiss-red);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  line-height: 1;
  border: 2.5px solid #fff;
  box-shadow: 0 3px 10px -2px rgba(218, 41, 28, 0.6);
  transition: transform 0.12s var(--ease-press);
}
.city-pin-wrap:hover .city-pin { transform: scale(1.12); }

/* Cluster bubble (sum of events of all child cities). */
.city-cluster-wrap { background: none; border: 0; }
.city-cluster {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff5a4d, #c81e10);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 18px -4px rgba(200, 30, 16, 0.7);
}

/* Canton hover tooltip. */
.canton-tip {
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.5);
}
.canton-tip::before { display: none; }

.ch-map { width: 100%; height: 100%; display: block; transition: none; }

/* ----- Map controls (zoom / reset) ----- */
.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.map-control-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), background 0.2s var(--ease-out),
    color 0.2s var(--ease-out);
}
.map-control-btn:hover {
  background: var(--swiss-red);
  color: white;
  transform: translateY(-1px);
}
.map-control-btn:active { transform: scale(0.95); }

/* ----- Canton picker dropdown ----- */
.map-canton-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  background: white;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(20, 20, 40, 0.06);
  transition: box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.map-canton-picker:focus-within {
  border-color: var(--swiss-red);
  box-shadow: 0 0 0 3px var(--swiss-red-glow);
}

.map-canton-picker__label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  white-space: nowrap;
}

.map-canton-picker__field {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.map-canton-picker select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  padding: 4px 22px 4px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  border-radius: 999px;
  font-family: inherit;
  max-width: 180px;
  text-overflow: ellipsis;
}
.map-canton-picker select:focus { outline: none; }

.map-canton-picker__chev {
  position: absolute;
  right: 4px;
  pointer-events: none;
  color: var(--swiss-red);
}

.map-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(20, 20, 40, 0.78);
  color: white;
  font-size: 11.5px;
  font-weight: 500;
  pointer-events: none;
  z-index: 1000;
  backdrop-filter: blur(8px);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.map-hint__icon { display: inline-flex; line-height: 0; opacity: 0.8; }
.map-hint.is-hidden { opacity: 0; transform: translateX(-50%) translateY(8px); }

.ch-map .canton {
  fill: #ffffff;
  stroke: #c8c8d4;
  stroke-width: 0.6;
  stroke-linejoin: round;
  cursor: pointer;
  transition:
    fill 0.4s var(--ease-soft),
    stroke 0.3s var(--ease-soft),
    stroke-width 0.3s var(--ease-soft),
    transform 0.35s var(--ease-spring),
    filter 0.3s var(--ease-soft);
  transform-origin: center;
  transform-box: fill-box;
}
.ch-map .canton.has-events { fill: var(--swiss-red); }
.ch-map .canton.lvl-1 { fill: #f7c8c3; }
.ch-map .canton.lvl-2 { fill: #ef8478; }
.ch-map .canton.lvl-3 { fill: #da291c; }
.ch-map .canton:hover {
  fill: var(--swiss-red-deep);
  stroke: var(--swiss-red-deep);
  stroke-width: 1.4;
  filter: drop-shadow(0 6px 12px rgba(218, 41, 28, 0.4));
}
.ch-map .canton:hover:not(.has-events) {
  fill: #fff5f4;
  stroke: var(--swiss-red);
  filter: drop-shadow(0 4px 10px rgba(218, 41, 28, 0.2));
}
.ch-map .canton.is-selected {
  fill: var(--swiss-red-deep);
  stroke: white;
  stroke-width: 1.8;
  filter: drop-shadow(0 10px 18px rgba(218, 41, 28, 0.55));
}

.ch-map .lake {
  fill: #cfe5f2;
  stroke: #a8cee0;
  stroke-width: 0.4;
  pointer-events: none;
  opacity: 0.85;
}

.ch-map .country {
  fill: none;
  stroke: rgba(20, 20, 50, 0.12);
  stroke-width: 0.4;
  pointer-events: none;
}

/* ----- Canton labels (helps non-Swiss users locate cantons) ----- */
.ch-map .canton-label {
  font-family: "Inter", sans-serif;
  font-size: 11px;
  font-weight: 700;
  fill: rgba(50, 50, 70, 0.55);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  user-select: none;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 2.5px;
  stroke-linejoin: round;
}
.ch-map .canton-label--active {
  fill: white;
  stroke: rgba(218, 41, 28, 0.25);
  stroke-width: 1.5px;
}

/* Map markers (numeric badges) */
.map-marker { pointer-events: none; transform-box: fill-box; transform-origin: center; animation: markerIn 0.55s var(--ease-bounce) backwards; }
.map-marker__circle {
  fill: white;
  stroke: var(--swiss-red);
  stroke-width: 2;
  filter: drop-shadow(0 4px 10px rgba(218, 41, 28, 0.35));
}
.map-marker__text {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  fill: var(--swiss-red);
  text-anchor: middle;
  dominant-baseline: central;
  font-size: 14px;
}

@keyframes markerIn {
  from { opacity: 0; transform: scale(0.4); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- City markers layer ---------------------------------------
 * Two-stage reveal driven by the `.ch-map--city-zoom` class which the
 * runtime sets when the user zooms past CITY_ZOOM_THRESHOLD. At canton
 * zoom we already show small recessive dots so the user *knows* there
 * are details to discover. One zoom click promotes them to full
 * brightness, fades the big canton numeric badges, and reveals the
 * per-city text labels. The dots themselves are counter-scaled in JS
 * so they stay at a stable screen size at all zoom levels.
 */
.city-markers-layer {
  opacity: 0.55;          /* visible-but-recessive at canton zoom */
  pointer-events: none;   /* let canton path taps through */
  transition: opacity 0.35s var(--ease-soft);
}
.city-labels-layer {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-soft);
}
.ch-map--city-zoom .city-markers-layer {
  opacity: 1;
  pointer-events: auto;
}
.ch-map--city-zoom .city-labels-layer {
  opacity: 1;
}
.ch-map--city-zoom .markers-layer {
  opacity: 0;
  pointer-events: none;
}
.markers-layer {
  transition: opacity 0.35s var(--ease-soft);
}

.city-marker {
  cursor: pointer;
  /* Pointer events are gated on the parent layer (see below). When at
     canton zoom level the whole layer is `pointer-events: none` so taps
     fall through to the canton path underneath. */
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: markerIn 0.4s var(--ease-bounce) backwards;
}
.ch-map--city-zoom .city-marker {
  pointer-events: auto;
}
.city-marker__dot {
  fill: var(--swiss-red);
  stroke: white;
  stroke-width: 2;
  filter: drop-shadow(0 3px 8px rgba(218, 41, 28, 0.45));
  transition: transform 0.18s var(--ease-spring), fill 0.18s;
  transform-box: fill-box;
  transform-origin: center;
}
.city-marker:hover .city-marker__dot,
.city-marker:focus .city-marker__dot {
  fill: #b71c1c;
  transform: scale(1.18);
}
.city-marker__count {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
  font-size: 9px;
  pointer-events: none;
}
.city-label {
  font-family: "Inter", sans-serif;
  font-size: 8px;
  font-weight: 600;
  fill: rgba(30, 30, 50, 0.85);
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2.5px;
  stroke-linejoin: round;
  pointer-events: none;
  user-select: none;
}

/* When in city-zoom mode the canton 2-letter labels would clutter the
 * view at the top — dim them so they don't compete with city names. */
.ch-map--city-zoom .canton-label {
  opacity: 0.35;
  transition: opacity 0.35s var(--ease-soft);
}

.map-tooltip {
  position: absolute;
  top: 0; left: 0;
  background: var(--ink);
  color: white;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -130%);
  transition: opacity 0.18s var(--ease-out);
  white-space: nowrap;
  z-index: 10;
  box-shadow: var(--shadow-lg);
}
.map-tooltip::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--ink);
}
.map-tooltip.is-visible { opacity: 1; }
.map-tooltip strong { display: block; font-weight: 700; font-size: 13px; }
.map-tooltip span { font-size: 11.5px; color: rgba(255, 255, 255, 0.7); }

/* ===== Canton panel =====
   Desktop: full-width strip below the map — the events slide sideways in
   a card carousel (arrows + drag) instead of a tall vertical list.
   Mobile (≤1100px): becomes a bottom sheet, see the responsive block. */
.canton-panel { padding: 22px 22px 12px; display: flex; flex-direction: column; position: relative; }

.canton-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.canton-panel__header > div:first-of-type { flex: 1 1 auto; min-width: 0; }

.canton-panel__abbr {
  display: inline-block;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  background: var(--swiss-red);
  color: white;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.canton-panel__header h3 { font-size: 22px; font-weight: 700; }
.canton-panel__header p { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-mute); }

.canton-panel__close {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--ink-mute);
  background: var(--snow);
  transition: all 0.2s var(--ease-out);
  visibility: hidden;
}
.canton-panel.is-selected .canton-panel__close { visibility: visible; }
.canton-panel__close:hover { background: var(--swiss-red); color: white; }

/* Horizontal card rail — shared recipe with the search result rows. */
.canton-panel__body {
  display: flex;
  flex-direction: row;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.canton-panel__body::-webkit-scrollbar { height: 6px; }
.canton-panel__body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.canton-panel__body > .event-card {
  flex: 0 0 300px;
  width: 300px;
}
/* "Afficher plus" inside a rail = slim card at the end of the row. */
.canton-panel__body > .sheet-more,
.day-detail__list > .sheet-more {
  flex: 0 0 130px;
  width: 130px;
  margin: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--radius-md);
  line-height: 1.4;
}
.canton-panel__empty { text-align: center; font-size: 13px; color: var(--ink-mute); padding: 40px 16px; line-height: 1.55; width: 100%; }

/* ============================================================
   EVENT CARD (used in canton panel + search results)
   Immersive design: the source image fills the card behind a
   dark scrim, text sits on top in white. Events WITHOUT an
   image get a category-tinted gradient + watermark icon, so
   both variants share the same silhouette and the list keeps
   a perfectly even rhythm.
============================================================ */
.event-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 300px;
  padding: 0;
  border-radius: var(--radius-md);
  /* Category gradient is ALWAYS painted underneath: it is the
     fallback when there is no image (or the hotlink 404s). */
  background: linear-gradient(150deg, #55617e 0%, #303a52 100%);
  border: 1px solid rgba(20, 20, 50, 0.12);
  flex-shrink: 0;
  cursor: pointer;
  transition:
    transform 0.3s var(--ease-spring),
    box-shadow 0.3s var(--ease-soft),
    border-color 0.25s var(--ease-soft);
  animation: itemIn 0.5s var(--ease-spring) backwards;
  overflow: hidden;
}
.event-card--expo { background: linear-gradient(150deg, #8b7cf0 0%, #43349b 100%); }
.event-card--festival { background: linear-gradient(150deg, #f06aab 0%, #8e2262 100%); }
.event-card--sport { background: linear-gradient(150deg, #16cfa8 0%, #00705c 100%); }
.event-card--gastronomie { background: linear-gradient(150deg, #ffb62e 0%, #b45309 100%); }
.event-card--autre { background: linear-gradient(150deg, #64748b 0%, #334155 100%); }

@media (hover: hover) {
  .event-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: transparent;
  }
  .event-card:hover .event-card__bg img { transform: scale(1.05); }
}
/* Tactile press — gives mobile users a confirmation that their tap landed. */
.event-card:active {
  transform: scale(0.985);
  transition-duration: 0.1s;
}

/* --- background layers ------------------------------------ */
.event-card__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.event-card__bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s var(--ease-soft);
}
/* No-image variant: watermark category icon over the gradient. */
.event-card__bg--fallback {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.28);
}
.event-card__bg--fallback svg { width: 92px; height: 92px; }

/* Readability scrim — strong at the bottom where the text lives. */
.event-card__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    180deg,
    rgba(10, 12, 24, 0.42) 0%,
    rgba(10, 12, 24, 0.14) 32%,
    rgba(10, 12, 24, 0.52) 62%,
    rgba(10, 12, 24, 0.9) 100%
  );
}

/* --- top row: category chip + canton arms ------------------ */
.event-card__top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.event-card__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: white;
  background: rgba(16, 18, 32, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 4px 11px;
  border-radius: 999px;
}
.event-card__chip > :not(.event-card__chip-dot) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-card__chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat-autre);
}
.event-card__chip-dot--expo { background: var(--cat-expo); }
.event-card__chip-dot--festival { background: var(--cat-festival); }
.event-card__chip-dot--sport { background: var(--cat-sport); }
.event-card__chip-dot--gastronomie { background: var(--cat-gastronomie); }
.event-card__arms { filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45)); }

/* --- bottom content ---------------------------------------- */
.event-card__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}
.event-card__content::before {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: -4px;
  top: -8px;
  z-index: -1;
  border-radius: 0 0 16px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.28) 55%, transparent 100%);
  pointer-events: none;
}

.event-card__title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  color: white;
  line-height: 1.25;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.85),
    0 2px 10px rgba(0, 0, 0, 0.45);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.event-card__content:not(:has(.event-card__desc)) .event-card__title {
  -webkit-line-clamp: 3;
  font-size: 17px;
  line-height: 1.22;
}

/* Venue subtitle: shown right under the title, before the description. */
.event-card__venue {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.005em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-card__venue svg { flex: 0 0 auto; opacity: 0.85; }

.event-card__desc {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.5;
  margin: 0;
  /* Clamp on the immersive card — the modal shows the full text. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-card__meta {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.78);
}

.event-card__meta-item { display: inline-flex; align-items: center; gap: 5px; }

.event-card__meta-item svg { opacity: 0.75; }

/* ============================================================
   SEARCH VIEW
============================================================ */
[hidden] { display: none !important; }

.search-results-state { display: flex; flex-direction: column; gap: 22px; }

/* NB: no backdrop-filter here — it would turn the popovers' position:fixed
   bottom sheets into header-relative boxes (hidden behind the result list).
   The raised z-index keeps the desktop popover panels above the results. */
.search-header {
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 60;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Search bar + filter toggle on one line; filters collapse below. */
.search-topline { display: flex; align-items: flex-start; gap: 10px; }
.search-bar-wrapper { position: relative; flex: 1 1 auto; min-width: 0; }

.search-filters-toggle {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 50px;
  min-width: 50px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line-soft);
  background: var(--snow);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out),
    color 0.2s var(--ease-out), transform 0.12s var(--ease-press);
}
.search-filters-toggle:hover { border-color: rgba(218, 41, 28, 0.4); }
.search-filters-toggle:active { transform: scale(0.96); }
.search-filters-toggle.is-open,
.search-filters-toggle.has-active {
  border-color: var(--swiss-red);
  color: var(--swiss-red);
  background: rgba(218, 41, 28, 0.06);
}
.search-filters-toggle__count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--swiss-red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
/* Filters are collapsed by default and revealed via the toggle. */
.search-filters[hidden] { display: none; }
.search-filters:not([hidden]) { animation: filtersSlideDown 0.3s var(--ease-soft); }
@keyframes filtersSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--snow);
  border-radius: 14px;
  border: 1px solid transparent;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

/* ----- Live suggestions popover ----- */
.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(20, 20, 40, 0.06);
  max-height: min(60vh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  animation: sugIn 0.18s var(--ease-out);
}
@keyframes sugIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.search-suggestions::-webkit-scrollbar { width: 6px; }
.search-suggestions::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.suggestion {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s var(--ease-out);
}
.suggestion:hover,
.suggestion.is-active {
  background: var(--snow);
}
.suggestion.is-active { background: var(--swiss-red-glow); }

.suggestion .cat-badge { width: 32px; height: 32px; flex-shrink: 0; }
.suggestion .cat-badge .cat-icon { width: 16px; height: 16px; }

.suggestion__text { flex: 1; min-width: 0; }
.suggestion__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestion__sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
}
.suggestion__sub > * {
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestion__canton {
  font-weight: 700;
  color: var(--swiss-red);
  background: var(--swiss-red-glow);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.suggestion__sep { opacity: 0.5; flex-shrink: 0; }
.suggestion__cat { font-weight: 500; flex-shrink: 0; }

.suggestion__arrow {
  color: var(--ink-mute);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  flex-shrink: 0;
}
.suggestion:hover .suggestion__arrow,
.suggestion.is-active .suggestion__arrow {
  opacity: 1;
  transform: translateX(0);
  color: var(--swiss-red);
}

.sug-mark {
  background: rgba(255, 222, 0, 0.55);
  color: inherit;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 3px;
}
.search-bar:focus-within {
  background: white;
  border-color: var(--swiss-red);
  box-shadow: 0 0 0 4px var(--swiss-red-glow);
}
.search-bar > svg:first-child { color: var(--ink-mute); flex-shrink: 0; }
.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: var(--ink);
  font-family: inherit;
  min-width: 0;
}
.search-bar input::placeholder { color: var(--ink-mute); }
.search-bar__clear {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--line);
  color: var(--ink-soft);
  transition: all 0.2s var(--ease-out);
  flex-shrink: 0;
}
.search-bar__clear:hover { background: var(--swiss-red); color: white; }

.search-filters { display: flex; flex-direction: column; gap: 12px; }

.filter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.filter-row__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  min-width: 80px;
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.chip-group--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--snow);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
  cursor: pointer;
}
.chip:hover { background: white; border-color: var(--ink-mute); transform: translateY(-1px); }
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
  box-shadow: var(--shadow-md);
}
.chip.is-active .cat-icon { filter: brightness(0) invert(1); }

.chip--cat.is-active.chip--cat-expo { background: var(--cat-expo); border-color: var(--cat-expo); }
.chip--cat.is-active.chip--cat-festival { background: var(--cat-festival); border-color: var(--cat-festival); }
.chip--cat.is-active.chip--cat-sport { background: var(--cat-sport); border-color: var(--cat-sport); }
.chip--cat.is-active.chip--cat-gastronomie { background: var(--cat-gastronomie); border-color: var(--cat-gastronomie); }
.chip--cat.is-active.chip--cat-autre { background: var(--cat-autre); border-color: var(--cat-autre); }

.chip--canton .chip__full { display: none; }
.chip--canton.is-active { background: var(--swiss-red); border-color: var(--swiss-red); color: white; }

.chip-empty { font-size: 12px; color: var(--ink-mute); padding: 8px 0; }

.search-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  transition: all 0.2s var(--ease-out);
  align-self: flex-start;
}
.search-reset:hover { background: var(--swiss-red); color: white; border-color: var(--swiss-red); }

.search-results-meta {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-mute);
  padding-left: 4px;
  letter-spacing: 0.02em;
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.search-empty {
  grid-column: 1 / -1;
  padding: 60px 24px;
  text-align: center;
  color: var(--ink-mute);
}
.search-empty svg { color: var(--ink-mute); margin-bottom: 14px; }
.search-empty h3 { font-size: 18px; color: var(--ink); margin-bottom: 6px; }
.search-empty p { font-size: 13px; margin: 0; }

/* "Voir tous les X résultats" — appears when the result list is capped */
.search-show-more {
  grid-column: 1 / -1;
  appearance: none;
  border: 1px dashed var(--line);
  background: var(--white);
  color: var(--swiss-red);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 16px 20px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.search-show-more:hover {
  background: var(--swiss-red-glow);
  border-color: var(--swiss-red);
  border-style: solid;
}
.search-show-more:active { transform: scale(0.98); }

/* ============================================================
   DETAIL SUB-VIEW (event detail + mini-map)
============================================================ */
.search-detail-state { display: flex; flex-direction: column; gap: 18px; }

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.2s var(--ease-out);
  align-self: flex-start;
}
.detail-back:hover {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
  transform: translateX(-3px);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}

.detail-card { padding: 28px; display: flex; flex-direction: column; gap: 16px; }

.detail-card__cat-row { display: flex; align-items: center; gap: 12px; }

.detail-card__title { font-size: 28px; line-height: 1.15; margin: 0; }

.detail-card__location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
}
.detail-card__location svg { color: var(--swiss-red); flex-shrink: 0; }

.detail-card__dates {
  display: flex;
  align-items: stretch;
  gap: 12px;
  background: var(--snow);
  padding: 14px;
  border-radius: var(--radius-md);
}
.detail-date { flex: 1; }
.detail-date__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.detail-date__value { font-family: "Space Grotesk", sans-serif; font-size: 16px; font-weight: 600; color: var(--ink); }
.detail-date__arrow { font-size: 18px; color: var(--swiss-red); align-self: center; }

.detail-card__desc { font-size: 15px; line-height: 1.6; color: var(--ink-soft); margin: 0; }

.detail-card__source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  align-self: flex-start;
}

/* Mini map */
.detail-map { padding: 22px; }
.detail-map__header h3 { font-size: 16px; margin-bottom: 4px; }
.detail-map__header p { font-size: 12.5px; color: var(--ink-mute); margin: 0 0 14px; }
.detail-map__stage {
  width: 100%;
  aspect-ratio: 1000 / 650;
  border-radius: var(--radius-md);
  background: var(--snow);
  padding: 8px;
  overflow: hidden;
}
.ch-map--mini .canton {
  fill: #ecedf2;
  stroke: #d8d8e2;
  stroke-width: 0.5;
  cursor: default;
  pointer-events: none;
}
.ch-map--mini .canton.is-highlight {
  fill: var(--swiss-red);
  stroke: white;
  stroke-width: 1.5;
  filter: drop-shadow(0 6px 14px rgba(218, 41, 28, 0.5));
}
.ch-map--mini .canton-label {
  fill: rgba(120, 120, 140, 0.5);
  font-size: 10px;
}
.ch-map--mini .canton-label--active { fill: rgba(120, 120, 140, 0.7); }
.ch-map--mini .lake { fill: #dfeaf1; stroke: #c8d6df; opacity: 0.6; }

.mini-map-marker { pointer-events: none; }
.mini-map-marker__dot {
  fill: white;
  stroke: var(--swiss-red);
  stroke-width: 2.5;
  filter: drop-shadow(0 3px 8px rgba(218, 41, 28, 0.55));
}
.mini-map-marker__pulse {
  fill: var(--swiss-red);
  opacity: 0.4;
  transform-origin: center;
  transform-box: fill-box;
  animation: pulse 1.8s var(--ease-out) infinite;
}
@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ============================================================
   CALENDAR PROVIDERS (multi-calendar adder)
============================================================ */
.cal-providers {
  background: var(--snow);
  padding: 14px 14px 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cal-providers__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.cal-providers__buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.cal-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 6px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.cal-btn:hover {
  transform: translateY(-2px);
  border-color: transparent;
  box-shadow: var(--shadow-md);
}
.cal-btn:focus-visible {
  outline: 2px solid var(--swiss-red);
  outline-offset: 2px;
}
.cal-btn--google:hover { background: #e8f0fe; color: #1A73E8; border-color: #1A73E8; }
.cal-btn--apple { color: #000; }
.cal-btn--apple:hover { background: #f0f0f0; border-color: #000; }
.cal-btn--outlook:hover { background: #e3eefa; color: #0078D4; border-color: #0078D4; }
.cal-btn--ics:hover { background: var(--swiss-red-glow); color: var(--swiss-red); border-color: var(--swiss-red); }
.cal-providers__hint {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--ink-mute);
  text-align: center;
  line-height: 1.4;
}

/* ============================================================
   MODAL (event detail)
============================================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s var(--ease-soft);
}
.modal.is-open { opacity: 1; pointer-events: auto; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 40, 0.55);
  /* Start un-blurred so the haze fades in alongside opacity. */
  backdrop-filter: blur(0px) saturate(100%);
  -webkit-backdrop-filter: blur(0px) saturate(100%);
  transition:
    backdrop-filter 0.4s var(--ease-soft),
    -webkit-backdrop-filter 0.4s var(--ease-soft);
}
.modal.is-open .modal__backdrop {
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.modal__panel {
  position: relative;
  max-width: 560px;
  width: 100%;
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  /* Slightly bigger initial offset + small scale = the panel "rises"
     into place rather than popping. Spring easing softens the landing. */
  transform: scale(0.94) translateY(32px);
  transition: transform 0.5s var(--ease-spring), opacity 0.35s var(--ease-soft);
  opacity: 0;
  /* dvh tracks the *visible* viewport on iOS (Safari toolbar shown or not),
     so the top of the panel — and its close button — always stays
     reachable. Plain vh is the fallback for older browsers. */
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  will-change: transform, opacity;
}
.modal.is-open .modal__panel {
  transform: none;
  opacity: 1;
}

/* Always-visible close: dark glass pill that reads on ANY background —
   white panel, event photo, gradient. Sticky so it stays reachable while
   the panel content scrolls. */
.modal__close {
  position: sticky;
  top: 0;
  float: right;
  margin: -8px -6px 0 12px;
  z-index: 20;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  background: rgba(16, 18, 32, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 10px rgba(10, 12, 24, 0.25);
  transition: all 0.2s var(--ease-out);
}
.modal__close:hover { background: var(--swiss-red); color: white; transform: rotate(90deg); }

.modal__cat-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }

.modal__cat-banner {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: white;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--cat-autre);
}
.modal__cat-banner--expo { background: var(--cat-expo); }
.modal__cat-banner--festival { background: var(--cat-festival); }
.modal__cat-banner--sport { background: var(--cat-sport); }
.modal__cat-banner--gastronomie { background: var(--cat-gastronomie); }

.modal__title { font-size: 26px; margin: 0 0 10px; line-height: 1.15; padding-right: 36px; }

.modal__location {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.modal__location strong { color: var(--swiss-red); }

.modal__desc { font-size: 15px; line-height: 1.6; color: var(--ink-soft); margin: 0 0 18px; }

.modal__dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.modal__date { background: var(--snow); border-radius: var(--radius-md); padding: 14px; }
.modal__date-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.modal__date-value { font-family: "Space Grotesk", sans-serif; font-size: 16px; font-weight: 600; color: var(--ink); }

/* Mini-map inside the event modal — same look as the search detail */
.modal__map {
  margin: 18px 0;
  padding: 16px;
  background: var(--snow);
  border-radius: var(--radius-md);
}
.modal__map-header { margin-bottom: 12px; }
.modal__map-header h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 2px;
}
.modal__map-header p {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin: 0;
}
.modal__loc-stack { display: flex; flex-direction: column; gap: 2px; }
.modal__loc-venue {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.modal__loc-address {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.modal__map-stage {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  background: white;
  padding: 6px;
  overflow: hidden;
}
.modal__map-stage svg.ch-map { width: 100%; height: 100%; display: block; }

.modal__source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-mute);
  font-weight: 500;
  margin-top: 12px;
}
.modal__source-link:hover { color: var(--swiss-red); border-bottom-color: transparent; }

/* ============================================================
   BOTTOM SHEET (mobile)
============================================================ */
.sheet-handle { display: none; }
.sheet-close {
  display: none;
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--snow);
  color: var(--ink-soft);
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease-out);
  cursor: pointer;
  z-index: 2;
}
.sheet-close:hover { background: var(--swiss-red); color: white; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 40, 0.5);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  opacity: 0;
  pointer-events: none;
  /* Blur ramps up at the same time as the opacity for a "breathing"
     reveal instead of an instant haze. */
  transition:
    opacity 0.45s var(--ease-soft),
    backdrop-filter 0.45s var(--ease-soft),
    -webkit-backdrop-filter 0.45s var(--ease-soft);
  z-index: 89;
}
.sheet-backdrop.is-open {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* The backdrop is purely visual on purpose. Taps go through to the
   element underneath so users can switch directly from one date /
   canton to another without having to first dismiss the current sheet.
   A document-level click listener handles "tap outside to dismiss"
   semantics in JS (see app.js). */
.sheet-backdrop.is-open { opacity: 1; pointer-events: none; }

body.is-sheet-locked { overflow: hidden; }

/* ============================================================
   FOOTER
============================================================ */
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-mute);
  padding-top: 8px;
  flex-wrap: wrap;
  gap: 8px;
}

/* ============================================================
   RESPONSIVE - Tablet (≤ 1100px)
============================================================ */
@media (max-width: 1100px) {
  .calendar-layout,
  .map-layout,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .calendar-side,
  .canton-panel { order: 2; }

  /* Detail map first on mobile/tablet then content below — wait, more
     natural: keep content first, mini-map below */
  .detail-map { order: 2; }
  .detail-map__stage { aspect-ratio: 16 / 10; }

  /* ---- Transform side panels into bottom sheets ---- */
  /* Important: keep `overflow: hidden` on the sheet itself and let the
     inner list scroll. This keeps the handle + header sticky and
     prevents the entire sheet from scrolling away while reading. */
  .day-detail,
  .canton-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    margin: 0;
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    min-height: 0;
    border-radius: 28px 28px 0 0;
    padding: 14px 22px 22px;
    transform: translateY(110%);
    opacity: 0.6;
    transition:
      transform 0.55s var(--ease-spring),
      opacity 0.3s var(--ease-soft);
    z-index: 90;
    box-shadow: 0 -20px 60px -10px rgba(20, 20, 40, 0.25);
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
    display: flex;
    flex-direction: column;
    will-change: transform;
    height: min(92vh, 860px);
    height: min(92dvh, 860px);
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .day-detail.is-sheet-shown,
  .canton-panel.is-sheet-shown {
    transform: translateY(0);
    opacity: 1;
  }

  /* Header/handle stay pinned at the top. The card rail stays HORIZONTAL
     inside the sheet: one card fills most of the width, the next one
     peeks in, and a sideways swipe browses events — the sheet no longer
     needs to be huge to show more than one event. */
  .canton-panel__header,
  .day-detail__header { flex-shrink: 0; }
  .canton-panel__body,
  .day-detail__list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 16px;
    /* The sheet root is `touch-action: pan-y` (swipe-down dismiss); the
       rail itself must re-allow horizontal panning or cards won't slide. */
    touch-action: pan-x pan-y;
    scroll-snap-type: x proximity;
  }
  .canton-panel__body > .event-card,
  .day-detail__list > .event-card {
    flex: 0 0 min(78vw, 320px);
    width: min(78vw, 320px);
    scroll-snap-align: start;
    min-height: 300px;
  }
  /* Grouped category rails inside mobile sheets */
  .canton-panel__body.is-grouped,
  .day-detail__list.is-grouped {
    overflow-x: hidden;
    overflow-y: auto;
    scroll-snap-type: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
    cursor: default;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .canton-panel__body.is-vertical,
  .day-detail__list.is-vertical {
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: none;
    /* The base sheet rail is a horizontal flexbox; expanded mode must
       stack the back button + category sections vertically. */
    display: flex;
    flex-direction: column;
    gap: 18px;
    cursor: default;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .canton-panel__body.is-grouped .panel-group__grid > .event-card,
  .day-detail__list.is-grouped .panel-group__grid > .event-card {
    flex: 0 0 min(76vw, 300px);
    width: min(76vw, 300px);
    min-height: 320px;
    opacity: 1;
    transform: none;
    transition: transform 0.15s var(--ease-press);
  }
  /* Mobile sheets: skip heavy entry animations & blur for smoother scroll */
  .canton-panel__body.is-grouped .event-card,
  .day-detail__list.is-grouped .event-card,
  .canton-panel__body.is-vertical .event-card,
  .day-detail__list.is-vertical .event-card {
    animation: none;
    contain: layout style paint;
  }
  .canton-panel__body.is-grouped .panel-group,
  .day-detail__list.is-grouped .panel-group {
    animation: none;
  }
  .canton-panel__body.is-grouped .panel-group__grid,
  .day-detail__list.is-grouped .panel-group__grid {
    scroll-snap-type: none;
  }
  .event-card__chip {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(16, 18, 32, 0.58);
  }
  .event-card__fav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(16, 18, 32, 0.58);
  }
  .canton-panel__body.is-vertical .panel-group__list,
  .day-detail__list.is-vertical .panel-group__list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .canton-panel__body.is-vertical .panel-group__list > .event-card,
  .day-detail__list.is-vertical .panel-group__list > .event-card {
    width: 100%;
    min-height: 240px;
  }

  .sheet-handle {
    display: block;
    width: 44px;
    height: 5px;
    background: #d4d4dd;
    border-radius: 999px;
    margin: 0 auto 14px;
    flex-shrink: 0;
  }
  .sheet-close { display: inline-flex; }

  .day-detail__bigday { display: none; }
  .day-detail__header { padding-right: 50px; padding-bottom: 14px; margin-bottom: 14px; }
  .canton-panel__close { display: none; }
}

/* ============================================================
   RESPONSIVE - Mobile (≤ 720px)
============================================================ */
@media (max-width: 720px) {
  .app-shell { padding: 16px 12px; gap: 16px; }
  .brand h1 { font-size: 19px; }
  .brand__subtitle { display: none; }

  /* Calendar */
  .calendar-card { padding: 18px 12px 16px; border-radius: 22px; }
  .calendar-card__header { margin-bottom: 14px; }
  .calendar-card__title h2 { font-size: 22px; }
  .cal-nav-btn { width: 38px; height: 38px; border-radius: 12px; }
  .calendar-card__weekdays { gap: 4px; }
  .calendar-card__weekdays span { font-size: 10px; padding: 4px 0; }
  .calendar-card__grid { gap: 4px; }
  .cal-day { padding: 7px 3px 5px; border-radius: 12px; aspect-ratio: 1 / 1.05; font-size: 15px; }
  .cal-day__num { font-size: 15px; font-weight: 600; }
  .cal-day__count { font-size: 9.5px; padding: 1.5px 6px; }

  /* Stats : 3 compact columns */
  .stat-grid { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .stat { padding: 12px 10px; border-radius: 16px; }
  .stat:first-child { grid-column: auto; }
  .stat__value { font-size: 22px; }
  .stat__label { font-size: 10.5px; line-height: 1.25; }

  .calendar-side { gap: 0; }

  /* ===== Map: full-screen on mobile for real usability ===== */
  /* Map takes the entire remaining viewport height. The canton-panel
     bottom-sheet appears on tap and covers the lower half — but the
     map is always the hero of the view. */
  .map-layout { gap: 0; }
  .map-card {
    padding: 6px;
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .map-card__header {
    padding: 4px 8px 8px;
    margin-bottom: 0;
    flex-shrink: 0;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }
  .map-card__header > div:first-child { display: none; } /* hide verbose title on phone */
  .map-card__header h2 { font-size: 15px; line-height: 1.2; }
  .map-card__subtitle { display: none; }
  /* The picker shares the header row with the funnel icon: canton jump
     stays one tap away, filters are stowed until needed. */
  .map-canton-picker {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: space-between;
    padding: 8px 10px 8px 14px;
  }
  .map-canton-picker select { font-size: 14px; max-width: none; flex: 1; }
  /* (The collapsed filter bar + funnel toggle rules live next to the
     .map-filterbar base styles further down — CSS order matters there.) */
  /* Leaflet map fills the remaining viewport so it's the hero of the view. */
  .map-stage {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    padding: 0;
    border-radius: 12px;
  }
  .map-card {
    height: calc(100dvh - 132px);
    min-height: 0;
    max-height: none;
  }
  .map-controls {
    top: 10px;
    right: 10px;
  }
  .map-control-btn { width: 44px; height: 44px; }
  .city-pin { font-size: 11px; }
  .city-cluster { font-size: 12px; }

  /* Canton bottom-sheet: tall enough to show full event cards above Safari bar */
  .canton-panel.is-sheet-shown,
  .day-detail.is-sheet-shown {
    max-height: 92vh;
    max-height: 92dvh;
    height: min(92vh, 900px);
    height: min(92dvh, 900px);
  }

  /* Modal as bottom sheet — slides up from the bottom on mobile. The
     bigger initial offset + spring easing gives the same "real gesture"
     feel as the side panels turned bottom-sheets above. */
  .modal { padding: 0; align-items: flex-end; }
  .modal__panel {
    border-radius: 24px 24px 0 0;
    padding: 22px 20px calc(26px + env(safe-area-inset-bottom));
    max-height: 88vh;
    max-height: 88dvh;
    transform: translateY(100%);
  }
  .modal__title { font-size: 22px; padding-right: 30px; }
  .modal__dates { gap: 8px; }
  .modal__date { padding: 12px; }
  .modal__date-value { font-size: 14px; }

  /* Cal providers : single row 4 columns on mobile */
  .cal-providers__buttons { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .cal-btn { padding: 9px 4px; font-size: 10.5px; }

  /* Sheets content */
  .canton-panel,
  .day-detail { padding: 14px 18px 24px; }
  .canton-panel__header,
  .day-detail__header { padding-bottom: 14px; margin-bottom: 14px; }
  .canton-panel__header { padding-right: 44px; }
  .canton-panel__header h3 { font-size: 20px; }

  .map-tooltip { font-size: 11.5px; padding: 6px 10px; }

  /* Search view */
  .search-header { padding: 16px 14px; gap: 14px; }
  .search-bar { padding: 12px 14px; gap: 10px; }
  .search-bar input { font-size: 14px; }
  .filter-row { gap: 8px; flex-direction: column; align-items: flex-start; }
  .filter-row__label { min-width: 0; font-size: 10.5px; }
  .chip-group { gap: 5px; width: 100%; }
  .chip { padding: 6px 11px; font-size: 12px; }
  .chip--canton .chip__abbr { display: inline; }
  .search-results-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Detail sub-view */
  .detail-card { padding: 20px 16px; gap: 14px; }
  .detail-card__title { font-size: 22px; }
  .detail-card__dates { gap: 8px; padding: 12px; }
  .detail-date__arrow { display: none; }
  .detail-map { padding: 16px; }
  .detail-map__stage { aspect-ratio: 16 / 11; padding: 6px; }
}

/* ============================================================
   RESPONSIVE - Very small (≤ 480px)
============================================================ */
@media (max-width: 480px) {
  .view-switch__btn { padding: 9px 12px; font-size: 12.5px; gap: 6px; }
  .view-switch__btn span { display: none; }
  .stat__value { font-size: 19px; }
  .stat__label { font-size: 9.5px; }

  /* Calendar cells: same clean number+count design as desktop, just a
     touch taller so the pill never crowds the number at 375 px. */
  .cal-day {
    aspect-ratio: 1 / 1.15;
    padding: 8px 2px 6px;
    border-radius: 12px;
  }
  .cal-day__num { font-size: 16px; font-weight: 700; }
  .cal-day__count { font-size: 10px; padding: 1px 6px; }

  .calendar-card { padding: 14px 10px 12px; }
  .calendar-card__grid { gap: 3px; }
  .calendar-card__weekdays { gap: 3px; }
  .cal-providers__buttons { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   GLOBAL TAP RESPONSIVENESS
   ------------------------------------------------------------
   `touch-action: manipulation` tells the browser that pan + pinch are
   the only gestures handled — it never participates in double-tap-to-zoom.
   Without this, iOS Safari keeps a 300–500 ms (and in some viewport
   states, several seconds) "wait-and-see" delay after every tap to
   detect a follow-up tap, which suppresses `click` events fired during
   that window. `touch-action` is NOT inherited, so we apply it to every
   element and then override only where we need richer gestures
   (map-stage = none, sheets = pan-y).
============================================================ */
* {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   GLOBAL TAP / PRESS FEEDBACK
   ------------------------------------------------------------
   Every interactive control gets a small scale-down on press so the
   user feels the click instead of wondering whether it landed. We
   override `transition-duration` to make the press response near-
   instant (8 % size change in ~100 ms) while keeping the release
   smooth via the element's own transition definition.
============================================================ */
button:not(:disabled):active,
.chip:active,
.cal-nav-btn:active,
.cal-today-btn:active,
.cal-btn:active,
.consent-btn:active,
.search-show-more:active,
.canton-panel__close:active,
.modal__close:active,
.stat:active {
  transform: scale(0.95);
  transition-duration: 0.08s;
}

/* ============================================================
   TOUCH DEVICE HOVER FIX
   ------------------------------------------------------------
   On phones/tablets without a fine pointer, the :hover transforms
   defined throughout the design system "stick" after the first tap
   and physically move the element away from the user's finger.
   The browser then sees a release outside the target and does not
   fire a `click`, forcing the user to tap a second time. We neutralise
   the transforms (only the transforms — colours/backgrounds keep
   their feedback on hybrid devices) when no fine pointer is available
   to guarantee single-tap reliability everywhere.
============================================================ */
@media (hover: none) {
  .cal-day:hover,
  .cal-day:hover:not(.is-empty),
  .cal-nav-btn:hover,
  .cal-today-btn:hover,
  .stat:hover,
  .map-control-btn:hover,
  .event-card:hover,
  .day-detail__item:hover,
  .chip:hover,
  .cal-btn:hover,
  .brand:hover .brand__logo,
  .detail-back:hover,
  .search-reset:hover,
  .canton-panel__close:hover,
  .modal__close:hover,
  .sheet-close:hover,
  .search-bar__clear:hover,
  .suggestion:hover .suggestion__arrow {
    transform: none;
  }

  /* Tactile feedback on touch — combine a small opacity drop with the
     scale-down defined globally above. Together they give a clear "tap
     registered" cue. We keep `transition-property: opacity` so the
     fade-back is smooth on release; the transform is handled by each
     element's own transition. */
  .cal-day:active:not(.is-empty),
  .event-card:active,
  .chip:active,
  .cal-btn:active,
  .cal-nav-btn:active,
  .cal-today-btn:active,
  .suggestion:active,
  .day-detail__item:active,
  .map-control-btn:active,
  .canton-panel__close:active,
  .sheet-close:active,
  .modal__close:active,
  .search-bar__clear:active,
  .detail-back:active,
  .search-reset:active,
  .view-switch__btn:active {
    opacity: 0.78;
  }
}

/* ============================================================
   CONSENT BANNER (analytics — nFADP / RGPD)
   ------------------------------------------------------------
   Discrete, non-blocking banner at the bottom-right on desktop,
   sticky full-width sheet at the bottom on mobile. Slides in from
   the bottom after a short delay so it doesn't fight with the
   page's initial entrance animations.
============================================================ */
.consent-banner {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 12px 14px;
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow:
    0 18px 40px -20px rgba(20, 20, 50, 0.25),
    0 4px 12px -4px rgba(20, 20, 50, 0.08);
  font-size: 13.5px;
  color: var(--ink-soft);
  animation: consentIn 0.5s var(--ease-bounce) 0.6s backwards;
}

@keyframes consentIn {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.consent-banner__icon {
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--swiss-red) 0%, var(--swiss-red-soft) 100%);
  color: var(--white);
  flex-shrink: 0;
}

.consent-banner__content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.consent-banner__content strong {
  color: var(--ink);
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
}
.consent-banner__content p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.consent-banner__content p strong {
  color: var(--ink);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
}

.consent-banner__actions {
  grid-column: 2;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

.consent-btn {
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--ease-out);
  font-family: inherit;
}
.consent-btn:hover { border-color: var(--ink-mute); }

.consent-btn--ghost { color: var(--ink-mute); }
.consent-btn--ghost:hover { color: var(--ink); background: var(--snow-2); }

.consent-btn--primary {
  background: linear-gradient(135deg, var(--swiss-red) 0%, var(--swiss-red-soft) 100%);
  border-color: transparent;
  color: var(--white);
  box-shadow: 0 6px 16px -8px var(--swiss-red-glow);
}
.consent-btn--primary:hover { filter: brightness(1.05); }

/* Mobile: full-width sticky banner at the bottom */
@media (max-width: 720px) {
  .consent-banner {
    right: 12px;
    left: 12px;
    bottom: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    max-width: none;
    padding: 14px 16px;
    grid-template-columns: auto 1fr;
    gap: 10px 12px;
  }
  .consent-banner__icon { width: 32px; height: 32px; border-radius: 10px; }
  .consent-banner__content strong { font-size: 14px; }
  .consent-banner__content p { font-size: 12px; }
  .consent-btn { padding: 8px 14px; font-size: 12.5px; }
}

@media (hover: none) {
  .consent-btn--ghost:hover { background: var(--white); }
  .consent-btn--primary:hover { filter: none; }
  .consent-btn:active { opacity: 0.72; transition: opacity 0.08s ease; }
}

/* ====================================================================
   "PRÈS DE MOI" BUTTON (geolocation, in the header next to lang switch)
   ==================================================================== */
.geo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 10px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 0;
  border-radius: 999px;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(0, 0, 0, 0.04);
  color: var(--ink-mute);
  font: inherit;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.2s var(--ease-soft), color 0.2s var(--ease-soft), transform 0.12s var(--ease-press);
}
.geo-btn__icon { color: var(--swiss-red); flex: 0 0 auto; }
.geo-btn:hover { background: var(--white); color: var(--ink); }
.geo-btn:active { transform: scale(0.96); }
.geo-btn--active {
  background: var(--swiss-red);
  color: var(--white);
  box-shadow: 0 6px 18px -8px rgba(220, 38, 38, 0.55), 0 0 0 1px rgba(0,0,0,0.04);
}
.geo-btn--active .geo-btn__icon { color: var(--white); }
.geo-btn__prefix { font-weight: 500; opacity: 0.92; }
.geo-btn__label strong { font-weight: 800; }
.geo-btn__clear {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s var(--ease-soft), transform 0.12s var(--ease-press);
}
.geo-btn__clear:hover { background: rgba(255, 255, 255, 0.38); }
.geo-btn__clear:active { transform: scale(0.9); }
@media (max-width: 480px) {
  .geo-btn__label { display: none; }
  .geo-btn { padding: 8px; }
  .geo-btn--active {
    padding: 7px 10px 7px 8px;
    gap: 5px;
    max-width: min(72vw, 280px);
  }
  .geo-btn--active .geo-btn__label {
    display: inline;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .geo-btn--active .geo-btn__clear { display: inline-grid; }
}

/* ----- First-visit banner (slides up from bottom) ----- */
.geo-banner {
  position: fixed;
  left: 16px; right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  box-shadow: 0 18px 50px -18px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(0,0,0,0.04);
  transform: translateY(140%);
  opacity: 0;
  transition: transform 0.45s var(--ease-spring), opacity 0.3s var(--ease-soft);
  max-width: 520px;
  margin: 0 auto;
}
.geo-banner.is-visible { transform: translateY(0); opacity: 1; }
.geo-banner__icon {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--swiss-red), #b91c1c);
  color: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 18px -6px rgba(220,38,38,0.5);
}
.geo-banner__body { flex: 1; min-width: 0; }
.geo-banner__title { display: block; font-size: 14px; color: var(--ink); }
.geo-banner__text { margin: 2px 0 0; font-size: 12px; color: var(--ink-mute); line-height: 1.35; }
.geo-banner__actions { flex: 0 0 auto; display: flex; gap: 6px; }
.geo-banner__btn {
  border: 0;
  padding: 8px 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s var(--ease-soft), transform 0.12s var(--ease-press);
  touch-action: manipulation;
}
.geo-banner__btn--ghost { background: rgba(0,0,0,0.06); color: var(--ink-mute); }
.geo-banner__btn--ghost:hover { background: rgba(0,0,0,0.1); color: var(--ink); }
.geo-banner__btn--primary { background: var(--swiss-red); color: var(--white); box-shadow: 0 6px 14px -6px rgba(220,38,38,0.55); }
.geo-banner__btn--primary:hover { filter: brightness(1.05); }
.geo-banner__btn:active { transform: scale(0.96); }

/* ----- Toast ----- */
.geo-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 140%);
  z-index: 100;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  background: rgba(20, 20, 20, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px -16px rgba(0,0,0,0.5);
  opacity: 0;
  transition: transform 0.4s var(--ease-spring), opacity 0.25s var(--ease-soft);
  pointer-events: none;
  max-width: calc(100vw - 32px);
  white-space: nowrap;
}
.geo-toast.is-visible { transform: translate(-50%, 0); opacity: 1; }
.geo-toast--success { background: linear-gradient(135deg, #16a34a, #15803d); }
.geo-toast--error   { background: linear-gradient(135deg, #dc2626, #991b1b); }

/* ====================================================================
   LANGUAGE SWITCHER (flag pills in the header)
   ==================================================================== */
.lang-switch {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 999px;
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(0, 0, 0, 0.04);
  touch-action: manipulation;
}
.lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--ink-mute);
  transition: background 0.2s var(--ease-soft), color 0.2s var(--ease-soft), transform 0.12s var(--ease-press);
  touch-action: manipulation;
  letter-spacing: 0.06em;
}
.lang-flag__emoji { display: none; }
.lang-flag__code { letter-spacing: 0.06em; }
.lang-flag:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); }
.lang-flag:active { transform: scale(0.94); }
.lang-flag.is-active {
  background: var(--swiss-red);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(218, 41, 28, 0.32);
}
.lang-flag.is-active:hover { background: var(--swiss-red); color: var(--white); }

/* ====================================================================
   CALENDAR FILTERS (chips + dropdowns above the grid)
   ==================================================================== */
.cal-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.cal-filters__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.cal-filters__label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-right: 4px;
}
.cal-filters__row--selects {
  border-top: 1px dashed rgba(0, 0, 0, 0.06);
  padding-top: 10px;
  gap: 12px;
}
.cal-filters__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 160px;
}
.cal-filters__field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.cal-filters__select {
  position: relative;
  display: flex;
  align-items: center;
}
/* Coat of arms of the selected canton, pinned inside the closed control. */
.select-arms {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 20px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(20, 20, 50, 0.18));
  animation: armsIn 0.3s var(--ease-spring);
}
@keyframes armsIn {
  from { opacity: 0; transform: translateY(-50%) scale(0.6); }
  to   { opacity: 1; transform: translateY(-50%) scale(1); }
}
.cal-filters__select.arms-on select { padding-left: 36px; }
.map-canton-picker__field.arms-on select { padding-left: 30px; }
.map-canton-picker__field .select-arms { left: 8px; width: 14px; height: 18px; }
.cal-filters__select select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  padding: 11px 40px 11px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line-soft);
  background: var(--white);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 1px 2px rgba(20, 20, 40, 0.04);
  transition: border-color 0.18s var(--ease-soft), box-shadow 0.18s var(--ease-soft);
}
.cal-filters__select:hover select { border-color: rgba(218, 41, 28, 0.4); }
.cal-filters__select select:focus-visible {
  outline: none;
  border-color: var(--swiss-red);
  box-shadow: 0 0 0 3px var(--swiss-red-glow);
}
/* Chevron sits inside a soft rounded chip on the right edge. */
.cal-filters__select svg {
  position: absolute;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 4px;
  border-radius: 8px;
  background: var(--snow);
  pointer-events: none;
  color: var(--swiss-red);
}
.cal-filters__reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(218, 41, 28, 0.3);
  background: transparent;
  color: var(--swiss-red);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease-soft);
  touch-action: manipulation;
}
.cal-filters__reset:hover { background: rgba(218, 41, 28, 0.08); }

/* Collapse toggle — hidden on desktop (filters always visible), shown on
   mobile so the calendar is the hero on load. */
.cal-filters-toggle { display: none; }

/* "Afficher plus" button at the end of a batched event list. */
.sheet-more {
  display: block;
  width: 100%;
  margin: 10px auto 4px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 1.5px dashed rgba(218, 41, 28, 0.35);
  background: rgba(218, 41, 28, 0.04);
  color: var(--swiss-red);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.18s var(--ease-soft);
}
.sheet-more:hover { background: rgba(218, 41, 28, 0.1); }
.sheet-more:active { transform: scale(0.98); }

/* ====================================================================
   MAPS ACTION BUTTONS in event modal (Google Maps / Waze / Apple Plans)
   ==================================================================== */
.maps-actions {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(0, 0, 0, 0.05);
}
.maps-actions__header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.maps-actions__address {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.45;
}
.maps-actions__buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.maps-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 10px;
  border-radius: 12px;
  background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.08);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s var(--ease-press), box-shadow 0.2s var(--ease-soft), border-color 0.2s var(--ease-soft);
  touch-action: manipulation;
}
.maps-btn:hover {
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.maps-btn:active { transform: scale(0.97); }

/* Share button (event detail / modal) */
.share-row { margin: 14px 0 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--red, #DA291C);
  border: 1px solid var(--red, #DA291C);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s var(--ease-press), box-shadow 0.2s var(--ease-soft), filter 0.2s var(--ease-soft);
  touch-action: manipulation;
}
.share-btn:hover { box-shadow: 0 6px 16px rgba(218, 41, 28, 0.28); filter: brightness(1.03); }
.share-btn:active { transform: scale(0.97); }
.share-btn svg { display: block; }
@media (max-width: 640px) {
  .share-btn { flex: 1 1 auto; }
}
.maps-btn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}
.maps-btn--waze { color: #0066cc; }
.maps-btn--apple { color: #1d4ed8; }

/* Mobile tweaks for header + filters */
@media (max-width: 720px) {
  .lang-switch { padding: 3px; }
  .lang-flag { padding: 6px 10px; font-size: 12px; }
  .lang-flag__code { display: inline; }
  /* ----- Collapsible filters: keep the calendar visible on load ----- */
  .cal-filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    margin: 12px 0 4px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--line-soft);
    background: var(--white);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 1px 3px rgba(20, 20, 40, 0.06);
    transition: border-color 0.18s var(--ease-soft), background 0.18s var(--ease-soft);
  }
  .cal-filters-toggle.has-active {
    border-color: var(--swiss-red);
    color: var(--swiss-red);
  }
  .cal-filters-toggle__count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--swiss-red);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
  }
  .cal-filters-toggle__chev {
    transition: transform 0.25s var(--ease-spring);
  }
  .cal-filters-toggle.is-open .cal-filters-toggle__chev { transform: rotate(180deg); }

  /* Collapsed by default on phones; expands when toggled. */
  .cal-filters {
    display: none;
    padding: 12px;
    gap: 10px;
    margin: 4px 0 14px;
    animation: filtersSlideDown 0.3s var(--ease-soft);
  }
  .cal-filters.is-open { display: flex; }
  @keyframes filtersSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .cal-filters__row--selects { flex-direction: column; align-items: stretch; }
  /* In a column flex, `flex: 1 1 160px` made the basis apply to HEIGHT,
     creating a huge empty gap between the canton & city selects. Pin the
     fields to content height instead. */
  .cal-filters__field { flex: 0 0 auto; }
  .cal-filters__select select { padding: 13px 44px 13px 14px; font-size: 15px; }
  .cal-filters__reset { align-self: flex-end; }
  .maps-actions__buttons { grid-template-columns: 1fr; gap: 6px; }
  .maps-btn { justify-content: flex-start; padding: 12px 14px; }
}

/* =========================================================
   Reusable popover filter controls
   (date picker + searchable multi-select)
========================================================= */
.up-pop { position: relative; display: inline-flex; }

.up-pop__trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 220px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.18s var(--ease-soft), background 0.18s var(--ease-soft),
    box-shadow 0.18s var(--ease-soft), transform 0.12s var(--ease-press);
}
.up-pop__trigger:hover { border-color: var(--ink-mute); }
.up-pop__trigger:active { transform: scale(0.97); }
.up-pop.is-active .up-pop__trigger {
  border-color: var(--swiss-red);
  color: var(--swiss-red);
  background: rgba(218, 41, 28, 0.05);
}
.up-pop__icon { display: inline-flex; color: currentColor; }
.up-pop__arms {
  width: 16px;
  height: 20px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 1px rgba(20, 20, 50, 0.18));
}
.up-pop__sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-mute);
  white-space: nowrap;
}
/* Canton "Aller à" picker: borderless trigger nested in the header pill. */
.map-canton-picker .up-pop { flex: 1 1 auto; min-width: 0; }
.map-canton-picker .up-pop__trigger {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 4px 6px;
  max-width: none;
  width: 100%;
}
.map-canton-picker .up-pop.is-active .up-pop__trigger {
  background: transparent;
  color: var(--ink);
}
.map-canton-picker .up-pop__trigger:hover { border: none; }

/* Calendar canton filter: render the single-select like a full-width field. */
.cal-filters__field .up-pop { display: flex; width: 100%; }
.cal-filters__field .up-pop__trigger {
  width: 100%;
  max-width: none;
  justify-content: flex-start;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line-soft);
  background: var(--white);
}
.cal-filters__field .up-pop__label { margin-right: auto; }
.cal-filters__field .up-pop__trigger svg:last-child { margin-left: 6px; }
.up-pop__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.up-pop__badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--swiss-red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.up-pop__trigger svg:last-child { transition: transform 0.22s var(--ease-spring); margin-left: -2px; opacity: 0.6; }
.up-pop.is-open .up-pop__trigger svg:last-child { transform: rotate(180deg); }

/* ---- Popover panel (shared) ---- */
.up-pop__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 1300;
  width: 300px;
  max-width: min(92vw, 340px);
  padding: 12px;
  border-radius: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.02);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top left;
  transition: opacity 0.18s var(--ease-soft), transform 0.22s var(--ease-spring),
    visibility 0.18s;
}
.up-pop.is-open .up-pop__panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
/* When the trigger sits on the right half, flip the panel to the right edge. */
.up-pop--right .up-pop__panel { left: auto; right: 0; transform-origin: top right; }

/* ---- Date picker ---- */
.up-dp__presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.up-dp__preset {
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--snow);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.16s var(--ease-soft);
}
.up-dp__preset:hover { border-color: var(--ink-mute); }
.up-dp__preset.is-active {
  background: var(--swiss-red);
  border-color: var(--swiss-red);
  color: #fff;
}
.up-dp__modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--snow);
  border: 1px solid var(--line-soft);
}
.up-dp__mode {
  padding: 7px 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-mute);
  cursor: pointer;
  transition: all 0.16s var(--ease-soft);
}
.up-dp__mode.is-active {
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.up-dp__nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.up-dp__title { font-weight: 800; font-size: 14px; text-transform: capitalize; }
.up-dp__navbtn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.16s var(--ease-soft);
}
.up-dp__navbtn:hover { background: var(--snow); border-color: var(--ink-mute); }
.up-dp__weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}
.up-dp__weekdays span {
  text-align: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-mute);
  text-transform: uppercase;
}
.up-dp__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.up-dp__day {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.14s var(--ease-soft), color 0.14s var(--ease-soft),
    transform 0.1s var(--ease-press);
}
.up-dp__day:hover { background: var(--snow); }
.up-dp__day:active { transform: scale(0.9); }
.up-dp__day.is-out { color: var(--ink-mute); opacity: 0.45; }
.up-dp__day.is-today { box-shadow: inset 0 0 0 1.5px var(--swiss-red-glow); }
.up-dp__day.is-inrange { background: rgba(218, 41, 28, 0.1); border-radius: 0; color: var(--swiss-red-deep); }
.up-dp__day.is-sel {
  background: var(--swiss-red);
  color: #fff;
  box-shadow: var(--shadow-red);
}
.up-dp__hint { margin: 10px 0 4px; font-size: 11px; color: var(--ink-mute); line-height: 1.4; }
.up-dp__footer { display: flex; gap: 8px; margin-top: 6px; }
.up-dp__clear, .up-dp__apply, .up-ms__clear, .up-ms__done {
  flex: 1;
  padding: 9px 12px;
  border-radius: 11px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.16s var(--ease-soft);
}
.up-dp__clear, .up-ms__clear {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-mute);
}
.up-dp__clear:hover, .up-ms__clear:hover { border-color: var(--swiss-red); color: var(--swiss-red); }
.up-dp__apply, .up-ms__done {
  border: 1px solid var(--swiss-red);
  background: var(--swiss-red);
  color: #fff;
}
.up-dp__apply:hover, .up-ms__done:hover { background: var(--swiss-red-deep); border-color: var(--swiss-red-deep); }

/* ---- Multi-select ---- */
.up-ms__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--snow);
  color: var(--ink-mute);
}
.up-ms__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  outline: none;
}
.up-ms__list {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 -4px 10px;
  padding: 0 4px;
}
.up-ms__row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s var(--ease-soft);
}
.up-ms__row:hover { background: var(--snow); }
.up-ms__check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--white);
  position: relative;
  transition: all 0.16s var(--ease-soft);
}
.up-ms__row.is-on .up-ms__check {
  background: var(--swiss-red);
  border-color: var(--swiss-red);
}
.up-ms__row.is-on .up-ms__check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.5px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.up-ms__row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.up-ms__tag {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--snow);
  border: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-soft);
}
/* Cantonal coat of arms in option rows */
.up-ms__arms {
  flex: 0 0 auto;
  width: 18px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(20, 20, 50, 0.18));
}
.up-ms__row.is-on .up-ms__tag { background: rgba(218, 41, 28, 0.1); border-color: transparent; color: var(--swiss-red); }
.up-ms__row-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.up-ms__count { flex: 0 0 auto; font-size: 11.5px; font-weight: 700; color: var(--ink-mute); }
.up-ms__empty { padding: 18px; text-align: center; font-size: 12.5px; color: var(--ink-mute); }
.up-ms__footer { display: flex; gap: 8px; }

/* ---- Grid variant: canton showcase ----
   3-column grid of coat-of-arms tiles (like browsing car brands). Tiles
   cascade in with a stagger, lift on hover, and the arms zoom slightly. */
.up-ms--grid .up-pop__panel {
  width: 400px;
  max-width: min(94vw, 420px);
}
.up-ms__list--grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-height: 380px;
}
.up-ms__tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: auto;
  padding: 14px 8px 11px;
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: var(--white);
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.28s var(--ease-spring),
    box-shadow 0.25s var(--ease-soft),
    border-color 0.2s var(--ease-soft),
    background 0.2s var(--ease-soft);
  animation: tileIn 0.45s var(--ease-spring) backwards;
  animation-delay: calc(var(--ti, 0) * 16ms);
}
@keyframes tileIn {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to { opacity: 1; transform: none; }
}
@media (hover: hover) {
  .up-ms__tile:hover {
    transform: translateY(-3px);
    border-color: rgba(218, 41, 28, 0.4);
    box-shadow: var(--shadow-md);
  }
  .up-ms__tile:hover .up-ms__tile-arms { transform: scale(1.14) rotate(-2deg); }
}
.up-ms__tile:active { transform: scale(0.94); transition-duration: 0.1s; }
.up-ms__tile.is-on {
  border-color: var(--swiss-red);
  background: rgba(218, 41, 28, 0.05);
  box-shadow: 0 0 0 1px var(--swiss-red);
}
.up-ms__tile-arms {
  width: 36px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 3px rgba(20, 20, 50, 0.22));
  transition: transform 0.3s var(--ease-spring);
}
.up-ms__tile-all {
  width: 36px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ink-mute);
}
.up-ms__tile-label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.up-ms__tile-count { font-size: 10px; font-weight: 700; color: var(--ink-mute); }
.up-ms__tile.is-on .up-ms__tile-label,
.up-ms__tile.is-on .up-ms__tile-count { color: var(--swiss-red); }

/* =========================================================
   Map filter bar
========================================================= */
/* Collapsed by default on every screen size — the funnel icon in the
   header expands it. Keeps the header a single compact row and gives
   the map the vertical space back. */
.map-filterbar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -2px 0 16px;
}
.map-filterbar.is-open {
  display: flex;
  animation: filterbarIn 0.3s var(--ease-spring) backwards;
}
.map-filterbar__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-right: 2px;
}
.map-filterbar__reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-mute);
  cursor: pointer;
  transition: all 0.18s var(--ease-soft);
}
.map-filterbar__reset:hover { background: var(--swiss-red); border-color: var(--swiss-red); color: #fff; }

/* Funnel toggle in the map header — collapses/expands the filter bar. */
.map-filters-toggle {
  display: grid;
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink-soft);
  place-items: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-soft);
}
.map-filters-toggle.is-open {
  background: var(--swiss-red);
  border-color: var(--swiss-red);
  color: white;
}
.map-filters-toggle:active { transform: scale(0.92); }
.map-filters-toggle__dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--swiss-red);
  box-shadow: 0 0 0 2px var(--white);
}
.map-filters-toggle.is-open .map-filters-toggle__dot { background: white; box-shadow: 0 0 0 2px var(--swiss-red); }

@media (max-width: 720px) {
  .map-filterbar { margin: 8px 2px 10px; }
  .map-filterbar__label { display: none; }
}
@keyframes filterbarIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* =========================================================
   Search results grouped by category
========================================================= */
.search-results-grid.is-grouped { display: flex; flex-direction: column; gap: 26px; }
/* Sections cascade in one after another (--gi set by app.js). */
.result-group {
  animation: viewIn 0.45s var(--ease-soft) backwards;
  animation-delay: calc(var(--gi, 0) * 70ms);
}
.result-group__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.result-group__icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.result-group__title { font-size: 16px; font-weight: 800; color: var(--ink); }
.result-group__count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-mute);
  background: var(--snow);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
}
.result-group__count.is-link { cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.result-group__count.is-link:hover { border-color: var(--swiss-red); color: var(--swiss-red); background: rgba(218, 41, 28, 0.05); }

/* ---- Dedicated category page (search sub-state) ---- */
.search-category-state {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: viewIn 0.45s var(--ease-soft);
}
.search-category-state[hidden] { display: none; }
.category-page-head { display: flex; align-items: center; gap: 12px; }
.category-page-head h2 { font-size: 24px; }
.category-page-head .result-group__count { margin-left: 0; font-size: 13px; }

/* Horizontal carousel: one swipeable row per category. */
.result-group__nav { display: none; align-items: center; gap: 6px; margin-left: 10px; }
.result-group__navbtn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.result-group__navbtn:hover { border-color: var(--swiss-red); color: var(--swiss-red); }
.result-group__navbtn:active { transform: scale(0.92); }
.result-group__navbtn { transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease, opacity 0.25s ease; }
.result-group__navbtn.is-off { opacity: 0.28; pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  .result-group__nav { display: inline-flex; }
}

.result-group__grid {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  cursor: grab;
}

/* While the mouse drags a rail: grabbing cursor + no accidental
   text/image selection + hover lifts disabled so the row stays flat. */
.result-group__grid.is-dragging,
.canton-panel__body.is-dragging,
.day-detail__list.is-dragging {
  cursor: grabbing;
  user-select: none;
  scroll-snap-type: none;
  scroll-behavior: auto;
}
.is-dragging > .event-card { pointer-events: none; }
.canton-panel__body { cursor: grab; }
.day-detail__list { cursor: grab; }
.result-group__grid > .event-card {
  flex: 0 0 300px;
  width: 300px;
  scroll-snap-align: start;
}

/* Cards wake up as they slide into the row viewport (class toggled by an
   IntersectionObserver in app.js) and dim slightly once they leave. The
   transition list keeps the hover lift / press feedback intact. */
.result-group__grid > .event-card,
.result-group__grid > .row-more-card {
  transition:
    opacity 0.4s var(--ease-soft),
    transform 0.4s var(--ease-spring),
    box-shadow 0.3s var(--ease-soft),
    border-color 0.25s var(--ease-soft);
}
/* Visibility fade only in search carousels (desktop). Panel sheets reuse
   result-group__grid but must stay at full opacity. */
.search-results-grid .result-group__grid > .event-card:not(.is-visible),
.search-results-grid .result-group__grid > .row-more-card:not(.is-visible) {
  opacity: 0.4;
  transform: scale(0.93);
}

/* "+N" card appended at the end of a row to load the next batch. */
.row-more-card {
  flex: 0 0 130px;
  scroll-snap-align: start;
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg, 16px);
  background: var(--white);
  color: var(--swiss-red);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}
.row-more-card:hover { background: var(--swiss-red-glow); border-color: var(--swiss-red); }
.row-more-card:active { transform: scale(0.97); }
.row-more-card span:last-child { font-size: 11px; font-weight: 600; color: var(--ink-mute); }

/* Panel groups inside calendar/map mobile sheets */
.panel-group {
  animation: viewIn 0.45s var(--ease-soft) backwards;
  animation-delay: calc(var(--gi, 0) * 60ms);
}
.panel-group__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
}
.panel-group__icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.panel-group__title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}
.panel-group__count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-mute);
  background: var(--snow);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
}
.panel-group__grid > .sheet-more {
  flex: 0 0 120px;
  width: 120px;
  min-height: 280px;
  margin: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-lg, 16px);
  scroll-snap-align: start;
}
.panel-group--vertical .panel-group__list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.panel-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1.5px dashed rgba(218, 41, 28, 0.35);
  background: rgba(218, 41, 28, 0.04);
  color: var(--swiss-red);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}
.panel-expand-btn--back {
  justify-content: flex-start;
  margin-bottom: 4px;
  background: var(--snow);
  border-style: solid;
  border-color: var(--line);
  color: var(--ink);
}
.panel-expand-btn:hover { background: rgba(218, 41, 28, 0.08); }
.panel-expand-btn:active { transform: scale(0.98); }

/* Sort chips (search filters row) */
.sort-chips { display: inline-flex; flex-wrap: wrap; gap: 7px; }
.sort-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.sort-chip:active { transform: scale(0.96); }
.sort-chip.is-active {
  border-color: var(--swiss-red);
  color: var(--swiss-red);
  background: rgba(218, 41, 28, 0.05);
  animation: chipPop 0.32s var(--ease-spring);
}
@keyframes chipPop {
  0%   { transform: scale(0.9); }
  60%  { transform: scale(1.06); }
  100% { transform: none; }
}
.sort-chip svg { flex: 0 0 auto; }

/* =========================================================
   Mobile: popover panels become bottom sheets
========================================================= */
@media (max-width: 640px) {
  .up-pop__panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    transform-origin: bottom center;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 82vh;
    max-height: 82dvh;
    overflow-y: auto;
  }
  .up-pop.is-open .up-pop__panel { transform: translateY(0); }
  .up-pop__panel::before {
    content: "";
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 999px;
    background: var(--line);
    margin: -4px auto 12px;
  }
  .up-ms__list { max-height: 50vh; max-height: 50dvh; }
  /* Canton showcase: taller sheet so 4-5 rows of escutcheons show at
     once instead of three — less scrolling to reach your canton. */
  .up-ms--grid .up-pop__panel { max-height: 92vh; max-height: 92dvh; }
  .up-ms--grid .up-ms__list {
    max-height: none;
    height: calc(78vh - 120px);
    height: calc(78dvh - 120px);
  }
  .up-dp__day { font-size: 14px; }
  /* Narrower cards on phones so ~1.5 cards fit the viewport, and NO scroll
     snapping: snap points were killing the native fling momentum, forcing
     one swipe per card. Free momentum lets a firm flick travel 4-5 cards. */
  .result-group__grid {
    scroll-snap-type: none;
    padding-bottom: 10px;
  }
  .result-group__grid > .event-card {
    flex-basis: min(68vw, 260px);
    width: min(68vw, 260px);
    scroll-snap-align: none;
  }

  /* Slightly smaller arms bubbles on phones (declutter handles overlaps). */
  .canton-arms-bubble__img { width: 28px; height: 35px; }
  .canton-arms-bubble.is-lg .canton-arms-bubble__img { width: 33px; height: 41px; }
  .canton-arms-bubble.is-xl .canton-arms-bubble__img { width: 38px; height: 47px; }
  .canton-arms-bubble__count { font-size: 10px; padding: 1px 6px; }
}

/* =========================================================
   Cantonal coats of arms — shared inline badge
   (used across lists, cards, modal, detail, geo, search)
========================================================= */
.canton-arms {
  display: inline-block;
  width: 16px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  filter: drop-shadow(0 1px 1px rgba(20, 20, 50, 0.18));
}
.canton-arms--xs { width: 12px; height: 15px; margin-right: 3px; }
.canton-arms--sm { width: 14px; height: 18px; }
.canton-arms--lg { width: 26px; height: 32px; }

/* Calendar day list: shield sits inside the red abbr pill. */
.day-detail__canton {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Event-card location line shield aligns with the text baseline. */
.event-card__meta-item .canton-arms { margin-right: 1px; }

/* Modal / detail: large shield floated to the right of the category row. */
.modal__arms { margin-left: auto; }
.modal__location .canton-arms,
.detail-card__location .canton-arms { margin-right: 2px; }

/* Geo toast: shield + message on one line. */
.geo-toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.geo-toast__arms {
  width: 18px;
  height: 22px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Geo button: arms replaces the pin icon once a canton is resolved. */
.geo-btn__arms { width: 18px; height: 22px; object-fit: contain; }

/* Canton bottom-sheet header: shield next to the name block. */
.canton-panel__header { display: flex; align-items: center; gap: 12px; justify-content: flex-start; }
/* Keep the desktop reset button pinned to the right edge of the header. */
.canton-panel__close { margin-left: auto; }
.canton-panel__arms {
  width: 34px;
  height: 42px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 3px rgba(20, 20, 50, 0.2));
  animation: armsIn 0.35s var(--ease-spring);
}

/* Search: selected-canton reminder chips next to the multi-select. */
.filter-selected-arms { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-selected-arms.is-empty { display: none; }
.filter-arm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 5px;
  border-radius: 999px;
  background: rgba(218, 41, 28, 0.06);
  border: 1px solid rgba(218, 41, 28, 0.18);
  animation: armsIn 0.3s var(--ease-spring);
}
.filter-arm__tag { font-size: 11px; font-weight: 800; color: var(--swiss-red); letter-spacing: 0.03em; }

/* =========================================================
   Map: canton coat-of-arms bubbles (country overview)
========================================================= */
.canton-arms-wrap { background: none; border: none; }
.canton-arms-bubble {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transform-origin: center bottom;
  animation: armsBubbleIn 0.4s var(--ease-spring) backwards;
  cursor: pointer;
}
.canton-arms-bubble__img {
  width: 34px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(20, 20, 50, 0.35));
  transition: transform 0.2s var(--ease-spring);
}
.canton-arms-bubble.is-lg .canton-arms-bubble__img { width: 40px; height: 50px; }
.canton-arms-bubble.is-xl .canton-arms-bubble__img { width: 48px; height: 60px; }
.canton-arms-wrap:hover .canton-arms-bubble__img { transform: scale(1.12) translateY(-2px); }
.canton-arms-bubble__count {
  font-size: 11px;
  font-weight: 800;
  color: var(--swiss-red);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(218, 41, 28, 0.25);
  padding: 1px 7px;
  border-radius: 999px;
  box-shadow: 0 2px 5px -1px rgba(20, 20, 50, 0.25);
  line-height: 1.5;
}
@keyframes armsBubbleIn {
  from { opacity: 0; transform: scale(0.5) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ====================================================================
   Event images (hotlinked from source CDN). URL-only, lazy-loaded,
   and self-removing on error so a broken link leaves no empty gap.
   ==================================================================== */
.modal__media,
.detail-card__media {
  margin: 0 0 16px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(20, 20, 50, 0.06);
  max-height: 340px;
}
.modal__media img,
.detail-card__media img {
  width: 100%;
  height: 100%;
  max-height: 340px;
  object-fit: cover;
  display: block;
}

/* ====================================================================
   FAVORITES — heart buttons + 4th view
   ==================================================================== */

/* --- Count badge on the Favorites tab --- */
.view-switch__badge {
  position: absolute;
  top: 2px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--swiss-red);
  color: white;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
  animation: favBadgePop 0.35s var(--ease-bounce);
  pointer-events: none;
}
.view-switch__btn.is-active .view-switch__badge {
  background: white;
  color: var(--swiss-red);
  box-shadow: 0 0 0 2px rgba(218, 41, 28, 0.55);
}
@keyframes favBadgePop {
  0%   { transform: scale(0.4); }
  60%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* --- Heart on every event card (top-right, frosted circle) --- */
.event-card__top-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  justify-self: end;
}
.event-card__fav {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: rgba(16, 18, 32, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.92);
  transition: transform 0.15s var(--ease-press), background 0.2s var(--ease-soft), color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.event-card__fav:hover { background: rgba(16, 18, 32, 0.62); transform: scale(1.08); }
.event-card__fav:active { transform: scale(0.9); }
.event-card__fav svg path { fill: none; stroke: currentColor; stroke-width: 2; }
.event-card__fav.is-fav {
  background: rgba(255, 255, 255, 0.94);
  color: var(--swiss-red);
  animation: favHeartPop 0.4s var(--ease-bounce);
}
.event-card__fav.is-fav svg path { fill: currentColor; stroke: none; }
@keyframes favHeartPop {
  0%   { transform: scale(0.6); }
  55%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* --- Labeled save button in the event modal (next to Share) --- */
.fav-btn {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.fav-btn:hover { box-shadow: 0 6px 16px rgba(20, 20, 40, 0.12); filter: none; }
.fav-btn svg path { fill: none; stroke: currentColor; stroke-width: 2; }
.fav-btn.is-fav {
  background: var(--cat-festival-bg, rgba(218, 41, 28, 0.08));
  background: rgba(218, 41, 28, 0.08);
  border-color: rgba(218, 41, 28, 0.4);
  color: var(--swiss-red);
}
.fav-btn.is-fav svg { animation: favHeartPop 0.4s var(--ease-bounce); }
.fav-btn.is-fav svg path { fill: currentColor; stroke: none; }

/* --- Favorites view --- */
.view-favorites .fav-card {
  padding: 26px 26px 22px;
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.fav-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.fav-header__text h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  font-weight: 700;
}
.fav-header__text h2 svg { color: var(--swiss-red); }
.fav-header__sub { margin: 0; font-size: 13px; color: var(--ink-mute); }

.fav-header__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.fav-header__actions[hidden] { display: none; }
.fav-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: transform 0.12s var(--ease-press), box-shadow 0.2s var(--ease-soft), border-color 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.fav-action-btn:hover { box-shadow: var(--shadow-md); border-color: rgba(218, 41, 28, 0.35); color: var(--swiss-red); }
.fav-action-btn:active { transform: scale(0.97); }
.fav-action-btn--danger:hover { border-color: rgba(218, 41, 28, 0.5); color: var(--swiss-red-deep); }

/* Card grid: 3 columns desktop, 2 tablet, 1 mobile. Cards keep the same
   immersive design as everywhere else, with a quick-action bar below. */
.fav-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.fav-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  animation: favItemIn 0.5s var(--ease-spring) forwards;
}
@keyframes favItemIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.fav-item > .event-card { min-height: 240px; }
.fav-item--past > .event-card { filter: grayscale(0.5); opacity: 0.75; }

.fav-item__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}
.fav-item__spacer { flex: 1; }
.fav-item__past {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  background: var(--snow-2);
  border-radius: 999px;
  padding: 3px 9px;
}
.fav-item__nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.fav-item__nav-car { color: var(--ink-mute); margin-right: 2px; }
.fav-nav-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s var(--ease-press), box-shadow 0.2s var(--ease-soft), border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.fav-nav-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(20, 20, 40, 0.18); }
.fav-nav-btn:active { transform: scale(0.92); }
.fav-nav-btn--del:hover { border-color: rgba(218, 41, 28, 0.5); color: var(--swiss-red); }
.fav-nav-btn--car { color: var(--swiss-red); }
.fav-nav-btn--cal:hover { border-color: rgba(52, 199, 89, 0.45); color: #15803d; }

.fav-action-pop { position: relative; }
.fav-action-pop__menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 168px;
  padding: 6px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.fav-action-pop__menu[hidden] { display: none !important; }
.fav-map-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s var(--ease-soft);
}
.fav-map-link:hover { background: var(--snow); color: var(--ink); }
.fav-map-link svg { flex: 0 0 auto; }

/* --- Empty state --- */
.fav-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 60px 24px;
}
.fav-empty[hidden] { display: none; }
.fav-empty__heart {
  color: rgba(218, 41, 28, 0.28);
  animation: favEmptyBeat 2.4s ease-in-out infinite;
}
@keyframes favEmptyBeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.08); }
  24% { transform: scale(1); }
  36% { transform: scale(1.06); }
  48% { transform: scale(1); }
}
.fav-empty h3 {
  margin: 8px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  font-weight: 700;
}
.fav-empty p {
  margin: 0;
  max-width: 380px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-mute);
}
.fav-explore-btn {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--swiss-red) 0%, var(--swiss-red-soft) 100%);
  color: white;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-red);
  transition: transform 0.15s var(--ease-press), box-shadow 0.25s var(--ease-soft);
  -webkit-tap-highlight-color: transparent;
}
.fav-explore-btn:hover { transform: translateY(-2px); box-shadow: 0 22px 44px -16px rgba(218, 41, 28, 0.55); }
.fav-explore-btn:active { transform: scale(0.97); }

/* --- Responsive --- */
@media (max-width: 1100px) {
  .fav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .view-favorites .fav-card { padding: 20px 16px 18px; }
}
@media (max-width: 640px) {
  .fav-grid { grid-template-columns: 1fr; }
  .fav-header { flex-direction: column; }
  .fav-header__actions { width: 100%; }
  .fav-action-btn { flex: 1 1 auto; justify-content: center; }
}

