/* Motion layer for the Accretia storefront — entrances, sliced text, card
   sheen. Everything respects prefers-reduced-motion. */

:root {
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html {
  scroll-behavior: smooth;
}

/* ── Scroll reveals ────────────────────────────────────────────────────────── */

[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.8s var(--ease-out) var(--d, 0ms),
    transform 0.8s var(--ease-out) var(--d, 0ms),
    clip-path 0.9s var(--ease-out) var(--d, 0ms);
  will-change: opacity, transform;
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* Headings slice in from the left */
h2[data-reveal] {
  opacity: 1;
  transform: none;
  clip-path: inset(0 100% 0 0);
}

h2[data-reveal].is-revealed {
  clip-path: inset(0 0 0 0);
}

/* Sliced words inside hero titles */
.hero-slide.is-active h1 .wm {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.hero-slide.is-active h1 .word {
  display: inline-block;
  animation: word-rise 0.7s var(--ease-out) both;
  animation-delay: calc(var(--w, 0) * 55ms + 240ms);
}

@keyframes word-rise {
  from {
    transform: translateY(112%);
  }
  to {
    transform: none;
  }
}

/* Hidden slides keep their words neutral so they animate on activation */
.hero-slide:not(.is-active) h1 .word,
.hero-slide h1 .wm {
  transform: none;
}

/* Hero copy: staggered rise whenever a slide becomes active */
.hero-slide .hero-content > * {
  opacity: 0;
}

.hero-slide.is-active .hero-content > * {
  animation: hero-rise 0.75s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 110ms + 160ms);
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Hero photo: wipe across the frame on activation */
.hero-slide .hero-photo {
  clip-path: inset(4% 0 4% 100%);
  transform: scale(1.06);
}

.hero-slide.is-active .hero-photo {
  animation: photo-wipe 1.05s var(--ease-out) both;
}

@keyframes photo-wipe {
  from {
    clip-path: inset(4% 0 4% 100%);
    transform: scale(1.07);
  }
  to {
    clip-path: inset(4% 0 4% 0);
    transform: none;
  }
}

/* ── Product cards ─────────────────────────────────────────────────────────── */

.product-visual {
  overflow: hidden;
}

.product-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    115deg,
    transparent 32%,
    rgba(255, 255, 255, 0.38) 47%,
    rgba(255, 255, 255, 0.12) 55%,
    transparent 66%
  );
  transform: translateX(-135%);
  transition: transform 0.9s var(--ease-out);
  pointer-events: none;
}

.product-card:hover .product-visual::after {
  transform: translateX(135%);
}

.product-visual .product-photo {
  transition: transform 0.6s var(--ease-out);
}

.product-card:hover .product-visual .product-photo {
  transform: scale(1.045);
}

.product-card {
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s var(--ease-out);
}

/* ── Dialog ────────────────────────────────────────────────────────────────── */

.product-dialog[open] {
  animation: dialog-in 0.4s var(--ease-out);
}

.product-dialog[open]::backdrop {
  animation: backdrop-in 0.4s var(--ease-out);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ── Cart badge pop ────────────────────────────────────────────────────────── */

.cart-count.pulse {
  animation: badge-pop 0.45s var(--ease-out);
}

@keyframes badge-pop {
  35% {
    transform: scale(1.35);
  }
  70% {
    transform: scale(0.92);
  }
}

/* ── Reduced motion ────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  [data-reveal],
  .hero-slide .hero-content > *,
  .hero-slide .hero-photo,
  .hero-slide.is-active h1 .word {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    animation: none !important;
    transition: none !important;
  }
}
