:root {
  color-scheme: light;
  --ink: #103f5a;
  --muted: #607987;
  --paper: #f3f8fa;
  --surface: #ffffff;
  --surface-raised: rgba(255, 255, 255, 0.92);
  --surface-soft: #eef4f6;
  --line: #d4e3e9;
  --accent: #ee8b22;
  --accent-strong: #d76f08;
  --accent-soft: #fff0dc;
  --blue: #0075a9;
  --blue-deep: #005f8c;
  --blue-soft: #e3f2f8;
  --focus-ring: rgba(0, 117, 169, 0.18);
  --shadow: 0 14px 38px rgba(0, 73, 107, 0.1);
  --shadow-soft: 0 6px 18px rgba(0, 73, 107, 0.06);
  --header-surface: rgba(255, 255, 255, 0.96);
  --hover-surface: var(--blue-soft);
  --on-theme: #ffffff;
  --event-overlay-start: rgba(255, 255, 255, 0.98);
  --event-overlay-middle: rgba(255, 255, 255, 0.94);
  --event-overlay-end: rgba(255, 255, 255, 0.48);
}

body[data-theme="spcp"] {
  --theme-primary: var(--blue);
  --theme-primary-deep: var(--blue-deep);
  --theme-highlight: var(--accent);
  --theme-highlight-soft: var(--accent-soft);
  --theme-bar-gradient: linear-gradient(120deg, #005f8c 0%, #007caf 72%, #058ab9 100%);
  --theme-bar-context: #ffd29e;
}

body[data-theme="southport"] {
  --theme-primary: #5b2d82;
  --theme-primary-deep: #41205f;
  --theme-highlight: #c6a34a;
  --theme-highlight-soft: #f7efd9;
  --theme-bar-gradient: linear-gradient(120deg, #41205f 0%, #5b2d82 72%, #704096 100%);
  --theme-bar-context: #f2d98f;
}

body[data-theme="burleigh-heads"] {
  --theme-primary: #006f75;
  --theme-primary-deep: #004d52;
  --theme-highlight: #d5a329;
  --theme-highlight-soft: #f8efd6;
  --theme-bar-gradient: linear-gradient(120deg, #004d52 0%, #006f75 72%, #168b8e 100%);
  --theme-bar-context: #f5d98c;
}

body[data-theme="nerang"] {
  --theme-primary: #416c2b;
  --theme-primary-deep: #29471a;
  --theme-highlight: #9abc45;
  --theme-highlight-soft: #edf4dc;
  --theme-bar-gradient: linear-gradient(120deg, #29471a 0%, #416c2b 72%, #5b863b 100%);
  --theme-bar-context: #dceaa5;
}

body[data-theme="runaway-bay"] {
  --theme-primary: #31536a;
  --theme-primary-deep: #1d3547;
  --theme-highlight: #9fc6d7;
  --theme-highlight-soft: #e7f1f5;
  --theme-bar-gradient: linear-gradient(120deg, #1d3547 0%, #31536a 72%, #4b7187 100%);
  --theme-bar-context: #d7eaf2;
}

body[data-theme="coomera"] {
  --theme-primary: #1235b8;
  --theme-primary-deep: #091f78;
  --theme-highlight: #f49732;
  --theme-highlight-soft: #fff0d9;
  --theme-bar-gradient: linear-gradient(120deg, #091f78 0%, #1235b8 68%, #e52b34 100%);
  --theme-bar-context: #ffd99b;
}

body[data-theme="coolangatta-tugun"] {
  --theme-primary: #1f6f84;
  --theme-primary-deep: #154b59;
  --theme-highlight: #d2a13b;
  --theme-highlight-soft: #f7edd4;
  --theme-bar-gradient: linear-gradient(120deg, #154b59 0%, #1f6f84 70%, #3f8fa0 100%);
  --theme-bar-context: #f1d58f;
}

body[data-theme="gc-pilgrim"] {
  --theme-primary: var(--blue);
  --theme-primary-deep: var(--blue-deep);
  --theme-highlight: var(--accent);
  --theme-highlight-soft: var(--accent-soft);
  --theme-bar-gradient: linear-gradient(120deg, #005f8c 0%, #007caf 72%, #ee8b22 100%);
  --theme-bar-context: #ffd29e;
}

body[data-theme="traditional"] {
  --rubric-red: #b8262e;
  --ink: #382b1f;
  --muted: #61523b;
  --paper: #f0ebde;
  --surface: #f9f5eb;
  --surface-raised: rgba(249, 245, 235, 0.96);
  --surface-soft: #e8e0cf;
  --line: rgba(84, 61, 41, 0.18);
  --accent: #8a784c;
  --accent-strong: var(--rubric-red);
  --accent-soft: #f3dddd;
  --blue-soft: #f3dddd;
  --theme-primary: var(--rubric-red);
  --theme-primary-deep: #382b1f;
  --theme-highlight: #8a784c;
  --theme-highlight-soft: #e9dfc7;
  --theme-bar-gradient: #543d29;
  --theme-bar-context: #f0e0ad;
  --focus-ring: rgba(184, 38, 46, 0.24);
  --shadow: 0 14px 34px rgba(56, 43, 31, 0.1);
  --shadow-soft: 0 6px 16px rgba(56, 43, 31, 0.08);
  --header-surface: rgba(249, 245, 235, 0.97);
  --hover-surface: #f3dddd;
  --event-overlay-start: rgba(249, 245, 235, 0.99);
  --event-overlay-middle: rgba(249, 245, 235, 0.96);
  --event-overlay-end: rgba(249, 245, 235, 0.74);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 7% 10%, rgba(0, 117, 169, 0.13), transparent 30rem),
    radial-gradient(circle at 92% 18%, rgba(238, 139, 34, 0.12), transparent 25rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.filters-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: clamp(14px, 3vw, 32px);
  align-items: center;
  width: 100%;
  padding: 4px clamp(20px, 4vw, 56px);
  border-bottom: 3px solid var(--theme-highlight);
  background: var(--header-surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.header-branding {
  display: flex;
  min-width: 0;
  max-width: 390px;
  flex: 0 1 auto;
  align-items: center;
  gap: clamp(8px, 1.5vw, 16px);
}

.pilgrim-icon {
  display: block;
  width: clamp(46px, 5vw, 62px);
  height: clamp(46px, 5vw, 62px);
  flex: 0 0 auto;
  border-radius: 12px;
  object-fit: cover;
}

.pilgrim-home {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.pilgrim-home:hover {
  box-shadow: 0 0 0 4px var(--hover-surface);
}

.pilgrim-home:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.brand-lockup {
  position: relative;
  min-width: 0;
  flex: 0 1 auto;
}

.parish-selector-toggle {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 100%;
  padding: 3px 3px 3px 7px;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.parish-selector-toggle:hover,
.parish-selector-toggle[aria-expanded="true"] {
  background: var(--hover-surface);
}

.parish-logo {
  display: block;
  width: auto;
  max-width: 260px;
  max-height: 58px;
  flex: 0 1 auto;
  object-fit: contain;
  object-position: left center;
  height: auto;
}

.selected-region-name {
  display: block;
  color: var(--theme-primary-deep);
  font-size: clamp(0.94rem, 1.7vw, 1.15rem);
  font-weight: 800;
  line-height: 1.1;
  text-align: left;
  white-space: nowrap;
}

.parish-selector-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-right: 2px solid var(--theme-primary-deep);
  border-bottom: 2px solid var(--theme-primary-deep);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.parish-selector-toggle[aria-expanded="true"] .parish-selector-chevron {
  transform: translateY(2px) rotate(225deg);
}

.parish-selector {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 60;
  width: min(250px, calc(100vw - 28px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.parish-selector-option {
  display: block;
  width: 100%;
  padding: 10px 7px 10px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  text-align: left;
}

.parish-selector-option:hover,
.parish-selector-option:focus-visible,
.parish-selector-option[aria-checked="true"] {
  background: var(--hover-surface);
}

.header-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  min-height: 100%;
  padding-left: clamp(14px, 2vw, 24px);
  border-left: 1px solid var(--line);
}

.mobile-navigation-heading {
  display: none;
}

.site-navigation {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
}

.navigation-link {
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--theme-primary-deep);
  font-size: 0.94rem;
  font-weight: 780;
  text-decoration: none;
}

.navigation-link:hover {
  background: var(--hover-surface);
}

.navigation-link[aria-current="page"] {
  background: var(--theme-primary);
  color: var(--on-theme);
}

.settings-navigation-link {
  margin-left: auto;
}

.navigation-toggle {
  display: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--theme-highlight);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--theme-primary-deep);
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
}

.page-shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 28px 64px;
}

.filters {
  position: sticky;
  top: calc(var(--page-header-height, 65px) + var(--sticky-bar-gap, 6px));
  align-self: start;
  max-height: calc(
    100vh
    - var(--page-header-height, 65px)
    - var(--sticky-bar-gap, 6px)
    - 16px
  );
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.filters.filters-collapsed {
  display: block;
}

.filters-backdrop {
  display: none;
}

.filters-heading,
.results-header,
.event-tags {
  display: flex;
  align-items: center;
}

.filters-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filters-heading,
.results-header {
  justify-content: space-between;
  gap: 16px;
}

.results-filter-button {
  display: none;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  background: transparent;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 750;
}

.filter-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.filters-close {
  display: none;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--theme-primary-deep);
  font-size: 1.3rem;
  line-height: 1;
}

.filters h2,
.results-header h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--theme-primary);
  font-weight: 700;
}

.mobile-show-all {
  display: none;
}

.filter-view {
  margin-top: 18px;
  padding-bottom: 14px;
}

.filter-label {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

fieldset {
  margin: 0;
  padding: 20px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

legend {
  width: 100%;
  padding: 0;
}

.filter-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.filter-toggle:hover {
  color: var(--theme-primary);
}

.filter-toggle:focus-visible {
  border-radius: 4px;
  outline: 3px solid var(--focus-ring);
  outline-offset: 4px;
}

.filter-toggle-icon {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 160ms ease;
}

.filter-toggle[aria-expanded="false"] {
  margin-bottom: 0;
}

.filter-toggle[aria-expanded="false"] .filter-toggle-icon {
  transform: rotate(-45deg);
}

.checkbox-list {
  display: grid;
  gap: 8px;
}

.church-filter-group {
  display: grid;
  gap: 8px;
}

.church-filter-group + .church-filter-group {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.church-filter-heading {
  margin: 0;
  color: var(--theme-primary-deep);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
}

.filter-family {
  display: grid;
  gap: 7px;
}

.filter-family-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.filter-family-toggle {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.filter-family-toggle:hover {
  background: var(--blue-soft);
  color: var(--theme-primary);
}

.filter-family-toggle:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.filter-family-toggle .filter-toggle-icon {
  width: 7px;
  height: 7px;
}

.filter-family-toggle[aria-expanded="false"] .filter-toggle-icon {
  transform: rotate(-45deg);
}

.checkbox-sublist {
  display: grid;
  gap: 7px;
  margin-left: 8px;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--blue-soft);
}

.checkbox-option-child {
  font-size: 0.83rem;
}

.checkbox-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.checkbox-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--theme-primary);
}

.filter-count {
  color: #8c989e;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.calendar-panel {
  min-width: 0;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.view-switcher,
.period-navigation {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
}

.filter-view .view-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.view-button,
.period-button {
  min-height: 34px;
  padding: 6px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.filter-view .view-button {
  min-width: 0;
  padding-right: 8px;
  padding-left: 8px;
}

.view-button:hover,
.period-button:hover:not(:disabled) {
  background: var(--blue-soft);
  color: var(--theme-primary-deep);
}

.view-button[aria-selected="true"] {
  background: var(--theme-primary);
  color: var(--on-theme);
}

.view-button:focus-visible,
.period-button:focus-visible,
.month-day:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.period-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.results-header {
  position: sticky;
  top: calc(var(--page-header-height, 65px) + var(--sticky-bar-gap, 6px));
  z-index: 14;
  overflow: hidden;
  margin-bottom: 14px;
  padding: 8px 10px;
  border: 0;
  border-radius: 18px;
  background: var(--theme-bar-gradient);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.desktop-period-navigation {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.desktop-period-navigation .period-button {
  min-width: 112px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--theme-primary-deep);
  box-shadow: var(--shadow-soft);
}

.desktop-period-navigation .period-button:hover:not(:disabled) {
  background: var(--blue-soft);
  color: var(--theme-primary-deep);
}

.mobile-period-navigation {
  display: none;
}

.results-header .results-summary {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
  margin: 0;
  overflow: hidden;
  font-size: clamp(0.88rem, 2vw, 1.12rem);
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#results-context {
  color: var(--theme-bar-context);
  font-size: 0.78em;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.secondary-button {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.calendar-view,
.day-section,
.week-day,
.month-detail {
  display: grid;
  gap: 9px;
}

.daily-view {
  gap: 19px;
}

.load-more-button {
  justify-self: center;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--theme-primary-deep);
  font-weight: 750;
  box-shadow: 0 6px 18px rgba(0, 73, 107, 0.06);
}

.day-section,
.week-day,
.month-detail {
  scroll-margin-top: 140px;
}

.day-heading {
  margin: 0;
  border-bottom: 2px solid var(--theme-highlight);
  color: var(--theme-primary-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
  font-weight: 600;
}

.day-heading-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 5px;
  border: 0;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.day-heading-toggle:hover {
  background: color-mix(in srgb, var(--theme-highlight-soft) 45%, transparent);
}

.day-heading-toggle:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--theme-primary) 48%, transparent);
  outline-offset: 2px;
}

.day-heading-chevron {
  width: 8px;
  height: 8px;
  margin-left: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.is-collapsed .day-heading-chevron {
  transform: rotate(-45deg);
}

.day-heading-label {
  min-width: 0;
}

.day-heading-status {
  color: var(--muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

.day-heading-compact {
  font-size: 1.05rem;
}

.day-events {
  display: grid;
  gap: 9px;
}

.day-events[hidden] {
  display: none;
}

.weekly-view {
  gap: 15px;
}

.week-footer-navigation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

.week-footer-navigation .period-button {
  min-width: 132px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--theme-primary-deep);
  box-shadow: var(--shadow-soft);
}

.week-day {
  padding: 0;
}

.week-day.is-today .day-heading {
  border-radius: 7px 7px 0 0;
  background: color-mix(in srgb, var(--theme-highlight-soft) 78%, var(--surface));
}

.week-day.is-today .day-heading-toggle {
  padding: 5px 8px;
}

.week-day.is-collapsed,
.day-section.is-collapsed {
  gap: 0;
}

.empty-day {
  margin: 0;
  padding: 2px 3px;
  color: var(--muted);
  font-size: 0.86rem;
  font-style: italic;
}

.monthly-view {
  gap: 24px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(88px, 1fr));
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--line);
  gap: 1px;
  box-shadow: var(--shadow);
}

.month-weekday {
  padding: 10px 7px;
  background-color: var(--theme-primary-deep);
  background-image: linear-gradient(
    105deg,
    var(--theme-primary-deep) 0%,
    var(--theme-primary) 82%,
    color-mix(in srgb, var(--theme-primary) 88%, var(--theme-highlight)) 100%
  );
  background-position: var(--month-header-position, 0%) center;
  background-size: 700% 100%;
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.month-weekday:nth-child(1) { --month-header-position: 0%; }
.month-weekday:nth-child(2) { --month-header-position: 16.667%; }
.month-weekday:nth-child(3) { --month-header-position: 33.333%; }
.month-weekday:nth-child(4) { --month-header-position: 50%; }
.month-weekday:nth-child(5) { --month-header-position: 66.667%; }
.month-weekday:nth-child(6) { --month-header-position: 83.333%; }
.month-weekday:nth-child(7) { --month-header-position: 100%; }

.month-day {
  display: flex;
  min-width: 88px;
  min-height: 118px;
  flex-direction: column;
  gap: 5px;
  align-items: stretch;
  padding: 8px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

button.month-day:hover {
  background: var(--blue-soft);
}

.month-day.is-selected {
  position: relative;
  z-index: 1;
  box-shadow: inset 0 0 0 3px var(--theme-primary);
}

.month-day.is-today .month-day-number {
  background: var(--theme-highlight);
  color: #ffffff;
}

.month-day-blank {
  background: var(--surface-soft);
}

.month-day-number {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  align-self: flex-end;
  border-radius: 50%;
  color: var(--theme-primary-deep);
  font-size: 0.84rem;
  font-weight: 800;
}

.month-event {
  overflow: hidden;
  padding: 3px 5px;
  border-left: 3px solid var(--theme-primary);
  border-radius: 3px;
  background: var(--blue-soft);
  color: var(--ink);
  font-size: 0.67rem;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-event[data-liturgical-colour="green"] {
  border-left-color: #16834c;
}

.month-event[data-liturgical-colour="red"] {
  border-left-color: #c53535;
}

.month-event[data-liturgical-colour="white"] {
  border-left-color: #d4a72c;
}

.month-event[data-liturgical-colour="violet"] {
  border-left-color: #75469b;
}

.month-event[data-liturgical-colour="rose"] {
  border-left-color: #d95f89;
}

.month-event[data-liturgical-colour="gold"] {
  border-left-color: #b78a13;
}

.month-event.is-past {
  border-left-color: #9ca8ad;
  background: #edf1f2;
  color: #7c898f;
  opacity: 0.72;
}

.month-event.is-cancelled {
  border-left-color: #7f8a90;
  background: #e3e8ea;
  color: #66747b;
  filter: grayscale(1);
  text-decoration: line-through;
}

.month-more {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.month-detail {
  padding-top: 4px;
}

.event-card {
  --liturgical-accent: var(--theme-primary);
  position: relative;
  scroll-margin-top: 16px;
  isolation: isolate;
  overflow: hidden;
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.event-card:hover {
  border-color: var(--theme-primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.event-card.is-past {
  --liturgical-accent: #9ca8ad;
  border-color: #d8dfe2;
  filter: grayscale(0.78);
  opacity: 0.62;
  box-shadow: none;
}

.event-card.is-past:hover {
  border-color: #cbd3d6;
  box-shadow: none;
  transform: none;
}

.event-card.is-cancelled,
.event-card.is-cancelled:hover {
  --liturgical-accent: #7f8a90;
  border-color: #cbd3d6;
  background: #edf1f2;
  filter: grayscale(1);
  opacity: 0.72;
  box-shadow: none;
  transform: none;
}

.event-card[data-liturgical-colour="green"] {
  --liturgical-accent: #16834c;
}

.event-card[data-liturgical-colour="red"] {
  --liturgical-accent: #c53535;
}

.event-card[data-liturgical-colour="white"] {
  --liturgical-accent: #d4a72c;
}

.event-card[data-liturgical-colour="violet"] {
  --liturgical-accent: #75469b;
}

.event-card[data-liturgical-colour="rose"] {
  --liturgical-accent: #d95f89;
}

.event-card[data-liturgical-colour="gold"] {
  --liturgical-accent: #b78a13;
}

.event-card[data-liturgical-colour="parish"] {
  --liturgical-accent: var(--theme-primary);
}

.event-card {
  border-left: 6px solid var(--liturgical-accent);
}

.event-card::before,
.event-card::after {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  pointer-events: none;
}

.event-card::before {
  background-image: var(--church-image);
  background-position: var(--church-position, center);
  background-size: cover;
  opacity: 0.42;
}

.event-card::after {
  z-index: -1;
  background: linear-gradient(
    90deg,
    var(--event-overlay-start) 0%,
    var(--event-overlay-middle) 45%,
    color-mix(in srgb, var(--event-overlay-middle) 78%, transparent) 72%,
    var(--event-overlay-end) 100%
  );
}

.church-stella-maris {
  --church-image: url("assets/sm-wc.jpg");
  --church-position: center 76%;
}

.church-sacred-heart {
  --church-image: url("assets/sh-wc.jpg");
  --church-position: center 78%;
}

.church-st-vincents {
  --church-image: url("assets/sv-wc.jpg");
  --church-position: center 74%;
}

.event-mass-fallback {
  --church-image: url("assets/mass-fallback.jpg");
  --church-position: right 46%;
}

.event-mass-fallback::before {
  background-repeat: no-repeat;
  background-size: 58% auto;
}

.event-reconciliation {
  --church-image: url("assets/reconciliation.png");
  --church-position: right center;
}

.event-lay-led-communion {
  --church-image: url("assets/lay-led-communion.png");
  --church-position: right center;
}

.event-adoration {
  --church-image: url("assets/adoration.png");
  --church-position: right center;
}

.event-reconciliation::before,
.event-lay-led-communion::before,
.event-adoration::before {
  background-repeat: no-repeat;
  background-size: 58% auto;
}

.event-time {
  margin: 0;
  color: var(--theme-primary-deep);
  font-size: 0.92rem;
  font-weight: 800;
}

.event-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 10px;
  margin-bottom: 3px;
}

.event-heading-labels {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.event-cancelled-label {
  padding: 3px 8px;
  border-radius: 999px;
  background: #66747b;
  color: #fff;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-transform: uppercase;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 14px;
  align-items: baseline;
  margin-bottom: 4px;
}

.event-church {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.16rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.event-service {
  justify-self: end;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--theme-primary-deep);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.event-service-confession {
  display: grid;
  gap: 1px;
  padding-top: 4px;
  padding-bottom: 4px;
  border-radius: 10px;
}

.event-service-confession span {
  display: block;
}

.event-parish {
  margin: 0 0 4px;
  color: var(--theme-primary);
  font-size: 0.76rem;
  font-weight: 800;
}

.event-subtitle {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.3;
}

.event-description {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.event-details {
  min-width: 0;
}

.event-tags {
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.tag {
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--liturgical-accent) 25%, var(--line));
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.message {
  padding: 36px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.message h3 {
  margin-bottom: 6px;
  color: var(--ink);
}

.about-page {
  width: min(1040px, calc(100% - 56px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px) 0 70px;
}

.about-introduction {
  display: flex;
  max-width: 920px;
  align-items: center;
  justify-content: space-between;
  gap: clamp(24px, 6vw, 64px);
  margin-bottom: 28px;
}

.about-introduction-copy {
  max-width: 720px;
}

.about-logo {
  width: min(300px, 32vw);
  max-height: 120px;
  flex: 0 1 auto;
  object-fit: contain;
  object-position: right center;
}

.about-introduction h2 {
  margin-bottom: 10px;
  color: var(--theme-primary-deep);
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.04em;
}

.about-introduction > p:last-child {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.about-card {
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.about-card-label {
  margin-bottom: 6px;
  color: var(--theme-highlight);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.about-card h3 {
  margin-bottom: 18px;
  color: var(--theme-primary-deep);
  font-size: 1.35rem;
}

.about-card address {
  color: var(--muted);
  font-style: normal;
  line-height: 1.5;
}

.about-card address p {
  margin-bottom: 9px;
}

.about-card a {
  color: var(--theme-primary);
  font-weight: 700;
}

.about-card-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.hours-list,
.hours-list div {
  margin: 0;
}

.hours-list div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.hours-list div:last-child {
  border-bottom: 0;
}

.hours-list dt {
  font-weight: 750;
}

.hours-list dd {
  margin: 0;
  color: var(--muted);
}

.clergy-list {
  display: grid;
  gap: 12px;
}

.clergy-list article,
.church-list article {
  padding: 15px;
  border-radius: 14px;
  background: var(--paper);
}

.clergy-list h4,
.church-list h4 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.clergy-list p,
.church-list p {
  margin: 4px 0 0;
  color: var(--muted);
}

.about-churches {
  grid-column: 1 / -1;
}

.church-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.church-list article > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.aggregate-parish-list {
  display: grid;
  gap: 24px;
}

.aggregate-parish-list > section > h4 {
  margin: 0 0 12px;
  color: var(--theme-primary-deep);
  font-size: 1.1rem;
}

.aggregate-parish-list .church-list h5 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
}

.settings-page {
  width: min(920px, calc(100% - 56px));
  margin: 0 auto;
  padding: clamp(32px, 6vw, 68px) 0 76px;
}

.settings-introduction {
  max-width: 680px;
  margin-bottom: 28px;
}

.settings-introduction h2 {
  margin-bottom: 10px;
  color: var(--theme-primary-deep);
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: -0.04em;
}

.settings-introduction > p:last-child,
.settings-description {
  color: var(--muted);
  line-height: 1.6;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.settings-card {
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.settings-card legend {
  width: auto;
  padding: 0 8px;
  color: var(--theme-primary-deep);
  font-size: 1.3rem;
  font-weight: 800;
}

.settings-description {
  min-height: 3.2em;
  margin-bottom: 18px;
}

.choice-list {
  display: grid;
  gap: 9px;
}

.choice-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.choice-option:hover {
  border-color: var(--theme-primary);
  background: var(--hover-surface);
}

.choice-option:has(input:checked) {
  border-color: var(--theme-primary);
  box-shadow: inset 0 0 0 1px var(--theme-primary);
}

.choice-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--theme-primary);
}

.choice-option span,
.choice-option strong,
.choice-option small {
  display: block;
}

.choice-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

body[data-theme="traditional"] {
  background: var(--paper);
  font-family: Georgia, "Times New Roman", ui-serif, serif;
}

body[data-theme="traditional"] button,
body[data-theme="traditional"] input,
body[data-theme="traditional"] .event-time,
body[data-theme="traditional"] .event-subtitle,
body[data-theme="traditional"] .event-tags,
body[data-theme="traditional"] .settings-description,
body[data-theme="traditional"] .choice-option small {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="traditional"] .page-header {
  border-bottom-width: 1px;
  border-bottom-color: var(--rubric-red);
}

body[data-theme="traditional"] .results-header {
  border: 1px solid color-mix(in srgb, var(--rubric-red) 48%, transparent);
}

body[data-theme="traditional"] .event-card,
body[data-theme="traditional"] .about-card,
body[data-theme="traditional"] .settings-card,
body[data-theme="traditional"] .filters {
  border-radius: 20px;
}

body[data-theme="traditional"] .event-card::after {
  background: var(--event-overlay-start);
}

body[data-theme="traditional"] .eyebrow,
body[data-theme="traditional"] .about-card-label,
body[data-theme="traditional"] .filter-label,
body[data-theme="traditional"] .filter-toggle {
  color: var(--rubric-red);
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  letter-spacing: 0.13em;
}

body[data-theme="traditional"] .settings-card legend,
body[data-theme="traditional"] .day-heading {
  border-color: var(--rubric-red);
  color: var(--rubric-red);
}

body[data-theme="traditional"] .navigation-link[aria-current="page"],
body[data-theme="traditional"] .view-button[aria-selected="true"],
body[data-theme="traditional"] .choice-option:has(input:checked) {
  border-color: var(--rubric-red);
}

body[data-theme="traditional"] .event-card[data-liturgical-colour="green"],
body[data-theme="traditional"] .month-event[data-liturgical-colour="green"] {
  --liturgical-accent: #1f7a4a;
  border-left-color: #1f7a4a;
}

body[data-theme="traditional"] .event-card[data-liturgical-colour="violet"],
body[data-theme="traditional"] .month-event[data-liturgical-colour="violet"] {
  --liturgical-accent: #61388f;
  border-left-color: #61388f;
}

body[data-theme="traditional"] .event-card[data-liturgical-colour="white"],
body[data-theme="traditional"] .month-event[data-liturgical-colour="white"] {
  --liturgical-accent: #f0e0ad;
  border-left-color: #f0e0ad;
}

body[data-theme="traditional"] .event-card[data-liturgical-colour="red"],
body[data-theme="traditional"] .month-event[data-liturgical-colour="red"] {
  --liturgical-accent: #b8262e;
  border-left-color: #b8262e;
}

body[data-theme="traditional"] .event-card[data-liturgical-colour="rose"],
body[data-theme="traditional"] .month-event[data-liturgical-colour="rose"] {
  --liturgical-accent: #d16182;
  border-left-color: #d16182;
}

.primary-site-badge {
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.error-message {
  border-color: #d9a6a6;
  background: #fff5f4;
  color: #7d292d;
}

[hidden] {
  display: none !important;
}

@media (max-width: 800px) {
  .page-header {
    gap: 10px;
    align-items: center;
    padding: 4px 14px;
  }

  .header-branding {
    max-width: calc(100% - 135px);
    gap: 8px;
  }

  .pilgrim-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  .parish-logo {
    width: auto;
    max-width: 170px;
    max-height: 52px;
  }

  .header-copy {
    position: relative;
    display: flex;
    align-self: stretch;
    align-items: center;
    min-width: 125px;
    padding: 0 0 0 12px;
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .header-copy .eyebrow {
    display: none;
  }

  .mobile-navigation-heading {
    display: flex;
    width: 100%;
    min-height: 58px;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
  }

  .mobile-navigation-heading h1 {
    margin: 0;
    overflow: hidden;
    font-size: clamp(1rem, 4vw, 1.35rem);
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .selected-region-name {
    font-size: 0.86rem;
  }

  .navigation-toggle {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-content: center;
    gap: 4px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
  }

  .navigation-toggle span {
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--theme-primary-deep);
  }

  .site-navigation {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 50;
    min-width: 210px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .site-navigation.navigation-open {
    display: grid;
  }

  .navigation-link {
    display: block;
  }

  .settings-navigation-link {
    margin-left: 0;
  }

  .page-shell {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 16px;
  }

  .filters {
    position: fixed;
    inset: 0;
    z-index: 40;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    align-self: stretch;
    overscroll-behavior: contain;
    margin-top: 0;
    padding:
      max(18px, env(safe-area-inset-top))
      18px
      max(18px, env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    background: var(--surface);
    box-shadow: none;
    transform: none;
  }

  .filters.filters-collapsed {
    display: none;
  }

  .filters-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(8, 45, 64, 0.28);
    backdrop-filter: blur(2px);
  }

  .filters-close {
    display: grid;
  }

  .calendar-toolbar {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    margin-bottom: 12px;
  }

  .view-switcher {
    display: flex;
  }

  .view-button {
    flex: 1;
  }

  .results-filter-button {
    display: inline-grid;
  }

  .desktop-period-navigation {
    display: none;
  }

  .mobile-period-navigation {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .mobile-period-navigation .period-button {
    flex: 0 1 auto;
    min-width: 112px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--theme-primary-deep);
    box-shadow: var(--shadow-soft);
  }

  .about-page,
  .settings-page {
    width: calc(100% - 36px);
    padding-top: 30px;
  }

  .about-introduction {
    align-items: flex-start;
  }

  .about-logo {
    width: min(240px, 34vw);
  }

  .about-grid,
  .church-list,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-description {
    min-height: 0;
  }
}

@media (max-width: 520px) {
  .page-header {
    gap: 8px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .pilgrim-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
  }

  .header-branding {
    max-width: calc(58% - 4px);
  }

  .parish-selector-toggle {
    gap: 6px;
  }

  .parish-logo {
    max-width: 125px;
    max-height: 44px;
  }

  .selected-region-name {
    font-size: 0.76rem;
  }

  .header-copy {
    min-width: 116px;
    padding-left: 8px;
  }

  .mobile-navigation-heading {
    min-height: 50px;
    gap: 7px;
  }

  .mobile-navigation-heading h1 {
    font-size: clamp(0.9rem, 4vw, 1.05rem);
  }

  .navigation-toggle {
    width: 36px;
    height: 36px;
  }

  .page-shell {
    padding-right: 18px;
    padding-left: 18px;
  }

  .event-card {
    padding: 12px 14px;
  }

  .day-heading-toggle {
    gap: 6px;
  }

  .day-heading-status {
    font-size: 0.68rem;
  }

  .about-introduction {
    display: block;
  }

  .about-logo {
    width: min(280px, 100%);
    max-height: 100px;
    margin-top: 20px;
    object-position: left center;
  }

  .results-header {
    gap: 4px;
    padding: 7px;
    border-radius: 14px;
  }

  .results-header .results-summary {
    justify-content: center;
    gap: 3px;
    font-size: 0.67rem;
  }

  .secondary-button {
    padding: 5px 6px;
    font-size: 0.68rem;
  }

  .results-filter-button {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }

  .view-button,
  .period-button {
    min-height: 34px;
    padding: 6px 9px;
  }

  .event-church {
    font-size: 1.08rem;
  }

  .month-grid {
    grid-template-columns: repeat(7, minmax(78px, 1fr));
  }

  .month-day {
    min-width: 78px;
    min-height: 106px;
    padding: 6px;
  }

  .month-weekday {
    min-width: 78px;
  }
}
