{# ========================================
   Scroll Swap Module Styles
   ======================================== #}

{# ========================================
   Desktop/Tablet Layout
   ======================================== #}
:root {
  {# x px from top of viewport where the media "freezes" #}
  --stick-top: 20vh;
  {# if you have a fixed footer or want a bottom cushion, set this #}
  --stick-bottom: 0px;
}

.scroll-swap-row {
  margin-left: 0;
  margin-right: 0;
}

.scroll-swap-container {
  display: flex;
  position: relative;
  gap: 30px;
  width: 100%;
  min-height: 100%;
}


{# Text content on left, media on right by default #}
.scroll-swap-text-side {
  flex: 0 0 50%;
  position: relative;
  z-index: 2;
  margin-top: 100px;
  margin-bottom: 50px;
}

.scroll-swap-media-side {
  flex: 0 0 50%;
  position: relative;
  overflow: visible;
  min-height: 100%;
}

{# Swap sides when text content is on right #}
.scroll-swap-container.swap-sides {
  flex-direction: row-reverse;
}


{# ========================================
   Text Sections
   ======================================== #}

.scroll-swap-text-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: start;
  scroll-margin-top: var(--stick-top);
}

.scroll-swap-text-section:first-child {
  padding-top: 0;
}

.scroll-swap-text-section:last-child {
  min-height: 50vh;
}

{# Apply spacing from fields using inline styles via HubL - handled in HTML #}

{# ========================================
   Media Container
   ======================================== #}

.scroll-swap-media-container {
  position: sticky;
  top: var(--stick-top);
  max-height: calc(100vh - var(--stick-top) - var(--stick-bottom));
  align-self: flex-start;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.scroll-swap-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.scroll-swap-background,
.scroll-swap-foreground {
  display: none;
}

.scroll-swap-background.is-active {
  display: block;
}

.scroll-swap-foreground.is-active {
  display: flex;
}


.scroll-swap-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
}

.scroll-swap-background.active {
  opacity: 1;
}

.scroll-swap-bg-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.scroll-swap-foreground {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-swap-foreground.active {
  opacity: 1;
}

.scroll-swap-fg-image,
.scroll-swap-fg-video {
  width: 100%;
  height: 100%;
  max-height: unset;
  object-fit: cover;
  display: block;
}

{# ========================================
   Mobile Layout
   ======================================== #}

.scroll-swap-mobile {
  display: none;
}

{# ========================================
   Responsive - Mobile
   ======================================== #}

@media (max-width: 576px) {
  {# Hide desktop layout #}
  .scroll-swap-container {
    display: none;
  }

  {# Show mobile layout #}
  .scroll-swap-mobile {
    display: block;
  }

  .scroll-swap-mobile-section {
    margin-bottom: 40px;
  }

  .scroll-swap-mobile-section:last-child {
    margin-bottom: 0;
  }

  .scroll-swap-mobile-text {
    margin-bottom: 30px;
  }

  .scroll-swap-mobile-media {
    width: 100%;
  }

  .scroll-swap-mobile-image,
  .scroll-swap-mobile-video {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
  }

  .scroll-swap-mobile-video {
    max-height: 60vh;
    object-fit: contain;
  }
}

{# ========================================
   Tablet Adjustments
   ======================================== #}

@media (min-width: 769px) and (max-width: 1024px) {
  .scroll-swap-text-side {
    padding-right: 1.5rem;
  }

  .scroll-swap-container.swap-sides .scroll-swap-text-side {
    padding-right: 0;
    padding-left: 1.5rem;
  }

  .scroll-swap-fg-image,
  .scroll-swap-fg-video {
    max-height: unset;
  }
}

{# ========================================
   Accessibility
   ======================================== #}

.scroll-swap-fg-video:focus,
.scroll-swap-mobile-video:focus {
  outline: 2px solid #007bff;
  outline-offset: 4px;
}

