/* ============================================================
   DESIGN TOKENS
   Two layers. Layer 1 is the raw palette and is referenced ONLY
   inside this block. Layer 2 is the semantic set - roles, not
   colours - and is the only vocabulary the rest of this file uses.
   Dark mode redefines layer 2 and nothing else.

   Adding a new component? See DESIGN.md, "Choosing a token".
   ============================================================ */

/* stylelint-disable declaration-property-value-disallowed-list -- Token definitions - the one place raw colour belongs. */
:root {
  /* ---- Layer 1: primitives. Never use these outside :root. ---- */
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;
  --white:     #ffffff;

  --blue-900: #0c4a6e;
  --blue-800: #075985;
  --blue-700: #0369a1;
  --blue-600: #0284c7;
  --blue-500: #0ea5e9;
  --blue-400: #38bdf8;
  --blue-300: #7dd3fc;
  --blue-200: #bae6fd;
  --blue-50:  #f0f9ff;

  --red-800: #991b1b;
  --red-700: #b91c1c;
  --red-600: #dc2626;
  --red-300: #fca5a5;
  --red-200: #fecaca;
  --red-50:  #fef2f2;

  --green-700: #047857;
  --green-600: #059669;
  --green-300: #6ee7b7;
  --green-200: #a7f3d0;
  --green-50:  #ecfdf5;

  /* ---- Layer 2: surfaces. An elevation ladder, not a grey ramp. ---- */
  --bg-canvas:  var(--slate-50);   /* the page itself */
  --bg-surface: var(--white);      /* cards, panels, the header */
  --bg-raised:  var(--white);      /* popovers and modals, above a surface */
  --bg-sunken:  var(--slate-100);  /* control wells, segmented tracks, chips */
  --bg-hover:   var(--slate-100);  /* hover over a surface */
  --bg-active:  var(--slate-200);  /* pressed and selected */
  --bg-shimmer: var(--slate-200);  /* the moving band in a skeleton */
  --bg-sticky:  rgba(255, 255, 255, 0.98); /* blurred sticky chrome */

  /* Inverted pair - a high-contrast pill that flips with the theme. */
  --bg-inverse:   var(--slate-900);
  --text-inverse: var(--white);

  /* ---- Text ---- */
  --text-heading: var(--slate-950);
  --text-body:    var(--slate-900);
  --text-muted:   var(--slate-600);
  /* Slate-500 (#64748b) misses AA at 4.34:1 on --bg-sunken, where most subtle
     text actually lands (chips, meta rows). Two steps darker clears it on
     every surface in the ladder. */
  --text-subtle:  #5b697d;
  --text-on-solid:  var(--white);  /* ink on any *-solid fill */

  /* ---- Borders ---- */
  --border:        var(--slate-200); /* decorative separation */
  --border-strong: var(--slate-300); /* emphasis, card hover */
  --border-input:  var(--slate-300); /* the only affordance for a control */
  --border-focus:  var(--blue-600);

  /* ---- Accent: Chicago blue ---- */
  --accent:        var(--blue-600);  /* fills, icons, non-text marks */
  --accent-hover:  var(--blue-700);
  --accent-text:   var(--blue-700);  /* coloured TEXT on a surface (4.5:1) */
  --accent-tint:   var(--blue-50);   /* tinted fills */
  /* One step up from --accent-tint. The band between the two endpoints of a
     selected date range has to read as "inside the selection" while sitting
     next to two --accent-solid pills, which --accent-tint is too faint to do. */
  --accent-subtle: #d5edfd;
  --accent-border: var(--blue-200);
  --accent-ring:   rgba(2, 132, 199, 0.18); /* focus glow */
  /* A fill that carries --text-on-solid. Kept separate from --accent because
     the two pull opposite ways: --accent must brighten in dark mode to stay
     visible as an icon, while a fill must stay dark enough to seat light text
     (or, in dark mode, bright enough to seat dark text). */
  --accent-solid:  var(--blue-700);

  /* ---- Danger: municipal red ---- */
  --danger:            var(--red-600);
  --danger-text:       var(--red-700);
  --danger-tint:       var(--red-50);
  --danger-solid:      var(--red-600);
  --danger-border:     var(--red-200);
  --danger-border-soft: rgba(220, 38, 38, 0.16);

  /* ---- Success ---- */
  --success:        var(--green-600);
  --success-text:   var(--green-700);
  --success-tint:   var(--green-50);
  --success-solid:  var(--green-700);
  --success-border: var(--green-200);

  /* ---- Fixed: identical in both themes, deliberately.
     Anything sitting on artwork, a gradient or a filled button. ---- */
  --always-white:      var(--white);
  --art-chrome:        rgba(15, 23, 42, 0.85);
  --art-chrome-strong: rgba(15, 23, 42, 0.95);
  --art-border:        rgba(255, 255, 255, 0.12);
  --art-border-strong: rgba(255, 255, 255, 0.25);
  --art-border-danger: rgba(220, 38, 38, 0.45);
  --art-fill:          rgba(255, 255, 255, 0.2);
  --art-accent:        var(--blue-400);
  --art-accent-soft:   var(--blue-200);
  --art-badge-accent:  var(--blue-700);
  --inset-highlight:   rgba(255, 255, 255, 0.3);
  --media-bg:          var(--slate-900); /* letterbox behind event photos */
  --scrim:             rgba(15, 23, 42, 0.6);
  --flag-blue:         #41b6e6;  /* Chicago flag. Not a themeable asset. */
  --flag-glow:         rgba(225, 29, 72, 0.25);

  /* ---- Elevation ---- */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-up: 0 -4px 16px rgba(15, 23, 42, 0.05);

  /* ---- Scrollbars ---- */
  --scrollbar-thumb:       var(--slate-300);
  --scrollbar-thumb-hover: var(--slate-500);
  --scrollbar-track:       transparent;

  /* ---- Geometry & type: theme-independent ---- */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-heading: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}
