/* =========================================================================
   Training calendar (/training/calendar/)
   ========================================================================= */

/* ---- 1. Hero: planning photo under the header, forest fade, ribbon of upcoming dates ---- */
.jd-cal-hero { position: relative; display: grid; align-content: end; min-height: min(100svh, 920px); overflow: clip; background: var(--forest); color: var(--on-forest); }
.jd-cal-hero__media { position: absolute; inset: 0; }
.jd-cal-hero__media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 70% 50%; }
.jd-cal-hero__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(35, 56, 49, .97) 0%, rgba(35, 56, 49, .86) 42%, rgba(35, 56, 49, .2) 80%), linear-gradient(0deg, rgba(35, 56, 49, .7), transparent 45%); }

.jd-cal-hero__inner { position: relative; z-index: 1; padding-top: 180px; padding-bottom: clamp(48px, 6vw, 88px); }
.jd-cal-hero__copy { display: grid; gap: var(--space-5); justify-items: start; max-width: 720px; }
.jd-cal-hero__title { margin: 0; font-size: var(--fs-h1); font-weight: 500; line-height: 1.06; letter-spacing: -.025em; }
.jd-cal-hero__title em { font-style: normal; color: var(--lime); }
.jd-cal-hero__text { margin: 0; max-width: 54ch; font-size: var(--fs-lead); line-height: 1.5; color: var(--on-forest-muted); }
.jd-cal-hero__btns { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }
.jd-cal-hero__dl { gap: 10px; }
.jd-cal-hero__dl svg { flex: none; width: 18px; height: 18px; }

/* The ribbon: two identical tracks side by side, each sliding one full width, so the loop never jumps */
.jd-cal-hero__ribbon { position: relative; z-index: 1; display: flex; overflow: hidden; background: var(--lime); color: var(--forest); }
.jd-cal-hero__track { display: flex; flex: none; margin: 0; padding: 0; list-style: none; animation: jd-cal-roll var(--jd-cal-dur, 40s) linear infinite; }
.jd-cal-hero__ribbon:hover .jd-cal-hero__track,
.jd-cal-hero__ribbon:focus-within .jd-cal-hero__track { animation-play-state: paused; }
.jd-cal-hero__track a { display: flex; align-items: baseline; gap: 12px; padding: var(--space-4) var(--space-7); border-right: 1px solid rgba(35, 56, 49, .2); color: inherit; text-decoration: none; white-space: nowrap; font-size: var(--fs-body); }
.jd-cal-hero__track a:hover .jd-cal-hero__name { text-decoration: underline; text-underline-offset: 3px; }
.jd-cal-hero__track a:focus-visible { outline: 2px solid var(--forest); outline-offset: -4px; }
.jd-cal-hero__track time { font-size: var(--fs-h4); font-weight: 600; }
.jd-cal-hero__fmt { font-size: var(--fs-caption); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .7; }
@keyframes jd-cal-roll { to { transform: translateX(-100%); } }

/* Reduced motion: the ribbon stands still and can be scrolled sideways instead */
@media (prefers-reduced-motion: reduce) {
  .jd-cal-hero__ribbon { overflow-x: auto; scrollbar-width: none; }
  .jd-cal-hero__track { animation: none; }
  .jd-cal-hero__track[aria-hidden] { display: none; }
}

@media (max-width: 767px) {
  .jd-cal-hero__media img { object-position: 78% 50%; }
  .jd-cal-hero__media::after { background: linear-gradient(0deg, rgba(35, 56, 49, .97) 50%, rgba(35, 56, 49, .55)); }
  .jd-cal-hero__inner { padding-top: 140px; }
  .jd-cal-hero__track a { padding: var(--space-3) var(--space-5); }
}

