/* ============================================================
   WOW MOTION — уровни 1–3
   Откат: см. MOTION_ROLLBACK.md и js/core/MotionConfig.js
   ============================================================ */

/* [MOTION:viewTransitions] */
.motion-vt .brand-mark {
  view-transition-name: brand-mark;
}

.motion-vt .site-header {
  view-transition-name: site-header;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: wow-vt-out 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

::view-transition-new(root) {
  animation: wow-vt-in 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes wow-vt-out {
  to { opacity: 0; transform: scale(0.985); }
}

@keyframes wow-vt-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* [MOTION:pageCurtain] */
.motion-curtain-out::after,
.motion-page-enter::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: var(--navy, #1a2b3c);
  pointer-events: none;
}

.motion-curtain-out::after {
  animation: wow-curtain-cover 0.42s ease forwards;
}

.motion-page-enter::after {
  opacity: 1;
  animation: wow-curtain-reveal 0.5s ease forwards;
}

.motion-page-enter-active::after {
  opacity: 0;
}

@keyframes wow-curtain-cover {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes wow-curtain-reveal {
  from { transform: translateY(0); }
  to { transform: translateY(-100%); }
}

/* [MOTION:heroSplitText] */
.motion-hero-split .hero-title__left,
.motion-hero-split .hero-title__right {
  display: inline-block;
  transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.85s ease;
}

.motion-hero-split:not(.is-ready) .hero-title__left {
  transform: translateX(-28px);
  opacity: 0;
}

.motion-hero-split:not(.is-ready) .hero-title__right {
  transform: translateX(28px);
  opacity: 0;
}

/* [MOTION:heroGrain] */
.hero-grain {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* [MOTION:heroScrollCollapse] */
.hero-scale {
  transition: transform 0.08s linear, opacity 0.08s linear;
  will-change: transform, opacity;
}

/* [MOTION:goldShimmer] — лого в шапке + значки при hover */
@keyframes wow-shine-sweep {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}

@keyframes wow-logo-shimmer-loop {
  0%, 72%, 100% { transform: translateX(-130%); opacity: 0; }
  8% { opacity: 1; }
  36% { transform: translateX(130%); opacity: 1; }
  44% { opacity: 0; }
}

.wow-logo-shimmer {
  position: relative;
}

.wow-logo-shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    105deg,
    transparent 34%,
    rgba(197, 160, 89, 0.55) 50%,
    transparent 66%
  );
  transform: translateX(-130%);
  pointer-events: none;
  animation: wow-logo-shimmer-loop 5.5s ease-in-out infinite;
}

.wow-icon-shine {
  position: relative;
  overflow: hidden;
}

.wow-icon-shine--wrap {
  display: inline-block;
  line-height: 0;
}

.wow-icon-shine::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    105deg,
    transparent 36%,
    rgba(197, 160, 89, 0.65) 50%,
    transparent 64%
  );
  transform: translateX(-120%);
  pointer-events: none;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .wow-icon-shine:hover::after {
    animation: wow-shine-sweep 0.75s ease;
  }

  .wow-icon-shine:hover {
    filter: drop-shadow(0 0 10px rgba(197, 160, 89, 0.28));
  }
}

/* [MOTION:kenBurns] */
.gallery-cell {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.gallery-cell-inner {
  display: block;
  overflow: hidden;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.gallery-cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), filter 0.5s ease;
}

.gallery-cell--kenburns img {
  animation: wow-ken-burns 14s ease-in-out infinite alternate;
}

@keyframes wow-ken-burns {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.07) translate(-1.5%, -1%); }
}

@media (hover: hover) {
  .gallery-cell:hover img {
    transform: scale(1.05);
  }

  .gallery-cell--kenburns:hover img {
    animation-play-state: paused;
  }
}

.gallery-cell--wide {
  grid-column: 1 / -1;
}

/* [MOTION:blurUpLoad] */
.wow-blur-up {
  filter: blur(14px);
  transform: scale(1.03);
}

.wow-blur-up.is-loaded {
  filter: blur(0);
  transform: scale(1);
}

