/* ==========================================================================
   Vive La Vivi — motion layer (design v2)
   Entrance, scroll reveals, parallax and hovers. Layout lives in site.css;
   this file only moves things that are already in place, so every element
   comes to rest exactly on its design position.
   Everything here is scoped to html.motion, which the <head> script sets only
   when the visitor has not asked for reduced motion.
   ========================================================================== */

/* ---------- Split title lines (always split, animated only with motion) ---------- */
.line {
  display: block;
}

.line__inner {
  display: block;
}

/* ---------- Intro curtain (first visit in a session) ---------- */
.preloader {
  display: none;
}

html.intro .preloader {
  position: fixed; /* full-screen overlay above the page during the intro */
  inset: 0;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  background-color: var(--c-stone);
  clip-path: inset(0 0 0 0);
  transition: clip-path 1.1s var(--ease-in-out);
}

html.intro .preloader.is-leaving {
  clip-path: inset(0 0 100% 0);
}

.preloader__logo {
  width: 143px;
  height: auto;
  opacity: 0;
  scale: .86;
  animation: preloader-logo 1.1s var(--ease-out) .15s forwards;
}

.preloader__bar {
  display: block;
  width: 120px;
  border-top: 1px solid rgba(60, 56, 50, .18);
}

.preloader__bar::after {
  content: "";
  display: block;
  margin-top: -1px;
  border-top: 1px solid var(--c-ink);
  transform-origin: left center;
  scale: 0 1;
  animation: preloader-bar 1.3s var(--ease-in-out) .2s forwards;
}

.preloader.is-leaving .preloader__logo {
  translate: 0 -40px;
  opacity: 0;
  transition: translate .9s var(--ease-in-out), opacity .6s var(--ease-in-out);
}

@keyframes preloader-logo {
  to {
    opacity: 1;
    scale: 1;
  }
}

@keyframes preloader-bar {
  to {
    scale: 1 1;
  }
}

/* ---------- Hero entrance ---------- */
/* the film settles from a slow zoom and sinks a little as the page scrolls */
html.motion .hero__video {
  scale: 1.1;
  translate: 0 var(--hero-shift, 0px);
  transition: scale 3.2s var(--ease-out);
}

html.motion.is-ready .hero__video {
  scale: 1;
}

html.motion .masthead {
  opacity: 0;
  transition: opacity 1.4s var(--ease-out), translate .6s var(--ease-out), color .4s var(--ease);
}

html.motion .hero__eyebrow,
html.motion .hero__subtitle,
html.motion .hero__cta .btn,
html.motion .hero__cta-note,
html.motion .hero__scroll {
  opacity: 0;
  transition: opacity 1.4s var(--ease-out), translate 1.6s var(--ease-out);
}

html.motion .hero__eyebrow,
html.motion .hero__subtitle,
html.motion .hero__cta .btn,
html.motion .hero__cta-note {
  translate: 0 20px;
}

html.motion.is-ready .masthead,
html.motion.is-ready .hero__eyebrow,
html.motion.is-ready .hero__subtitle,
html.motion.is-ready .hero__cta .btn,
html.motion.is-ready .hero__cta-note,
html.motion.is-ready .hero__scroll {
  opacity: 1;
  translate: 0 0;
}

/* once in, the masthead keeps only its own scroll slide */
html.motion.is-ready .masthead.is-scrolled {
  translate: 0 calc(-1 * var(--announce-h, 30px));
}

html.motion.is-ready .masthead {
  transition-delay: .2s, 0s, 0s;
}

html.motion.is-ready .hero__eyebrow {
  transition-delay: .4s;
}

html.motion.is-ready .hero__subtitle {
  transition-delay: .95s;
}

html.motion.is-ready .hero__cta .btn {
  transition-delay: 1.15s;
}

html.motion.is-ready .hero__cta-note {
  transition-delay: 1.3s;
}

html.motion.is-ready .hero__scroll {
  transition-delay: 1.8s;
}

