/* Horizontal scroll — position: sticky + CSS scroll-driven animations.
   The section is as tall as the track is wide; while it scrolls past, the
   track slides left by its own width minus one screen.
   Fallback (no support or reduced motion): a normal swipeable row with snap points. */

.hs {
  --panel: min(72vw, 560px);   /* panel width */
  --gap: 24px;
  --panels: 5;
  view-timeline: --hs block;
}

/* fallback first: a native horizontal scroller */
.hs__sticky {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  padding: 24px 0;
}
.hs__track {
  display: flex;
  gap: var(--gap);
  width: max-content;
  margin: 0;
  padding: 0 28px;
  list-style: none;
}
.hs__panel {
  width: var(--panel);
  scroll-snap-align: center;
}

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    /* vertical room = horizontal distance to travel + one screen to stay pinned */
    .hs { height: calc(var(--panels) * (var(--panel) + var(--gap)) - 100vw + 100svh + 56px); }

    .hs__sticky {
      position: sticky;
      top: 0;
      height: 100svh;
      display: grid;
      align-items: center;
      overflow: clip;
      padding: 0;
    }

    .hs__track {
      will-change: transform;
      animation: hs-slide linear both;
      animation-timeline: --hs;
      animation-range: contain 0% contain 100%;
    }

    /* each picture drifts a little against the track: depth for free */
    .hs__art {
      animation: hs-drift linear both;
      animation-timeline: --hs;
      animation-range: contain 0% contain 100%;
    }
  }
}

@keyframes hs-slide {
  to { transform: translateX(calc(-100% + 100vw)); }
}
@keyframes hs-drift {
  from { transform: scale(1.15) translateX(6%); }
  to   { transform: scale(1.15) translateX(-6%); }
}

/* Reduced motion: the fallback row above (swipe or scroll sideways, no pinning). */

/* demo layout */
.hs__panel h2 { margin: 16px 0 4px; font: 600 22px var(--font-display, system-ui, sans-serif); }
.hs__panel p { margin: 0; color: var(--muted, #9c9488); }
.hs__frame {
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  overflow: hidden;
}
.hs__art {
  display: block;
  height: 100%;
  background: radial-gradient(circle at 35% 40%, var(--a) 0 22%, transparent 23%), linear-gradient(150deg, var(--b), #0f0e0c);
}
.hs-intro, .hs-outro { min-height: 80svh; display: grid; align-content: center; padding: 0 28px; }
.hs-intro h1 { margin: 12px 0 0; font: 700 clamp(44px, 7.4vw, 96px)/0.98 var(--font-display, system-ui, sans-serif); letter-spacing: -0.035em; }
.hs-outro p { color: var(--muted, #9c9488); font-size: 19px; }
