/* ------------------------------------------------------------------------
   Component: Hero
   ------------------------------------------------------------------------ */

.hero {
  position: relative;
  padding-block: var(--space-4) var(--space-6);
  padding-inline: var(--space-4);
  overflow-x: hidden;
}

.hero + * {
  margin-block-start: calc(-1 * var(--space-2));
}

.hero__inner {
  display: grid;
  flex: 1;
  gap: var(--space-6, 1.5rem);
  align-items: flex-end;
  padding-block: var(--space-8, 2rem);
  padding-inline: var(--space-8);
}

/* Content */

.hero__content {
  max-width: 42rem;
  text-align: center;
}

.hero__title {
  margin: 0 0 var(--space-3, 0.75rem);
  line-height: 1.1;
  text-shadow: var(--hero-title-shadow);
  color: var(--hero-title-color);
  font-weight: 700;
}

.hero__lead,
.hero__summary {
  margin: 0 0 var(--space-3, 0.75rem);
  line-height: var(--leading-normal);
  text-shadow: var(--hero-text-shadow);
}

.hero__lead {
  color: var(--hero-accent);
  font-size: var(--text-xl);
  font-weight: 600;
}

.hero__summary {
  margin-bottom: var(--space-5, 1.25rem);
  font-size: var(--text-md);
  display: none;
  color: var(--hero-summary-color);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3, 0.75rem);
  align-items: center;
  justify-content: center;
  margin-top: var(--space-3);
}

/* Links */

.hero__link--primary {
  position: relative;
  /* required if you’re using ::after for effects */
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 40px;
  padding-inline: var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  border-radius: var(--radius-button);
  background-color: var(--hero-link-primary-bg);
  color: var(--hero-link-primary-color);
  text-decoration: none;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  font-size: var(--text-lg);
  box-shadow: var(--shadow-md);
}

/* Remove empty rule */
.hero__link--primary:hover {
  background-color: var(--hero-link-primary-hover-bg);
  color: var(--hero-link-primary-hover-color);
}

.hero__link--primary:focus {
  outline: 2px solid var(--link);
}

/* If this was intended as a stretched-link, it should be on the card/slide wrapper
   rather than the link itself. Leaving disabled to avoid unexpected behaviour. */
/*
.hero__link--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
*/

/* Media */

.hero__media {
  border-radius: var(--radius-hero);
  overflow: hidden;
  min-height: 14rem;
  /* ensures the image has presence on mobile */
}

.hero__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* ------------------------------------------------------------------------
   Splide integration
   ------------------------------------------------------------------------ */

.splide {
  width: 100%;
}

.splide__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Prevent “jumping” when slides have different content heights */
.hero--carousel .splide__slide {
  height: auto;
}

/* Track overflow (needed if you have shadows/overhang) */
.hero--carousel .splide__track {
  overflow: visible;
}

/* Slide card */

.hero--carousel .hero__slide {
  width: 100%;
  display: flex;
  min-height: 24rem;
  max-height: calc(100vh - 16rem);
  aspect-ratio: 2 / 3;

  border: var(--border-1);
  border-radius: var(--radius-hero);
  overflow: hidden;

  background-color: var(--hero-slide-bg);
  box-shadow: var(--shadow-lg);

  outline: 2px solid transparent;
  transition:
    box-shadow var(--dur-3) var(--ease-standard),
    outline-color var(--dur-3) var(--ease-standard);
}

.hero--carousel .is-visible .hero__slide:hover {
  outline-color: var(--link);
  box-shadow: 0 12px 12px color-mix(in srgb, var(--link-hover) 50%, transparent);
}

/* Arrow buttons */

.hero .splide__arrows {
  position: absolute;
  top: 50%;
  left: var(--space-2);
  right: var(--space-2);
  justify-content: space-between;
  transform: translateY(-50%);
  z-index: 1;
}

.hero .splide__arrow {
  box-shadow: var(--shadow-sm);
  background-color: var(--surface-2);
  transition: all var(--dur-3) var(--ease-standard);
}

.hero .splide__arrow:hover {
  background-color: var(--surface);
}

/* Pagination */

.hero .splide__pagination {
  position: absolute;
  bottom: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
}

.splide__pagination__page {
  color: var(--surface);
}

/* ------------------------------------------------------------------------
   Overlay variant (mobile)
   ------------------------------------------------------------------------ */

.hero--overlay .hero__inner {
  position: relative;
  padding-block: var(--space-10, 2.5rem);
}

.hero--overlay .hero__media {
  position: absolute;
  inset: 0;
  min-height: 100%;
  border-radius: var(--radius-hero);
}

.hero--overlay .hero__image {
  height: calc(100% - var(--space-12));
}

/* Overlay gradient for readability (bottom blend 4rem up) */
.hero--overlay .hero__inner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  height: calc(100% - var(--space-12));
  background: linear-gradient(
    to bottom,
    var(--hero-overlay-bottom-from) 40%,
    var(--hero-overlay-bottom-to) 100%
  );
}

.hero--overlay .hero__content {
  position: relative;
  z-index: 2;
  color: var(--surface);
  max-width: var(--container-max);
}