/* ---- 2+3. Filters and programme list: white, month tabs, one programme per row, page numbers ---- */
.jd-cal-list { position: relative; overflow: clip; padding-block: clamp(72px, 8vw, 120px); background: var(--surface); color: var(--ink); }
.jd-cal-list > .jd-container { position: relative; z-index: 1; }
.jd-cal-list p { margin: 0; }
.jd-cal-list [hidden] { display: none !important; }
.jd-cal-list__head { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: var(--space-8); align-items: end; }
.jd-cal-list__title { margin: var(--space-4) 0 0; font-size: var(--fs-h2); font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.jd-cal-list__title em { padding: 0 .06em; font-style: normal; color: var(--forest); background: linear-gradient(transparent 62%, var(--lime) 62% 92%, transparent 92%); }
.jd-cal-list__text { font-size: var(--fs-body); line-height: 1.6; color: var(--ink-muted); }

/* Month tabs: All, then twelve months with their counts */
.jd-cal-list__tabs { display: flex; gap: 6px; margin-top: var(--space-8); padding: 6px; overflow-x: auto; border-radius: var(--radius-pill); background: var(--forest-tint); scrollbar-width: none; }
.jd-cal-list__tab { flex: none; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); background: none; color: var(--ink); font: 500 var(--fs-small) / 1 var(--font-sans); cursor: pointer; transition: background .2s, color .2s, opacity .2s; }
.jd-cal-list__n { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 99px; background: var(--surface); font-size: var(--fs-caption); font-weight: 600; }
.jd-cal-list__tab:hover { background: rgba(255, 255, 255, .6); }
.jd-cal-list__tab:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.jd-cal-list__tab[aria-pressed="true"] { background: var(--forest); color: var(--on-forest); }
.jd-cal-list__tab[aria-pressed="true"] .jd-cal-list__n { background: var(--lime); color: var(--forest); }
.jd-cal-list__tab.is-zero:not([aria-pressed="true"]) { opacity: .45; }

