.calendar-view-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.today-button {
  min-width: auto;
  white-space: nowrap;
}

.event-type-filter-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.event-type-filter-field span {
  white-space: nowrap;
}

.event-type-filter-field select {
  min-height: 38px;
  min-width: 185px;
  border: 1px solid var(--border, #d6ddd9);
  border-radius: 10px;
  background: var(--surface, #fff);
  color: inherit;
  padding: 6px 10px;
  font: inherit;
}

.calendar-return-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.public-footer-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
}

.event-town-filter-options {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.event-town-filter-options .filter-group-label {
  margin: 0;
  font-size: .82rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.event-town-filter-options .town-filter-help {
  margin: 0;
  font-size: .82rem;
}

/* Bring the legacy calendar shell into the same visual system as the portal pages. */
body.page-shell.soft-light {
  padding: 0;
  background: var(--mp-cream, #fbf9fc);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.phone-shell.home-shell.wide-shell {
  gap: 0;
  padding-bottom: 48px;
}

.home-hero.hero-card {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--mp-hero-background);
  color: #fff;
}

.home-hero .hero-topline-home {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(1180px, calc(100% - 32px));
  min-height: 390px;
  margin: 0 auto;
  padding: 64px 0 58px;
}

.home-hero .header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}

.home-hero .header-left .eyebrow {
  margin: 0 0 12px;
  color: var(--mp-gold);
  opacity: 1;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .14em;
}

.home-hero .header-left h1 {
  margin: 0;
  max-width: 820px;
  color: #fff;
  font-size: clamp(3.8rem, 9vw, 7.4rem);
  line-height: .88;
  letter-spacing: -.065em;
  text-shadow: 0 3px 20px color-mix(in srgb, var(--today-primary-deep) 42%, transparent);
}

.home-hero .hero-topline-home > .subtle {
  max-width: 720px;
  margin: 24px 0 0;
  color: rgba(255,255,255,.92);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.6;
}

.home-hero .header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-hero #open-submit-event {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255,255,255,.35);
  background: var(--mp-gold);
  color: var(--today-accent-contrast, #241a12);
  font-weight: 850;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--today-primary-deep) 16%, transparent);
}

