/* Event single page (/event/{id}) — header, two-column split, detail cards,
   booking panel, OpenStreetMap embed and long-form content blocks. Shared
   labels (.card-label / .event-meta-badge) live in cards.css. */

.event-page .container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* --- Header: title + utility actions (title band = .page-title, layout.css) ---
   The container is a flex column with its own gap, which would stack on the
   band's margin-bottom; take the gap off so title-to-content spacing matches
   every other internal page (--space-md-lg-d). */
.event-page .internal-header {
  margin-bottom: calc(var(--space-md-lg-d) - var(--space-md));
}

/* Status pill for cancelled / past occurrences (the single-event API still
   serves them — booking is disabled in the template). On its own line under
   the title / "Hosted by", inside .page-title__text: --space-sm above (the
   column's own gap is --space-xs). Cancelled is purple; past a muted grey. */
.event-status {
  align-self: flex-start;
  margin-top: calc(var(--space-sm) - var(--space-xs));
  padding: 0.25em 0.7em;
  border-radius: var(--br-rounded);
  font-size: var(--font-sm);
  font-weight: 700;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: var(--label-letter-spacing);
}

.event-status--cancelled {
  background: var(--secondary-color);
  color: var(--white);
}

.event-status--past {
  background: var(--grey-10);
  color: var(--grey-70);
}

/* Notice shown in the aside in place of the booking panel. */
.event-notice {
  color: var(--grey-70);
}

.event-head__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Ghost icon buttons (add to calendar / share). */
.event-action {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  color: var(--grey-50);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease), background var(--duration-fast) var(--ease);
}

.event-action:hover {
  color: var(--primary-color);
}

.event-action svg {
  width: 2rem;
  height: 2rem;
  fill: currentColor;
}

/* Brief "Copied" confirmation after the share fallback copies the link. */
.event-share.is-copied::after {
  content: "Link copied";
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  white-space: nowrap;
  padding: 0.2rem 0.5rem;
  border-radius: var(--br-sm);
  background: var(--grey-100);
  color: var(--white);
  font-size: var(--font-sm);
}

/* --- Layout: aside (narrow) + main (wide) ------------------------------- */

.event-layout {
  display: grid;
  gap: var(--space-md-lg-d);
  align-items: start;
}

@media (min-width: 62rem) {
  .event-layout {
    grid-template-columns: var(--grid-narrow) var(--grid-wide);
  }
}

.event-aside,
.event-main {
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  min-width: 0;
  /* Override the sitewide `aside { width: 33% }` rule (layout.css) — here the
     grid track already sizes the column. */
  width: 100%;
}

/* Mobile: flatten both wrappers into the single-column grid so cards can be
   ordered across them (mirrors the group single's display:contents approach).
   Everything keeps DOM order (aside cards, then Notes, description, agenda and
   Hosted by) except the banner, which is pulled up directly beneath the header,
   as on the group single. */
@media (max-width: 61.99rem) {
  .event-aside,
  .event-main {
    display: contents;
  }

  .event-layout {
    gap: var(--card-gap);
  }

  .event-banner-card {
    order: -1;
  }
}

/* --- Banner (event image → group banner → default), mirrors .group-banner-card */

.event-banner-card {
  padding: 0;
  overflow: hidden;
}

.event-banner-card img {
  display: block;
  width: 100%;
  height: auto;
}

/* --- Booking panel (pink-bordered) -------------------------------------- */

.event-book {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-md);
  border: 2px solid var(--primary-color);
  border-radius: var(--br-md);
  background: var(--primary-10);
}

/* Reuses .card-label; only the weight + colour differ (pink, in the pink
   panel). Icon styling comes from the shared glyph block below. */
.event-book__label {
  font-weight: 700;
  color: var(--primary-on-tint);
}

.event-price {
  display: flex;
  align-items: center;
  gap: var(--row-gap);
  margin: 0;
}

.event-aside .cta-button.booking-modal-trigger{
  margin-top: var(--space-sm);
}

/* --- Sticky mobile booking bar ------------------------------------------ */
/* The shared .sticky-bar component (elements.css, sticky-bar.js) — it slides
   up on mobile once the .event-book panel scrolls out of view. Only its price
   line is event-specific. */
.event-booking-bar__price {
  display: flex;
  align-items: center;
  gap: var(--row-gap);
  margin: 0;
  color: var(--white);
  font-size: var(--h4-h5-fs);
}

.event-booking-bar__price strong {
  color: var(--white);
}

/* --- Detail + host cards ------------------------------------------------- */

/* The fact rows themselves are the shared .icon-row component (elements.css).
   The booking-panel price rows are the other glyph spot that shares its size +
   brand colour (the sticky bar's icon lives with .sticky-bar). */
.event-price__icon {
  display: inline-flex;
  flex-shrink: 0;
}

