* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #000000;
  --text-secondary: #888888;
  --text-muted: #aaaaaa;
  --border: #d0d0d0;
  --border-light: #e8e8e8;
  --now-dot: #22c55e;
  --radius: 2px;
}

html {
  overscroll-behavior-y: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* ── Prevent iOS zoom on input focus ── */
input, select, textarea {
  font-size: 16px !important;
}

/* ── Jurisdiction banner ── */
.jurisdiction-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 600;
  background: var(--bg);
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.jurisdiction-banner::-webkit-scrollbar { display: none; }

.jurisdiction-chip {
  flex: none;
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.jurisdiction-chip:hover { color: var(--text-secondary); }
.jurisdiction-chip.active {
  color: var(--bg);
  border-bottom-color: transparent;
}

/* ── Map (full-screen background) ── */
.map-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#map { height: 100%; width: 100%; touch-action: none; }

/* ── Bottom sheet ── */
#bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  /* JS sets exact pixel height in computeSnaps so the sheet's bottom at
     full snap sits on the visible viewport bottom (not clipped by the
     iOS address bar). Fallback for pre-JS render. */
  height: 78dvh;
  z-index: 500;
  background: var(--bg);
  border-radius: 12px 12px 0 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  will-change: transform;
  /* Default: half screen. JS sets this on init */
  transform: translateY(50vh);
}
#bottom-sheet.snapping {
  transition: transform 0.35s cubic-bezier(0.2, 0, 0, 1);
}
#bottom-sheet.dragging {
  transition: none;
}

#sheet-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  min-height: 0;
}

/* Buffer below sheet-scroll — lives offscreen at rest (sheet extends below
   viewport bottom by SHEET_SPACER_PX in app.js), becomes visible when
   rubber-band past SNAP_FULL lifts the sheet, so the user never sees the
   map behind it. flex-basis must match SHEET_SPACER_PX in app.js. */
.sheet-spacer {
  flex: 0 0 200px;
}

/* ── Grab handle (top of sheet) ── */
.map-grab-handle {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 4px;
  cursor: ns-resize;
}
.map-grab-handle::after {
  content: '';
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}

/* ── Mode bar ── */
.mode-bar {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--border-light);
}

.services-btn {
  flex: none;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.services-btn:hover { color: var(--text); border-color: var(--text-secondary); }
.services-btn.active {
  color: var(--bg);
  background: var(--text);
  border-color: var(--text);
}

.time-pills {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: flex-end;
  align-items: center;
}
/* Today sits at the true horizontal centre of the mode bar (viewport
   centre), This month stays flush-right via the flex container. */
.time-pills .today-pill {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% - 2px));
}

/* ── Filters button (collapses services/social/english) ──
   Sized to match the Today/This month pills: same padding, radius,
   font-size, and line height. */