/* Search, category, format, clear, count */
.jd-cal-list__bar { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .8fr) auto auto; gap: var(--space-3); align-items: center; margin-top: var(--space-4); }
.jd-cal-list__search, .jd-cal-list__select { position: relative; display: flex; align-items: center; min-width: 0; height: 48px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink-muted); }
.jd-cal-list__search { gap: var(--space-3); padding: 0 var(--space-4); }
.jd-cal-list__search svg { flex: none; }
.jd-cal-list__search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: var(--fs-small); color: var(--ink); outline: none; }
.jd-cal-list__select select { appearance: none; width: 100%; height: 100%; padding: 0 44px 0 var(--space-4); border: 0; border-radius: inherit; background: none; font: inherit; font-size: var(--fs-small); color: var(--ink); cursor: pointer; outline: none; }
.jd-cal-list__select svg { position: absolute; right: 16px; pointer-events: none; }
.jd-cal-list__search:focus-within, .jd-cal-list__select:focus-within { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(35, 56, 49, .18); }
.jd-cal-list__clear { display: inline-flex; align-items: center; gap: 6px; height: 48px; padding: 0 var(--space-2); border: 0; background: none; color: var(--forest); font: 600 var(--fs-small) / 1 var(--font-sans); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.jd-cal-list__clear svg { width: 16px; height: 16px; }
.jd-cal-list__clear:disabled { color: var(--ink-subtle); text-decoration: none; cursor: default; opacity: .6; }
.jd-cal-list__status { font-size: var(--fs-small); color: var(--ink-muted); white-space: nowrap; }
.jd-cal-list__status b { color: var(--ink); }

/* One programme per row */
.jd-cal-list__res { margin-top: var(--space-5); }
.jd-cal-list__rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.jd-cal-list__row { display: grid; grid-template-columns: 120px minmax(0, 1.5fr) minmax(0, 1fr) 190px; gap: var(--space-6); align-items: center; padding: var(--space-6) var(--space-2); border-bottom: 1px solid var(--line); transition: background .3s; }
.jd-cal-list__row:hover { background: linear-gradient(90deg, var(--forest-tint), transparent); }
.jd-cal-list__day { display: flex; align-items: center; gap: 10px; color: var(--forest); }
.jd-cal-list__day b { font-size: var(--fs-h1); font-weight: 500; line-height: .9; letter-spacing: -.03em; }
.jd-cal-list__day span { font-size: var(--fs-caption); font-weight: 600; line-height: 1.3; text-transform: uppercase; color: var(--ink-muted); }
.jd-cal-list__main { display: grid; gap: 6px; }
.jd-cal-list__tag { font-size: var(--fs-caption); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-subtle); }
.jd-cal-list__name { margin: 0; font-size: var(--fs-h4); font-weight: 500; line-height: 1.3; letter-spacing: -.01em; }
.jd-cal-list__name a { color: inherit; text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .3s var(--ease-out); }
.jd-cal-list__name a:hover { background-size: 100% 1px; }
.jd-cal-list__when { font-size: var(--fs-small); color: var(--ink-muted); }
.jd-cal-list__info { display: grid; gap: 8px; justify-items: start; font-size: var(--fs-small); color: var(--ink-muted); }
.jd-cal-list__info > span:not(.jd-cal-list__badge) { display: flex; gap: 8px; align-items: center; }
.jd-cal-list__info svg { flex: none; color: var(--forest); }
.jd-cal-list__info b { color: var(--ink); font-weight: 600; }
.jd-cal-list__badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: var(--fs-caption); font-weight: 600; white-space: nowrap; }
.jd-cal-list__badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.jd-cal-list__badge--open { background: var(--forest-tint); color: var(--forest); }
.jd-cal-list__badge--few { background: var(--lime); color: var(--forest); }
.jd-cal-list__badge--full { background: var(--surface-soft); color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line); }
.jd-cal-list__acts { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-3); }
.jd-cal-list__reg.is-off { background: var(--surface-soft); color: var(--ink-subtle); box-shadow: inset 0 0 0 1px var(--line); cursor: not-allowed; }
.jd-cal-list__more { font-size: var(--fs-small); font-weight: 600; color: var(--forest); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.jd-cal-list__more:hover { text-decoration-thickness: 2px; }

/* Nothing matches, and the page numbers */
.jd-cal-list__empty { display: grid; justify-items: center; gap: var(--space-4); padding: var(--space-8) var(--space-5); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); text-align: center; }
.jd-cal-list__empty h3 { margin: 0; font-size: var(--fs-h4); font-weight: 500; }
.jd-cal-list__empty p { max-width: 58ch; color: var(--ink-muted); }
.jd-cal-list__pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-3); margin-top: var(--space-8); }
.jd-cal-list__pages { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.jd-cal-list__pg { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); font: 600 var(--fs-small) / 1 var(--font-sans); cursor: pointer; transition: background .2s, border-color .2s, color .2s; }
.jd-cal-list__pg:hover:not(:disabled) { border-color: var(--forest); }
.jd-cal-list__pg:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.jd-cal-list__pg[aria-current="page"] { border-color: var(--forest); background: var(--forest); color: var(--lime); }
.jd-cal-list__pg:disabled { color: var(--ink-subtle); cursor: default; opacity: .55; }