/* stylelint-enable declaration-property-value-disallowed-list */

/* ============================================================
   DARK THEME
   Layer 2 only. index.html stamps data-theme before first paint,
   so the document is never unstamped and no prefers-color-scheme
   query is needed here - see DESIGN.md for that trade-off.
   ============================================================ */

/* stylelint-disable declaration-property-value-disallowed-list -- Dark theme token definitions. */
:root[data-theme="dark"] {
  --bg-canvas:  #0b1120;
  --bg-surface: #131c2e;
  --bg-raised:  #1b2740;
  --bg-sunken:  #0d1620;
  --bg-hover:   #22304d;
  --bg-active:  #2b3a5c;
  --bg-shimmer: #1b2740;
  --bg-sticky:  rgba(19, 28, 46, 0.96);

  --bg-inverse:   var(--slate-200);
  --text-inverse: var(--slate-900);

  --text-on-solid: #08131f;

  --text-heading: #f8fafc;
  --text-body:    #e2e8f0;
  --text-muted:   #94a3b8;
  --text-subtle:  #8b99ae;

  --border:        #24304a;
  --border-strong: #33415c;
  --border-input:  #5a6b8a;
  --border-focus:  var(--blue-400);

  --accent:        var(--blue-500);
  --accent-hover:  var(--blue-400);
  --accent-text:   var(--blue-300);
  --accent-tint:   #0c2033;
  --accent-subtle: #17395a;
  --accent-border: #1e4f6d;
  --accent-ring:   rgba(56, 189, 248, 0.3);
  /* Dark mode inverts the solid button: a bright fill with dark ink reads far
     better on a dark page than a deep fill that sinks into it. */
  --accent-solid:  var(--blue-400);

  --danger:            #ef4444;
  --danger-text:       var(--red-300);
  --danger-tint:       #2a1215;
  --danger-solid:      #f87171;
  --danger-border:     #5b1d1d;
  --danger-border-soft: rgba(248, 113, 113, 0.22);

  --success:        #34d399;
  --success-text:   var(--green-300);
  --success-tint:   #0d2a20;
  --success-solid:  #34d399;
  --success-border: #1c5142;

  /* Photos sit in a well that must not glow brighter than its card. */
  --media-bg: #080d14;
  --scrim:    rgba(2, 6, 23, 0.72);

  /* Shadow all but disappears on a dark ground; deepen it and let the
     surface ladder carry most of the elevation. */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.55), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 24px -6px rgba(0, 0, 0, 0.65), 0 4px 8px -4px rgba(0, 0, 0, 0.5);
  --shadow-up: 0 -4px 16px rgba(0, 0, 0, 0.45);

  /* ---- Scrollbars ---- */
  --scrollbar-thumb:       rgba(255, 255, 255, 0.18);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.35);
  --scrollbar-track:       transparent;
}
/* stylelint-enable declaration-property-value-disallowed-list */

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Global Modern Scrollbars (WebKit / Chromium / Safari) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-canvas);
  color: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top App Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-sticky);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand-group {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.chicago-star-icon {
  width: 48px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.chicago-star-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.chicago-star-icon .flag-bg {
  fill: var(--always-white);
}

/* Chicago flag: two light-blue bars, four six-pointed red stars. */
.chicago-star-icon .flag-bar {
  fill: var(--flag-blue);
}

.chicago-star-icon .flag-star {
  fill: var(--danger);
}



/* Auth & Form Styles */


.chicago-star-svg polygon {
  fill: var(--danger);
}

.auth-logo .chicago-star-svg {
  filter: drop-shadow(0 1px 2px var(--flag-glow));
}




.auth-tab-btn,
.auth-tab {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}




.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.1;
  color: var(--text-heading);
}

.brand-subtitle {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
  margin-top: 2px;
}

/* Omni Search Bar */
.search-bar-wrapper {
  flex: 1;
  min-width: 280px;
  max-width: 480px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  color: var(--text-subtle);
  font-size: 0.88rem;
  pointer-events: none;
}

.search-bar-wrapper input {
  width: 100%;
  padding: 0.52rem 2.4rem 0.52rem 2.4rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background-color: var(--bg-sunken);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-body);
  transition: all 0.15s ease;
}

.search-bar-wrapper input:focus {
  outline: none;
  background-color: var(--bg-surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.search-clear-btn {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: all 0.15s ease;
}

.search-clear-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-heading);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.view-mode-tabs {
  display: flex;
  background-color: var(--bg-sunken);
  border-radius: var(--radius-full);
  padding: 3px;
  border: 1px solid var(--border);
}

.view-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-tab-btn:hover {
  color: var(--text-body);
}

.view-tab-btn.active {
  background-color: var(--bg-surface);
  color: var(--accent-text);
  box-shadow: var(--shadow-xs);
}

.badge-count {
  background-color: var(--danger-solid);
  color: var(--text-on-solid);
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.user-auth-area {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.8rem;
}

.btn-primary {
  background-color: var(--accent-solid);
  color: var(--text-on-solid);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--bg-sunken);
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
  color: var(--text-body);
}

.btn-icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.88rem;
}