.filters-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  transition: all 0.15s;
}
.filters-btn:hover { color: var(--text); border-color: var(--text-secondary); }
.filters-btn.has-active {
  color: var(--text);
  border-color: var(--text-secondary);
}
.filters-btn-content { display: inline-flex; align-items: center; gap: 4px; }
.filters-btn-content img { width: 14px; height: 14px; opacity: 0.8; }
.filters-btn-hamburger { font-size: 13px; line-height: 1; }
.filters-btn-label { font-size: 12px; font-weight: 500; letter-spacing: 0.02em; }
.filters-btn-content .fm-en-badge {
  opacity: 1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border: 1px solid var(--text);
  border-radius: 4px;
  line-height: 1;
  color: var(--text);
  background: transparent;
}
.filters-btn-content .fm-en-badge.strict {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ── Filters dropdown menu ── */
.filters-menu {
  position: absolute;
  top: 40px;
  left: 12px;
  /* Fixed width so toggling english labels doesn't resize the menu. */
  width: 240px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  padding: 4px;
  z-index: 600;
}
.filters-menu-sep {
  height: 1px;
  background: var(--border-light);
  margin: 4px 10px;
}
.filters-menu.hidden { display: none; }
.filters-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.filters-menu-item:hover { background: var(--border-light); }
.filters-menu-item .fm-icon {
  flex: none;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.filters-menu-item .fm-label {
  flex: 1;
  font-size: 13px;
  color: var(--text);
}
.filters-menu-item .fm-check {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  position: relative;
}
.filters-menu-item.active .fm-check {
  background: var(--text);
  border-color: var(--text);
}
.filters-menu-item.active .fm-check::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 4px;
  height: 8px;
  border: solid var(--bg);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.fm-en-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 4px;
  border: 1px solid var(--text);
  border-radius: 4px;
  color: var(--text);
  line-height: 1;
}
.filters-menu-item.fm-english.strict .fm-en-badge {
  background: var(--text);
  color: var(--bg);
}

.pill {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.pill:hover { color: var(--text); }
.pill.active {
  color: var(--text);
  border-color: var(--border);
}

/* ── Parish filter pills ── */
.parish-filter-row {
  flex: none;
  display: none;
  gap: 4px;
  padding: 4px 12px 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.parish-filter-row::-webkit-scrollbar { display: none; }
.parish-filter-row.visible { display: flex; }

/* Sticky exit-X in multi-parish mode — pinned to right edge while pills scroll under */
.parish-row-exit {
  position: sticky;
  right: 0;
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  margin-left: auto;
  font-size: 18px;
  line-height: 22px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  box-shadow: -6px 0 8px -4px var(--bg);
}
.parish-row-exit:hover { background: var(--bg-hover, #f5f5f5); }

/* ── Archdiocese events banner ── */
.archdiocese-events-banner {
  flex: none;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.archdiocese-events-banner:hover {
  color: var(--text);
  background: var(--bg-hover, #f5f5f5);
}
.archdiocese-events-banner.visible { display: flex; }
.archdiocese-events-icon {
  width: 13px;
  height: 13px;
  opacity: 0.5;
}

.parish-pill {
  flex: none;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.parish-pill:hover { color: var(--text-secondary); border-color: var(--border); }
.parish-pill.active {
  color: var(--bg);
  border-color: transparent;
}

.location-pill {
  flex: none;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.location-pill:hover { color: var(--text-secondary); border-color: var(--border); }
.location-pill.active {
  color: #1565c0;
  border-color: #1565c0;
  background: #e3f2fd;
}
.location-pill img {
  width: 14px;
  height: 14px;
  filter: brightness(0) saturate(100%) invert(55%);
}
.location-pill.active img {
  filter: brightness(0) saturate(100%) invert(28%) sepia(97%) saturate(1200%) hue-rotate(199deg);
}

/* ── Content views ── */
.content-view { display: none; }
.content-view.active { display: block; }

/* ── Section headers ── */
.section-header {
  padding: 12px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.sub-day-header {
  padding: 4px 14px 2px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.6;
}
.day-divider {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 8px 0 0;
}
.month-header {
  padding: 28px 14px 12px;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--text);
  border-top: 1px solid var(--border-light);
  margin-top: 16px;
}
.section-header .now-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--now-dot);
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Services title (replaces time pills when in services mode) ── */
.services-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Centre the title at the true middle of the mode bar (viewport centre),
   regardless of filters-btn width. */
.time-pills:has(.services-title) {
  position: static;
}
.services-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% - 2px));
}

/* ── Event cards ── */
.event-card {
  display: flex;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s;
  box-shadow: inset 0 -6px 8px -8px rgba(0, 0, 0, 0.14);
}
.event-card:hover { background: #fafafa; }
.event-card:active { background: #f5f5f5; }
.event-card.event-cancelled { opacity: 0.5; }
.event-card.event-cancelled .event-title { text-decoration: line-through; }

.event-content { flex: 1; min-width: 0; }

.event-title-row {
  line-height: 1.4;
}
.event-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.event-time {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  margin-right: 5px;
}
.event-time .t-min,
.event-time .t-mer {
  font-size: 0.72em;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}
.event-time .t-mer {
  text-transform: uppercase;
  margin-left: 1px;
}

.event-parish-row {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.event-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 2px;
  margin-left: 4px;
  vertical-align: middle;
}
.badge-liturgy { background: #e8d5e8; color: #6b2d6b; }
.badge-prayer { background: #d5e0f0; color: #2d4a7a; }
.badge-youth { background: #d0e8f5; color: #2d5a8a; }
.badge-social { background: #d5ead5; color: #2d6a2d; }
.badge-talk { background: #f0e8d5; color: #7a5a20; }
.badge-feast { background: #f5ecd0; color: #7a6520; }
.badge-other { background: #f0f0f0; color: #555; }
.badge-cancelled { background: #f0f0f0; color: #888; }
.badge-bilingual { background: #e0f0e8; color: #1a6640; }
.badge-live { background: #ef4444; color: #fff; display: inline-flex; align-items: center; gap: 4px; }
.badge-live .live-dot { background: #fff; }
.badge-live-soon { background: #fee2e2; color: #b91c1c; }
.live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #ef4444;
  border-radius: 50%;
  animation: live-pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.btn-watch-live {
  background: #ef4444;
  color: #fff;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-watch-live .live-dot { background: #fff; }
.detail-actions .btn-service-book {
  background: #1e3a5f;
  color: #fff;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-service-book-icon {
  width: 15px;
  height: 15px;
  filter: invert(1);
  flex-shrink: 0;
  display: block;
}
/* Legacy types still in DB — mapped to display types at render time */
.badge-vespers { background: #d5e0f0; color: #2d4a7a; }
.badge-matins { background: #f0e0d0; color: #7a4a20; }
.badge-festival { background: #d5ead5; color: #2d6a2d; }
.badge-fundraiser { background: #e0f0e0; color: #3a6a3a; }

/* ── Parish acronym on event cards ── */
.event-parish-acronym {
  font-weight: 700;
  margin-right: 4px;
  opacity: 0.6;
}

/* ── Sunday cluster ── */
.sunday-cluster {
  border-left: 3px solid var(--border);
  background: #fafafa;
  margin: 4px 0;
  padding-left: 0;
  border-radius: 0 4px 4px 0;
}
.sunday-cluster .section-header {
  font-weight: 700;
}

/* ── Services view ── */
.parish-schedule {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.parish-schedule:hover { background: #fafafa; }
.parish-schedule:active { background: #f5f5f5; }
.parish-schedule-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.parish-schedule-jurisdiction {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1px;
}
.schedule-day {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-top: 10px;
}
.schedule-item {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
  padding-left: 2px;
}
.schedule-item-time {
  color: var(--text-muted);
}
.schedule-item-lang {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 4px;
}
.schedule-item-wom {
  font-size: 9px;
  font-style: italic;
  color: var(--text-muted);
  margin-left: 4px;
  opacity: 0.7;
}
.schedule-edit-btn {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  margin-left: 2px;
  opacity: 0.5;
}
.schedule-edit-btn:hover { opacity: 1; }
.schedule-edit-form {
  padding: 6px 0 8px;
  margin-left: 8px;
}
.schedule-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.schedule-edit-grid input,
.schedule-edit-grid select {
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: inherit;
}
.wom-checkboxes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
}
.wom-label {
  color: var(--text-muted);
  font-size: 10px;
}
.wom-check {
  display: flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font-size: 11px !important;
}
.wom-check input { width: auto; font-size: 11px !important; }

.schedule-save-btn, .schedule-del-btn {
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.schedule-save-btn { background: var(--text); color: #fff; border-color: transparent; }
.schedule-del-btn { background: none; color: #ef4444; border-color: #ef4444; }

/* ── Detail panel ── */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border-left: 4px solid var(--border);
  z-index: 1000;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  padding: 20px;
}
.detail-panel:not(.hidden) { transform: translateX(0); }
.detail-panel.dragging { transition: none; }

/* Grab handle on left edge */
.detail-grab-handle {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  width: 16px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 1;
}
.detail-grab-handle::after {
  content: '';
  width: 3px;
  height: 28px;
  border-radius: 2px;
  background: var(--border);
}

/* Parish info section in event detail */
.detail-parish-info {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.close-btn {
  position: absolute;
  top: 12px;
  left: 14px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  z-index: 1;
}

.detail-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  padding-left: 30px;
}
.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.detail-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-actions a,
.detail-actions button {
  display: inline-block;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 4px;
  transition: opacity 0.15s;
  cursor: pointer;
}
.detail-actions a:hover,
.detail-actions button:hover { opacity: 0.8; }
.btn-primary {
  background: var(--text);
  color: var(--bg);
  border: none;
}
.btn-outline {
  background: none;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-danger {
  background: #dc3545;
  color: #fff;
  border: none;
}
.btn-cancel-event { color: #b91c1c; border-color: #fca5a5; }
.btn-hide-event { color: #6b7280; border-color: #d1d5db; }
.btn-save {
  background: #28a745;
  color: #fff;
  border: none;
  min-height: 44px;
  padding: 10px 20px;
  font-size: 16px;
}

/* ── Admin edit form in detail panel ── */
.detail-edit-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}
.detail-edit-form .edit-row {
  margin-bottom: 8px;
}
.detail-edit-form label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}
.detail-edit-form input:not([type=checkbox]):not([type=radio]),
.detail-edit-form textarea,
.detail-edit-form select {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
}
.detail-edit-form textarea { resize: vertical; min-height: 60px; }

/* ── Location-active distance indicators ── */
.distance-blue { color: #2196f3; }
.distance-near { color: #1565c0; font-weight: 600; }
.distance-mid { color: #42a5f5; }
.distance-far { color: #90caf9; }

/* ── Nearby/Time sort toggle ── */
.sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  float: right;
}
.sort-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--bg, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.sort-toggle button.active {
  color: #1565c0;
  background: #e3f2fd;
  border-color: #1565c0;
}
.sort-toggle button:hover { color: var(--text); }
.sort-toggle .sort-icon {
  width: 12px;
  height: 12px;
  filter: brightness(0) saturate(100%) invert(50%);
}
.sort-toggle button.active .sort-icon {
  filter: brightness(0) saturate(100%) invert(28%) sepia(97%) saturate(1200%) hue-rotate(199deg);
}

/* ── Empty state ── */
.empty-state {
  padding: 48px 20px 32px;
  text-align: center;
  color: var(--text-muted);
}
.empty-ornament {
  display: block;
  font-size: 11px;
  color: var(--border);
  letter-spacing: 6px;
  margin-bottom: 14px;
}
.empty-state h3 {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}
.empty-state p {
  font-size: 12px;
}
/* Pull View more closer when nothing is on today. */
.empty-state + .list-footer {
  padding-top: 4px;
  min-height: 0;
}
/* ── Earlier today section ── */
.earlier-today-section {
  position: relative;
  margin-top: 16px;
  opacity: 0.55;
}
.earlier-today-header {
  color: var(--text-muted);
}

.cta-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
}

/* ── List footer (view-more + archdiocese link) ── */
.list-footer {
  position: relative;
  padding: 28px 16px 32px;
  min-height: 30vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  background: #fff;
}
/* Tighter footer when 'Earlier today' follows — collapses the big gap. */
.list-footer:has(+ .earlier-today-section) {
  min-height: 0;
  padding-bottom: 16px;
}
.list-footer-ornament {
  font-size: 9px;
  color: var(--border);
  letter-spacing: 8px;
  padding-left: 8px; /* optically centre the letter-spaced dots */
  user-select: none;
}
.list-footer-btn {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 11px 28px;
  border-radius: 24px;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 0 transparent;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.list-footer-btn:hover {
  border-color: #bbb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.09);
}
.list-footer-btn:active {
  background: var(--border-light);
  box-shadow: none;
}
.list-footer-arch-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  text-decoration: none;
  text-transform: uppercase;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 10px 20px;
  min-height: 44px;
  background: #fff;
  transition: border-color 0.15s, color 0.15s;
}
.list-footer-arch-link::after {
  content: '→';
  font-size: 14px;
  opacity: 0.5;
}
.list-footer-arch-link:hover {
  color: var(--text);
  border-color: #bbb;
}
.cta-link:hover { color: var(--text); }

/* ── Admin float ── */
.admin-float {
  position: fixed;
  bottom: 12px;
  right: 12px;
  z-index: 550;
}
.admin-float a {
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}
.admin-float a:hover { color: var(--text); border-color: var(--text-secondary); }

/* ── Backdrop for detail panel ── */
.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 999;
}

/* ── Map text labels ── */
.map-label {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-shadow: 1px 1px 2px rgba(255,255,255,0.9), -1px -1px 2px rgba(255,255,255,0.9),
               0 1px 2px rgba(255,255,255,0.9), 0 -1px 2px rgba(255,255,255,0.9);
}
.map-label-sub {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.7;
}

/* ── Event poster in detail panel ── */
.detail-poster {
  display: flex;
  justify-content: center;
  margin: 20px 0 24px;
}
.detail-poster img {
  width: 40%;
  display: block;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  transform-origin: center center;
  /* No touch-action:none here — lets single-finger scroll the panel when not zoomed */
  user-select: none;
  -webkit-user-select: none;
  cursor: zoom-in;
}

/* ── Fullscreen poster lightbox ── */
.poster-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2,0,0,1);
}
.poster-fullscreen.open {
  opacity: 1;
  transform: scale(1);
}
.poster-fullscreen.hidden {
  display: none;
}
.poster-fullscreen img {
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transform-origin: center center;
}


/* ── Reset FAB (top center) ── */
#reset-fab {
  position: fixed;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  display: none;
  padding: 7px 16px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary, #555);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#reset-fab.visible { display: block; opacity: 1; }

/* ── Location FAB (bottom right) ── */
#location-fab {
  position: fixed;
  right: 16px;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border, #d0d0d0);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.45s ease;
}
#location-fab img {
  width: 22px;
  height: 22px;
  filter: brightness(0) saturate(100%) invert(60%);
  transform: translateX(-1px);
}
#location-fab.active { border-color: #4285f4; }
#location-fab.active img { filter: brightness(0) saturate(100%) invert(38%) sepia(98%) saturate(1000%) hue-rotate(199deg); }
#location-fab.fading { opacity: 0; pointer-events: none; }
body.map-expanded #location-fab { display: flex; }

/* ── Parish card header ── */
.parish-card-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface, #fff);
}
.parish-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
  transition: background 0.15s;
}
.parish-card-top:hover { background: var(--border-light); }
.parish-card-chevron {
  align-self: center;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  margin-left: 4px;
  transform: translateY(-1px);
}
.parish-card-avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}
.parish-card-info { flex: 1; min-width: 0; }
.parish-card-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}
.parish-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.parish-card-sep { margin: 0 4px; }
.parish-card-close {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}
.parish-card-close:hover { background: var(--border-light); }
.parish-card-addr-row {
  margin-top: 6px;
  padding-left: 46px;
}
.parish-card-address {
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
}
.parish-card-address:hover { text-decoration: underline; }
.parish-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-left: 46px;
}
.parish-card-btn {
  display: inline-block;
  padding: 5px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  cursor: pointer;
}
.parish-card-btn:hover { background: var(--border-light); }

/* ── Responsive ── */
@media (min-width: 640px) {
  #bottom-sheet { max-width: 420px; left: auto; right: 16px; border-radius: 12px 12px 0 0; }
  .events-list, .services-list { max-width: none; }
  .mode-bar { max-width: none; padding: 4px 12px 8px; }
  .parish-filter-row { max-width: none; }
}