/* [MOTION:gallerySpotlight] */
.gallery-grid--spotlight .gallery-cell {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.gallery-grid--spotlight:hover .gallery-cell {
  opacity: 0.55;
  transform: scale(0.98);
}

.gallery-grid--spotlight .gallery-cell:hover {
  opacity: 1;
  transform: scale(1);
  z-index: 2;
}

/* [MOTION:galleryBeforeAfter] */
.wow-before-after {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 4px;
  overflow: hidden;
  cursor: ew-resize;
}

.wow-before-after img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wow-before-after__after,
.wow-before-after__before {
  position: absolute;
  inset: 0;
}

.wow-before-after__before {
  clip-path: inset(0 50% 0 0);
}

.wow-before-after__slider {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1rem;
  width: min(280px, 70%);
  margin: 0 auto;
  z-index: 3;
  accent-color: var(--gold, #c5a059);
}

.wow-before-after__label {
  position: absolute;
  bottom: 2.6rem;
  z-index: 2;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.wow-before-after__label--left { left: 1rem; }
.wow-before-after__label--right { right: 1rem; }

/* [MOTION:galleryLightbox] */
.wow-lightbox {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
  box-sizing: border-box;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.wow-lightbox.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.wow-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(26, 43, 60, 0.82);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}

.wow-lightbox-stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(96vw, 1100px);
  max-height: 88vh;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.wow-lightbox-img {
  display: block;
  max-width: min(96vw, 1100px);
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.wow-lightbox-close {
  position: fixed;
  top: clamp(0.75rem, 2vw, 1.25rem);
  right: clamp(0.75rem, 2vw, 1.25rem);
  z-index: 3;
  width: 2.35rem;
  height: 2.35rem;
  border: none;
  border-radius: 50%;
  background: rgba(248, 249, 247, 0.95);
  color: var(--navy, #1a2b3c);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.wow-lightbox-nav {
  position: fixed;
  top: 50%;
  z-index: 3;
  width: 2.65rem;
  height: 2.65rem;
  margin-top: -1.325rem;
  border: 0;
  border-radius: 50%;
  background: rgba(248, 249, 247, 0.94);
  color: var(--gold-hover, #9a7b3f);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  transition: background 0.2s ease, transform 0.2s ease;
}

.wow-lightbox-nav:hover {
  background: #fff;
  transform: scale(1.05);
}

.wow-lightbox-nav--prev {
  left: clamp(0.65rem, 2.5vw, 1.35rem);
}

.wow-lightbox-nav--next {
  right: clamp(0.65rem, 2.5vw, 1.35rem);
}

.wow-lightbox-nav[hidden],
.wow-lightbox-counter[hidden] {
  display: none !important;
}

.wow-lightbox-counter {
  position: fixed;
  left: 50%;
  bottom: clamp(0.85rem, 2.5vw, 1.35rem);
  z-index: 3;
  transform: translateX(-50%);
  margin: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(12, 20, 28, 0.72);
  color: rgba(248, 249, 247, 0.95);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  pointer-events: none;
}

body.wow-lightbox-open {
  overflow: hidden;
}

/* [MOTION:roomSpotlight + roomShine] */
@media (min-width: 901px) and (hover: hover) {
  .rooms-track--spotlight .room-card {
    transition: opacity 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
  }

  .rooms-track--spotlight:hover .room-card {
    opacity: 0.55;
    transform: scale(0.98);
  }

  .rooms-track--spotlight .room-card:hover {
    opacity: 1;
    transform: scale(1.02);
    z-index: 2;
    box-shadow: 0 16px 44px rgba(26, 43, 60, 0.14);
  }

  .room-card--shine::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    background: linear-gradient(
      105deg,
      transparent 40%,
      rgba(255, 255, 255, 0.22) 50%,
      transparent 60%
    );
    transform: translateX(-130%);
    pointer-events: none;
  }

  .room-card--shine:hover::before {
    animation: wow-card-shine 0.75s ease;
  }
}

@media (min-width: 1025px) {
  .rooms-track--spotlight .room-card:hover {
    transform: scale(1.02);
    border-color: rgba(197, 160, 89, 0.55);
  }

  .rooms-track--spotlight:hover .room-card:not(:hover) {
    transform: scale(0.98);
  }
}

@keyframes wow-card-shine {
  to { transform: translateX(130%); }
}

/* [MOTION:magneticButtons] — transform задаётся в JS */

/* [MOTION:stickyBookingBar] */
.wow-sticky-booking {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  transform: translateY(110%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.wow-sticky-booking.is-visible {
  transform: translateY(0);
  pointer-events: auto;
}

.wow-sticky-booking__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(248, 249, 247, 0.88);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(184, 154, 91, 0.25);
  box-shadow: 0 -8px 28px rgba(26, 43, 60, 0.08);
}

.wow-sticky-booking__text {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--navy);
}

/* [MOTION:counterUp] */
.wow-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 2.5rem;
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
}

.wow-stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  color: var(--gold);
  line-height: 1.1;
}

.wow-stat-label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* [MOTION:imageSequence] */
.wow-sequence {
  position: relative;
  height: 220vh;
  margin-top: 3rem;
}

.wow-sequence-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
}

.wow-sequence-frame {
  position: relative;
  width: min(92vw, 880px);
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(26, 43, 60, 0.18);
}

.wow-sequence-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s ease;
}

.wow-sequence-img.is-active {
  opacity: 1;
}

.wow-sequence-caption {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--green-dark);
  text-align: center;
}

/* [MOTION:cursorFollower] */
.motion-custom-cursor,
.motion-custom-cursor body,
.motion-custom-cursor a,
.motion-custom-cursor button,
.motion-custom-cursor .gallery-cell {
  cursor: none;
}

.wow-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--gold);
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: multiply;
  transition: width 0.2s ease, height 0.2s ease, margin 0.2s ease, background 0.2s ease;
}

.wow-cursor.is-link {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  background: rgba(197, 160, 89, 0.35);
}

.wow-cursor.is-gallery {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  background: rgba(26, 43, 60, 0.2);
}

.wow-cursor.is-gallery::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  color: var(--navy);
}

/* [MOTION:springModal] */
.motion-spring-modal .booking-modal-dialog {
  transition: transform 0.45s cubic-bezier(0.34, 1.45, 0.64, 1), opacity 0.3s ease;
  transform: scale(0.92) translateY(12px);
}

.motion-spring-modal .booking-modal.is-open .booking-modal-dialog {
  transform: scale(1) translateY(0);
}

/* [MOTION:smoothScroll] */
.motion-smooth-scroll {
  scroll-behavior: smooth;
}

/* —— Глобальный откат —— */
html.motion-off .wow-cursor,
html.motion-off .wow-sticky-booking,
html.motion-off .hero-grain,
html.motion-off .wow-sequence {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .gallery-cell--kenburns img,
  .wow-logo-shimmer::after,
  .wow-icon-shine::after {
    animation: none !important;
    transform: none !important;
    opacity: 0 !important;
  }

  .motion-hero-split .hero-title__left,
  .motion-hero-split .hero-title__right {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .wow-icon-shine:hover {
    filter: none !important;
  }

  .wow-cursor {
    display: none !important;
  }

  .wow-blur-up {
    filter: none !important;
    transform: none !important;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
