/* Hero: desktop layout and optional background video */
.amaxa-hero {
  background: var(--light);
}

.amaxa-hero .hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: var(--amaxa-hero-height-desktop, 510px);
  position: relative;
  isolation: isolate;
}

.amaxa-hero .hero-copy {
  position: relative;
  z-index: 2;
  max-width: 610px;
  padding: 72px 24px 72px 0;
}

.amaxa-hero .hero-copy h1 {
  margin: 22px 0;
  max-width: 610px;
}

.amaxa-hero .hero-description {
  max-width: 490px;
}

.amaxa-hero .hero-media {
  min-width: 0;
  align-self: stretch;
}

.amaxa-hero .hero-media__desktop {
  height: 100%;
  position: relative;
  overflow: hidden;
}

.amaxa-hero .hero-media__desktop img,
.amaxa-hero .hero-background-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.amaxa-hero .hero-background-video {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.amaxa-hero .hero-media__mobile {
  display: none;
}

.amaxa-hero--background {
  position: relative;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
}

.amaxa-hero--background .hero-inner {
  grid-template-columns: 1fr;
}

.amaxa-hero--background .hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.amaxa-hero--background::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    var(--light) 0%,
    #f3f7fcf2 35%,
    #f3f7fc00 80%
  );
}

.amaxa-hero--text .hero-inner {
  grid-template-columns: 1fr;
  min-height: var(--amaxa-hero-height-desktop, 300px);
}

/* Wider desktop headings, while the paragraph keeps its readable line length. */
@media (min-width: 769px) {
  .amaxa-hero .eyebrow {
    font-size: 16px;
    line-height: 22px;
    font-weight: 600;
  }

  .amaxa-hero .hero-copy h1 {
    font-size: 64px;
    line-height: 76px;
    font-weight: 600;
  }

  .amaxa-hero .hero-description {
    font-size: 20px;
    line-height: 30px;
    font-weight: 600;
  }

  .amaxa-hero--background .hero-copy,
  .amaxa-hero--text .hero-copy {
    width: 100%;
    max-width: 720px;
  }

  .amaxa-hero--background .hero-copy h1,
  .amaxa-hero--text .hero-copy h1 {
    max-width: none;
  }
}

/* Mobile: eyebrow -> heading -> description -> image, 32px gap */
@media (max-width: 768px) {
  .amaxa-hero--background {
    display: flex;
    flex-direction: column;
  }

  .amaxa-hero--background > .hero-media {
    order: 2;
  }

  .amaxa-hero .hero-inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
  }

  .amaxa-hero .hero-copy {
    padding: 40px 0 0;
    max-width: none;
  }

  .amaxa-hero .hero-copy h1 {
    font-size: clamp(32px, 9vw, 42px);
  }

  .amaxa-hero .hero-description {
    margin-bottom: 0;
  }

  .amaxa-hero .hero-media,
  .amaxa-hero--background .hero-media {
    position: static;
    z-index: auto;
    align-self: stretch;
    margin-top: 32px;
    padding-bottom: 32px;
  }

  .amaxa-hero .hero-media__desktop {
    display: none;
  }

  .amaxa-hero .hero-media__mobile {
    display: block;
    overflow: hidden;
    border-radius: 12px;
  }

  .amaxa-hero .hero-mobile-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 350 / 205;
    object-fit: cover;
  }

  .amaxa-hero--background::after {
    display: none;
  }
}

/* Mobile hero media extends edge-to-edge, without rounding or side gutters. */
@media (max-width: 768px) {
  .amaxa-hero .hero-media,
  .amaxa-hero--background .hero-media {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: 32px;
    padding-bottom: 0;
    border-radius: 0;
  }

  .amaxa-hero .hero-media__mobile,
  .amaxa-hero .hero-mobile-image {
    border-radius: 0;
  }

  .amaxa-hero .hero-mobile-image {
    width: 100%;
  }
}

/* A selected section color also tints the overlay above background media. */
.amaxa-hero--background[style*="--amaxa-section-bg:"]::after {
  background: linear-gradient(
    90deg,
    var(--amaxa-section-bg) 0%,
    color-mix(in srgb, var(--amaxa-section-bg) 95%, transparent) 35%,
    transparent 80%
  );
}

/* A single picture selects the correct device image before making a request. */
.hero-picture {
  display: block;
  height: 100%;
}
@media (max-width: 768px) {
  .amaxa-hero .hero-media__desktop {
    display: block;
    height: auto;
  }
  .amaxa-hero .hero-picture {
    height: auto;
  }
  .amaxa-hero .hero-responsive-image {
    height: auto;
  }
}

/* Keep the responsive image visible until the video has a decoded frame. */
.amaxa-hero .hero-background-video {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.amaxa-hero .hero-background-video.is-video-ready {
  opacity: 1;
}
.amaxa-hero .hero-background-video--mobile {
  display: none;
}
@media (max-width: 768px) {
  .amaxa-hero .hero-background-video:not(.hero-background-video--mobile) {
    display: none;
  }
  .amaxa-hero .hero-background-video--mobile {
    display: block;
  }
}
@media (prefers-reduced-motion: reduce) {
  .amaxa-hero .hero-background-video {
    display: none;
    transition: none;
  }
}

/* Mobile height applies to the whole section, including the image. */
@media (max-width: 768px) {
  .amaxa-hero {
    min-height: var(--amaxa-hero-height-mobile, auto);
  }

  .amaxa-hero--background > .hero-inner {
    flex-grow: 1;
    justify-content: center;
  }
}

/* Leave room for the transparent desktop header above the first Hero's copy. */
@media (min-width: 1024px) {
  .site-header--home + main > .amaxa-hero:first-child .hero-inner {
    padding-top: var(--amaxa-header-height);
  }
}
