/* Motion for the Boozart site (motion.js adds the `motion` class).
   Everything here sits under .motion, so a visitor who asked for reduced
   motion, or a browser without JavaScript, sees the page exactly as designed. */

:root {
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ─── Reveal on scroll ─────────────────────────────────────────────────── */
.motion .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.9s var(--ease) var(--d, 0ms),
    transform 0.9s var(--ease) var(--d, 0ms);
}
.motion .reveal.in {
  opacity: 1;
  transform: none;
}
.motion-instant .reveal {
  transition: none !important;
}

/* Photos open like a curtain, then settle. The frame stays in place (so the
   page knows when it scrolls into view); the photo inside it is revealed. */
.motion .offer-image,
.motion .invitation { overflow: hidden; }
.motion .offer-image.reveal,
.motion .invitation.reveal { transform: none; opacity: 1; }
.motion .offer-image > img,
.motion .invitation > img,
.motion .hero-visual figure > img {
  translate: 0 var(--py, 0px);
  scale: 1.08;
  will-change: translate;
}
.motion .offer-image.reveal > img,
.motion .invitation.reveal > img {
  clip-path: inset(0 0 100% 0);
  scale: 1.22;
  transition:
    clip-path 1.3s var(--ease) var(--d, 0ms),
    scale 2.2s var(--ease) var(--d, 0ms);
}
.motion .offer-image.reveal.in > img,
.motion .invitation.reveal.in > img {
  clip-path: inset(0 0 0 0);
  scale: 1.08;
}
.motion .invitation:hover > img {
  scale: 1.12;
  transition: scale 1.6s var(--ease);
}

/* ─── The opening ──────────────────────────────────────────────────────── */
@keyframes boz-rise {
  from { opacity: 0; transform: translateY(0.6em); }
  to { opacity: 1; transform: none; }
}
@keyframes boz-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes boz-curtain {
  from { clip-path: inset(0 0 0 100% round 140px 3px 3px 3px); }
  to { clip-path: inset(0 0 0 0 round 140px 3px 3px 3px); }
}
@keyframes boz-curtain-rtl {
  from { clip-path: inset(0 100% 0 0 round 3px 140px 3px 3px); }
  to { clip-path: inset(0 0 0 0 round 3px 140px 3px 3px); }
}
@keyframes boz-settle {
  from { scale: 1.28; }
  to { scale: 1.08; }
}
.motion .hero.intro h1 > * {
  animation: boz-rise 1.1s var(--ease) both;
  animation-delay: calc(0.15s + var(--i, 0) * 0.14s);
}
.motion .hero.intro .eyebrow { animation: boz-fade-up 0.8s var(--ease) both; }
.motion .hero.intro .hero-description { animation: boz-fade-up 0.9s var(--ease) 0.6s both; }
.motion .hero.intro .hero-actions { animation: boz-fade-up 0.9s var(--ease) 0.75s both; }
.motion .hero.intro .hero-note { animation: boz-fade-up 0.9s var(--ease) 0.9s both; }
.motion .hero.intro .hero-visual figure { animation: boz-curtain 1.5s var(--ease) 0.1s both; }
.motion[dir="rtl"] .hero.intro .hero-visual figure { animation-name: boz-curtain-rtl; }
.motion .hero.intro .hero-visual figure > img { animation: boz-settle 2.6s var(--ease) 0.1s both; }

/* The photo leans gently toward the pointer. */
.motion .hero-visual figure {
  transform: perspective(1400px) rotateY(calc(var(--tx, 0) * 4deg)) rotateX(calc(var(--ty, 0) * -3deg));
  transition: transform 0.6s var(--ease);
}

/* The voice card floats, its sound bars move, its microphone breathes. */
@keyframes boz-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -7px; }
}
@keyframes boz-bar {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}
@keyframes boz-ring {
  0% { box-shadow: 0 0 0 0 #a64f3540; }
  100% { box-shadow: 0 0 0 14px #a64f3500; }
}
.motion .hero.intro .hero-label {
  animation: boz-fade-up 1s var(--ease) 1.1s both, boz-float 6s ease-in-out 2.2s infinite;
}
.motion .hero:not(.intro) .hero-label { animation: boz-float 6s ease-in-out infinite; }
.small-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 22px;
}
.small-wave i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: var(--clay);
  transform: scaleY(0.45);
}
.motion .small-wave i { animation: boz-bar 1.1s ease-in-out infinite; }
.motion .small-wave i:nth-child(2) { animation-delay: 0.15s; }
.motion .small-wave i:nth-child(3) { animation-delay: 0.3s; }
.motion .small-wave i:nth-child(4) { animation-delay: 0.45s; }
.motion .small-wave i:nth-child(5) { animation-delay: 0.6s; }
.motion .small-wave i:nth-child(6) { animation-delay: 0.75s; }
.motion .label-icon { animation: boz-ring 2.4s ease-out 2s infinite; }