.splide__arrow:disabled {
  display: none;
}

/* ------------------------------------------------------------------------
   Breakpoints (mobile first → up)
   ------------------------------------------------------------------------ */
/* ≥ 20rem (320px) */
@media (min-width: 20rem) {
  .hero__summary {
    font-size: var(--text-md);
    display: unset;
  }
}

/* ≥ 30rem (480px) */
@media (min-width: 30rem) {
  .hero--carousel .hero__slide {
    aspect-ratio: 2 / 3;
  }
}

/* ≥ 40rem (640px) */
@media (min-width: 40rem) {
  .hero--carousel .hero__slide {
    aspect-ratio: 3 / 2;
  }

  .hero .splide__arrows {
    left: var(--space-4);
    right: var(--space-4);
  }
}

/* ≥ 48rem (768px) */
@media (min-width: 48rem) {
  .hero {
    padding-inline: var(--space-8);
  }

  /* Gradient overlay for carousel edges */
  .hero--carousel::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;

    background: linear-gradient(
      to right,
      color-mix(in srgb, var(--surface-1) 90%, transparent) 0,
      color-mix(in srgb, var(--surface-1) 60%, transparent) 1.25rem,
      color-mix(in srgb, var(--surface-1) 0%, transparent) 1.5rem,
      color-mix(in srgb, var(--surface-1) 0%, transparent) calc(100% - 1.5rem),
      color-mix(in srgb, var(--surface-1) 60%, transparent) calc(100% - 1.25rem),
      color-mix(in srgb, var(--surface-1) 90%, transparent) 100%
    );
  }
}

/* ≥ 64rem (1024px) */
@media (min-width: 64rem) {
  .hero .splide__arrows {
    left: -1.5rem;
    right: -1.5rem;
  }

  .hero .splide__arrow {
    background-color: transparent;
    box-shadow: none;
    color: var(--text);
  }

  .hero:hover .splide__arrow {
    background-color: transparent;
  }

  .hero__inner {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: center;
    gap: var(--space-8, 2rem);
    padding-block: var(--space-12, 3rem);
    padding-inline: 3rem;
  }

  .hero__media {
    min-height: 24rem;
  }

  .hero__content {
    max-width: 48rem;
    text-align: left;
  }

  .hero__summary {
    font-size: var(--text-lg);
  }

  .hero__actions {
    justify-content: flex-start;
  }

  .hero--carousel .hero__slide {
    max-height: calc(100vh - 24rem);
    aspect-ratio: 21 / 9;
    min-height: 28rem;
  }

  /* Overlay variant: revert to non-overlay layout */
  .hero--overlay .hero__inner {
    position: static;
  }

  .hero--overlay .hero__image {
    height: 100%;
    border-radius: var(--radius-hero);
  }

  .hero--overlay .hero__inner::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    height: 100%;
    border-radius: var(--radius-hero);

    /* left-to-right readability gradient */
    background: linear-gradient(
      to left,
      var(--hero-overlay-side-from) 30%,
      var(--hero-overlay-side-mid) 60%,
      var(--hero-overlay-side-to) 100%
    );
  }
}

/* ≥ 80rem (1280px) */
@media (min-width: 80rem) {
  .hero__carousel {
    max-width: 1376px;
    margin-inline: auto;
  }

  .hero__inner {
    gap: var(--space-10, 2.5rem);
  }

  .hero__title {
    font-size: 3rem;
  }

  .hero__lead {
    font-size: var(--text-2xl);
  }

  .hero__summary {
    font-size: var(--text-xl);
  }

  .hero__link--primary {
    height: 56px;
    font-size: var(--text-xl);
    font-weight: 700;
  }

  .hero__image {
    transform: scale(1);
    transition: all 1s cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  .hero:hover .hero__image {
    transform: scale(1.05);
  }

  .hero__media {
    min-height: 28rem;
  }

  /* Edge gradient adjusted to centered 1376px carousel */
}

/* ≥ 96rem (1536x) */
@media (min-width: 96rem) {
  .hero__title {
    font-size: 3.25rem;
  }

  .hero__lead {
    font-size: var(--text-2xl);
  }

  .hero__summary {
    font-size: var(--text-xl);
  }

  .hero--carousel::before {
    background: linear-gradient(
      to right,
      color-mix(in srgb, var(--surface-1) 99%, transparent) 0,
      color-mix(in srgb, var(--surface-1) 90%, transparent)
        calc((100vw - 1376px - 2rem) / 2),
      color-mix(in srgb, var(--surface-1) 0%, transparent)
        calc((100vw - 1376px) / 2),
      color-mix(in srgb, var(--surface-1) 0%, transparent)
        calc(1376px + ((100vw - 1376px) / 2)),
      color-mix(in srgb, var(--surface-1) 90%, transparent)
        calc(1376px + ((100vw - 1376px + 2rem) / 2)),
      color-mix(in srgb, var(--surface-1) 99%, transparent) 100%
    );
  }

  .hero .splide__arrows {
    left: -2.5rem;
    right: -2.5rem;
  }
}