.event-price__icon svg {
  width: var(--row-icon-size);
  height: var(--row-icon-size);
  fill: var(--primary-color);
}

/* --- Map embed ---------------------------------------------------------- */

.event-map {
  margin-top: var(--space-sm);
}

.event-map__canvas {
  width: 100%;
  height: 190px;
  border-radius: var(--br-md);
  overflow: hidden;
  /* Keep the map (and Leaflet's panes) beneath the sticky header. */
  z-index: 0;
}

/* Brand-coloured Leaflet pin (mirrors the venues map marker). */
.event-map__marker {
  background: none;
  border: 0;
}

.event-map__pin {
  display: block;
  filter: var(--pin-shadow);
}

.event-map__pin path {
  fill: var(--primary-color);
}

/* --- Long-form content blocks (notes / description / agenda) ------------ */

.event-block {
  padding: var(--space-md);
}

/* Notes: pink dashed outline rather than a solid card. */
.event-block--notes {
  border: var(--border-width-sm) dashed var(--primary-color);
  border-radius: var(--br-md);
  background: transparent;
}

/* Reuse .rich-text media/list rules without its centred max-width. */
.event-block .rich-text {
  width: 100%;
  margin: 0;
}

.event-block .rich-text > :first-child {
  margin-top: 0;
}

.event-block .rich-text > :last-child {
  margin-bottom: 0;
}

/* --- Booking modal -------------------------------------------------------
   Event-only booking dialog (template-event.php), opened from .event-book /
   .event-booking-bar above. Layout is a flex column: fixed header + step
   progress, a scrolling body holding one .booking-step at a time, and a sticky
   footer bar carrying the price and the Back / Continue / Pay buttons. The
   <dialog> keeps overflow hidden so only the body scrolls. Leans on the form
   primitives in forms.css.

   The wizard is progressive enhancement (booking-modal.js): without JS every
   .booking-step is on screen at once and the footer is just price + submit, so
   the progress bar and the nav buttons start out [hidden] here.
*/

.booking-modal {
  width: min(100% - 2rem, 38rem);
  /* dvh, not vh: mobile Safari's 100vh assumes a collapsed URL bar, so a vh-only
     cap can push the footer bar (which now carries Back / Continue / Pay) below
     the visible viewport. vh first as the fallback for anything without dvh. */
  max-height: calc(100vh - 4rem);
  max-height: calc(100dvh - 4rem);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--br-lg);
  background: var(--white);
  color: var(--text-color);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
}

.booking-modal::backdrop {
  background: var(--overlay);
}

.booking-modal-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 4rem);
  max-height: calc(100dvh - 4rem);
  min-height: 0;
}

/* Header — brand badge + event name + close, divided from the body. */
.booking-modal-head {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
  padding: var(--space-md);
  border-bottom: 1px solid var(--grey-10);
}

.booking-modal-head__badge {
  flex-shrink: 0;
  display: inline-flex;
  font-size: 1.75rem;
  /* Disc colour for the .icon-rev treatment. */
  color: var(--primary-color);
}

/* .icon-rev disc badge, 1.6em of its own font-size (the title band's disc
   is a fixed --page-title-icon-size instead). */
.booking-modal-head__badge svg {
  width: 1.6em;
  height: 1.6em;
}

.booking-modal-title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.booking-modal-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text-color);
  cursor: pointer;
}

.booking-modal-close:hover {
  background: var(--grey-10);
}

.booking-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  max-width: none;
}

.booking-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-md);
}

/* --- Step progress -------------------------------------------------------
   Numbered stepper + a thin fill bar, sitting between the modal header and the
   scrolling body. Revealed by booking-modal.js, which also renumbers the steps
   (members skip "About you") and marks done / current.
*/
.booking-progress {
  flex-shrink: 0;
  padding: var(--space-sm) var(--space-md) 0;
}

.booking-progress__count {
  margin: 0 0 var(--space-sm);
  font-size: var(--font-sm);
  text-transform: uppercase;
  letter-spacing: var(--label-letter-spacing);
  color: var(--secondary-color);
}

.booking-progress__steps {
  display: flex;
  gap: var(--space-sm);
  margin: 0 0 var(--space-sm);
  padding: 0;
  list-style: none;
}

.booking-progress__step {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
  margin-top: 0;
}

/* Skipped steps drop out of the stepper entirely — the flex display above would
   otherwise beat the UA [hidden] rule. */
.booking-progress__step[hidden] {
  display: none;
}

/* Completed steps are clickable to go back; current + upcoming are disabled, so
   the cursor and colour do the explaining. */
.booking-progress__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-sm);
  text-align: center;
  color: var(--grey-60);
  cursor: pointer;
}

.booking-progress__link:disabled {
  cursor: default;
}

