/* Calendar palette and page frame: reuse the homepage's black, grey, paper and lime tones. */
.calendar-body {
  --cal-black: #111211;
  --cal-panel: #202220;
  --cal-line: #454945;
  --cal-grey: #a5aaa2;
  --cal-paper: #faecd2;
  --cal-lime: #dffc3a;
  margin: 0;
  color: var(--cal-paper);
  background: var(--cal-black);
  font-family: Arial, Helvetica, sans-serif;
}

.calendar-body [hidden] { display: none !important; }

/* Intro: establish the week view and align the calendar heading. */
.calendar-page {
  box-sizing: border-box;
  width: 100%;
  max-width: 1500px;
  min-height: calc(100vh - var(--site-nav-height, 100px));
  margin: var(--site-nav-height, 100px) auto 0;
  padding: var(--site-page-gap, 30px) clamp(18px, 5vw, 72px) 76px;
  color: var(--cal-paper);
  background: var(--cal-black);
}

.calendar-page div { border-bottom: 0; }
/* Reset the shared site header sizing so the intro grows around its heading. */
.calendar-page > .calendar-intro {
  height: auto;
  min-height: 0;
  margin: 0 0 30px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.calendar-eyebrow { margin: 0 0 10px; color: var(--cal-lime); font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.calendar-intro__row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.calendar-intro h1 { margin: 0; font-size: clamp(38px, 7vw, 86px); line-height: .92; letter-spacing: -.065em; text-transform: uppercase; }
.calendar-lede { margin: 14px 0 0; color: var(--cal-grey); font-size: 16px; }

/* Filter controls: keep sport, cost and area consistent across both schedule views. */
.calendar-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 28px 0 18px; }
.calendar-filters label { display: grid; gap: 6px; min-width: 150px; color: var(--cal-grey); font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.calendar-filters select {
  min-height: 44px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--cal-line);
  border-radius: 0;
  color: var(--cal-paper);
  background: var(--cal-panel);
  font: 14px Arial, Helvetica, sans-serif;
}
.calendar-filters select:focus-visible,
.calendar-clear-filters:focus-visible,
.calendar-day-nav button:focus-visible { outline: 2px solid var(--cal-lime); outline-offset: 2px; }
.calendar-result-count { margin: 0 0 12px auto; color: var(--cal-grey); font-size: 13px; }

/* Preferred starting time: match the neighbouring black-and-green filter controls. */
.calendar-time-filter { text-transform:uppercase; }
.calendar-time-filter input { box-sizing:border-box; width:100%; min-width:0; min-height:44px; padding:9px 12px; border:1px solid var(--cal-line); border-radius:0; background:#111211; color:var(--cal-lime); color-scheme:dark; font:700 13px/1.4 Arial,sans-serif; }
.calendar-time-filter input:focus-visible { outline:2px solid var(--cal-lime); outline-offset:3px; }

/* Active filter labels: wrap on narrow screens and provide a clear individual reset action. */
.calendar-active-filters { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 18px; }
.calendar-active-filters[hidden] { display:none; }
.calendar-filter-label { display:inline-flex; align-items:center; justify-content:space-between; gap:14px; min-height:44px; max-width:100%; padding:8px 12px; box-sizing:border-box; border:1px solid var(--cal-lime); background:var(--cal-panel); color:var(--cal-lime); font:700 13px/1.4 Arial, Helvetica, sans-serif; text-align:left; overflow-wrap:anywhere; cursor:pointer; }
.calendar-filter-label:hover { background:var(--cal-lime); color:var(--cal-black); }
.calendar-filter-label:focus-visible { outline:2px solid var(--cal-paper); outline-offset:3px; }
.calendar-filter-label__remove { flex-shrink:0; font-size:20px; line-height:1; }

/* Day navigation: select Full Week or toggle individual weekday agendas. */
.calendar-day-nav {
  position: sticky;
  top: var(--site-nav-height, 100px);
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 0;
  padding: 6px 0;
  background: var(--cal-black);
}
.calendar-day-nav__days { display: flex; flex: 1; flex-wrap: wrap; align-items: stretch; gap: 4px; height: auto; border: 0; background: transparent; }
.day-nav-button {
  position: relative;
  z-index: 1;
  min-width: 54px;
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  color: var(--cal-grey);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  cursor: pointer;
}
.day-nav-button:hover { color: var(--cal-paper); }
/* Each selected button keeps two lime rails; toggling a day animates its own lines. */
.day-nav-button::before,
.day-nav-button::after {
  position: absolute;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--cal-lime);
  content: '';
  pointer-events: none;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .32s cubic-bezier(.22, 1, .36, 1);
}
.day-nav-button::before { top: 0; }
.day-nav-button::after { bottom: 0; }
.day-nav-button[aria-pressed="true"] { color: var(--cal-lime); }
.day-nav-button[aria-pressed="true"]::before,
.day-nav-button[aria-pressed="true"]::after { transform: scaleX(1); }
.day-nav-button--week { margin-right: auto; }
.day-nav-button--week[aria-pressed="true"] { color: var(--cal-black); background: var(--cal-lime); }

/* Selection tools: stack the explanation and reset button below the weekday navigation. */
.calendar-selection-tools { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 12px 0 28px; }
.calendar-selection-help { margin: 0; color: var(--cal-grey); font-size: 14px; line-height: 1.5; }
.calendar-clear-filters { min-height: 44px; padding: 0 14px; border: 1px solid var(--cal-line); color: var(--cal-paper); background: var(--cal-panel); font: 700 12px Arial, Helvetica, sans-serif; letter-spacing: .06em; cursor: pointer; }
.calendar-clear-filters:hover:not(:disabled) { border-color: var(--cal-lime); color: var(--cal-lime); }
.calendar-clear-filters:disabled { opacity: .5; cursor: default; }
.calendar-message { margin: 0 0 24px; padding: 14px 16px; border-left: 2px solid var(--cal-lime); color: var(--cal-grey); background: var(--cal-panel); font-size: 13px; }
.calendar-page a.calendar-find-club,
.calendar-page a.calendar-find-club:visited,
.calendar-page a.calendar-find-club:hover,
.calendar-page a.calendar-find-club:focus,
.calendar-page a.calendar-find-club:active { color:#fff; }

/* View heading: shared title treatment for the club-first grid and day agenda. */
.calendar-view-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.calendar-view-heading h2 { margin: 0; color: var(--cal-paper); font-size: clamp(24px, 3vw, 38px); line-height: 1; letter-spacing: -.045em; }
.calendar-view-heading > p { max-width: 310px; margin: 0; color: var(--cal-grey); font-size: 12px; }
.calendar-view.is-entering { animation: calendar-view-in .24s ease-out both; }
@keyframes calendar-view-in { from { opacity: .45; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Week grid: each club has one row, with its sessions placed under their weekdays. */
.week-grid { border-top: 1px solid var(--cal-line); }
.week-head,
.week-row { display: grid; grid-template-columns: minmax(155px, 1.5fr) repeat(7, minmax(0, 1fr)); }
.calendar-page .week-head {
  position: sticky;
  top: calc(var(--site-nav-height, 100px) + var(--calendar-day-nav-height, 54px));
  z-index: 19;
  min-height: 48px;
  border-bottom: 1px solid var(--cal-line);
  background: var(--cal-black);
  box-shadow: 0 4px 8px rgb(0 0 0 / .2);
}
.week-head > div { display: flex; align-items: center; justify-content: center; min-width: 0; border-left: 1px solid var(--cal-line); color: var(--cal-grey); font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.week-head > div:first-child { justify-content: flex-start; border-left: 0; }
.week-head > div button { width: 100%; height: 100%; border: 0; color: inherit; background: transparent; font-size: inherit; font-weight: inherit; letter-spacing: inherit; cursor: pointer; }
.week-head > div button:hover { color: var(--cal-lime); }
.calendar-page .week-row { min-height: 102px; border-bottom: 1px solid var(--cal-line); }
.week-club { display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; padding: 12px 14px 12px 0; }
.week-club a:hover { color: var(--cal-lime); }
.week-club a { overflow: hidden; color: var(--cal-paper); font-size: 16px; font-weight: 700; text-decoration: none; text-overflow: ellipsis; }

.week-club__title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.calendar-remove-favourite { display:inline-flex; flex:0 0 44px; align-items:center; justify-content:center; width:44px; height:44px; padding:0; border:0; background:transparent; color:var(--cal-lime); cursor:pointer; }
.calendar-remove-favourite:hover { color:var(--cal-lime); }
.calendar-remove-favourite:focus-visible { outline:2px solid var(--cal-lime); outline-offset:3px; }
.agenda-club > a { color:inherit; text-decoration:inherit; }
.week-club__title a { flex: 1; box-sizing: border-box; min-width: 0; min-height: 44px; padding: 12px 0; }
.club-calendar-control { position: relative; flex: 0 0 44px; }
.week-club span { overflow: hidden; color: var(--cal-grey); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.week-cell { display: flex; flex-direction: column; justify-content: center; gap: 5px; min-width: 0; padding: 8px 6px; border-left: 1px solid var(--cal-line); }
.week-day-label { display: none; }
.week-session { display: block; min-width: 0; padding: 7px 6px; border-left: 2px solid var(--cal-lime); background: var(--cal-panel); }
.week-session__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; }
/* Session details stay readable at every breakpoint; narrow time ranges can wrap. */
.session-title { display: block; margin-bottom: 5px; color: var(--cal-paper); font-size: 14px; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
/* Session titles: link to the profile timetable while retaining the calendar's text styling. */
.session-title-link { display:inline-flex; align-items:center; min-height:44px; color:inherit; text-decoration:underline; text-underline-offset:3px; }

.session-title-link:hover { color:var(--cal-lime); }
.session-title-link:focus-visible { outline:2px solid var(--cal-lime); outline-offset:3px; }
.session-audience { display: block; margin-top: 4px; color: var(--cal-grey); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
/* Optional session subtitle: show distances and other short details below the title. */
.session-subtitle { display: block; margin: 0 0 5px; color: var(--cal-grey); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
/* Venue-charge emphasis uses the same green as the other calendar highlights. */
.session-fee { color: var(--cal-lime); font-weight: inherit; }
.week-session time { display: block; color: var(--cal-lime); font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.week-session__area { display: block; margin-top: 4px; color: var(--cal-grey); font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.session-frequency { position: relative; display: inline-flex; flex: 0 0 auto; margin: 0; }
/* A compact information icon sits inside a 44px touch target; open notes reflow in the card. */
.session-frequency summary { position: relative; display: grid; width: 44px; height: 44px; place-items: center; color: var(--cal-paper); cursor: pointer; font-size: 14px; font-weight: 700; line-height: 1; list-style: none; }
.session-frequency summary::before { position: absolute; width: 22px; height: 22px; border: 1px solid var(--cal-grey); border-radius: 50%; content: ''; pointer-events: none; }
.session-frequency summary::-webkit-details-marker { display: none; }
.session-frequency[open] { display: block; flex: 1 1 100%; min-width: 0; }
.session-frequency > span { display: block; box-sizing: border-box; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--cal-line); background: var(--cal-black); color: var(--cal-paper); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.week-empty { color: #6d726b; font-size: 10px; }

/* Day agenda: list sessions chronologically and expose club, price and meeting point together. */
.calendar-view-heading--day { margin-bottom: 24px; }
/* Selected days share one neon eyebrow that wraps as more weekdays are chosen. */
.calendar-view-heading--day > .calendar-eyebrow { max-width: none; color: var(--cal-lime); font-size: 10px; }
.day-agenda { border-top: 1px solid var(--cal-line); }
.agenda-event { display: grid; grid-template-columns: minmax(104px, .45fr) minmax(180px, 1fr) minmax(150px, .9fr) minmax(110px, .5fr); align-items: center; gap: 20px; min-height: 106px; border-bottom: 1px solid var(--cal-line); }
.agenda-time { color: var(--cal-lime); font-size: 16px; font-weight: 700; white-space: nowrap; }
.agenda-day { display: block; margin-bottom: 4px; color: var(--cal-paper); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; white-space: normal; }
.agenda-club:hover { color: var(--cal-lime); }
.agenda-club { display: flex; min-width: 0; min-height: 44px; align-items: center; color: var(--cal-paper); font-size: 18px; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }

.agenda-details { min-width: 0; color: var(--cal-grey); font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.agenda-details span { display: block; }
.agenda-details .session-frequency { margin-top: 6px; }
.agenda-price { justify-self: end; color: var(--cal-paper); font-size: 14px; text-align: right; }
.agenda-sport { display: block; margin-top: 4px; color: var(--cal-grey); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; white-space: normal; }
.agenda-empty { padding: 30px 0; color: var(--cal-grey); font-size: 14px; }

.calendar-back-to-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 30;
  min-height: 44px;
  padding: 12px 18px;
  border: 1px solid var(--cal-lime);
  color: var(--cal-black);
  background: var(--cal-lime);
  font: 700 12px Arial, Helvetica, sans-serif;
  cursor: pointer;
  box-shadow: 0 4px 16px rgb(0 0 0 / .3);
}
.calendar-back-to-top:hover { background: var(--cal-paper); }

.week-empty-summary { display: none; }

@media (max-width: 1040px) {
  /* Reflow the week into club cards instead of shrinking seven columns of session text. */
  /* Keep download tooltips inside the viewport throughout the compact calendar layout. */
  .week-club .club-calendar-tooltip { left: auto; right: 0; transform: none; max-width: calc(100vw - 40px); box-sizing: border-box; }
  .week-head { display: none; }
  /* Mobile schedules use standalone session boxes without table grid borders. */
  .calendar-page .week-grid,
  .calendar-page .week-row { border: 0; }
  /* Remove space above club headings while retaining separation below each schedule. */
  .week-row { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 0 14px; }
  .week-club { grid-column: 1 / -1; padding: 0 0 12px; }
  /* Keep mobile sport and area labels beside the download icon at the right edge. */
  .week-club { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) 44px; align-items: center; }
  .week-club__title { display: contents; }
  .week-club__title > a { grid-column: 1; grid-row: 1; display: flex; align-items: center; padding: 0; }
  .week-club__title > .club-calendar-control { grid-column: 3; grid-row: 1; }
  .week-club .week-club__meta { grid-column: 2; grid-row: 1; text-align: right; white-space: normal; overflow-wrap: anywhere; }
  /* Mobile weekly club names are larger; daily entries retain their compact title size. */
  .week-club a { font-size: 20.8px; }
  /* Mobile weekly links: underline club names while day-view titles retain their original style. */
  /* Let mobile session links follow their text height instead of reserving a 44px row. */
  .session-title-link { min-height: 0; text-decoration: none; }
  .week-club__title > a { text-decoration: underline; text-underline-offset: 3px; }
  .week-cell { min-height: 52px; padding: 8px; border: 0; }
  /* Compact weeks show scheduled days only; entry heights match within each club. */
  .week-cell--empty { display: none; }
  .week-session { box-sizing: border-box; min-height: var(--week-session-height, 0px); }
  .week-grid--measuring .week-session { min-height: 0; }
  .week-empty-summary { display: block; grid-column: 1 / -1; margin: 0; padding: 8px; color: var(--cal-grey); font-size: 14px; }
  .week-day-label { display: block; margin-bottom: 5px; color: var(--cal-grey); font-size: 12px; font-weight: 700; letter-spacing: .1em; }
}

@media (max-width: 820px) {
  .agenda-event { grid-template-columns: 104px minmax(150px, 1fr) minmax(130px, .9fr); gap: 14px; }
  .agenda-time { grid-column: 1; grid-row: 1 / 3; }
  .agenda-club { grid-column: 2; grid-row: 1; }
  .agenda-details { grid-column: 2; grid-row: 2; }
  .agenda-price { grid-column: 3; grid-row: 1 / 3; justify-self: end; margin: 0; padding: 0; text-align: right; }
}

@media (max-width: 620px) {
  .calendar-page { padding-top: 6px; }
  .calendar-intro__row { display: block; }
  .calendar-filters label { flex: 1 1 135px; min-width: 0; }
  /* Mobile sizing: native selects must fit their filter columns. */
  .calendar-filters select { width: 100%; min-width: 0; box-sizing: border-box; }
  .calendar-result-count { width: 100%; margin: 0; }
  .calendar-day-nav { align-items: stretch; }
  .day-nav-button--week { flex: 0 0 100%; margin: 0; text-align: left; }
  .calendar-day-nav__days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); width: 100%; }
  .day-nav-button { min-width: 0; padding: 0 5px; }
  .calendar-view-heading { align-items: start; flex-direction: column; }
  .calendar-view-heading > p { max-width: none; }
  .agenda-event { grid-template-columns: 98px minmax(0, 1fr); gap: 8px 12px; padding: 16px 0; }
  .agenda-time { grid-row: span 2; font-size: 14px; }
  .agenda-club { font-size: 16px; }
  .agenda-details { grid-column: 2; }
  .agenda-price { grid-column: 2; grid-row: auto; justify-self: start; margin: 0; padding: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .day-nav-button::before,
  .day-nav-button::after { transition: none; }
  .calendar-view.is-entering { animation: none; }
}

/* Session estimates remain visible beside the schedule. */
.session-distance { color:var(--cal-lime); font-size:12px; }

