/* Motion, November 2026. Loaded on every page with motion.js.
   Everything here only applies when <html> has the class "motion", which a tiny script in the page head adds before
   the first paint. It is not added for people who have asked their device for reduced motion, and if motion.js fails
   to start the class "motion-failed" shows everything, so nothing can stay hidden.
   Only transform, opacity and clip-path are animated, so it stays smooth on phones. */

/* ---------- 1. Moving between pages: the old page lifts away and the new one rises in ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: page-out .42s cubic-bezier(.4, 0, .2, 1) both; }
  ::view-transition-new(root) { animation: page-in .8s cubic-bezier(.16, 1, .3, 1) both; }
}
@keyframes page-out { to { opacity: 0; transform: translateY(-18px); } }
@keyframes page-in { from { opacity: 0; transform: translateY(26px); } }

/* A fine line across the top while the next page is on its way. */
.leaving-line { position: fixed; left: 0; top: 0; height: 2px; width: 100%; background: #b9a98c; z-index: 95; transform: scaleX(0); transform-origin: left; pointer-events: none; }
.leaving .leaving-line { transform: scaleX(.82); transition: transform 2.4s cubic-bezier(.1, .7, .2, 1); }

/* ---------- 2. The opening curtain: once per visit, on whichever page someone arrives at ---------- */
.curtain { display: none; }
.motion:not(.seen) .curtain {
  display: flex; flex-direction: column; align-items: center; justify-content: center; position: fixed; inset: 0; z-index: 90;
  background: #24271f; color: #eae5dc; pointer-events: none; animation: curtain-lift 1s cubic-bezier(.76, 0, .24, 1) 1.15s forwards;
}
.curtain span { font: clamp(45px, 7vw, 110px)/1 'Cormorant Garamond', Georgia, serif; letter-spacing: 12px; padding-left: 12px; animation: curtain-word 1.1s cubic-bezier(.16, 1, .3, 1) both; }
.curtain i { width: 120px; height: 1px; background: #cfc3ac; margin: 24px; transform-origin: left; animation: curtain-rule 1.2s cubic-bezier(.16, 1, .3, 1) both; }
.curtain small { font: 8px 'Manrope', sans-serif; letter-spacing: 3px; animation: curtain-fade .8s .45s both; }
@keyframes curtain-lift { to { transform: translateY(-101%); visibility: hidden; } }
@keyframes curtain-word { from { opacity: 0; transform: translateY(16px); letter-spacing: 20px; } }
@keyframes curtain-rule { from { transform: scaleX(0); } }
@keyframes curtain-fade { from { opacity: 0; } }

/* The home page has its own opening. After the first page of a visit it is skipped, so coming back to it is instant. */
.seen .intro { display: none !important; }
.js.seen .hero h1 > span { animation-delay: .1s; }
.js.seen .hero h1 > span:nth-child(2) { animation-delay: .22s; }
.js.seen .hero h1 > span:nth-child(3) { animation-delay: .34s; }
.js.seen .hero-brand { animation-delay: .1s; }
.seen .hero-reveal { animation-delay: .55s; }

/* ---------- 3. Things rise into place as they come into view ---------- */
.motion:not(.motion-failed) :is(.offer, .work-tile, .journal-tile, .more-grid a, .how li, .how > div, .page-faq-head, .page-faq-list details, .care-section,
  .aftercare-intro, .examples-head, .post-body > *, .post-cta, .confirm-grid > *, .index-empty, .index-empty-actions, .chips, .service-about, .more > h2, .more-all, .book-crumb) {
  opacity: 0; transform: translateY(34px); transition: opacity 1s cubic-bezier(.16, 1, .3, 1), transform 1.15s cubic-bezier(.16, 1, .3, 1); transition-delay: var(--d, 0s);
}
.motion:not(.motion-failed) .in.in { opacity: 1; transform: none; }

/* Photos are uncovered from the top while they settle back from a slight zoom. */
.motion:not(.motion-failed) :is(.offer-image, .work-tile-image, .journal-tile-image, .post-image, .service-image, .look-photos figure, .studio-frame, .journal-card > div, .book-aside img) {
  clip-path: inset(0 -60px 100% -60px); transition: clip-path 1.35s cubic-bezier(.76, 0, .24, 1); transition-delay: var(--d, 0s);
}
.motion:not(.motion-failed) :is(.offer-image, .work-tile-image, .journal-tile-image, .post-image, .look-photos figure, .studio-frame, .journal-card > div) > img {
  transform: scale(1.16); transition: transform 1.9s cubic-bezier(.16, 1, .3, 1); transition-delay: var(--d, 0s);
}
.motion:not(.motion-failed) .wipe-in.wipe-in { clip-path: inset(0 -60px -80px -60px); } /* room for the shadow under each photo */
.motion:not(.motion-failed) .wipe-in.wipe-in > img { transform: none; }
.motion:not(.motion-failed) .wipe-in:hover > img { transform: scale(1.045); transition-duration: 1.1s; transition-delay: 0s; }

/* Headings arrive a word at a time: each word fades into focus, one after the next, while the heading settles upward.
   The words stay ordinary inline text, so line breaks are exactly the same as without the animation (no stray words). */
.motion:not(.motion-failed) :is(.post-head h1, .service-copy h1):not(.split) { opacity: 0; }
.motion:not(.motion-failed) .split { transform: translateY(26px); transition: transform 1.3s cubic-bezier(.16, 1, .3, 1); transition-delay: var(--d, 0s); }
.motion:not(.motion-failed) .split .w { opacity: 0; filter: blur(7px); transition: opacity .95s cubic-bezier(.3, 0, .2, 1), filter 1.1s cubic-bezier(.3, 0, .2, 1); transition-delay: calc(var(--i, 0) * 70ms + var(--d, 0s)); }
.motion:not(.motion-failed) .split.in { transform: none; }
.motion:not(.motion-failed) .split.in .w { opacity: 1; filter: none; }

/* ---------- 4. Small touches ---------- */
/* Arrows lean forward when a button is hovered or focused. */
.button span, .hero-cta span, .book-bar span, .text-link > span { transition: transform .45s cubic-bezier(.16, 1, .3, 1); }
.button:hover > span:last-child, .hero-cta:hover span, .book-bar:hover span, .button:focus-visible > span:last-child { transform: translateX(7px); }

/* Questions open and close smoothly (newer browsers; others simply open). */
:root { interpolate-size: allow-keywords; }
.faq-list details::details-content, .page-faq-list details::details-content { block-size: 0; overflow: clip; transition: block-size .55s cubic-bezier(.16, 1, .3, 1), content-visibility .55s allow-discrete; }
.faq-list details[open]::details-content, .page-faq-list details[open]::details-content { block-size: auto; }

/* The header on every page but the home page: it tucks away on the way down and returns on the way up. */
.post-header { position: sticky; top: 0; z-index: 40; background: var(--paper); transition: transform .55s cubic-bezier(.16, 1, .3, 1); }
.nav-hidden .post-header { transform: translateY(-101%); }
.page-progress { position: fixed; left: 0; top: 0; height: 2px; width: 100%; background: #b9a98c; z-index: 60; transform: scaleX(0); transform-origin: left; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .curtain { display: none !important; }
  .post-header { transition: none; }
}
@media print {
  .curtain, .leaving-line, .page-progress { display: none !important; }
  .motion * { opacity: 1 !important; transform: none !important; clip-path: none !important; }
}