.calendar-controls-row,
.home-content-grid {
  width: min(1180px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

.calendar-controls-row {
  margin-top: 28px;
}

.home-content-grid {
  margin-top: 18px;
}

.public-footer {
  margin: 0;
  padding: 32px max(16px, calc((100% - 1180px) / 2));
  border: 0;
  border-top: 4px solid var(--mp-gold);
  border-radius: 0;
  background: var(--today-primary-deep, #29103f);
  color: rgba(255,255,255,.84);
  box-shadow: none;
  text-align: center;
}

.public-footer > .subtle {
  max-width: 840px;
  margin: 0 auto 18px;
  color: rgba(255,255,255,.78);
}

.public-footer-actions a {
  color: #fff;
  font-weight: 700;
  text-underline-offset: 4px;
}

html[data-theme="dark"] body.page-shell.soft-light {
  background: #17131c;
}

html[data-theme="dark"] .home-hero.hero-card {
  background: var(--mp-hero-background);
}

/* Canonical layout for agenda/selected-day event actions.
   Keep presentation in CSS rather than the historical JS-injected placement layer. */
.selected-day-panel .event-chip-actions,
.agenda-day-card .event-chip-actions {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.selected-day-panel .event-chip-actions > .calendar-event-chip,
.agenda-day-card .event-chip-actions > .calendar-event-chip {
  display: block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding-right: .9rem;
}

.selected-day-panel .event-chip-actions > .calendar-event-chip .event-time,
.agenda-day-card .event-chip-actions > .calendar-event-chip .event-time {
  display: block;
  width: auto;
  min-width: 0;
  max-width: calc(100% - 9.7rem);
  min-height: 34px;
  padding: 0;
  white-space: nowrap;
  box-sizing: border-box;
}

.selected-day-panel .event-chip-actions > .calendar-event-chip .event-text,
.agenda-day-card .event-chip-actions > .calendar-event-chip .event-text {
  display: block;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin-top: .34rem;
  padding: 0;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.selected-day-panel .event-chip-actions > .calendar-event-chip .event-time:empty,
.agenda-day-card .event-chip-actions > .calendar-event-chip .event-time:empty {
  min-height: 34px;
}

.selected-day-panel .event-chip-actions > .add-to-calendar-button,
.agenda-day-card .event-chip-actions > .add-to-calendar-button {
  position: absolute;
  top: .68rem;
  right: .72rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  min-height: 34px;
  margin: 0;
  padding: .3rem .62rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: rgba(255,255,255,.52);
  color: inherit;
  font: inherit;
  font-size: .74rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.selected-day-panel .event-chip-actions > .add-to-calendar-button:hover,
.selected-day-panel .event-chip-actions > .add-to-calendar-button:focus-visible,
.agenda-day-card .event-chip-actions > .add-to-calendar-button:hover,
.agenda-day-card .event-chip-actions > .add-to-calendar-button:focus-visible {
  background: rgba(255,255,255,.78);
}

html[data-theme="dark"] .selected-day-panel .event-chip-actions > .add-to-calendar-button,
html[data-theme="dark"] .agenda-day-card .event-chip-actions > .add-to-calendar-button,
body.theme-dark .selected-day-panel .event-chip-actions > .add-to-calendar-button,
body.theme-dark .agenda-day-card .event-chip-actions > .add-to-calendar-button {
  background: rgba(0,0,0,.28);
}

html[data-theme="dark"] .selected-day-panel .event-chip-actions > .add-to-calendar-button:hover,
html[data-theme="dark"] .selected-day-panel .event-chip-actions > .add-to-calendar-button:focus-visible,
html[data-theme="dark"] .agenda-day-card .event-chip-actions > .add-to-calendar-button:hover,
html[data-theme="dark"] .agenda-day-card .event-chip-actions > .add-to-calendar-button:focus-visible,
body.theme-dark .selected-day-panel .event-chip-actions > .add-to-calendar-button:hover,
body.theme-dark .selected-day-panel .event-chip-actions > .add-to-calendar-button:focus-visible,
body.theme-dark .agenda-day-card .event-chip-actions > .add-to-calendar-button:hover,
body.theme-dark .agenda-day-card .event-chip-actions > .add-to-calendar-button:focus-visible {
  background: rgba(0,0,0,.42);
}

/* Event-detail sections are created by the behavioral event UI module. */
.calendar-event-detail-section {
  margin-top: 1rem;
}

.calendar-event-detail-section h3 {
  margin-bottom: .35rem;
  font-size: 1rem;
}

.calendar-event-detail-actions {
  margin-top: 1.15rem;
}

/* Halloween calendar styling */
.month-grid .calendar-day-events .calendar-event-chip.bucket-halloween {
  background: #f97316;
  border-color: #fb923c;
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.22);
}

.calendar-event-chip.bucket-halloween {
  background: linear-gradient(180deg, #fff2e8 0%, #ffe0cc 100%);
  color: #8a3d00;
  border-color: rgba(249, 115, 22, 0.32);
}

html[data-theme="dark"] .month-grid .calendar-day-events .calendar-event-chip.bucket-halloween {
  background: #fb923c;
  border-color: #fdba74;
  box-shadow: 0 0 0 1px rgba(251, 146, 60, 0.34);
}

html[data-theme="dark"] .calendar-event-chip.bucket-halloween {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.28) 0%, rgba(194, 65, 12, 0.34) 100%);
  color: #ffedd5;
  border-color: rgba(251, 146, 60, 0.42);
}

@media (max-width: 860px) {
  .home-hero .hero-topline-home {
    min-height: 320px;
    padding: 52px 0 48px;
  }

  .home-hero .header {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-hero .header-left h1 {
    font-size: clamp(3.4rem, 16vw, 5.6rem);
  }
}

@media (max-width: 760px) {
  .calendar-controls-row,
  .calendar-controls-left,
  .calendar-controls-center,
  .calendar-controls-right {
    width: 100%;
  }

  .calendar-view-actions {
    width: 100%;
  }

  .event-type-filter-field {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .event-type-filter-field select {
    width: 100%;
  }

  .home-hero .hero-topline-home,
  .calendar-controls-row,
  .home-content-grid {
    width: min(100% - 24px, 1180px);
  }

  .home-hero .header-actions {
    width: 100%;
  }

  .home-hero #open-submit-event {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .home-hero .header-left h1 {
    font-size: clamp(3.1rem, 18vw, 4.8rem);
  }
}

@media (max-width: 420px) {
  .selected-day-panel .event-chip-actions > .calendar-event-chip .event-time,
  .agenda-day-card .event-chip-actions > .calendar-event-chip .event-time {
    max-width: calc(100% - 8.7rem);
  }

  .selected-day-panel .event-chip-actions > .add-to-calendar-button,
  .agenda-day-card .event-chip-actions > .add-to-calendar-button {
    right: .58rem;
    padding-inline: .48rem;
    font-size: .68rem;
  }
}

/* Final /events presentation previously carried by events-polish.css.
   Preserved here verbatim so the ordered two-file cascade has one canonical owner. */
body.page-shell.soft-light {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  padding: 0;
}

.events-page-hero {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--mp-hero-background);
  color: #fff;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.events-page-hero .hero-topline,
.events-page-hero .hero-topline-home {
  width: min(1180px, calc(100% - 32px));
  min-height: 540px;
  margin: 0 auto;
  padding: 70px 0;
  display: flex;
  align-items: center;
}

.home-hero .header {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  align-items: center;
  gap: 56px;
}

.home-hero .header-left {
  align-self: center;
  min-width: 0;
}

.events-hero-copy .eyebrow {
  margin-bottom: 12px;
  color: rgba(255,255,255,.9);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.events-hero-copy h1 {
  max-width: 760px;
  margin: 0;
  color: #fff;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: .92;
  letter-spacing: -.065em;
  text-shadow: 0 3px 20px color-mix(in srgb, var(--today-primary-deep) 42%, transparent);
  overflow-wrap: break-word;
}

.events-hero-description {
  max-width: 650px;
  margin: 24px 0 0;
  color: rgba(255,255,255,.94);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.55;
}

.events-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.events-hero-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: var(--mp-blue-dark);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--today-primary-deep) 16%, transparent);
}

.events-hero-button:hover,
.events-hero-button:focus-visible {
  background: color-mix(in srgb, var(--mp-blue-light) 70%, #fff);
}

.events-hero-button-secondary {
  background: rgba(255,255,255,.12);
  color: #fff;
  box-shadow: none;
}

.events-hero-button-secondary:hover,
.events-hero-button-secondary:focus-visible {
  background: rgba(255,255,255,.2);
}

.home-hero .header-actions.events-hero-feature {
  align-self: center;
  display: block;
  min-height: 0;
  padding: 28px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 24px;
  background: rgba(255,255,255,.16);
  box-shadow: 0 20px 60px color-mix(in srgb, var(--today-primary-deep) 20%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.events-next-major {
  display: block;
}

.events-feature-kicker {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--mp-gold);
  color: var(--today-accent-contrast, #241a12);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.events-feature-title {
  display: block;
  margin: 18px 0 8px;
  color: #fff;
  font-size: 2rem;
  line-height: 1.08;
  letter-spacing: -.035em;
}

.events-feature-date {
  display: block;
  color: rgba(255,255,255,.92);
  line-height: 1.45;
}

.events-feature-summary {
  margin: 18px 0 0;
  color: rgba(255,255,255,.92);
  line-height: 1.5;
}

.events-feature-link {
  display: inline-flex;
  margin-top: 14px;
  color: #fff;
  font-weight: 800;
  text-underline-offset: 4px;
}

.home-hero .events-hero-feature #open-submit-event {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#calendar-controls {
  scroll-margin-top: 96px;
}

.calendar-controls-row {
  margin-top: 18px;
}

.calendar-controls-row,
.home-content-grid {
  width: min(1380px, calc(100% - 32px));
}

.home-content-grid {
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px) !important;
  align-items: start;
  gap: 20px;
}

.proper-calendar-shell,
.calendar-shell,
.calendar-grid {
  min-width: 0;
  width: 100%;
}

.bucket-rail {
  min-width: 0;
}

.public-footer {
  box-sizing: border-box;
  display: block;
  width: 100vw !important;
  max-width: none !important;
  margin: 0 !important;
  margin-left: calc(50% - 50vw) !important;
  padding: 34px max(20px, calc((100vw - 1180px) / 2)) !important;
  align-self: stretch;
}

.public-footer > .subtle {
  width: min(760px, 100%);
  max-width: none;
  margin: 0 auto 20px;
  line-height: 1.55;
}

.public-footer-actions {
  width: min(760px, 100%);
  margin: 0 auto;
}

html[data-theme="dark"] .event-type-filter-field select,
body.theme-dark .event-type-filter-field select {
  background: var(--mp-paper, #24182f);
  border-color: color-mix(in srgb, var(--mp-blue) 28%, transparent);
  color: var(--mp-ink, #faf6fc);
  color-scheme: dark;
}

@media (max-width: 1050px) {
  .home-content-grid {
    grid-template-columns: minmax(0, 1fr) 270px !important;
  }
}

@media (max-width: 900px) {
  .events-page-hero .hero-topline,
  .events-page-hero .hero-topline-home {
    min-height: 0;
    padding: 58px 0;
  }

  .home-hero .header,
  .home-content-grid {
    grid-template-columns: 1fr !important;
  }

  .home-hero .header {
    gap: 34px;
  }

  .home-hero .header-actions.events-hero-feature {
    width: 100%;
  }

  .bucket-rail {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .events-page-hero .hero-topline,
  .events-page-hero .hero-topline-home {
    width: min(100% - 24px, 1180px);
  }

  .calendar-controls-row,
  .home-content-grid {
    width: min(100% - 24px, 1380px);
  }
}

@media (max-width: 560px) {
  .events-hero-copy h1 {
    font-size: clamp(2.6rem, 13vw, 4rem);
  }

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

  .events-hero-button {
    width: 100%;
  }
}
