// ============================================
// l-section (for reference / completeness)
// ============================================
// _l-section.scss

$section-spacing: (
  none: 0,
  xs: clamp(1.5rem, 4vw, 1.5rem),
  s: clamp(2rem, 4vw, 2.5rem),
  m: clamp(2.5rem, 5vw, 4rem),
  l: clamp(3.5rem, 6vw, 6rem),
  xl: clamp(4.5rem, 8vw, 7.5rem),
  xxl: clamp(6rem, 10vw, 9rem),
  accent: clamp(8rem, 12vw, 9rem),
) !default;

.l-section {
  padding-block: map-get($section-spacing, m);

  @each $name, $value in $section-spacing {
    &--#{$name} {
      padding-block: $value;
    }

    &--#{$name}-top {
      padding-block-start: $value;
    }

    &--#{$name}-bottom {
      padding-block-end: $value;
    }
  }

  &--flush-top {
    padding-block-start: 0;
  }
  &--flush-bottom {
    padding-block-end: 0;
  }

  @include media-breakpoint-down(xl) {
    &--xs {
      padding-block: map-get($section-spacing, s);
    }
    &--xs-top {
      padding-block-start: map-get($section-spacing, s);
    }
    &--xs-bottom {
      padding-block-end: map-get($section-spacing, s);
    }

    // &--s {
    //   padding-block: map-get($section-spacing, m);
    // }
    // &--s-top {
    //   padding-block-start: map-get($section-spacing, m);
    // }
    // &--s-bottom {
    //   padding-block-end: map-get($section-spacing, m);
    // }
  }

  & + &--connected {
    padding-block-start: 0;
  }
}

main > .l-section:last-child:not(.b-form) {
  padding-block-end: 0 !important;
}

// Optional top accent layer (enabled per content element via tx_hks_top_accent).
// The layer always starts at top: 0 of the block and scales with l-section top spacing.
.has-top-accent-blue {
  position: relative;
  isolation: isolate;
  --hks-top-accent-section-top: #{map-get($section-spacing, m)};
  --hks-top-accent-header-title-height: 3.5rem;
  --hks-top-accent-header-margin-bottom: 2.5rem;
  --hks-top-accent-body-offset: 80px;
  --hks-top-accent-height: calc(
    var(--hks-top-accent-section-top) +
      var(--hks-top-accent-header-title-height) +
      var(--hks-top-accent-header-margin-bottom) +
      var(--hks-top-accent-body-offset)
  );

  &::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--hks-top-accent-height);
    background-color: $primary;
    pointer-events: none;
    z-index: 0;
  }

  .c-block-header .section-title,
  .c-block-header .section-title a {
    color: $white;
  }

  > * {
    position: relative;
    z-index: 1;
  }

  @include media-breakpoint-up(md) {
    --hks-top-accent-header-title-height: 4.5rem;
    --hks-top-accent-header-margin-bottom: 2.5rem;
  }

  @each $name, $value in $section-spacing {
    &.l-section--#{$name},
    &.l-section--#{$name}-top {
      --hks-top-accent-section-top: #{$value};
    }
  }

  &.l-section--flush-top {
    --hks-top-accent-section-top: 0;
  }
}