.booking-progress__num {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--grey-30);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--grey-60);
  transition: background-color var(--duration-fast) var(--ease), border-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

/* The link is a centred column, so the label sizes to its content and would
   otherwise spill out of its equal-width track — clamp it before the ellipsis
   can do its job. */
.booking-progress__label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-progress__step.is-done .booking-progress__link,
.booking-progress__step.is-current .booking-progress__link {
  color: var(--text-color);
}

.booking-progress__step.is-current .booking-progress__label {
  font-weight: 700;
}

.booking-progress__step.is-current .booking-progress__num,
.booking-progress__step.is-done .booking-progress__num {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: var(--white);
}

.booking-progress__step.is-done .booking-progress__num {
  background: var(--primary-30);
  border-color: var(--primary-30);
  color: var(--primary-color);
}

.booking-progress__bar {
  height: 3px;
  border-radius: var(--br-rounded);
  background: var(--grey-10);
  overflow: hidden;
}

.booking-progress__fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--primary-color);
  transition: width var(--duration) var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  .booking-progress__fill {
    transition: none;
  }
}

/* Narrow screens: the labels don't fit alongside four numbers, so lean on the
   "Step 2 of 4" line and show numbers only. */
@media (max-width: 32rem) {
  .booking-progress__label {
    display: none;
  }

  .booking-progress__steps {
    gap: 0.35rem;
  }

  .booking-progress__step {
    flex: 0 0 auto;
  }

  /* Numbers-only, so pad the hit area out towards a thumb-sized target — the
     circle itself is only 24px. */
  .booking-progress__link {
    padding: 0.4rem;
  }
}

/* --- Steps ---------------------------------------------------------------- */

/* One step at a time once the wizard is running; all of them stacked without JS. */
.booking-step[hidden] {
  display: none;
}

/* Child selectors so these beat the `.booking-step > *` rhythm rule further
   down the file (same specificity would otherwise let the later rule win). */
.booking-step > .booking-step__title {
  margin: 0 0 var(--space-sm);
  font-size: var(--h4-h5-fs);
  line-height: var(--h4-h5-lh);
}

/* The title takes focus on each step change (tabindex="-1"), so suppress the
   focus ring that would otherwise flash on a heading nobody clicked. */
.booking-step__title:focus {
  outline: none;
}

.booking-step__title:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.booking-step > .booking-step__hint {
  margin: 0 0 var(--space-md);
  font-size: var(--font-sm);
  color: var(--grey-70);
}

/* --- Step 1: membership choice -------------------------------------------
   Two radio cards rather than a checkbox: the answer branches the rest of the
   form, so it reads as a question with two answers, not an opt-in.
*/
.booking-choices {
  display: grid;
  gap: var(--space-sm);
}

.booking-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin: 0;
  padding: var(--space-md);
  border: 1px solid var(--grey-20);
  border-radius: var(--br-md);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease), background-color var(--duration-fast) var(--ease);
}

.booking-choice:hover {
  border-color: var(--primary-color);
}

.booking-choice input[type="radio"] {
  flex: 0 0 auto;
  margin-top: 0.2rem;
}

.booking-choice:has(input:checked) {
  border-color: var(--primary-color);
  background: var(--primary-10);
}

.booking-choice:has(input:focus-visible) {
  box-shadow: 0 0 0 2px var(--primary-30);
}

.booking-choice__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.booking-choice__title {
  font-weight: 700;
}

.booking-choice__note {
  font-size: var(--font-sm);
  color: var(--grey-70);
}

body.has-modal-open {
  overflow: hidden;
}

.booking-form .form-field {
  margin-bottom: var(--space-sm);
}

.booking-form .form-grid .form-field {
  margin-bottom: 0;
}

.booking-reveal [data-reveal-field] > label {
  margin-top: var(--space-sm);
}

/* Vertical rhythm lives on the step: each top-level block inside it (contact
   grid, About you grid, dietary, review, discount code, consent) is evenly
   spaced and the last carries none — so a collapsed block leaves no gap and the
   consent box never bunches up against the field above it. */
.booking-step > * {
  margin-bottom: var(--space-md);
}

.booking-step > *:last-child {
  margin-bottom: 0;
}

/* Dietary requirements and accessibility notes each nest a checkbox + textarea
   inside a .booking-reveal at the foot of the "About you" step. As plain wrappers
   they would otherwise pick up the step's section rhythm (--space-md); match the
   checkbox rows (--space-sm) instead. Zero the inner rows' own margins and space
   the textarea off the checkbox only when it's shown. */
.booking-reveal {
  margin-bottom: var(--space-sm);
}

.booking-reveal > .form-field {
  margin-bottom: 0;
}

.booking-reveal [data-reveal-field] {
  margin-top: var(--space-sm);
}