.btn-block {
  width: 100%;
}

/* User Profile Menu & Popover */
.user-menu-wrapper {
  position: relative;
  display: inline-flex;
}

.user-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background-color: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px 8px 3px 4px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
  font-family: inherit;
  color: inherit;
}

.user-pill-btn:hover,
.user-pill-btn[aria-expanded="true"] {
  border-color: var(--border-strong);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.user-avatar-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--always-white);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 1px 1px var(--inset-highlight);
}

.user-display-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-body);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill-chevron {
  font-size: 0.65rem;
  color: var(--text-subtle);
  transition: transform 0.15s ease;
}

.user-pill-btn[aria-expanded="true"] .user-pill-chevron {
  transform: rotate(180deg);
}

/* Dropdown Popover */
.user-dropdown-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background-color: var(--bg-raised);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 1200;
  animation: popoverFadeIn 0.12s ease-out;
  overflow: hidden;
}

.user-dropdown-popover.active {
  display: flex;
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.user-popover-header {
  padding: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background-color: var(--bg-sunken);
}

.user-avatar-large {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--always-white);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-popover-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-popover-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.2;
}

.user-popover-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-popover-divider {
  height: 1px;
  background-color: var(--border);
}

.user-popover-items,
.user-popover-footer {
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-body);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
}

.user-menu-item i {
  font-size: 0.85rem;
  color: var(--text-subtle);
  width: 16px;
  text-align: center;
}

.user-menu-item:hover {
  background-color: var(--bg-hover);
  color: var(--accent-text);
}

.user-menu-item:hover i {
  color: var(--accent-text);
}

.user-menu-badge {
  margin-left: auto;
  background-color: var(--accent-tint);
  color: var(--accent-text);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* Theme toggle row */
.theme-switch {
  margin-left: auto;
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: var(--radius-full);
  background-color: var(--border);
  flex-shrink: 0;
  transition: background-color 0.18s ease;
}

.theme-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--always-white);
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease;
}

.user-theme-toggle[aria-checked="true"] .theme-switch {
  background-color: var(--accent);
}

.user-theme-toggle[aria-checked="true"] .theme-switch-knob {
  transform: translateX(14px);
}

.user-signout-item {
  color: var(--danger-text);
}

.user-signout-item i {
  color: var(--danger-text);
}

.user-signout-item:hover {
  background-color: var(--danger-tint);
  color: var(--danger-text);
}

.user-signout-item:hover i {
  color: var(--danger-text);
}

/* ========================================================
   DISCOVER RIBBON (Airbnb-style Category Bar + Dropdowns)
   ======================================================== */
.discover-ribbon {
  position: sticky;
  top: var(--site-header-height, 57px);
  z-index: 990;
  background-color: var(--bg-sticky);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0 0.15rem 0;
  box-shadow: var(--shadow-xs);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.28s ease;
  will-change: transform;
}

.discover-ribbon.ribbon-hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.discover-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.category-scroller {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  padding: 0.1rem 0;
}

.category-scroller::-webkit-scrollbar {
  display: none;
}

.category-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 0.4rem 0.65rem 0.35rem 0.65rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  gap: 0.3rem;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: center;
}

.category-item .cat-icon {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
}

.category-item .cat-label {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: -0.1px;
  line-height: 1.2;
}

.category-item:hover {
  color: var(--text-body);
  border-bottom-color: var(--border-strong);
  background-color: var(--bg-hover);
}

.category-item.active {
  color: var(--accent-text);
  border-bottom-color: var(--accent);
  font-weight: 700;
  background-color: transparent;
}

/* Quick Filter Dropdowns */
.filter-controls-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.filter-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-select-icon {
  position: absolute;
  left: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.filter-select {
  padding: 0.45rem 2.2rem 0.45rem 2.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background-color: var(--bg-sunken);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  transition: all 0.15s ease;
}

.filter-select:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-surface);
}

.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
  background-color: var(--bg-surface);
}

/* Enhanced Date Range Filter & Popover */
.date-picker-dropdown-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.date-picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem 0.45rem 2.2rem;
  background-image: none;
  text-align: left;
  user-select: none;
  white-space: nowrap;
}

.date-picker-btn .filter-select-icon {
  position: absolute;
  left: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
  pointer-events: none;
}

.date-picker-label {
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-body);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-picker-chevron {
  font-size: 0.65rem;
  color: var(--text-subtle);
  margin-left: 0.25rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.date-picker-btn[aria-expanded="true"] .date-picker-chevron {
  transform: rotate(180deg);
}

.date-picker-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  background-color: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.85rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.date-picker-popover[hidden] {
  display: none !important;
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.date-picker-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.date-picker-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.date-picker-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.date-preset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background-color: var(--bg-sunken);
  color: var(--text-body);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.date-preset-btn:hover {
  border-color: var(--border-strong);
  background-color: var(--bg-hover);
}

.date-preset-btn.active {
  background-color: var(--accent-solid);
  border-color: var(--accent-solid);
  color: var(--text-on-solid);
  font-weight: 700;
}

.date-picker-divider {
  height: 1px;
  background-color: var(--border);
  margin: 0.1rem 0;
}

.date-picker-calendar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}


.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.15rem;
}

.cal-month-title {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-heading);
}

.cal-nav-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-body);
  cursor: pointer;
  font-size: 0.7rem;
  transition: all 0.15s ease;
}

.cal-nav-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.cal-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-subtle);
  padding: 0.2rem 0;
}

