/* Decks are enabled only after ScrollTrigger is available. */
@media (prefers-reduced-motion: no-preference) {
  .auto-photo-gallery.is-card-deck {
    width: 100%;
    max-width: 550px;
    justify-self: center;
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck] {
    display: block;
    width: 100%;
    height: clamp(370px, 62vh, 570px);
    min-height: 0;
    padding: 0;
    overflow: clip;
    isolation: isolate;
    scroll-snap-type: none;
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck] > .photo-card,
  .scroll-photo-stack[data-auto-gallery][data-card-deck] > .visual-card {
    position: absolute;
    inset: 24px 30px 38px 18px;
    width: auto;
    height: auto;
    max-width: none;
    margin: 0;
    padding: 12px;
    border-radius: 28px;
    background: #f0fbff;
    box-shadow: 0 20px 28px rgba(8, 92, 150, .19);
    transform-origin: 50% 88%;
    transform: translate3d(var(--deck-x, 0px), var(--deck-y, 0px), 0)
      rotate(var(--deck-rotation, 0deg)) scale(var(--deck-scale, 1)) !important;
    opacity: var(--deck-opacity, 1) !important;
    z-index: var(--deck-z, 1);
    transition: none;
    --deck-opacity: 0;
    --deck-scale: .96;
    --deck-y: 450px;
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck] > figure:first-child {
    --deck-opacity: 1;
    --deck-scale: 1;
    --deck-y: 0px;
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck]::before,
  .scroll-photo-stack[data-auto-gallery][data-card-deck]::after {
    content: "";
    position: absolute;
    inset: 24px 30px 38px 18px;
    border: 1px solid rgba(25, 185, 230, .25);
    border-radius: 28px;
    background: #e8f8fc;
    transform: translate(10px, 14px) rotate(2deg) scale(.98);
    z-index: 0;
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck]::before {
    transform: translate(15px, 22px) rotate(-2deg) scale(.96);
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck] > .photo-card img,
  .scroll-photo-stack[data-auto-gallery][data-card-deck] > .visual-card img {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 16px;
    object-fit: cover;
  }

  .is-card-deck .auto-gallery-controls {
    padding: 0 20px;
    min-height: 32px;
  }

  .auto-photo-gallery.is-card-deck .auto-gallery-controls button {
    display: none;
  }

  .card-deck-count {
    color: var(--azul-profundo);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    letter-spacing: .06em;
    white-space: nowrap;
  }
}

@media (min-width: 861px) and (prefers-reduced-motion: no-preference) {
  .section[data-card-deck-section] {
    min-height: calc(100svh - var(--deck-header, 90px));
    display: grid;
    align-items: center;
    padding: 32px 0;
  }

  [data-card-deck-section] .split-grid > [data-animate] h2 {
    font-size: clamp(2rem, 3.6vw, 3.4rem);
    line-height: 1.12;
  }
}

@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .section[data-card-deck-section] {
    overflow: visible;
  }

  [data-card-deck-section] .split-grid {
    align-items: start;
  }

  .auto-photo-gallery.is-card-deck {
    align-self: start;
    touch-action: pan-y pinch-zoom;
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck] {
    height: min(120vw, calc(100svh - var(--deck-header, 80px) - 80px), 570px);
    touch-action: pan-y pinch-zoom;
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck] > .photo-card,
  .scroll-photo-stack[data-auto-gallery][data-card-deck] > .visual-card,
  .scroll-photo-stack[data-auto-gallery][data-card-deck]::before,
  .scroll-photo-stack[data-auto-gallery][data-card-deck]::after {
    inset: 10px 22px 34px 2px;
    border-radius: 24px;
  }

  .scroll-photo-stack[data-auto-gallery][data-card-deck] > .photo-card,
  .scroll-photo-stack[data-auto-gallery][data-card-deck] > .visual-card {
    padding: 9px;
  }

  .is-card-deck .auto-gallery-controls {
    padding: 0 4px;
    gap: 8px;
    font-size: .75rem;
  }
}