/* the hero content drifts up a little as the page scrolls away (it never fades:
   the button stays solid) */
html.motion .hero__content {
  translate: 0 var(--hero-drift, 0px);
}

/* hidden until its lines are split, so it never flashes unanimated */
html.motion .hero__title:not(.is-split) {
  opacity: 0;
}

/* ---------- Line reveal (hero title + section titles) ---------- */
/* each line rises out of a mask; the mask is wider than the line so the
   display face's ascenders and descenders are never cut, and it is removed
   once the line has landed */
html.motion .is-split .line {
  clip-path: inset(-.35em -.3em -.3em -.3em);
}

html.motion .is-split .line.is-done {
  clip-path: none;
}

html.motion .is-split .line__inner {
  translate: 0 150%;
  rotate: 2deg;
  transform-origin: left top;
  transition: translate 1.5s var(--ease-out), rotate 1.5s var(--ease-out);
  transition-delay: var(--d, 0s);
}

html.motion.is-ready .hero__title .line__inner,
html.motion .is-split.is-in .line__inner {
  translate: 0 0;
  rotate: 0deg;
}

/* ---------- Scroll reveals ---------- */
html.motion [data-reveal="up"] {
  opacity: 0;
  translate: 0 44px;
  transition: opacity 1.2s var(--ease-out), translate 1.4s var(--ease-out);
  transition-delay: var(--d, 0s);
}

html.motion [data-reveal="fade"] {
  opacity: 0;
  transition: opacity 1.4s var(--ease-out);
  transition-delay: var(--d, 0s);
}

html.motion [data-reveal="up"].is-in,
html.motion [data-reveal="fade"].is-in {
  opacity: 1;
  translate: 0 0;
}

/* photos: the frame opens from the bottom while the photo settles from a zoom */
html.motion [data-reveal="media"] {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.5s var(--ease-in-out);
  transition-delay: var(--d, 0s);
}

html.motion [data-reveal="media"] .media__img {
  transform: scale(1.28);
  transition: transform 2.2s var(--ease-out), scale 1.1s var(--ease-out);
  transition-delay: var(--d, 0s), 0s;
}

html.motion [data-reveal="media"].is-in {
  clip-path: inset(0 0 0 0);
}

html.motion [data-reveal="media"].is-in .media__img {
  transform: none;
}

/* parallax: set from scroll by motion.js, composes with the reveals */
html.motion [data-parallax] {
  translate: 0 var(--py, 0px);
}

/* ---------- Hovers ---------- */
.btn__chev {
  transition: translate .45s var(--ease-out);
}

.btn--arrow:hover .btn__chev {
  translate: -5px 0;
}

.arrow-btn svg {
  transition: translate .45s var(--ease-out);
}

.arrow-btn:hover svg {
  translate: -2px 0;
}

.carousel-arrows .arrow-btn:last-child:hover svg,
.carousel-arrows .arrow-btn:last-child:focus-visible svg {
  translate: 2px 0;
}

.room-card:hover .arrow-btn {
  color: var(--c-paper);
  background-color: var(--c-ink);
}

.room-card:hover .arrow-btn svg {
  translate: -3px 0;
}

/* underline that draws in from the reading side */
.footer-nav__list a,
.site-nav__fr {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 100% 100%;
  background-size: 0 1px;
  transition: background-size .6s var(--ease-out);
}

.site-nav__item:hover .site-nav__fr {
  background-size: 100% 1px;
}

.footer-nav__list a:hover {
  background-size: 100% 1px;
}

.post-card__title {
  transition: color .4s var(--ease-out);
}

.post-card__link:hover .post-card__title {
  color: var(--c-olive);
}

/* ---------- Responsive: lighter motion on small screens ---------- */
@media (max-width: 767px) {
  html.motion [data-reveal="up"] {
    translate: 0 28px;
  }

  html.motion [data-parallax] {
    translate: 0 0;
  }

  .preloader__logo {
    width: 110px;
  }
}
