/* Card → page expand (View Transitions). Tune the feel here.
   --vt-speed is a multiplier the option board uses for slow-motion. */
:root{
  --vt-dur: 520ms;
  --vt-ease: cubic-bezier(.2, .8, .2, 1);   /* fast start, soft landing */
  --vt-speed: 1;
  --vt-t: calc(var(--vt-dur) * var(--vt-speed));
}
html[data-vt-variant="d"]{
  --vt-dur: 820ms;
  /* gentle spring: ~6% overshoot, then settles */
  --vt-ease: linear(0, .06 3%, .24 7%, .52 13%, .8 20%, .97 27%, 1.04 33%, 1.06 38%, 1.05 44%, 1.02 52%, 1 62%, .995 72%, 1);
}

/* ---------- Shared: the photo morphs into the gallery image ---------- */
::view-transition-group(vt-photo){
  animation-duration: var(--vt-t);
  animation-timing-function: var(--vt-ease);
  border-radius: 9px; overflow: hidden; z-index: 3;
}
::view-transition-old(vt-photo),
::view-transition-new(vt-photo){ height: 100%; width: 100%; object-fit: cover; }

/* Everything else: quick crossfade so the rest of the page doesn't compete */
::view-transition-old(root){ animation: vt-fade-out calc(var(--vt-t) * .5) ease both; }
::view-transition-new(root){ animation: vt-fade-in calc(var(--vt-t) * .6) ease calc(var(--vt-t) * .35) both; }

/* ---------- B: card frame grows into the page ---------- */
::view-transition-group(vt-card){
  animation-duration: var(--vt-t);
  animation-timing-function: var(--vt-ease);
  border-radius: 22px; overflow: hidden; z-index: 2;
}
::view-transition-old(vt-card),
::view-transition-new(vt-card){ height: 100%; width: 100%; object-fit: cover; object-position: top; }

/* ---------- C: page details rise in after the photo lands ---------- */
::view-transition-group(vt-content){ animation: none; z-index: 2; }
::view-transition-new(vt-content){ animation: vt-rise calc(var(--vt-t) * 1.1) var(--vt-ease) calc(var(--vt-t) * .3) both; }
::view-transition-old(vt-content){ animation: vt-sink calc(var(--vt-t) * .45) ease-in both; }

/* ---------- D: home recedes behind as the photo springs forward ---------- */
html[data-vt-variant="d"][data-vt-dir="open"]::view-transition-old(root){
  animation: vt-recede calc(var(--vt-t) * .6) cubic-bezier(.4, 0, .2, 1) both;
}
html[data-vt-variant="d"][data-vt-dir="close"]::view-transition-new(root){
  animation: vt-advance calc(var(--vt-t) * .7) cubic-bezier(.2, .8, .2, 1) calc(var(--vt-t) * .15) both;
}

@keyframes vt-fade-out{ to{ opacity: 0 } }
@keyframes vt-fade-in{ from{ opacity: 0 } }
@keyframes vt-rise{ from{ opacity: 0; transform: translateY(56px) } }
@keyframes vt-sink{ to{ opacity: 0; transform: translateY(40px) } }
@keyframes vt-recede{ to{ opacity: 0; transform: scale(.94); filter: blur(2px) } }
@keyframes vt-advance{ from{ opacity: 0; transform: scale(.96) } }