/* Hive email hint appended to the Email label on the member path. */
.booking-member-hint {
  font-weight: 400;
  font-size: var(--font-sm);
  color: var(--grey-70);
}

/* Field layout (.form-grid / .form-field--full / --checkbox) lives in forms.css,
   shared with other forms. Booking-specific spacing stays here: on narrow
   screens the stacked grid's fields take the booking step's --space-md rhythm. */
@media (max-width: 32rem) {
  .booking-form .form-grid .form-field {
    margin-bottom: var(--space-md);
  }
}

/* --- Review summary (pay step) -------------------------------------------
   What they're booking (static, from the template) followed by what they've
   entered (built by booking-modal.js when the step opens).
*/
.booking-review {
  padding: var(--space-md);
  border: 1px solid var(--grey-20);
  border-radius: var(--br-md);
  background: var(--secondary-10);
}

.booking-review__event {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Own margin, not just margin-bottom — otherwise the global `li + li` rule
   (typography.css) drops a --space-md between the rows. */
.booking-review__event li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin: 0 0 var(--space-sm);
  font-weight: 700;
  line-height: 1.35;
}

.booking-review__icon {
  flex: 0 0 auto;
  display: inline-flex;
}

.booking-review__icon svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: var(--primary-color);
}

.booking-review__list {
  margin: 0;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--grey-20);
  font-size: var(--font-sm);
}

/* Empty without JS (the fields are all on screen anyway) — drop the divider. */
.booking-review__list:empty {
  padding-top: 0;
  border-top: 0;
}

.booking-review__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-sm);
  padding: 0.3rem 0;
}

.booking-review__row dt {
  flex: 0 0 7rem;
  color: var(--grey-80);
}

.booking-review__row dd {
  flex: 1 1 10rem;
  display: flex;
  gap: var(--space-sm);
  justify-content: space-between;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.booking-review__edit {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
}

/* Discount code — text input + Apply button on one row, feedback line below. */
.booking-promo__row {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
}

.booking-promo__row input {
  flex: 1 1 auto;
  text-transform: uppercase;
}

.booking-promo__apply {
  flex: 0 0 auto;
  padding: 0 var(--space-md);
  border: 1px solid var(--primary-color);
  border-radius: var(--br-sm);
  background: var(--white);
  color: var(--primary-color);
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease), color var(--duration-fast) var(--ease);
}

.booking-promo__apply:hover {
  background: var(--primary-color);
  color: var(--white);
}

.booking-promo__apply:disabled {
  opacity: 0.6;
  cursor: default;
}

.booking-promo__feedback {
  margin: var(--space-sm) 0 0;
  font-size: var(--font-sm);
}

.booking-promo__feedback.is-ok {
  color: var(--success-color);
}

.booking-promo__feedback.is-error {
  color: var(--error-color);
}

/* Struck original price shown alongside the discounted figure in the footer. */
.booking-foot__was {
  margin-right: 0.35rem;
  color: var(--grey-60);
  font-weight: 400;
  text-decoration: line-through;
}

/* Footer price bar — pink, sticky at the base of the modal. The active rate sits
   on the left, the single Pay-with-Stripe CTA on the right. */
.booking-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  flex-shrink: 0;
  padding: var(--space-md);
  background: var(--primary-10);
}

.booking-foot__prices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem var(--space-md);
  min-width: 0;
}

.booking-foot__price {
  display: inline-flex;
  align-items: center;
  gap: var(--row-gap);
  margin: 0;
  font-size: 1.1rem;
}

.booking-foot__price strong {
  font-weight: 700;
}

/* The price rows set an explicit display, which would otherwise beat the
   [hidden] attribute the member toggle uses to swap visitor/member price. */
.booking-foot__prices [hidden] {
  display: none;
}

.booking-foot__icon {
  display: inline-flex;
}

.booking-foot__icon svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: var(--primary-color);
}

/* --- Footer navigation ---------------------------------------------------- */

.booking-foot__nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-left: auto;
}

/* Both CTAs set an explicit display, which would beat the [hidden] attribute
   booking-modal.js uses to swap Continue for Pay on the last step. */
.booking-foot__nav [hidden] {
  display: none;
}

.booking-back {
  padding: 0.5rem 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-color);
  text-decoration: underline;
  cursor: pointer;
}

.booking-back:hover {
  color: var(--primary-color);
}

/* Disabled states come from .cta-button:disabled (buttons.css). */
.booking-foot__cta,
.booking-next {
  margin: 0;
  align-self: center;
}

/* Narrow screens: price on its own line, nav full width beneath it with the
   primary action always on the right. */
@media (max-width: 32rem) {
  .booking-foot__nav {
    width: 100%;
  }

  .booking-next,
  .booking-foot__cta {
    margin-left: auto;
  }
}
