/*
 * First section on a page: clear the overlapping header.
 *
 * WCAG 1.4.4 (Resize Text): the header is out of flow (position:absolute in
 * overlap mode) and grows when text is enlarged and the nav wraps. The top
 * padding is therefore header height + a fixed gap, where the header height
 * is measured by HeaderInteractive and published as --gmpf-header-height.
 *
 * Gaps reproduce the old spacing at normal text size:
 *   mobile  : 4rem + 5.5rem = 9.5rem   -> 6.25rem header + 3.25rem gap
 *   desktop : 6rem + 6rem   = 12rem    -> 6.25rem header + 5.75rem gap
 * The 6.25rem fallback is the normal one-row header, used before the script
 * runs.
 */
 
.gmpf-page-main
  .dnd-section:not(.dnd-section ~ .dnd-section)
  :is(
    [data-testid='gmpf-text-media-cta'],
    [data-testid='gmpf-content-bullets'],
    [data-testid='gmpf-card-stack'],
    [data-testid='gmpf-hero'],
    [data-testid='change-password']
  ):not(.dnd-row:not(:first-child) *) {
  padding-block: calc(var(--gmpf-header-height, 6.25rem) + 3.25rem)
    var(--section-padding-y);
}

@media (min-width: 48em) {
  .gmpf-page-main
    .dnd-section:not(.dnd-section ~ .dnd-section)
    :is(
      [data-testid='gmpf-text-media-cta'],
      [data-testid='gmpf-content-bullets'],
      [data-testid='gmpf-card-stack'],
      [data-testid='gmpf-hero'],
      [data-testid='change-password']
    ):not(.dnd-row:not(:first-child) *) {
    padding-block: calc(var(--gmpf-header-height, 6.25rem) + 5.75rem)
      var(--section-padding-y);
  }
}

/*
 * First-section CardStack sidebars with brand-gradient sit under the
 * overlap header's rounded primary row. Paint the hero clearance band
 * with the page surface so purple does not bleed behind the nav
 * corners; keep the gradient on the card column only.
 */
.gmpf-page-main
  .dnd-section:not(.dnd-section ~ .dnd-section)
  [data-testid='gmpf-card-stack'][data-section-bg='brand-gradient'] {
  position: relative;
  isolation: isolate;
  /* Match TextMediaCta brand-gradient-fade in the hero band. */
  background:
    linear-gradient(243.79deg, rgba(238, 238, 238, 0) 9.25%, #eeeeee 41.84%),
    linear-gradient(185.43deg, rgba(255, 255, 255, 0) 78.59%, #ffffff 93.49%),
    linear-gradient(0deg, var(--color-surface-soft-panel), var(--color-surface-soft-panel));
}

.gmpf-page-main
  .dnd-section:not(.dnd-section ~ .dnd-section)
  [data-testid='gmpf-card-stack'][data-section-bg='brand-gradient']::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  inset-block-start: calc(var(--space-3xl) + 5.5rem);
  inset-block-end: 0;
  background: var(--gradient-brand-diagonal);
  z-index: 0;
  pointer-events: none;
}

@media (min-width: 768px) {
  .gmpf-page-main
    .dnd-section:not(.dnd-section ~ .dnd-section)
    [data-testid='gmpf-card-stack'][data-section-bg='brand-gradient']::before {
    inset-block-start: calc(var(--space-4xl) + 6rem);
  }
}

.gmpf-page-main
  .dnd-section:not(.dnd-section ~ .dnd-section)
  [data-testid='gmpf-card-stack'][data-section-bg='brand-gradient']
  > .gmpf-container {
  position: relative;
  z-index: 1;
}

/*
 * Side-by-side promotional download rows (posters, graphics, etc.).
 * Kentico served previews at 460–500px inside centred two-column rows.
 */
.gmpf-page-main .dnd-section:is(.gmpf-poster-pair, .gmpf-promo-graphics-pair) {
  --gmpf-promo-image-max: 28.75rem;
  box-sizing: border-box;
  max-width: var(--container-default);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.gmpf-page-main .dnd-section.gmpf-poster-pair {
  --gmpf-promo-image-max: 31.25rem;
}

@media (min-width: 768px) {
  .gmpf-page-main .dnd-section:is(.gmpf-poster-pair, .gmpf-promo-graphics-pair) {
    padding-inline: var(--space-2xl);
  }
}

.gmpf-page-main .dnd-section:is(.gmpf-poster-pair, .gmpf-promo-graphics-pair) .dnd-column {
  padding-inline: var(--space-sm);
}

@media (min-width: 768px) {
  .gmpf-page-main .dnd-section:is(.gmpf-poster-pair, .gmpf-promo-graphics-pair) .dnd-column {
    padding-inline: var(--space-md);
  }
}

.gmpf-page-main
  .dnd-section:is(.gmpf-poster-pair, .gmpf-promo-graphics-pair)
  [data-testid='gmpf-image-inner'] {
  max-width: var(--gmpf-promo-image-max);
}

.gmpf-page-main
  .dnd-section:is(.gmpf-poster-pair, .gmpf-promo-graphics-pair)
  [data-testid='gmpf-image-link'] {
  max-width: var(--gmpf-promo-image-max);
  margin-inline: auto;
  box-shadow: var(--shadow-md);
}

.gmpf-page-main
  .dnd-section.gmpf-promo-graphics-pair
  [data-testid='gmpf-image-caption'] {
  text-align: center;
  font-size: var(--font-size-sm);
}

/* Inline leaflet previews embedded in Text + Media + CTA body copy */
.gmpf-page-main [data-testid='gmpf-tmc-body'] :global(img) {
  display: block;
  width: 100%;
  max-width: 34rem;
  height: auto;
  margin-inline: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