.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 34px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-body);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.cal-day-cell.other-month {
  color: var(--text-muted);
  opacity: 0.65;
}

.cal-day-cell.other-month.has-events {
  opacity: 0.9;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}

.cal-day-cell.other-month.has-events:hover {
  opacity: 1;
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.cal-day-cell.other-month.is-disabled {
  opacity: 0.25;
  pointer-events: none;
  cursor: not-allowed;
}

.cal-day-cell.is-disabled {
  color: var(--text-subtle);
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Future days the dates index has no listings for. Muted, but still clickable:
   they are legitimate start/end points for a range. */
.cal-day-cell.is-empty-day {
  color: var(--text-muted);
}

.cal-day-cell.is-empty-day:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-heading);
}

.cal-day-cell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  z-index: 1;
}


.cal-day-cell.has-events {
  font-weight: 700;
  color: var(--text-heading);
}

.cal-day-cell.has-events:hover {
  background-color: var(--bg-hover);
  border-color: var(--border-strong);
}

.cal-day-cell.is-today {
  border-color: var(--accent);
}

.cal-day-cell.is-selected,
.cal-day-cell.range-start,
.cal-day-cell.range-end {
  background-color: var(--accent-solid) !important;
  border-color: var(--accent-solid) !important;
  color: var(--text-on-solid) !important;
  font-weight: 700;
}

.cal-day-cell.range-start:not(.range-end):not(.range-solo) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.cal-day-cell.range-end:not(.range-start) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.cal-day-cell.in-range {
  background-color: var(--accent-subtle) !important;
  border-color: var(--accent-subtle) !important;
  color: var(--accent-text) !important;
  border-radius: 0;
  font-weight: 600;
}

/* The provisional band while a range is being dragged out. Same fill as a
   committed range so the preview is an honest picture of the result; the
   endpoint is what differs (outlined below, rather than solid). */
.cal-day-cell.in-range-preview {
  background-color: var(--accent-subtle);
  border-color: var(--accent-subtle);
  color: var(--accent-text);
  border-radius: 0;
}

.cal-day-cell.range-end-preview {
  background-color: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-text);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.cal-day-dot {
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: var(--radius-full);
  background-color: var(--accent);
}

.cal-day-cell.is-selected .cal-day-dot,
.cal-day-cell.range-start .cal-day-dot,
.cal-day-cell.range-end .cal-day-dot {
  background-color: var(--text-on-solid);
}


.date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-subtle);
}

.date-picker-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cal-legend-dot {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background-color: var(--accent);
  display: inline-block;
}

.date-picker-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-text-sm {
  background: none;
  border: none;
  padding: 0.1rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-text);
  cursor: pointer;
  border-radius: var(--radius-xs);
  font-family: inherit;
}

.btn-text-sm:hover {
  text-decoration: underline;
}

.cal-apply-btn {
  background-color: var(--accent-solid);
  color: var(--text-on-solid);
  border: none;
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cal-apply-btn:hover {
  background-color: var(--accent-hover);
}



/* Main Content Layout */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem 1.5rem;
  flex: 1;
  width: 100%;
}

/* Feed Header Row & Count */
.feed-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.feed-heading {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0 0 0.875rem;
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-heading);
}

.feed-heading-count {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-muted);
  display: inline-flex;
  align-items: baseline;
}

.feed-heading-count .results-number {
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  color: var(--text-heading);
}

.feed-heading-count .results-number.skeleton-count {
  display: inline-block;
  width: 2.2rem;
  height: 1.1rem;
  border-radius: var(--radius-xs);
  background-color: var(--bg-sunken);
  background-image: linear-gradient(
    90deg,
    var(--bg-sunken) 0%,
    var(--bg-shimmer) 50%,
    var(--bg-sunken) 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  vertical-align: middle;
}

.active-filter-chips-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--accent-tint);
  border: 1px solid var(--accent-border);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.summary-chip {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-hover);
}

.btn-clear-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  color: var(--accent-text);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.25rem;
}

.btn-clear-filters:hover {
  text-decoration: underline;
}

/* Views */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* Events Grid */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  min-height: 420px;
  transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.events-grid:empty {
  display: none;
  min-height: 0;
}

.events-grid.is-refreshing {
  opacity: 0.45;
  pointer-events: none;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Event Card */
.event-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  animation: cardFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  cursor: pointer;
}

.event-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.card-media {
  position: relative;
  height: 160px;
  background-color: var(--media-bg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-media img.card-img-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.card-media-category {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  color: var(--always-white);
  position: relative;
}

.category-icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--art-fill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--always-white);
  margin-bottom: 0.35rem;
}

/* Inline SVG rather than a webfont glyph: this artwork is the whole of the card
   for the ~quarter of events with no image, so it has to paint on the first
   frame instead of leaving an empty circle while a font loads. */
.category-icon-svg {
  width: 22px;
  height: 22px;
  display: block;
}

.category-icon-lg .category-icon-svg {
  width: 34px;
  height: 34px;
}

.category-banner-title {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--always-white);
}

/* Category Themes */
/* Category art. Every gradient is built from the two Chicago flag colours plus
   ink - no stray purple/teal/emerald/orange. Category identity is carried by the
   icon and label, not the hue, so these only have to read as CHI FREE.
   theme-movies, theme-parks and theme-museums are referenced by getCategoryTheme()
   and previously had no rule at all, so those cards rendered as a flat dark box. */
