/* Scope is set by loading this file only on the main display pages. */
@layer gbc-page-heading {
  :root {
    --gbc-subtitle-gap: clamp(1rem, calc(.75rem + 1vw), 1.5rem);
  }

  h1 {
    font-size: clamp(1.75rem, min(calc(1.25rem + 2.5vw), 8.2vw), 3.5rem) !important;
    line-height: 1.12 !important;
    letter-spacing: -.05em !important;
  }

  h1:has(+ p), .v3-about-title > h1 {
    margin-block-end: 0 !important;
  }

  h1 + p, .v3-about-intro > p.lede {
    font-size: clamp(1rem, calc(.9rem + .35vw), 1.125rem) !important;
    line-height: 1.6 !important;
  }

  h1 + p, .v3-about-intro {
    margin-block-start: calc(var(--gbc-subtitle-gap) - var(--gbc-existing-hero-gap, 0px)) !important;
  }

  .v3-about-intro > p.lede {
    margin-block-start: 0 !important;
  }

  /* These layouts already contribute a row gap between the title and subtitle. */
  .top2 > h1 + p.mt-sub {
    --gbc-existing-hero-gap: 20px;
  }

  @media (max-width: 1050px) {
    .top2 > h1 + p.mt-sub { --gbc-existing-hero-gap: 15px; }
  }

  @media (max-width: 680px) {
    .top2 > h1 + p.mt-sub { --gbc-existing-hero-gap: 12px; }
  }

  @media (max-width: 660px) {
    :is(.v3-swing, .v3-tc2000) .rd-product-hero h1 + p { --gbc-existing-hero-gap: 14px; }
  }

  @media (max-width: 380px) and (max-height: 760px) {
    .v3-tc2000 .rd-product-hero h1 + p { --gbc-existing-hero-gap: 10px; }
  }

  :root {
    --gbc-section-space: clamp(3rem, calc(2rem + 4.2vw), 5.5rem);
    --gbc-section-half: calc(var(--gbc-section-space) / 2);
    --gbc-section-title: clamp(1.375rem, calc(1rem + 1.55vw), 2.25rem);
    --gbc-section-subtitle: clamp(1.375rem, calc(1rem + 1.3vw), 1.75rem);
  }

  main > :is(#software, #ricerca, #latest-radar, #metodo, #corsi, #domande, #contatti) h2,
  .v3-about-section .v3-about-heading h2,
  .mentorship-faq h2,
  .v2-shop > .shop-other-products > .ix,
  .v2-shop > #mentorship .top2 h2,
  .v2-shop > #mentorship + section:not(.mentorship-faq) > .ix,
  .v2-shop-faq > div:first-child > .ix,
  .v3-membership-activation h2,
  .rd-product-details :is(.v3-swing-syllabus, .sec) h2,
  .compact-gallery-heading h2,
  .rd-signup-card h2,
  .cases > .case .sh1 h2,
  .hero .outline h2 {
    font-size: var(--gbc-section-title) !important;
    line-height: 1.2 !important;
    letter-spacing: -.035em !important;
  }

  .rd-signup-card h2, .cases > .case .sh1 h2, .hero .outline h2 {
    font-size: var(--gbc-section-subtitle) !important;
  }

  /* Keep dividers and existing layout boundaries, sharing the gap across their padding. */
  main:has(> .rd-hero) {
    --gbc-home-stats-end: 34px;
    --gbc-home-feature-end: 30px;
    --gbc-home-standard-end: 64px;
    --gbc-home-radar-end: 64px;
  }

  main > .rd-stats:has(+ #software) {
    padding-block-end: min(var(--gbc-home-stats-end), var(--gbc-section-half)) !important;
  }

  main > #software {
    padding-block-start: calc(var(--gbc-section-space) - min(var(--gbc-home-stats-end), var(--gbc-section-half))) !important;
  }

  main > :is(#ricerca, #domande, #contatti) {
    padding-block-start: calc(var(--gbc-section-space) - min(var(--gbc-home-feature-end), var(--gbc-section-half))) !important;
  }

  main > :is(#latest-radar, #corsi) {
    padding-block-start: calc(var(--gbc-section-space) - min(var(--gbc-home-standard-end), var(--gbc-section-half))) !important;
  }

  main > :is(#ricerca, #metodo) {
    padding-block-end: min(var(--gbc-home-standard-end), var(--gbc-section-half)) !important;
  }

  main > #latest-radar {
    padding-block-end: min(var(--gbc-home-radar-end), var(--gbc-section-half)) !important;
  }

  main > #metodo {
    padding-block-start: calc(var(--gbc-section-space) - min(var(--gbc-home-radar-end), var(--gbc-section-half))) !important;
  }

  .v3-about-section, .v3-membership-activation {
    padding-block-start: var(--gbc-section-space) !important;
  }

  .mentorship-page > .gbc-mentorship-v6:has(+ .mentorship-faq),
  .cases > .case:not(:last-child) {
    padding-block-end: var(--gbc-section-half) !important;
  }

  .mentorship-faq, .cases > .case + .case {
    padding-block-start: var(--gbc-section-half) !important;
  }

  .v2-shop:has(> .shop-compact-offers) {
    --gbc-shop-card-end: 0px;
    --gbc-shop-ticket-end: var(--gbc-section-half);
  }

  .v2-shop > .shop-other-products,
  .v2-shop > .shop-other-products + #mentorship,
  .v2-shop > .shop-compact-hero ~ .v2-shop-faq {
    padding-block-start: calc(var(--gbc-section-space) - var(--gbc-shop-card-end)) !important;
  }

  .v2-shop > .shop-other-products + #mentorship {
    padding-block-end: var(--gbc-shop-ticket-end) !important;
  }

  .v2-shop > .shop-other-products + #mentorship + section {
    padding-block-start: calc(var(--gbc-section-space) - var(--gbc-shop-ticket-end)) !important;
  }

  main:has(> .rd-product-hero + .rd-product-details) {
    --gbc-product-hero-end: 50px;
  }

  main:is(.v3-swing, .v3-session):has(> .rd-product-hero + .rd-product-details) {
    --gbc-product-hero-end: 28px;
  }

  .rd-product-hero:has(+ .rd-product-details) {
    padding-block-end: min(var(--gbc-product-hero-end), var(--gbc-section-half)) !important;
  }

  .rd-product-hero + .rd-product-details {
    padding-block-start: calc(var(--gbc-section-space) - min(var(--gbc-product-hero-end), var(--gbc-section-half))) !important;
  }

  main:has(> .compact-hero + .compact-gallery) { --gbc-course-hero-end: 54px; }

  .compact-hero:has(+ .compact-gallery) {
    padding-block-end: min(var(--gbc-course-hero-end), var(--gbc-section-half)) !important;
  }

  .compact-hero + .compact-gallery {
    padding-block-start: calc(var(--gbc-section-space) - min(var(--gbc-course-hero-end), var(--gbc-section-half))) !important;
  }

  .rd-archive-top:has(+ section), .rd-archive-top + section {
    --gbc-archive-half: calc(clamp(1.5rem, calc(1rem + 1.5vw), 2rem) / 2);
  }

  .rd-archive-top:has(+ section) { padding-block-end: var(--gbc-archive-half) !important; }
  .rd-archive-top + section { padding-block-start: var(--gbc-archive-half) !important; }

  @media (max-width: 760px) {
    main:has(> .rd-hero) {
      --gbc-home-feature-end: 10px;
      --gbc-home-standard-end: 24px;
      --gbc-home-radar-end: 20px;
    }

    .v2-shop:has(> .shop-compact-offers) {
      --gbc-shop-card-end: 10px;
      --gbc-shop-ticket-end: 10px;
    }

    main:has(> .rd-product-hero + .rd-product-details) { --gbc-product-hero-end: 20px; }
    main:has(> .compact-hero + .compact-gallery) { --gbc-course-hero-end: 26px; }
  }
}

@media (max-width: 350px) {
  .shop-compact-hero h1 {
    inline-size: calc(100% + 24px);
    max-inline-size: none;
  }
}

@media (min-width: 761px) {
  .nl-hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .nl-hero {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  }
}