/* ─── Tabs: one sliding underline, panels that glide in ────────────────── */
.motion .tabs { position: relative; }
.motion .tabs button[aria-selected="true"] { border-bottom-color: transparent; }
.tab-ink {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  background: var(--clay);
  transition: transform 0.45s var(--ease), width 0.45s var(--ease);
  pointer-events: none;
}
.motion .tabs button { transition: background 0.2s, color 0.2s; }
@keyframes boz-panel {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
.motion .swap > * { animation: boz-panel 0.65s var(--ease) both; }
.motion .swap > *:nth-child(2) { animation-delay: 0.1s; }
.motion .swap .offer-image > img { animation: boz-settle 1.4s var(--ease) both; }

/* ─── The example conversation ─────────────────────────────────────────── */
.motion .conversation .bubble {
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}
.motion .conversation .bubble.pending {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
}
.motion .conversation .bubble.pending:not(.visitor) { transform-origin: left bottom; }
.bubble.typing {
  display: inline-flex;
  gap: 5px;
  width: fit-content;
  padding-block: 16px;
}
.bubble.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b9aab3;
  animation: boz-dot 1s ease-in-out infinite;
}
.bubble.typing i:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes boz-dot {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* The recorded-story wave breathes. */
.motion .wave i {
  transform-origin: center;
  animation: boz-bar 1.4s ease-in-out infinite;
}
.motion .wave i:nth-child(3n + 1) { animation-delay: 0.2s; }
.motion .wave i:nth-child(3n + 2) { animation-delay: 0.45s; }
.motion .wave i:nth-child(5n) { animation-duration: 1.9s; }

/* ─── Icons that draw themselves ───────────────────────────────────────── */
.motion .reveal .icon .draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.6s var(--ease) calc(var(--d, 0ms) + 0.25s);
}
.motion .reveal.in .icon .draw,
.motion .swap .icon .draw { stroke-dashoffset: 0; }

/* ─── How it works: the steps join up ──────────────────────────────────── */
.motion .process-grid article { position: relative; }
.motion .process-icon {
  transition: transform 0.7s var(--ease) calc(var(--d, 0ms) + 0.1s), background 0.4s;
  transform: scale(0.6);
}
.motion .process-grid article.in .process-icon { transform: none; }
.motion .process-grid article:hover .process-icon { background: #f7eee9; }
@media (min-width: 981px) {
  .motion .process-grid article:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 26px;
    inset-inline-start: 68px;
    width: calc(100% + 40px - 84px);
    height: 1px;
    background: linear-gradient(90deg, var(--clay), #dfd5d9);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 1.1s var(--ease) calc(var(--d, 0ms) + 0.45s);
  }
  .motion[dir="rtl"] .process-grid article:not(:last-child)::after {
    transform-origin: right center;
    background: linear-gradient(270deg, var(--clay), #dfd5d9);
  }
  .motion .process-grid article.in:not(:last-child)::after { transform: scaleX(1); }
}

/* ─── Small touches ────────────────────────────────────────────────────── */
/* Buttons: a soft shine passes on hover. */
.motion .button {
  position: relative;
  overflow: hidden;
  transition: background 0.18s, transform 0.25s var(--ease), box-shadow 0.25s;
}
.motion .button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -12px #36233666; }
.motion .button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, #ffffff40 50%, transparent 70%);
  translate: -120% 0;
  pointer-events: none;
}
.motion .button:hover::after { translate: 120% 0; transition: translate 0.8s var(--ease); }

/* Links: the underline warms on hover. */
.motion .text-link { transition: color 0.2s, text-decoration-color 0.2s, text-underline-offset 0.25s var(--ease); }
.motion .text-link:hover { text-decoration-color: var(--clay); text-underline-offset: 8px; }

/* Cards lift a little. */
.motion .benefit-grid article,
.motion .share-items article { transition: transform 0.35s var(--ease); }
.motion .benefit-grid article:hover,
.motion .share-items article:hover { transform: translateY(-4px); }

/* Questions open smoothly. */
@keyframes boz-open {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.motion details[open] > p { animation: boz-open 0.4s var(--ease); }
.motion .plus:after { transition: transform 0.3s var(--ease); }

/* The header settles with a soft shadow once the page scrolls. */
.motion header { transition: box-shadow 0.3s, background 0.3s; }
.motion header.scrolled { box-shadow: 0 10px 30px -18px #36233640; }

/* The Boozart mark in the contact section floats. */
.motion .contact-mark { animation: boz-float 7s ease-in-out infinite; }

/* The form's success check pops. */
@keyframes boz-pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: none; }
}
.motion .success > .icon { animation: boz-pop 0.6s var(--ease) both; }
.motion .success > :not(.icon) { animation: boz-fade-up 0.6s var(--ease) 0.15s both; }

@media (prefers-reduced-motion: reduce) {
  .motion *,
  .motion *::before,
  .motion *::after {
    animation: none !important;
    transition: none !important;
  }
  .motion .reveal { opacity: 1; transform: none; clip-path: none; }
}