/* stylelint-disable declaration-property-value-disallowed-list -- Category card artwork - fixed gradients, white text sits on them. */
.theme-tech { background: linear-gradient(135deg, #0c4a6e, #0284c7); }
.theme-books { background: linear-gradient(135deg, #075985, #0ea5e9); }
.theme-kids { background: linear-gradient(135deg, #0369a1, #38bdf8); }
.theme-crafts { background: linear-gradient(135deg, #991b1b, #ef4444); }
.theme-games { background: linear-gradient(135deg, #7f1d1d, #b91c1c); }
.theme-civic { background: linear-gradient(135deg, #0f172a, #075985); }
.theme-music { background: linear-gradient(135deg, #7f1d1d, #dc2626); }
.theme-movies { background: linear-gradient(135deg, #0f172a, #334155); }
.theme-parks { background: linear-gradient(135deg, #0f172a, #0369a1); }
.theme-nature { background: linear-gradient(135deg, #0c4a6e, #0ea5e9); }
.theme-fitness { background: linear-gradient(135deg, #7f1d1d, #ef4444); }
.theme-museums { background: linear-gradient(135deg, #0c4a6e, #0369a1); }
.theme-default { background: linear-gradient(135deg, #0f172a, #0369a1); }
/* stylelint-enable declaration-property-value-disallowed-list */

/* Badges on Card Top */
.card-badges-top {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  z-index: 2;
}

.source-badge {
  background: var(--art-chrome);
  backdrop-filter: blur(4px);
  color: var(--always-white);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
}

.ongoing-tag-badge {
  background: var(--art-chrome);
  color: var(--art-accent);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-card-favorite {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  min-width: 32px;
  height: 32px;
  padding: 0 0.55rem;
  border-radius: var(--radius-full);
  background: var(--art-chrome);
  backdrop-filter: blur(4px);
  border: 1px solid var(--art-border);
  color: var(--always-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  line-height: 1;
}

.btn-card-favorite:not(.has-count) {
  width: 32px;
  padding: 0;
  border-radius: 50%;
}

.btn-card-favorite:hover {
  transform: scale(1.06);
  background: var(--art-chrome-strong);
  border-color: var(--art-border-strong);
}

.btn-card-favorite i {
  font-size: 0.78rem;
  color: var(--always-white);
  transition: color 0.15s ease;
}

.btn-card-favorite .card-saves-count {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--always-white);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

.btn-card-favorite.favorited {
  background: var(--art-chrome-strong);
  border-color: var(--art-border-danger);
}

.btn-card-favorite.favorited i {
  color: var(--danger);
}

/* Card Body */
.card-body {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-datetime {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-text);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* A run rather than an appointment: an exhibition, a seasonal installation, a
   months-long park sculpture. It gets a date window instead of a start time,
   because "8:00 PM" on something open for 240 days is not the useful fact and
   a countdown to its end is actively misleading. */
.date-ongoing-highlight,
.date-run-window {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-text);
}

.date-run-window {
  font-weight: 600;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.35;
  margin-bottom: 0.4rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-location {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.card-location span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-footer-row {
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-tags {
  display: flex;
  gap: 0.3rem;
  overflow: hidden;
}

.card-tag {
  font-size: 0.7rem;
  background-color: var(--bg-sunken);
  color: var(--text-muted);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
  font-weight: 600;
  white-space: nowrap;
  text-transform: capitalize;
}

.card-actions-quick {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-icon-action {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background-color: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-icon-action:hover {
  background-color: var(--bg-hover);
  color: var(--accent-text);
  border-color: var(--accent-border);
}

/* Map View */
.map-view-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1rem;
  height: calc(100vh - 190px);
  min-height: 560px;
}

.map-container {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  height: 100%;
  box-shadow: var(--shadow-sm);
  background-color: var(--bg-sunken);
}

#leaflet-map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Map Controls */
.map-recenter-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--art-chrome);
  backdrop-filter: blur(6px);
  color: var(--always-white);
  border: 1px solid var(--art-border-strong);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.map-recenter-btn:hover {
  background: var(--art-chrome-strong);
  transform: scale(1.03);
}

/* Custom Leaflet Category Pin */
.custom-leaflet-marker {
  background: none;
  border: none;
}

.map-pin-bubble {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--pin-bg, var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--always-white);
  transition: transform 0.15s ease;
}

.map-pin-bubble i {
  transform: rotate(45deg);
  color: var(--always-white);
  font-size: 0.85rem;
}

.custom-leaflet-marker:hover .map-pin-bubble {
  transform: rotate(-45deg) scale(1.18);
  box-shadow: var(--shadow-lg);
}

/* Map Popups */
.custom-popup-wrapper .leaflet-popup-content-wrapper {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
}

.custom-popup-wrapper .leaflet-popup-content {
  margin: 0;
  padding: 0.85rem;
  line-height: 1.4;
}

/* Dark mode has no keyless dark basemap available, so invert the OSM raster
   tiles instead. Scoped to the tile pane only - markers, popups and controls
   live in sibling panes and must not be touched. hue-rotate puts the blues and
   greens back the right way round after the invert; the brightness/contrast
   trim stops the result glaring against --bg-canvas. */
/* Most components carry transition: all, so flipping the theme would otherwise
   cross-fade several hundred elements at once - a visible smear rather than a
   switch. Suppress transitions for the duration of the swap only. */
:root.theme-switching *,
:root.theme-switching *::before,
:root.theme-switching *::after {
  transition: none !important;
}

:root[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.94) contrast(0.88) saturate(0.75);
}

/* Leaflet ships its own white chrome - popups, zoom buttons, the attribution
   bar and the tile-loading backdrop. None of it reads our stylesheet, so route
   each surface through the tokens or the map furniture stays light-mode. */
.leaflet-container {
  background: var(--bg-sunken);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--bg-raised);
  color: var(--text-body);
}

.leaflet-container a.leaflet-popup-close-button {
  color: var(--text-subtle);
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--text-body);
  background: transparent;
}

.leaflet-bar a,
.leaflet-bar a:hover {
  background-color: var(--bg-raised);
  color: var(--text-body);
  border-bottom-color: var(--border);
}

.leaflet-bar a:hover {
  background-color: var(--bg-hover);
}

.leaflet-bar a.leaflet-disabled {
  background-color: var(--bg-sunken);
  color: var(--text-subtle);
}

/* Leaflet scopes its own attribution rule under .leaflet-container, so match
   that specificity or the white bar survives on the dark basemap. */
.leaflet-container .leaflet-control-attribution {
  background: var(--bg-sticky);
  color: var(--text-subtle);
}

.leaflet-container .leaflet-control-attribution a {
  color: var(--accent-text);
}

.map-popup-badge-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.map-popup-source {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-tint);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-xs);
}

.map-popup-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.25;
  margin-bottom: 0.45rem;
}

.map-popup-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.map-popup-meta-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.map-popup-actions {
  display: flex;
  gap: 0.4rem;
}

.map-popup-btn {
  flex: 1;
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  text-align: center;
}

.map-popup-icon-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
}

/* Map Sidebar */
.map-sidebar {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  box-shadow: var(--shadow-xs);
}

.map-sidebar-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-sunken);
}

.map-header-info h3 {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.1rem;
}

.map-sidebar-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.map-mode-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  padding: 2px;
  border-radius: var(--radius-full);
  margin-top: 0.35rem;
}

.map-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-mode-btn:hover {
  color: var(--text-heading);
}

.map-mode-btn.active {
  background: var(--bg-surface);
  color: var(--accent-text);
  box-shadow: var(--shadow-xs);
}

.map-count-badge {
  background: var(--accent-tint);
  color: var(--accent-text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.landmark-badge-free {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--success-tint);
  color: var(--success-text);
  border: 1px solid var(--success-border);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
}

.map-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.map-card-mini {
  display: flex;
  gap: 0.65rem;
  padding: 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.15s ease;
}

.map-card-mini:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.map-card-mini.active {
  border-color: var(--accent);
  background: var(--accent-tint);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.map-card-mini-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.map-card-mini-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.map-card-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.map-card-mini-time {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-text);
}

.map-card-mini-neigh {
  font-size: 0.68rem;
  color: var(--text-subtle);
  background: var(--bg-sunken);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-xs);
}

.map-card-mini-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.25;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-card-mini-venue {
  font-size: 0.74rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--scrim);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background-color: var(--bg-raised);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
}

.modal-sm { max-width: 400px; }
.modal-md { max-width: 540px; }
.modal-lg { max-width: 680px; }

.modal-close-btn {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--bg-inverse);
  color: var(--text-inverse);
}

/* Event Details Modal Structure */
.modal-card.modal-lg {
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.modal-event-hero {
  position: relative;
  height: 200px;
  background-color: var(--media-bg);
  flex-shrink: 0;
}

.modal-event-hero img.modal-img-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* CPL Civic Library Hero */
.modal-cpl-hero {
  height: 140px;
  /* stylelint-disable-next-line declaration-property-value-disallowed-list -- CPL hero artwork. */
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--always-white);
  position: relative;
  padding: 1.25rem 1rem;
}

.modal-cpl-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: radial-gradient(var(--always-white) 1px, transparent 1px);
  background-size: 16px 16px;
  pointer-events: none;
}

.modal-cpl-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-cpl-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--art-fill);
  backdrop-filter: blur(6px);
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--always-white);
  margin-bottom: 0.35rem;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.modal-cpl-branch {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--always-white);
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.modal-cpl-category {
  font-size: 0.76rem;
  color: var(--art-accent-soft);
  font-weight: 600;
}

/* Category Fallback Hero */
.modal-category-hero {
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.category-icon-lg {
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
}

.category-title-lg {
  font-size: 1rem;
}

/* Scrollable Modal Body */
.modal-event-scrollable-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.modal-badges-row {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.free-tag-badge {
  background: var(--success-tint);
  color: var(--success-text);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
}

.neighborhood-tag-badge {
  background: var(--bg-sunken);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.modal-event-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
  color: var(--text-heading);
  margin-bottom: 1rem;
}

/* Interactive Meta Boxes (Date & Location) */
.modal-event-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.meta-item-clickable {
  display: flex;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.meta-item-clickable:hover,
.meta-item-clickable:focus {
  background: var(--bg-surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
  outline: none;
}

.meta-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  color: var(--accent-text);
  flex-shrink: 0;
}

.meta-text-block {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.meta-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.meta-label-row strong {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meta-action-hint {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-text);
}

.meta-primary-val {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-heading);
  line-height: 1.3;
}

.meta-sub-val {
  font-size: 0.74rem;
  color: var(--text-subtle);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Expandable Calendar Drawer */
.modal-calendar-drawer {
  background: var(--accent-tint);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  margin-bottom: 1rem;
  animation: drawerSlideDown 0.15s ease-out;
}

@keyframes drawerSlideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.calendar-drawer-heading {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-hover);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.calendar-drawer-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cal-btn {
  flex: 1;
  min-width: 180px;
  background: var(--bg-surface);
  border-color: var(--accent-border);
  font-size: 0.78rem;
}

.cal-btn:hover {
  background: var(--bg-surface);
  border-color: var(--accent);
  color: var(--accent-text);
}

.modal-event-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-body);
  margin-bottom: 0.5rem;
  white-space: pre-line;
}

/* Sticky Modal Footer */
.modal-sticky-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  z-index: 10;
  box-shadow: var(--shadow-up);
  flex-shrink: 0;
}

.modal-footer-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.modal-action-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.modal-action-btn.btn-favorited {
  background-color: var(--danger-tint);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.modal-source-btn {
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Auth & Form Styles */
.auth-header {
  text-align: center;
  padding: 1.25rem 1.25rem 0.5rem 1.25rem;
}

.auth-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-tint);
  border: 1px solid var(--accent-border);
  color: var(--accent-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin: 0 auto 0.5rem auto;
}

.auth-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.25rem;
}

.auth-header p {
  line-height: 1.4;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0.5rem 1.25rem 0.75rem 1.25rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.auth-tab {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.auth-tab-btn:hover, .auth-tab:hover {
  color: var(--text-heading);
}

.auth-tab-btn.active, .auth-tab.active {
  background: var(--bg-raised);
  color: var(--accent-text);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.auth-alert {
  margin: 0 1.25rem 0.85rem 1.25rem;
  padding: 0.6rem 0.85rem;
  background: var(--danger-tint);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  color: var(--danger-text);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
}

.auth-form {
  padding: 0 1.25rem 1.25rem 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.75rem;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group textarea {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-input);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--text-body);
  background: var(--bg-surface);
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.sub-neighborhood-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 120px;
  overflow-y: auto;
  padding: 0.35rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sub-neigh-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  background: var(--bg-surface);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  cursor: pointer;
}

.subscribe-sections {
  padding: 0 1.25rem 1.25rem 1.25rem;
}

.subscribe-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1rem 0;
  color: var(--text-subtle);
  font-size: 0.75rem;
  font-weight: 700;
}

.subscribe-divider::before, .subscribe-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.subscribe-divider span {
  padding: 0 0.5rem;
}

.calendar-feed-box {
  background: var(--bg-sunken);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.calendar-feed-box h4 {
  font-size: 0.88rem;
  margin-bottom: 0.25rem;
}

.feed-description {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.feed-url-copy-wrapper {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.6rem;
}

.feed-url-copy-wrapper input {
  flex: 1;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  background: var(--bg-surface);
}

.feed-app-links {
  display: flex;
  gap: 0.4rem;
}

.btn-feed-link {
  flex: 1;
  padding: 0.4rem;
  text-align: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-body);
  text-decoration: none;
}

.btn-feed-link:hover {
  background: var(--accent-tint);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.toast {
  background-color: var(--bg-inverse);
  color: var(--text-inverse);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Empty States & Loaders */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  grid-column: 1 / -1;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-sunken);
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem auto;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 400px;
  margin: 0 auto 1rem auto;
}

.infinite-scroll-status,
.scroll-status {
  padding: 1.5rem 0 3rem 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.end-of-feed {
  width: 100%;
  max-width: 580px;
  margin: 1rem auto 0 auto;
  display: flex;
  justify-content: center;
  animation: cardFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.end-feed-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.end-feed-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  /* stylelint-disable-next-line declaration-property-value-disallowed-list -- Chicago flag rule. */
  background: linear-gradient(90deg, #0284c7 0%, #dc2626 50%, #0284c7 100%);
}

.end-feed-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--danger-tint);
  border: 1px solid var(--danger-border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.end-feed-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.3px;
  margin: 0;
}

.end-feed-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 440px;
  margin: 0;
}

.end-feed-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.spinner-loader {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 1rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--bg-sticky);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  z-index: 1500;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  height: 100%;
  position: relative;
}

.mobile-nav-btn i {
  font-size: 1.05rem;
}

.mobile-nav-btn.active {
  color: var(--accent-text);
}

.mobile-badge {
  position: absolute;
  top: 6px;
  right: 25%;
  background: var(--danger-solid);
  color: white;
  font-size: 0.6rem;
  padding: 1px 4px;
  border-radius: var(--radius-full);
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .view-mode-tabs {
    display: none;
  }
  
  .mobile-bottom-nav {
    display: flex;
  }
  
  body {
    padding-bottom: 64px;
  }

  .map-view-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .map-container {
    height: 400px;
  }
}

@media (max-width: 768px) {
  .header-container {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
  }

  .brand-group {
    width: auto;
  }

  .search-bar-wrapper {
    max-width: 100%;
    order: 3;
    width: 100%;
    min-width: 100%;
  }

  .header-actions {
    order: 2;
  }

  .discover-container {
    padding: 0 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .filter-controls-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .date-picker-dropdown-wrap {
    width: 100%;
  }

  .date-picker-btn {
    width: 100%;
  }

  .date-picker-popover {
    left: 0;
    width: min(320px, calc(100vw - 2rem));
  }


  .main-content {
    padding: 1rem 1rem 2rem 1rem;
  }

  .events-grid {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 85vh;
  }
}

/* Print Friendly Styles */
/* stylelint-disable declaration-property-value-disallowed-list -- Print output is always light - literals are correct here. */
@media print {
  .site-header,
  .discover-ribbon,
  .mobile-bottom-nav,
  .card-footer-row,
  .btn-card-favorite,
  .toast-container,
  .modal-overlay {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding: 0 !important;
  }

  .main-content {
    max-width: 100% !important;
    padding: 0 !important;
  }

  .events-grid {
    display: block !important;
  }

  .event-card {
    page-break-inside: avoid;
    border: 1px solid #cccccc !important;
    margin-bottom: 1rem !important;
    box-shadow: none !important;
  }
}
/* stylelint-enable declaration-property-value-disallowed-list */

/* ============================================================
   Phase 1 + 2: invitation, hierarchy, and touch/a11y fixes
   ============================================================ */

/* Screen-reader-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* The page h1 keeps the old visual weight of the results counter */
h1.results-count-title {
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

/* --- Starting soon rail --- */
.tonight-strip {
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: linear-gradient(180deg, var(--accent-tint) 0%, var(--bg-surface) 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
}

.tonight-head {
  margin-bottom: 1rem;
}

.tonight-heading {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tonight-heading i {
  color: var(--danger-text);
}

.tonight-sub {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.tonight-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 300px);
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.tonight-rail::-webkit-scrollbar {
  height: 6px;
}

.tonight-rail > .event-card {
  scroll-snap-align: start;
}


/* --- Urgency badge on card media --- */
.card-urgency {
  position: absolute;
  top: 0.625rem;
  left: 0.625rem;
  z-index: 2;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--always-white);
  background-color: var(--art-chrome);
}

.card-urgency-now {
  background-color: var(--danger-solid);
}

.card-urgency-today {
  background-color: var(--art-badge-accent);
}

.card-urgency-soon {
  background-color: var(--art-chrome);
}

/* --- Card title as a real link --- */
.card-title-link {
  color: inherit;
  text-decoration: none;
}

.card-title-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card-pin {
  color: var(--danger-text);
  margin-top: 2px;
}


/* --- Featured card: breaks the uniform grid --- */
@media (min-width: 900px) {
  .event-card-featured {
    grid-column: span 2;
  }

  .event-card-featured .card-media {
    height: 220px;
  }

  .event-card-featured .card-title {
    font-size: 1.25rem;
  }
}

/* --- Skeletons --- */
.skeleton-grid {
  display: none;
}

.skeleton-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.skeleton-media {
  height: 160px;
  background-color: var(--bg-sunken);
}

.skeleton-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.skeleton-line {
  height: 0.75rem;
  border-radius: var(--radius-xs);
  background-color: var(--bg-sunken);
}

.skeleton-line-sm { width: 40%; }
.skeleton-line-lg { width: 85%; height: 1rem; }
.skeleton-line-md { width: 60%; }

.skeleton-media,
.skeleton-line {
  background-image: linear-gradient(
    90deg,
    var(--bg-sunken) 0%,
    var(--bg-shimmer) 50%,
    var(--bg-sunken) 100%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Working dot loader (replaces the styleless bounce divs) --- */

.spinner-loader .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-hover);
  animation: dotPulse 1.2s ease-in-out infinite;
}

.spinner-loader .dot:nth-child(3) { animation-delay: 0.16s; }
.spinner-loader .dot:nth-child(4) { animation-delay: 0.32s; }

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* --- Keyboard shortcuts overlay --- */
.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background-color: var(--scrim);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.shortcuts-overlay[hidden] {
  display: none;
}

.shortcuts-card {
  position: relative; /* containing block for the absolutely-positioned close button */
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 380px;
  padding: 1.25rem;
}

.shortcuts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.shortcuts-head h2 {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  color: var(--text-heading);
}

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shortcut-row dt {
  flex: 0 0 3rem;
}

.shortcut-row dd {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.shortcuts-list kbd {
  display: inline-block;
  min-width: 1.75rem;
  text-align: center;
  padding: 0.1875rem 0.4375rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  color: var(--text-body);
  background-color: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
}

/* --- Touch targets: PRODUCT.md mandates >=44px ---
   The in-card icon row cannot afford three 44px squares on a 300px card, so we
   keep the visual size and extend the *hit area* with a centered pseudo-element.
   Same accessible target, no layout cost. */
.btn-card-favorite,
.modal-close-btn {
  width: 40px;
  height: 40px;
}

.btn-icon-action,
.btn-icon-only {
  position: relative;
}

.btn-icon-action::after,
.btn-card-favorite::after,
.modal-close-btn::after,
.btn-icon-only::after,
.search-clear-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: inherit;
}

.view-tab-btn,
.filter-select,
.user-pill-btn,
.mobile-nav-btn {
  min-height: 44px;
}

/* --- Visible focus for every interactive element --- */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .event-card:hover {
    transform: none;
  }
}

/* ============================================================
   Phase 3 + 4: Chicago identity and engagement loops
   ============================================================ */

/* Neighborhood is the most meaningful word on a card for a Chicagoan -
   make it a real, tappable filter rather than bold grey text. */
.card-hood {
  font: inherit;
  font-weight: 700;
  color: var(--accent-text);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
}

.card-hood:hover {
  text-decoration-color: currentColor;
}

/* Saved view header holds the export action */
.favorites-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.favorites-header h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.favorites-header p {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

#btn-export-saved[hidden] {
  display: none;
}

/* ============================================================
   Popularity: saved-event counts (replaces the RSVP "Going" control)
   ============================================================ */



/* Modal badge. Lives in the badges row, which is already where facts about the
   event live - the footer stays purely actions. */
.saves-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-text);
  background-color: var(--accent-tint);
  border: 1px solid var(--accent-border);
}

.saves-badge-hot {
  color: var(--text-on-solid);
  background-color: var(--danger-solid);
  border-color: var(--danger);
}
