/* Keep the three story cards aligned with the site's editorial columns at any
   window width. The old 1920px section cap and viewport-based padding fought
   each other above 1920px, squeezing the cards on very wide displays. */
body[data-page="home"] .story-preview.section-pad {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
  align-items: stretch;
}
body[data-page="home"] .story-preview.section-pad > .story-preview-card {
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
}
@media (max-width: 760px) {
  body[data-page="home"] .story-preview.section-pad {
    gap: 16px;
  }
}
@media (max-width: 580px) {
  body[data-page="home"] .story-preview.section-pad {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
}

/* Gallery cards rise from below, a touch closer to the viewer, and settle at
   their normal size. Existing per-card intersection tracking remembers each
   revealed item, including after a filter rebuild. */
@media (prefers-reduced-motion: no-preference) {
  .js-motion body[data-page="gallery"] .gallery-grid .video-card.reveal {
    opacity: 0;
    transform: translate3d(0, 52px, 0) scale(1.035);
    transform-origin: center bottom;
    transition-property: opacity, transform, box-shadow !important;
    transition-duration: .68s, .82s, .3s !important;
    transition-timing-function: ease, cubic-bezier(.16,.75,.25,1), ease !important;
  }
  .js-motion body[data-page="gallery"] .gallery-grid .video-card.reveal:is(.visible, :focus-within) {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}
@media (max-width: 580px) and (prefers-reduced-motion: no-preference) {
  .js-motion body[data-page="gallery"] .gallery-grid .video-card.reveal {
    transform: translate3d(0, 38px, 0) scale(1.025);
  }
  .js-motion body[data-page="gallery"] .gallery-grid .video-card.reveal:is(.visible, :focus-within) {
    transform: translate3d(0, 0, 0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .js-motion body[data-page="gallery"] .gallery-grid .video-card.reveal {
    opacity: 1;
    transform: none;
    transition: none !important;
  }
}
