/* ==========================================================================
   Top sections: hero, stats strip, groups, booking dialog.
   ========================================================================== */

/* ---------- Hero ---------- */

.hero__inner {
  display: grid;
  gap: var(--space-7);
  align-items: center;
  padding-block: var(--space-6) var(--space-8);
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-h1);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.01em;
}

.hero__title-accent {
  display: block;
  color: var(--color-accent);
  font-style: italic;
}

.hero__lead {
  max-width: 33rem;
  margin-top: var(--space-5);
  color: var(--color-muted);
  font-size: var(--text-lg);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  margin-top: var(--space-6);
}

.hero__media {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin-inline: auto;
}

.hero__img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 50% 50% var(--radius-md) var(--radius-md) / 40% 40% var(--radius-md)
    var(--radius-md);
  background: var(--color-band);
}

.hero__badge {
  position: absolute;
  bottom: var(--space-6);
  left: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-card);
  box-shadow: var(--shadow-float);
}

.hero__badge-number {
  color: var(--color-accent);
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1;
}

.hero__badge-text {
  color: var(--color-muted);
  font-size: var(--text-sm);
}

@media (min-width: 960px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: var(--space-8);
    padding-block: var(--space-7) var(--space-8);
  }

  .hero__media {
    margin-inline: auto 0;
  }

  .hero__badge {
    left: calc(-1 * var(--space-5));
  }
}

/* ---------- Stats strip ---------- */

.stats {
  border-block: 1px solid var(--color-line);
}

.stats__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
  padding-block: var(--space-6);
  list-style: none;
}

.stats__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stats__value {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 1.9rem + 1.2vw, 2.75rem);
  line-height: 1;
}

.stats__label {
  color: var(--color-muted);
  font-size: 0.9375rem;
  line-height: 1.4;
}

@media (min-width: 768px) {
  .stats__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ---------- Groups ---------- */

.groups .section__intro {
  margin-bottom: var(--space-7);
}

.groups__grid {
  display: grid;
  gap: var(--space-5);
}

.course-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6) var(--space-5);
  border-radius: var(--radius-lg);
  background: var(--color-card);
}

.course-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.course-card__title {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.1;
}

.course-card__price {
  color: var(--color-accent);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.course-card__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-left: 1.25rem;
  color: var(--color-muted);
}

.course-card__list li::marker {
  color: var(--color-accent);
}

.course-card__seats {
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.course-card__button {
  margin-top: auto;
}

.groups__noscript {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-band);
}

@media (min-width: 768px) {
  .groups__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .course-card {
    padding: var(--space-7) 2.5rem;
  }
}

/* ---------- Booking dialog ---------- */

html:has(dialog[open]) {
  overflow: hidden;
  scrollbar-gutter: stable;
}

.booking-dialog {
  width: min(100% - 2 * var(--gutter), 30rem);
  max-height: calc(100dvh - 2 * var(--gutter));
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--color-card);
  color: var(--color-text);
  box-shadow: var(--shadow-float);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.booking-dialog::backdrop {
  background: rgb(30 26 23 / 0.55);
}

.booking-dialog__panel {
  --panel-pad-y: var(--space-5);
  --panel-pad-x: var(--space-5);
  --close-inset: var(--space-2);
  --close-size: 44px;

  position: relative;
  overscroll-behavior: contain;
  padding: var(--close-inset) var(--panel-pad-x) var(--panel-pad-y);
}

/* The dialog itself scrolls; the close button's form sticks to the top-right of its scrollport.
   The negative bottom margin lets the title share the button's row instead of starting below it. */
.booking-dialog__close-form {
  position: sticky;
  top: var(--close-inset);
  z-index: 1;
  width: var(--close-size);
  margin: 0 calc(var(--close-inset) - var(--panel-pad-x)) calc(-1 * var(--close-size)) auto;
}

.booking-dialog__close {
  display: grid;
  place-items: center;
  width: var(--close-size);
  height: var(--close-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-card);
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}

.booking-dialog__close:hover {
  background: var(--color-band);
}

.booking-dialog__title {
  margin-top: calc(var(--panel-pad-y) - var(--close-inset));
  margin-bottom: var(--space-4);
  padding-right: var(--space-7);
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 600;
  line-height: 1.1;
}

.booking-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.booking-form__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.booking-form__label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.booking-form__contacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  margin: var(--space-2) 0 0;
  padding: 0;
  border: 0;
}

/* Helper line above the contact fields. Floating takes the legend out of the fieldset's
   border slot, so it becomes an ordinary flex item and the inputs align with the name input. */
.booking-form__legend {
  float: left;
  width: 100%;
  margin-bottom: var(--space-1);
  padding: 0;
  color: var(--color-muted);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.45;
}

/* "At least one contact" error is the fieldset's direct child: accent the helper line. */
.booking-form__contacts:has(> .booking-form__error:not([hidden])) > .booking-form__legend {
  color: var(--color-accent);
  font-weight: 500;
}

.booking-form__input {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-line);
  border-radius: var(--radius-sm);
  background: var(--color-card);
}

.booking-form__input:focus-visible {
  border-color: var(--color-accent);
  outline-offset: 1px;
}

.booking-form__input[aria-invalid='true'] {
  border-color: var(--color-accent);
}

.booking-form__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.booking-form__captcha:empty {
  display: none;
}

.booking-form__consent {
  color: var(--color-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.booking-form__status:empty {
  display: none;
}

.booking-form__status {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-band);
  font-weight: 500;
}

.booking-form__status--success {
  padding: var(--space-5) var(--space-4);
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.booking-form__status--error {
  border-left: 3px solid var(--color-accent);
}

.booking-form__status--error a {
  color: var(--color-accent);
  font-weight: 600;
}

.booking-form__status:focus {
  outline: none;
}

.booking-form__error {
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 500;
}

/* JS hides fields after a successful submit; beat display rules of the elements */
.booking-form [hidden] {
  display: none;
}

.booking-form[aria-busy='true'] .booking-form__submit {
  cursor: progress;
  opacity: 0.7;
}

@media (min-width: 768px) {
  .booking-dialog__panel {
    --panel-pad-y: var(--space-6);
    --panel-pad-x: 2.5rem;
    --close-inset: var(--space-3);
  }
}