@media (max-width: 1100px) {
  .jd-cal-list__head { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .jd-cal-list__bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .jd-cal-list__search { grid-column: 1 / -1; }
  .jd-cal-list__row { grid-template-columns: 96px minmax(0, 1fr); }
  .jd-cal-list__info, .jd-cal-list__acts { grid-column: 2; }
  .jd-cal-list__acts { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }
}
@media (max-width: 600px) {
  .jd-cal-list__bar { grid-template-columns: minmax(0, 1fr); }
  .jd-cal-list__row { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .jd-cal-list__info, .jd-cal-list__acts { grid-column: 1; }
  .jd-cal-list__pg--step { padding: 0; font-size: 0; gap: 0; }
  .jd-cal-list__pg--step span { font-size: var(--fs-body); }
}

/* =========================================================================
   Download the calendar (template-parts/calendar/download.php)
   Soft green; a preview of the PDF on the left, the download form on the right.
   ========================================================================= */
.jd-cal-dl { position: relative; overflow: clip; padding-block: clamp(72px, 8vw, 120px); background: var(--forest-tint); color: var(--ink); scroll-margin-top: 0; }
.jd-cal-dl p { margin: 0; }
.jd-cal-dl__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(40px, 6vw, 96px); align-items: center; }
.jd-cal-dl__side { display: grid; gap: var(--space-7); }
.jd-cal-dl__copy { display: grid; gap: var(--space-4); }
.jd-cal-dl__title { margin: 0; font-size: var(--fs-h2); font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.jd-cal-dl__title em { padding: 0 .06em; font-style: normal; color: var(--forest); background: linear-gradient(transparent 62%, var(--lime) 62% 92%, transparent 92%); }
.jd-cal-dl__text { max-width: 52ch; font-size: var(--fs-body); line-height: 1.6; color: var(--ink-muted); }

/* the PDF preview */
.jd-cal-dl__visual { position: relative; width: 100%; max-width: 460px; aspect-ratio: 4 / 5; justify-self: center; }
.jd-cal-dl__sheet { position: absolute; inset: 0; display: grid; align-content: start; gap: var(--space-4); overflow: hidden; padding: 28px; border-radius: 18px; background: var(--surface); box-shadow: 0 30px 60px -36px rgba(23, 38, 31, .55); }
.jd-cal-dl__sheet--back { rotate: -8deg; translate: -18px 10px; background: var(--forest); }
.jd-cal-dl__sheet--mid { rotate: -3.5deg; translate: -8px 4px; background: var(--lime); }
.jd-cal-dl__sheet-top { display: flex; align-items: center; justify-content: space-between; }
.jd-cal-dl__sheet-top img { display: block; width: auto; height: 40px; }
.jd-cal-dl__sheet-top span { padding: 3px 8px; border-radius: 6px; background: var(--forest); color: var(--lime); font-size: var(--fs-caption); font-weight: 700; letter-spacing: .08em; }
.jd-cal-dl__sheet-title { padding-bottom: var(--space-3); border-bottom: 2px solid var(--forest); font-size: var(--fs-h3); font-weight: 600; color: var(--forest); }
.jd-cal-dl__rows { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.jd-cal-dl__rows li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 2px 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: var(--fs-caption); }
.jd-cal-dl__rows b { grid-row: span 2; color: var(--forest); font-weight: 700; }
.jd-cal-dl__rows span { overflow: hidden; font-weight: 600; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.jd-cal-dl__rows em { font-style: normal; color: var(--ink-subtle); }

/* the form */
.jd-cal-dl__form { display: grid; gap: var(--space-5); }
.jd-cal-dl__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.jd-cal-dl__field { display: grid; gap: 6px; min-width: 0; font-size: var(--fs-small); font-weight: 500; }
.jd-cal-dl__field i { font-style: normal; color: var(--forest); }
.jd-cal-dl__field input { width: 100%; min-width: 0; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-body); font-weight: 400; transition: border-color var(--dur-base), box-shadow var(--dur-base); }
.jd-cal-dl__field input:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px rgba(35, 56, 49, .18); }
.jd-cal-dl__field input[aria-invalid="true"] { border-color: #b3261e; }
.jd-cal-dl__check { position: relative; display: flex; gap: 12px; align-items: flex-start; font-size: var(--fs-small); line-height: 1.5; cursor: pointer; }
.jd-cal-dl__check input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; }
.jd-cal-dl__check small { font-size: inherit; color: var(--ink-subtle); }
.jd-cal-dl__box { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: transparent; transition: background-color var(--dur-base), border-color var(--dur-base), color var(--dur-base); }
.jd-cal-dl__box svg { width: 14px; height: 14px; }
.jd-cal-dl__check input:checked + .jd-cal-dl__box { border-color: var(--forest); background: var(--forest); color: var(--lime); }
.jd-cal-dl__check input:focus-visible + .jd-cal-dl__box { outline: 2px solid var(--forest); outline-offset: 2px; }
.jd-cal-dl__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.jd-cal-dl__foot .jd-btn[disabled] { opacity: .7; cursor: progress; }
.jd-cal-dl__foot .jd-btn__disc svg { flex: none; width: 18px; height: 18px; }
.jd-cal-dl__status { min-height: 1.5em; font-size: var(--fs-small); font-weight: 500; color: var(--forest); }
.jd-cal-dl__status.is-error { color: #b3261e; }

@media (max-width: 1023px) {
  .jd-cal-dl__grid { grid-template-columns: minmax(0, 1fr); }
  .jd-cal-dl__visual { max-width: 340px; }
}
@media (max-width: 600px) {
  .jd-cal-dl__visual { max-width: 280px; }
  .jd-cal-dl__sheet { padding: 20px; }
  .jd-cal-dl__visual { aspect-ratio: 3 / 4; }
  .jd-cal-dl__rows li:nth-child(n+4) { display: none; }
  .jd-cal-dl__fields { grid-template-columns: minmax(0, 1fr); }
  .jd-cal-dl__foot .jd-btn { width: 100%; justify-content: space-between; }
}

/* =========================================================================
   Training a Team? (template-parts/calendar/team.php)
   White, centred; two halves split by a line; the footer's lime card overlaps the bottom.
   ========================================================================= */
.jd-cal-team { position: relative; overflow: clip; padding-block: clamp(72px, 8vw, 120px); background: var(--surface); color: var(--ink); }
.jd-cal-team > .jd-container { position: relative; z-index: 1; }
.jd-cal-team p { margin: 0; }
.jd-cal-team__copy { display: grid; justify-items: center; gap: var(--space-5); max-width: 760px; margin: 0 auto; text-align: center; }
.jd-cal-team__title { margin: 0; font-size: var(--fs-h2); font-weight: 500; line-height: 1.1; letter-spacing: -.02em; }
.jd-cal-team__title em { padding: 0 .06em; font-style: normal; color: var(--forest); background: linear-gradient(transparent 62%, var(--lime) 62% 92%, transparent 92%); }
.jd-cal-team__text { max-width: 54ch; font-size: var(--fs-lead); line-height: 1.5; color: var(--ink-muted); }
.jd-cal-team__split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: clamp(40px, 5vw, 64px) 0 0; padding: 0; list-style: none; border-block: 1px solid var(--line); }
.jd-cal-team__half { display: grid; justify-items: center; align-content: start; gap: var(--space-3); padding: clamp(32px, 4vw, 56px); text-align: center; }
.jd-cal-team__half + .jd-cal-team__half { border-left: 1px solid var(--line); }
.jd-cal-team__big { display: grid; place-items: center; min-width: 120px; height: 88px; padding: 0 20px; border-radius: 24px; background: var(--forest); color: var(--lime); font-size: var(--fs-h1); font-weight: 600; line-height: 1; }
.jd-cal-team__big--icon { background: var(--lime); color: var(--forest); }
.jd-cal-team__big svg { width: 44px; height: 44px; }
.jd-cal-team__half h3 { margin: var(--space-3) 0 0; font-size: var(--fs-h3); font-weight: 500; }
.jd-cal-team__half p { max-width: 40ch; font-size: var(--fs-body); line-height: 1.6; color: var(--ink-muted); }
.jd-cal-team__act { display: flex; justify-content: center; margin-top: clamp(32px, 4vw, 48px); }
@media (max-width: 767px) {
  .jd-cal-team__split { grid-template-columns: minmax(0, 1fr); }
  .jd-cal-team__half + .jd-cal-team__half { border-left: 0; border-top: 1px solid var(--line); }
}
