/* motion.css
   Purpose: one motion language for the page. Words rise out of a mask (h2 on scroll), photos open
   with a clip-path, the intro sheet slides over the pinned hero (curtain), and hover/focus states are designed.
   NOT for: the "Step inside" scene (walkthrough.css) or basic fade-ups (.reveal in experience.css).
   WHY: only transform, scale, opacity and clip-path move. Scroll reveals need html.reveal-ready (IntersectionObserver
   works), the curtain needs html.scenes (JS on, no reduced motion), so without JS everything sits in its final state.
   Reveals use the scale property and hovers use transform, so a staggered reveal never delays a hover. */

/* Word masks. Padding with equal negative margins leaves room for descenders and italics without moving the text. */
.w{display:inline-block;overflow:hidden;vertical-align:top;padding:.12em .08em .2em;margin:-.12em -.08em -.2em}
.w>span{display:inline-block}

/* Doctor name: a drawn underline on hover and keyboard focus. */
.doctor-title h3{position:relative}
.doctor-title h3::after{content:'';position:absolute;left:0;right:0;bottom:-5px;height:1px;background:currentColor;transform:scaleX(0);transform-origin:left;transition:transform .6s var(--ease)}
.doctor-card:is(:hover,:focus-within) .doctor-title h3::after{transform:scaleX(1)}
/* Gallery tile: the caption lifts with the photo zoom, for pointer and keyboard alike. */
.gallery-item>span{transition:transform .5s var(--ease)}
.gallery-item:is(:hover,:focus-visible)>span{transform:translateY(-4px)}
.gallery-item:focus-visible img{transform:scale(1.05)}

@media(prefers-reduced-motion:no-preference){
  /* Hero entrance: eyebrow, then the wordmark, then lead and actions. */
  .hero-content>h1{animation-duration:1.1s;animation-delay:.14s}
  .hero-content>:nth-child(3){animation-delay:.36s}
  .hero-content>:nth-child(4){animation-delay:.48s}

  /* Section titles rise word by word as they enter. */
  .reveal-ready h2.split .w>span{transform:translateY(112%);transition:transform 1s var(--ease) calc(var(--i)*60ms)}
  .reveal-ready h2.split.is-in .w>span{transform:none}

  /* Photos open upward from a mask and settle from a slight zoom; --i staggers gallery tiles. */
  .reveal-ready :is(.stagger>*,.doctor-card) img{clip-path:inset(100% 0 0 0);scale:1.14;transition:clip-path 1.1s var(--ease) var(--delay,0s),scale 1.6s var(--ease) var(--delay,0s),transform .7s var(--ease)}
  .reveal-ready .stagger>*{--delay:calc(var(--i,0)*70ms)}
  .reveal-ready .doctor-card{--delay:.18s}
  .reveal-ready :is(.stagger.is-in>*,.doctor-card.is-in) img{clip-path:inset(0);scale:1}

  /* Curtain: the hero stays pinned while the intro sheet slides over it; the hero dims and its photo leans in. */
  .scenes .curtain .hero{position:sticky;top:0}
  .scenes .curtain .hero::after{content:'';position:absolute;inset:0;z-index:5;pointer-events:none;background:#1b1716;opacity:calc(var(--hp,0)*.72)}
  .scenes .curtain .hero-content{transform:translateY(calc(var(--hp,0)*-80px));opacity:calc(1.3 - var(--hp,0)*1.8)}
  .scenes .curtain .hero-photo{transform:scale(calc(1 + var(--hp,0)*.08))}
  .scenes .curtain .intro{background:var(--canvas);border-radius:var(--radius) var(--radius) 0 0;box-shadow:0 -30px 60px -28px #1b171673}
}
