/* Horizontal carousel */
@layer components {
  .carousel {
    background: var(--color-primary-dark);
    color: white;
    position: relative;
    isolation: isolate;
  }

  .carousel__track {
    display: grid;
    grid-auto-columns: 100%;
    grid-auto-flow: column;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .carousel__slide {
    display: grid;
    min-height: min(82vh, 49rem);
    overflow: hidden;
    position: relative;
    scroll-snap-align: start;
  }

  .carousel__image,
  .carousel__overlay {
    grid-area: 1 / 1;
  }

  .carousel__image {
    height: 100%;
    object-fit: cover;
    width: 100%;
  }

  .carousel__overlay {
    align-content: center;
    background: linear-gradient(90deg, rgb(15 28 19 / 94%) 0%, rgb(15 28 19 / 64%) 48%, rgb(15 28 19 / 8%) 76%);
    display: grid;
    padding-block: var(--space-8);
    width: 100%;
  }

  .carousel__content {
    --stack-space: var(--space-5);
    color: white;
    border-inline-start: 3px solid var(--color-secondary);
    max-width: 47rem;
    padding-inline-start: clamp(1.25rem, 3vw, 2.5rem);
  }

  .carousel__content h1,
  .carousel__content h2 {
    color: white;
  }

  .carousel__content h1,
  .carousel__content h2 {
    font-size: clamp(2.4rem, 8vw, 5rem);
  }

  .carousel__content p {
    font-size: clamp(1.05rem, 2vw, 1.3rem);
  }

  .carousel__content > p:first-child {
    color: var(--color-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
  }

  .carousel__nav {
    bottom: var(--space-5);
    display: flex;
    gap: var(--space-2);
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    z-index: 2;
  }

  .carousel__dot {
    background: white;
    border: 0;
    border-radius: 0;
    height: 0.25rem;
    opacity: 0.75;
    width: 2.4rem;
  }

  .carousel__dot:hover,
  .carousel__dot:focus-visible {
    background: var(--color-accent);
    opacity: 1;
  }

  @media (max-width: 42rem) {
    .carousel__slide {
      min-height: 42rem;
    }

    .carousel__image {
      object-position: 66% center;
    }

    .carousel__overlay {
      align-content: end;
      background: linear-gradient(0deg, rgb(20 42 28 / 94%) 20%, rgb(20 42 28 / 30%));
      padding-block: var(--space-7) var(--space-8);
    }

    .carousel__content {
      max-width: 32rem;
    }

    .carousel__content h1,
    .carousel__content h2 {
      font-size: clamp(2.35rem, 13vw, 4rem);
    }

    .carousel__content .cluster {
      align-items: stretch;
      flex-direction: column;
    }
  }

}
