@charset "UTF-8";
/* The fades at the ends of the scrolling filter chips; registered so they grow smoothly instead of jumping. */
@property --fade-start { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --fade-end { syntax: "<length>"; inherits: false; initial-value: 0px; }
@keyframes events-chips-fade-start { to { --fade-start: var(--fade-size); } }
@keyframes events-chips-fade-end { from { --fade-end: var(--fade-size); } }

@layer pages {
  /* Events page: filters, results and the month view. */
  .events-filters { display: grid; gap: var(--space-3); }
  .events-filters fieldset { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
  .events-filters__bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

  .search-field { flex: 1 1 20rem; max-inline-size: 26rem; display: flex; align-items: center; gap: var(--space-2); min-block-size: 3rem; padding-inline: var(--space-4); background: var(--color-surface); color: var(--color-ink-soft); border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); }
  .search-field:focus-within { outline: 3px solid var(--color-focus); outline-offset: 2px; }
  .search-field input { flex: 1; min-inline-size: 0; font: inherit; color: var(--color-ink); background: transparent; border: 0; outline: 0; }

  /* Radios and checkboxes that look like chips; the real inputs stay in the page for keyboards and screen readers. */
  .chip { position: relative; padding-inline: 0.9rem; }
  .chip__input, .segmented__option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
  .chip:has(.chip__input:checked) { background: var(--color-ink); color: var(--color-bg); border-color: var(--color-ink); }
  /* Every chip reserves room for the check on both sides (hidden until chosen), so choosing one never changes its width
     or moves the others, and the text stays centred. */
  .chip::before, .chip::after { content: "✓"; visibility: hidden; }
  .chip:has(.chip__input:checked)::after { visibility: visible; }
  .chip:has(.chip__input:focus-visible), .segmented__option:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }
  .chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
  .chip-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
  .chip[hidden] { display: none; }
  /* The group names show as headings in the phone dialog; inline, the dividers separate the groups. */
  .chip-group__title { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* How many events each chip would list; a chip with none is dimmed but can still be chosen or unchosen. */
  .chip__count { margin-inline-start: var(--space-1); font-size: var(--text-xs); font-weight: 600; color: var(--color-ink-soft); font-variant-numeric: tabular-nums; }
  .chip:has(.chip__input:checked) .chip__count { color: inherit; opacity: 0.8; }
  .chip[data-empty]:not(:has(.chip__input:checked)) { opacity: 0.55; }
  .chips__divider { inline-size: 1px; align-self: stretch; background: var(--color-border-strong); margin-inline: var(--space-1); }

  .segmented { display: inline-flex; padding: 4px; background: var(--color-band); border-radius: var(--radius-pill); }
  .segmented__option { position: relative; display: inline-flex; align-items: center; min-block-size: 2.5rem; padding-inline: 1.125rem; font-size: var(--text-sm); font-weight: 600; color: var(--color-ink-soft); border-radius: var(--radius-pill); cursor: pointer; }
  .segmented__option:has(input:checked) { background: var(--color-surface); color: var(--color-ink); font-weight: 700; box-shadow: var(--shadow-card); }

  /* Phones: a smaller title, search and view on full-width rows, the filter chips on one row that scrolls sideways
     (running to the screen edges, faded where more chips are hidden), and less space before the results. */
  @media (max-width: 40rem) {
    /* One row: the search takes what is left beside the filters button and may shrink as far as needed. */
    .events-filters__bar { flex-wrap: nowrap; }
    /* A list's create button (Sponsors) takes its own full line above the search. */
    .events-filters__bar:has(.events-filters__action) { flex-wrap: wrap; }
    .events-filters__action { order: -1; flex-basis: 100%; }
    .events-filters__bar:has(.events-filters__action) .search-field { flex: 1 1 0; }
    .search-field { flex: 1 1 0; min-inline-size: 0; max-inline-size: none; }
    /* With JavaScript the chips move into the filters dialog, opened from the round button beside the search. */
    .js .filters-button { display: inline-grid; }
    .js .events-filters > .chips { display: none; }
    /* The calendar and the map need more room than a phone has, so phones get only the list. A shared calendar
       link shows the list that comes under the month view; a map link, the list that is already under the map. */
    .events-filters__bar .segmented, .calendar, .events-map, .events-map__note, .events-map__empty { display: none; }
    .events-filters .chips {
      flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
      /* Room around the chips so their focus outline is not cut off by the scrolling box. */
      margin: -6px calc(-1 * var(--space-4)); padding: 6px var(--space-4);
      scroll-padding-inline: var(--space-6);
    }
    .events-filters .chip { flex: none; white-space: nowrap; }
    .events-filters .chip-group { flex: none; flex-wrap: nowrap; }
    .events-filters .chips__divider { flex: none; }
    @supports (animation-timeline: scroll()) {
      .events-filters .chips {
        --fade-size: 2.5rem;
        mask:
          linear-gradient(black, black) no-clip subtract,
          linear-gradient(to right, black, transparent) 0 0 / var(--fade-start) 100% no-repeat no-clip,
          linear-gradient(to right, transparent, black) 100% 0 / var(--fade-end) 100% no-repeat no-clip;
        animation: events-chips-fade-start linear both, events-chips-fade-end linear both;
        animation-timeline: scroll(self inline);
        animation-range: 0 var(--fade-size), calc(100% - var(--fade-size)) 100%;
      }
    }
  }

  .event-card__sponsors { margin: var(--space-2) 0 0; padding-block-start: var(--space-3); border-block-start: 1px solid var(--color-border); font-size: 0.8125rem; color: var(--color-ink-soft); }
  .event-card__sponsors strong { color: var(--color-ink); }
  /* The filters button and its full-screen dialog (phones with JavaScript; see static/js/events-filters.js). */
  .filters-button { display: none; position: relative; flex: none; }
  /* Wider screens where the chips would wrap (events-filters.js sets data-compact): the same button and dialog. */
  .events-filters[data-compact] .filters-button { display: inline-grid; }
  .events-filters[data-compact] > .chips { display: none; }
  .filters-button__count {
    position: absolute; inset-block-start: -0.25rem; inset-inline-end: -0.25rem; display: grid; place-items: center;
    min-inline-size: 1.25rem; block-size: 1.25rem; padding-inline: 0.25rem; font-size: var(--text-xs); font-weight: 700;
    color: var(--color-on-primary); background: var(--color-primary); border-radius: var(--radius-pill);
  }
  .filters-button__count[hidden] { display: none; }
  .filters-dialog:modal {
    inset: 0; inline-size: 100%; max-inline-size: none; block-size: 100%; max-block-size: none; margin: 0; padding: 0;
    border: 0; background: var(--color-bg); color: var(--color-ink); overscroll-behavior: contain;
  }
  .filters-dialog[open] { display: flex; flex-direction: column; }
  .filters-dialog::backdrop { overflow: hidden; overscroll-behavior: contain; background: rgb(0 0 0 / 0.45); }
  /* Wider screens: a centred window instead of the whole screen. */
  @media (min-width: 40.01rem) {
    .filters-dialog:modal {
      inset: 0; margin: auto; inline-size: min(36rem, 100% - 2rem); block-size: fit-content; max-block-size: min(44rem, 100% - 2rem);
      border: 1px solid var(--color-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-float);
    }
  }
  .filters-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-block-end: 1px solid var(--color-border); }
  .filters-dialog__title { margin: 0; font-size: var(--text-xl); }
  .filters-dialog__body { flex: 1; overflow-y: auto; padding: var(--space-5) var(--space-4); }
  /* In the dialog each group has its heading and its chips in a grid of equal cells, two per row: the name on the
     left, the number on the right. */
  .events-filters .filters-dialog__body .chips { display: grid; gap: var(--space-5); overflow: visible; margin: 0; padding: 0; mask: none; animation: none; }
  .events-filters .filters-dialog__body .chip-group { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .events-filters .filters-dialog__body .chips__divider { display: none; }
  .filters-dialog__body .chip-group__title {
    position: static; inline-size: auto; block-size: auto; overflow: visible; clip-path: none;
    grid-column: 1 / -1; margin-block-end: var(--space-1); padding: 0; font-weight: 700; color: var(--color-ink-soft);
  }
  .filters-dialog__body .chip { justify-content: flex-start; padding-inline: var(--space-4) var(--space-3); white-space: nowrap; }
  .filters-dialog__body .chip::before { content: none; }
  .filters-dialog__body .chip > span:not(.chip__count) { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; }
  .filters-dialog__body .chip__count { margin-inline-start: auto; padding-inline-start: var(--space-2); }
  .filters-dialog__actions {
    display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4);
    padding-block-end: calc(var(--space-3) + env(safe-area-inset-bottom, 0px)); border-block-start: 1px solid var(--color-border);
  }
  .filters-dialog__actions .button { flex: 1; justify-content: center; }

  .events-phone-list { display: none; }
  @media (max-width: 40rem) { .events-phone-list { display: block; } }
  .events-summary { margin: 0 0 var(--space-4); color: var(--color-ink-soft); font-size: var(--text-sm); max-inline-size: none; }
  .event-grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
  .event-subscribe { display: grid; align-content: center; gap: var(--space-3); padding: var(--space-6); border-radius: var(--radius-card); background: var(--color-band); }
  .event-subscribe > * { margin: 0; }
  .event-subscribe__title { font: 700 var(--text-xl) var(--font-display); line-height: 1.2; }
  .event-subscribe p:not(.event-subscribe__title) { max-inline-size: 32rem; color: var(--color-ink-soft); }
  @media (min-width: 42rem) { .event-subscribe { grid-column: span 2; } }
  .album-grid, .album-grid--list { list-style: none; margin: 0; padding: 0; max-inline-size: none; }
  .album-grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }

  /* Month view: a table, so screen readers get rows and columns, drawn as a grid of rounded days inside a white card.
     It scrolls inside its wrapper on narrow screens. */
  .calendar { padding: var(--space-5) var(--space-6); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); }
  .calendar__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-block-end: var(--space-3); }
  .calendar__head .cluster { flex: none; flex-wrap: nowrap; gap: var(--space-2); }
  @media (max-width: 39.99rem) { .calendar { padding: var(--space-4); } .calendar__title { font-size: var(--text-lg); } }
  .calendar__title { margin: 0; font-size: var(--text-xl); }
  .calendar__grid { table-layout: fixed; min-inline-size: 42rem; border-collapse: separate; border-spacing: 6px; margin-inline: -6px; inline-size: calc(100% + 12px); }
  .calendar__grid th { text-align: start; padding: var(--space-2); border: 0; font-size: var(--text-xs); letter-spacing: var(--tracking-eyebrow); text-transform: uppercase; color: var(--color-ink-soft); background: none; }
  .calendar__day { vertical-align: top; block-size: 5.5rem; padding: var(--space-2); border: 0; border-radius: var(--radius-md); background: var(--color-surface-sunken); }
  .calendar__day--outside { background: color-mix(in srgb, var(--color-surface-sunken) 55%, transparent); color: var(--color-muted); }
  .calendar__day--today .calendar__number { background: var(--color-primary); color: var(--color-on-primary); }
  .calendar__number { display: inline-block; min-inline-size: 1.6rem; text-align: center; font-size: var(--text-sm); font-weight: 600; border-radius: var(--radius-pill); }
  /* A day with events is filled with the primary colour, so busy days stand out at a glance. */
  .calendar__day--busy { background: var(--color-primary); color: var(--color-on-primary); }
  .calendar__day--busy.calendar__day--today .calendar__number { background: var(--color-on-primary); color: var(--color-primary); }
  .calendar__event {
    display: block; margin-block-start: var(--space-1); font-size: var(--text-xs); font-weight: 700; line-height: 1.25;
    color: inherit; text-decoration: none; overflow-wrap: anywhere;
  }
  .calendar__event:hover { text-decoration: underline; }
  .calendar__event:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; border-radius: 4px; }

  /* The events map: hidden until its script runs; the list of events below it is the version without a picture. */
  .events-map { position: relative; z-index: 0; isolation: isolate; inline-size: 100%; block-size: clamp(22rem, 62vh, 38rem); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: hidden; background: var(--color-surface-sunken); margin-block-end: var(--space-3); }
  .events-map--small { block-size: 15rem; max-inline-size: 40rem; }
  .events-map--picker { block-size: 20rem; margin-block-end: var(--space-2); }
  .events-map__note { margin-block: 0 var(--space-5); color: var(--color-ink-soft); font-size: var(--text-sm); }
  .events-map-pin span { display: block; inline-size: 26px; block-size: 26px; border: 4px solid #fff; border-radius: 50%; background: var(--color-primary); box-shadow: 0 2px 8px rgb(0 0 0 / 0.35); }
  .events-map-pin:focus-visible span { outline: 3px solid var(--color-focus); outline-offset: 3px; }
}

/* Leaflet's own stylesheet is not in a cascade layer, so rules that adjust its popups cannot be inside one either. */
.events-map__card p { margin: 0 0 0.6rem; font-size: 0.9375rem; line-height: 1.3; }
.events-map__card p:last-child { margin-block-end: 0; }
.events-map__card a { font-weight: 700; }
.events-map__card small { color: #4a5a68; }
.events-map .leaflet-control-attribution { margin: 0 0.5rem 0.5rem 0; border-radius: 4px; }
