/* Guest-page motion (docs/kalas/kalas-save-the-date-flow-and-motion.md §5). CSS only.

   The server puts one class on <html> for a single render (pages/guest/page.html):
     arrive-code   right after a typed code: the code page → save the date transition
     arrive-cold   an email link or /k/ link: no page to come from, so the look's load-in
     arrive-saved  after sending Who's coming?: only the answer settles
     (none)        reloads, language switch, Change answer: a quiet 150 ms crossfade
   <html> also carries the look (look-nouveau, …) so the ::view-transition-* rules, which belong
   to the new page's root, can differ per look.

   Everything sits inside prefers-reduced-motion: no-preference, and every animation only runs
   *from* a starting state to the element's normal one, so with motion off (or in a browser without
   View Transitions) the page is simply there. Loaded by the guest pages only, never the admin. */

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }

  /* --- every look: quiet by default ---------------------------------------------------- */
  ::view-transition-group(*) { animation-duration: 150ms; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: 150ms; }

  /* The couple's names are shared between the code page and the save the date, only for the
     code step. Elsewhere (reloads, language switch) they just crossfade with the page. */
  .std-door__names,
  .arrive-code .std-hero__names { view-transition-name: couple-names; }

  /* --- Nouveau: slow, poster-like (~1,000 ms) -------------------------------------------- */
  html.look-nouveau.arrive-code::view-transition-old(root) { animation: 400ms cubic-bezier(.2, .7, .1, 1) both k-wipe-off-right; }
  html.look-nouveau.arrive-code::view-transition-new(root) { animation: 300ms cubic-bezier(.2, .7, .1, 1) 150ms both k-fade-in; }
  html.look-nouveau.arrive-code::view-transition-group(couple-names) { animation-duration: 700ms; animation-timing-function: cubic-bezier(.2, .7, .1, 1); }
  html.look-nouveau.arrive-code::view-transition-old(couple-names), html.look-nouveau.arrive-code::view-transition-new(couple-names) { animation-duration: 700ms; }
  .arrive-code .look-nouveau .std-hero__top::after, .arrive-cold .look-nouveau .std-hero__top::after { animation: 250ms cubic-bezier(.2, .7, .1, 1) 100ms both k-draw; }
  .arrive-code .look-nouveau .std-hero__heading, .arrive-cold .look-nouveau .std-hero__heading { animation: 600ms cubic-bezier(.2, .7, .1, 1) 300ms both k-rise-out; }
  .arrive-code .look-nouveau .std-illustration, .arrive-cold .look-nouveau .std-illustration { animation: 500ms ease-out 600ms both k-ink; }
  .arrive-code .look-nouveau :is(.std-hero__when, .std-photo, .std-sec--hero ~ *) { animation: 300ms ease-out 600ms both k-fade-in; }

  /* --- Beach Club: quick (~400 ms) ------------------------------------------------------- */
  html.look-beach-club.arrive-code::view-transition-old(root) { animation: 400ms cubic-bezier(.3, 0, .2, 1) both k-slide-out-left; }
  html.look-beach-club.arrive-code::view-transition-new(root) { animation: 400ms cubic-bezier(.3, 0, .2, 1) both k-slide-in-right; }
  html.look-beach-club.arrive-code::view-transition-group(couple-names) { animation-duration: 400ms; animation-timing-function: cubic-bezier(.3, 0, .2, 1); }
  html.look-beach-club.arrive-code::view-transition-old(couple-names), html.look-beach-club.arrive-code::view-transition-new(couple-names) { animation-duration: 400ms; }
  .arrive-cold .look-beach-club .std-hero__media img { animation: 1600ms cubic-bezier(.2, .7, .1, 1) both k-push-in; }

  /* --- Soap: soft (~650 ms) -------------------------------------------------------------- */
  html.look-soap.arrive-code::view-transition-old(root) { animation: none; }
  html.look-soap.arrive-code::view-transition-new(root) { animation: 600ms cubic-bezier(.34, 1.3, .64, 1) both k-circle; }
  html.look-soap.arrive-code::view-transition-group(couple-names) { animation-duration: 500ms; animation-timing-function: cubic-bezier(.34, 1.3, .64, 1); }
  html.look-soap.arrive-code::view-transition-old(couple-names), html.look-soap.arrive-code::view-transition-new(couple-names) { animation-duration: 500ms; }
  .arrive-code .look-soap .std-hero__card,
  .arrive-code .look-soap .std-hero__strip { animation: 400ms cubic-bezier(.34, 1.3, .64, 1) 250ms both k-float-up; }
  .arrive-cold .look-soap .std-hero__card,
  .arrive-cold .look-soap .std-hero__strip { animation: 400ms cubic-bezier(.34, 1.3, .64, 1) both k-float-up; }
  .look-soap .std-btn:active { transform: scale(.96); transition: transform 120ms ease-out; }

  /* --- Classical: dignified (~800 ms) ---------------------------------------------------- */
  html.look-classical.arrive-code::view-transition-old(root) { animation: 800ms ease-in-out both k-fade-out; }
  html.look-classical.arrive-code::view-transition-new(root) { animation: 800ms ease-in-out both k-fade-in; }
  html.look-classical.arrive-code::view-transition-group(couple-names) { animation-duration: 800ms; animation-timing-function: ease-in-out; }
  html.look-classical.arrive-code::view-transition-old(couple-names), html.look-classical.arrive-code::view-transition-new(couple-names) { animation-duration: 800ms; }
  .arrive-code .look-classical .std-hero .std-photo { animation: 800ms ease-in-out both k-drift; }
  .arrive-cold .look-classical .std-hero .std-photo { animation: 900ms ease-out both k-drift; }

  /* --- after sending Who's coming? (§5.5) -------------------------------------------------- */
  .arrive-saved .std-interest--answered { animation: 250ms ease-out both k-settle; }
  .arrive-saved .look-nouveau .std-interest--answered .std-interest__h { animation: 300ms cubic-bezier(.2, .7, .1, 1) 100ms both k-rise-out; }
  .arrive-saved .look-soap .std-interest--answered { animation: 400ms cubic-bezier(.34, 1.3, .64, 1) both k-float-up; }
}

/* A rule under Nouveau's heading: what the heading rises out of. */
.look-nouveau .std-hero--type .std-hero__top::after {
  content: ""; grid-column: 1 / -1; height: 1px; background: var(--accent); transform-origin: left;
}

@keyframes k-fade-in { from { opacity: 0; } }
@keyframes k-fade-out { to { opacity: 0; } }
@keyframes k-wipe-off-right { to { clip-path: inset(0 0 0 100%); } }
@keyframes k-draw { from { transform: scaleX(0); } }
/* Rises from behind the line under it: the clip moves with the text, so the bottom edge stays put. */
@keyframes k-rise-out { from { transform: translateY(100%); clip-path: inset(0 0 100% 0); } }
@keyframes k-ink { from { opacity: 0; filter: blur(2px); } }
@keyframes k-slide-out-left { to { transform: translateX(-30%); } }  /* the new page covers it: no fade, no gap */
@keyframes k-slide-in-right { from { transform: translateX(100%); } }
@keyframes k-push-in { from { transform: scale(1.04); } }
@keyframes k-circle { from { clip-path: circle(0 at 50% 85%); } to { clip-path: circle(150% at 50% 85%); } }
@keyframes k-float-up { from { transform: translateY(12px); opacity: 0; } }
@keyframes k-drift { from { transform: translateY(16px); opacity: 0; } }
@keyframes k-settle { from { transform: translateY(8px); opacity: 0; } }
