/* Media + Text Block Base Styles */
.image-text {
  display: flex;
  inline-size: 100%;
  min-block-size: 20rem;
  padding-block: 4rem;
  padding-inline: 2rem;
}

.image-text__container {
  inline-size: 100%;
  margin-inline: auto;
}

.image-text__header {
  text-align: center;
}

/* Content alignment */
.image-text.text-left .image-text__header {
  text-align: start;
}

.image-text.text-left .image-text__section-description {
  margin-inline: 0;
}

.image-text.text-left .image-text__content {
  text-align: start;
}

.image-text.text-left .image-text__cta-wrapper {
  justify-content: flex-start;
}

.image-text.text-center .image-text__header {
  text-align: center;
}

.image-text.text-center .image-text__content {
  text-align: center;
}

.image-text.text-center .image-text__cta-wrapper {
  justify-content: center;
}

.image-text__pretitle {
  color: var(--body-color, #212529);
  display: inline-block;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-block: 0;
}

.image-text__section-title {
  font-size: var(--h2-font-size, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
  padding-block-start: 1rem;
}

.image-text__section-title:first-child {
  padding-block-start: 0;
}

.image-text__section-description {
  font-size: var(--p-font-size, 1rem);
  line-height: 1.6;
  margin-inline: auto;
  max-inline-size: 60rem; /* 960px */
  padding-block-start: 1.5rem;
}

.image-text__section-description:first-child {
  padding-block-start: 0;
}

/* Rows container needs padding from header */
.image-text__rows {
  padding-block-start: 3rem;
}

.image-text__rows:first-child {
  padding-block-start: 0;
}

.image-text__row {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-block-start: 4rem;
}

.image-text__row:first-child {
  padding-block-start: 0;
}

.image-text__content {
  inline-size: 100%;
}

.image-text__content--center {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.image-text__headline {
  font-size: var(--h3-font-size, 1.5rem);
  font-weight: 700;
  line-height: 1.2;
}

.image-text__wysiwyg {
  line-height: 1.6;
  padding-block-start: 1rem;
}

.image-text__wysiwyg:first-child {
  padding-block-start: 0;
}

.image-text__wysiwyg p {
  padding-block-start: 1rem;
}

.image-text__wysiwyg p:first-child {
  padding-block-start: 0;
}

.image-text__title {
  line-height: 1.2;
}

.image-text__description {
  font-size: calc(var(--p-font-size, 1rem) + 0.2rem);
  line-height: 1.6;
  padding-block-start: 1.5rem;
}

.image-text__description:first-child {
  padding-block-start: 0;
}

.image-text__description p {
  font-size: inherit;
}

.image-text__cta-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-block-start: 2rem;
}

.image-text__media {
  inline-size: 100%;
}

.image-text__image {
  block-size: auto;
  display: block;
  height: auto;
  max-inline-size: 100%;
  object-fit: cover;
}

/* Presentation 1 - Text Left, Image Right */
.image-text.presentation1 {
}

.image-text.presentation1 .image-text__container {
  max-inline-size: 81.25rem;
}

.image-text.presentation1 .image-text__row {
  display: grid;
  gap: 4rem;
  grid-template-columns: 1fr var(--media-width, 50%);
}

/* Swap: media first, text second */
.image-text.presentation1 .image-text__row--swap {
  grid-template-columns: var(--media-width, 50%) 1fr;
}

/* No title/description: remove pointless top padding on first row */
.image-text.no-header .image-text__row:first-child {
  padding-block-start: 0 !important;
}

.image-text.presentation1 .image-text__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.image-text.presentation1 .image-text__title {
  color: #1E2F50;
  font-size: var(--h2-font-size, 2.5rem);
  font-weight: 700;
}

.image-text.presentation1 .image-text__description {
  color: #7A7A7A;
  font-size: var(--p-font-size, 1rem);
  padding-block-start: 1.5rem;
}

.image-text.presentation1 .image-text__cta {
  animation: slideDown 0.8s ease-out forwards;
  animation-delay: 0.6s;
  inline-size: fit-content;
  opacity: 0;
  transform: translateY(-2rem);
}

.image-text.presentation1 .image-text__cta:hover {
  transform: translateY(-2px);
}

.image-text.presentation1 .image-text__media {
  inline-size: 100%;
}

/* Presentation 1 - Full Width Media variant */
.image-text.presentation1.full-width-media {
  padding-inline: 0;
}

.image-text.presentation1.full-width-media .image-text__container {
  max-inline-size: none;
}

.image-text.presentation1.full-width-media .image-text__header {
  margin-inline: auto;
  max-inline-size: 81.25rem;
  padding-inline: 2rem;
}

.image-text.presentation1.full-width-media .image-text__row {
  gap: 0;
  grid-template-columns: 1fr var(--media-width, 50%);
}

.image-text.presentation1.full-width-media .image-text__row--swap {
  grid-template-columns: var(--media-width, 50%) 1fr;
}

/* All rows except the first one: no top padding (no gap between rows) */
.image-text.presentation1.full-width-media .image-text__row:not(:first-child) {
  padding-block-start: 0;
}

/* First row keeps top padding: when there is a header, the row right after it (higher specificity than :not(:first-child)) */
.image-text.presentation1.full-width-media .image-text__container .image-text__header + .image-text__row {
  padding-block-start: 4rem;
}

/* When there is no header, the first child of container is a row – keep its top padding */
.image-text.presentation1.full-width-media .image-text__container > .image-text__row:first-child {
  padding-block-start: 4rem;
}

.image-text.presentation1.full-width-media .image-text__media {
  block-size: 100%;
  inline-size: 100%;
  min-block-size: 25rem;
}

.image-text.presentation1.full-width-media .image-text__media img,
.image-text.presentation1.full-width-media .image-text__media video {
  block-size: 100%;
  inline-size: 100%;
  object-fit: cover;
}

.image-text.presentation1.full-width-media .image-text__media .image-text__media-poster-image {
  object-fit: contain;
}

.image-text.presentation1.full-width-media .image-text__content {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
  text-align: center;
}

.image-text.presentation1.full-width-media.text-left .image-text__content {
  align-items: flex-start;
  text-align: start;
}

.image-text.presentation1.full-width-media.text-center .image-text__content {
  align-items: center;
  text-align: center;
}

.image-text.presentation1.full-width-media .image-text__content-inner {
  max-inline-size: 35rem;
}

@media (max-width: 48rem) {
  .image-text.presentation1.full-width-media .image-text__row {
    grid-template-columns: 1fr;
  }

  .image-text.presentation1.full-width-media .image-text__media {
    min-block-size: 15rem;
  }

  .image-text.presentation1.full-width-media .image-text__content {
    padding: 2rem 1.5rem;
  }

  .image-text.presentation1.full-width-media .image-text__media {
    order: -1;
  }

  .image-text__media-poster-image {
    object-fit: cover;
  }

  .image-text.presentation1.full-width-media .image-text__media .image-text__media-poster-image {
    object-fit: cover;
  }

}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Styles */
@media (max-width: 64rem) {
  .image-text {
    padding-block: 3rem;
    padding-inline: 1.5rem;
  }

  .image-text.presentation1 .image-text__row,
  .image-text.presentation1 .image-text__row--swap {
    gap: 2rem;
    grid-template-columns: 1fr;
  }

  .image-text.presentation1 .image-text__media {
    order: -1;
  }

  .image-text.presentation1 .image-text__content {
    text-align: center;
  }

  .image-text.presentation1.text-left .image-text__content {
    text-align: start;
  }

  .image-text.presentation1 .image-text__cta {
    margin-inline: auto;
  }

  .image-text.presentation1.text-left .image-text__cta {
    margin-inline: 0;
  }

  .image-text.presentation1 .image-text__title {
    font-size: var(--h2-font-size, 2rem);
    text-align: center;
  }

  .image-text.presentation1.text-left .image-text__title {
    text-align: start;
  }

  .image-text__section-description {
    padding-inline: 1rem;
  }
}

/* Presentation 2 - Sticky scroll (Stripe-style) */
.image-text.presentation2 {
  overflow: clip;
}

.image-text.presentation2 .image-text__container {
  max-inline-size: 81.25rem;
}

.image-text__layout--sticky {
  display: grid;
  gap: 4rem;
  grid-template-columns: 1fr 1fr;
  /* align-items: stretch (default) - важно за sticky да работи! */
  padding-block-start: 3rem;
}

.image-text__layout--sticky:first-child {
  padding-block-start: 0;
}

.image-text__rows-list {
  display: flex;
  flex-direction: column;
  gap: 6rem;
  padding-block-end: 6rem;
  padding-block-start: 6rem;
}

.image-text__row--sticky {
  opacity: 0.3;
  transition: opacity 0.6s ease;
}

.image-text__row--sticky.is-active {
  opacity: 1;
}

.image-text.presentation2 .image-text__headline {
  font-size: var(--h3-font-size, 1.75rem);
  font-weight: 700;
}

.image-text.presentation2 .image-text__wysiwyg {
  padding-block-start: 1rem;
}

.image-text.presentation2 .image-text__cta {
  inline-size: fit-content;
}

/* Media column stretches to full height of the grid row */
.image-text__media-column {
  /* No position relative needed - let it stretch naturally */
}

/* Sticky container - stays fixed while scrolling through rows */
.image-text__media-sticky {
  inset-block-start: 4rem;
  position: sticky;
}

/* First media item sets the container dimensions */
.image-text__media-item:first-child {
  opacity: 1;
  pointer-events: auto;
  position: relative;
  transition: opacity 0.6s ease;
}

/* All other media items are absolutely positioned */
.image-text__media-item:not(:first-child) {
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 0.6s ease;
}

/* When another item becomes active, fade out first item */
.image-text__media-item:first-child:not(.is-active) {
  opacity: 0;
}

/* Active item styling */
.image-text__media-item.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile-only media (hidden on desktop, shown per row on mobile) */
.image-text__row-media-mobile {
  display: none;
}

/* Media within the items */
.image-text__media-item .image-text__media {
  block-size: 100%;
  inline-size: 100%;
}

.image-text__media-item .image-text__image {
  aspect-ratio: 4 / 3;
  border-radius: 0.75rem;
  display: block;
  inline-size: 100%;
  object-fit: cover;
}

@media (max-width: 64rem) {
  .image-text__layout--sticky {
    gap: 2rem;
    grid-template-columns: 1fr;
  }

  .image-text__media-column {
    display: none;
  }

  .image-text__rows-list {
    gap: 3rem;
    padding-block: 0;
  }

  .image-text__row--sticky {
    opacity: 1;
    padding-block-start: 0;
  }

  .image-text__row--sticky .image-text__content {
    order: -1;
  }

  .image-text__row-media-mobile {
    display: block;
  }

  .image-text__row-media-mobile .image-text__image {
    aspect-ratio: 4 / 3;
    border-radius: 0.75rem;
    display: block;
    inline-size: 100%;
    object-fit: cover;
  }
}

/* Video Styles */
.image-text__media--video {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  position: relative;
}

.image-text__video {
  block-size: 100%;
  inline-size: 100%;
  object-fit: cover;
}

.image-text__video-embed {
  block-size: 100%;
  inline-size: 100%;
}

.image-text__video-embed iframe {
  block-size: 100%;
  inline-size: 100%;
}

.image-text__media-poster {
  block-size: 100%;
  cursor: pointer;
  inline-size: 100%;
  position: relative;
}

.image-text__media-poster-image {
  block-size: 100%;
  display: block;
  inline-size: 100%;
  object-fit: contain;
}

.image-text__play-button {
  align-items: center;
  background-color: rgba(0, 0, 0, 0.6);
  block-size: 5rem;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  inline-size: 5rem;
  inset: 50%;
  justify-content: center;
  position: absolute;
  transform: translate(-50%, -50%);
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.image-text__play-button:hover {
  background-color: var(--primary-color, #4285F4);
  transform: translate(-50%, -50%) scale(1.1);
}

.image-text__play-button svg {
  block-size: 2rem;
  inline-size: 2rem;
}

/* Autoplay poster: always hidden (autoplay now works on all devices) */
.image-text__media-poster--mobile-only {
  display: none;
}

/* Video Modal Styles */
.image-text__video-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 9999;
}

.image-text__video-modal-overlay {
  background-color: rgba(0, 0, 0, 0.9);
  inset: 0;
  position: absolute;
}

.image-text__video-modal-content {
  inline-size: 90%;
  max-inline-size: 60rem;
  position: relative;
  z-index: 1;
}

.image-text__video-modal-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 2rem;
  inset-block-start: -2.5rem;
  inset-inline-end: 0;
  line-height: 1;
  padding: 0.5rem;
  position: absolute;
}

.image-text__video-modal-close:hover {
  color: var(--primary-color, #4285F4);
}

.image-text__video-modal-video {
  aspect-ratio: 16 / 9;
  background-color: #000;
}

.image-text__video-modal-video video,
.image-text__video-modal-video iframe {
  block-size: 100%;
  inline-size: 100%;
}

/* Rounded Borders Modifier */
.image-text.rounded-media .image-text__image,
.image-text.rounded-media .image-text__video,
.image-text.rounded-media .image-text__media--video {
  border-radius: 1rem;
  overflow: hidden;
}

.image-text.rounded-media .image-text__video-embed {
  border-radius: 1rem;
  overflow: hidden;
}

.image-text.rounded-media .image-text__video-embed iframe {
  border-radius: 1rem;
}

/* ============================================
   Mobile CTA stacking
   ============================================ */

@media (max-width: 48rem) {
  .image-text__cta-wrapper {
    inline-size: 100%;
  }

  .image-text.presentation1 .image-text__cta,
  .image-text.presentation2 .image-text__cta {
    inline-size: 85%;
    justify-content: center;
  }
}
