/* =========================================================
   Phulwari Art — motion & glow layer
   Sits on top of style.css and adds life: scroll reveals,
   hero glow, marquee, hover depth and a scroll progress bar.

   Rules of engagement:
   - Nothing is hidden without JS (html.motion is added by script).
   - Reveals move, never fade text, so contrast never changes and a
     half-revealed paragraph is still readable.
   - Revealed elements are only transformed while they are pending,
     so hover effects live on children (image, media, arrow) and
     never fight the reveal transform.
   - Everything decorative stops under prefers-reduced-motion.
   ========================================================= */

/* 0. First-viewport entrance -------------------------------- */
/* .enter-ready is set by a tiny inline script in <head>, before CSS is
   parsed. The animation therefore starts from its hidden/raised frame on
   the very first paint — there is no final-position flash and no jump.
   It is a CSS animation, not a JS-added transition, so it still finishes
   safely if the rest of the script layer fails to load. */
html.enter-ready .hero__copy > *,
html.enter-ready .hero__media,
html.enter-ready .page-hero > .wrap > * {
  animation: enter-up 0.72s cubic-bezier(0.22, 0.68, 0.16, 1) both;
  animation-delay: var(--enter-d, 0ms);
}

html.enter-ready .hero__copy > *:nth-child(1),
html.enter-ready .page-hero > .wrap > *:nth-child(1) {
  --enter-d: 30ms;
}

html.enter-ready .hero__copy > *:nth-child(2),
html.enter-ready .page-hero > .wrap > *:nth-child(2) {
  --enter-d: 100ms;
}

html.enter-ready .hero__copy > *:nth-child(3),
html.enter-ready .page-hero > .wrap > *:nth-child(3) {
  --enter-d: 170ms;
}

html.enter-ready .hero__copy > *:nth-child(4) {
  --enter-d: 240ms;
}

html.enter-ready .hero__copy > *:nth-child(5) {
  --enter-d: 310ms;
}

html.enter-ready .hero__media {
  --enter-d: 150ms;
}

@keyframes enter-up {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* 1. Scroll reveal ----------------------------------------- */
html.motion .m-reveal {
  transition: transform 0.9s cubic-bezier(0.22, 0.68, 0.16, 1);
  transition-delay: var(--d, 0ms);
  will-change: transform;
}

html.motion .m-reveal:not(.m-in) {
  transform: translate3d(0, 26px, 0);
}

html.motion .m-reveal.m-in {
  will-change: auto;
}

/* The hero is the one entrance that should read as a single, quick
   gesture: same 80ms stagger, shorter travel time, and the image lands
   just after the words instead of racing them. */
html.motion .hero__copy > .m-reveal,
html.motion .hero__media.m-reveal {
  transition-duration: 0.72s;
}

html.motion .hero__media.m-reveal {
  transition-delay: 140ms;
}

/* 2. Hero — deep resin panel ------------------------------- */
/* The panel's own gradients live in style.css; this layer is the
   moving light on top of them, so the block never looks like a
   flat dark rectangle. */
.hero::before {
  content: "";
  position: absolute;
  inset: -18% -12%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.9;
  background:
    radial-gradient(38% 34% at 14% 12%, rgba(229, 169, 124, 0.22), transparent 68%),
    radial-gradient(32% 28% at 86% 6%, rgba(201, 148, 74, 0.18), transparent 70%),
    radial-gradient(40% 34% at 68% 92%, rgba(176, 74, 44, 0.16), transparent 72%);
  filter: blur(6px);
}

.hero::after {
  content: "";
  position: absolute;
  left: -4%;
  bottom: -12%;
  width: clamp(220px, 30vw, 400px);
  aspect-ratio: 120 / 160;
  z-index: 0;
  opacity: 0.06;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 160' fill='none' stroke='%23fbf7f0' stroke-width='1.4' stroke-linecap='round'%3E%3Cpath d='M60 152V30'/%3E%3Cpath d='M60 126c-19 0-32-10-33-27 18-2 31 9 33 27Z'/%3E%3Cpath d='M60 126c19 0 32-10 33-27-18-2-31 9-33 27Z'/%3E%3Cpath d='M60 94c-14 0-24-8-25-22 14-1 24 8 25 22Z'/%3E%3Cpath d='M60 94c14 0 24-8 25-22-14-1-24 8-25 22Z'/%3E%3Cpath d='M60 64c-9 0-15-5-15-14 9-1 14 5 15 14Z'/%3E%3Cpath d='M60 64c9 0 15-5 15-14-9-1-14 5-15 14Z'/%3E%3Ccircle cx='60' cy='28' r='6'/%3E%3C/svg%3E")
    center / contain no-repeat;
}

.hero > .wrap {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .hero::before {
    animation: hero-glow 18s ease-in-out infinite alternate;
  }

  .hero__stamp {
    animation: float 9s ease-in-out infinite;
  }
}

@keyframes hero-glow {
  0% {
    transform: translate3d(-2%, 1%, 0) scale(1);
  }
  100% {
    transform: translate3d(2%, -2%, 0) scale(1.08);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-2deg);
  }
  50% {
    transform: translate3d(0, -9px, 0) rotate(1.5deg);
  }
}

/* The script drives the frame image transform for parallax. */
.hero__frame img {
  transition: none;
  will-change: transform;
}

.hero__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  border: 1px solid rgba(251, 247, 240, 0.2);
  pointer-events: none;
}

.hero__card {
  transition: transform 0.5s cubic-bezier(0.22, 0.68, 0.16, 1),
    box-shadow 0.5s ease;
}

.hero__media:hover .hero__card {
  transform: translateY(-4px);
  box-shadow: 0 28px 54px -30px rgba(0, 0, 0, 0.85);
}

/* 3. Marquee band ------------------------------------------ */
.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  background: var(--paper-2);
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 7%,
    #000 93%,
    transparent
  );
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 7%,
    #000 93%,
    transparent
  );
}

.marquee__track {
  display: flex;
  width: max-content;
}

.marquee__row {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 36px);
  padding-block: 14px;
  padding-right: clamp(16px, 2.4vw, 36px);
  flex: none;
}

.marquee__row span {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}

.marquee__row em {
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.9rem;
  line-height: 1;
  color: var(--clay);
}

@media (prefers-reduced-motion: no-preference) {
  .marquee__track {
    animation: marquee 52s linear infinite;
  }

  .marquee:hover .marquee__track {
    animation-play-state: paused;
  }
}

@keyframes marquee {
  to {
    transform: translate3d(-50%, 0, 0);
  }
}

/* 4. Buttons & links --------------------------------------- */
/* Base fill + hover live in style.css. Here only the depth: footer links
   nudge with a matching curve. Letter-spacing is deliberately not
   animated — it reflows the label and reads as a shimmer, not movement. */
.footer__col a {
  display: inline-block;
  transition: color 0.3s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.footer__col a:hover {
  transform: translateX(3px);
}

/* 5. Product tiles ----------------------------------------- */
/* The tile itself lifts, the photo inside eases in a touch, the arrow
   slides. All three share one curve so the card moves as one object. */
.card__media {
  transition: border-color 0.3s cubic-bezier(0.22, 0.61, 0.36, 1),
    background-color 0.3s cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.card:hover .card__media {
  transform: translateY(-4px);
  box-shadow: 0 26px 44px -34px rgba(26, 20, 16, 0.65),
    inset 0 0 0 1px rgba(26, 20, 16, 0.04);
}

/* Category tints — only show behind the drawn fallback; real photos
   stay on their white product background. */
[data-cat~="mould"] .card__media {
  background: #f4e9e0;
}

[data-cat~="pigment"] .card__media {
  background: #f6ecda;
}

[data-cat~="tool"] .card__media {
  background: #eeece2;
}

[data-cat~="kit"] .card__media {
  background: #f2e7df;
}

[data-cat~="decal"] .card__media {
  background: #f7ece7;
}

[data-cat~="amazon"] .card__media {
  background: #f1ede4;
}

.card:hover [class^="card__media"] {
  background: var(--paper-3);
}

.card .card__media:has(img),
.card:hover .card__media:has(img) {
  background: #fff;
}

.card .link-arrow svg,
.bp__buy .link-arrow svg {
  transition: transform 0.35s cubic-bezier(0.22, 0.68, 0.16, 1);
}

.card:hover .link-arrow svg,
.bp__buy:hover .link-arrow svg {
  transform: translateX(4px);
}

/* 6. Rows & bands ------------------------------------------ */
/* The step number shifts colour only. Animating its letter-spacing made
   the whole row shuffle sideways on hover, which read as a glitch. */
.step::before {
  transition: color 0.4s ease;
}

.step:hover::before {
  color: var(--clay);
}

.proof,
.amazon-band {
  transition: box-shadow 0.5s ease, border-color 0.4s ease;
}

.amazon-band:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lg);
}

.proof:hover {
  box-shadow: 0 46px 90px -50px rgba(0, 0, 0, 0.85);
}

/* Tiny live pulse on the "real replies" dots. */
.note-row .dot {
  position: relative;
}

.note-row .dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(61, 74, 53, 0.35);
}

@media (prefers-reduced-motion: no-preference) {
  .note-row .dot::after {
    animation: ping 3.2s ease-out infinite;
  }
}

@keyframes ping {
  0% {
    transform: scale(0.8);
    opacity: 0.9;
  }
  60%,
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

/* 7. Gallery ----------------------------------------------- */
.gallery figcaption {
  transition: color 0.35s ease;
}

.gallery figure:hover figcaption {
  color: var(--ink-2);
}

/* 8. Dark bands -------------------------------------------- */
.section--dark {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.section--dark::after {
  content: "";
  position: absolute;
  inset: -45%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(34% 34% at 22% 30%, rgba(229, 169, 124, 0.16), transparent 70%),
    radial-gradient(30% 30% at 78% 68%, rgba(201, 148, 74, 0.14), transparent 72%);
}

@media (prefers-reduced-motion: no-preference) {
  .section--dark::after {
    animation: drift 24s ease-in-out infinite alternate;
  }
}

@keyframes drift {
  0% {
    transform: translate3d(-3%, 2%, 0) scale(1);
  }
  100% {
    transform: translate3d(4%, -3%, 0) scale(1.12);
  }
}

.section--dark > .wrap {
  position: relative;
  z-index: 1;
}

/* 9. Header & scroll progress ------------------------------ */
.site-header.is-stuck {
  background: rgba(251, 247, 240, 0.94);
  box-shadow: 0 18px 34px -30px rgba(26, 20, 16, 0.6);
}

.brand__mark {
  transition: transform 0.6s cubic-bezier(0.22, 0.68, 0.16, 1);
}

.brand:hover .brand__mark {
  transform: rotate(-8deg) scale(1.06);
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 120;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(90deg, var(--clay-dark), var(--clay), var(--gold-light, #e0b070));
  pointer-events: none;
  transition: width 0.12s linear;
}

/* 10. Filter chips ----------------------------------------- */
/* Chips keep a 2px lift while selected so the active one sits proud of
   the row. The lift, shadow and colour all live in style.css. */
.filter[aria-pressed="true"] {
  transform: translateY(-2px);
}

.filter[aria-pressed="true"]:active {
  transform: translateY(0) scale(0.97);
}

/* 11. Page heads ------------------------------------------- */
.page-hero::before {
  content: "";
  position: absolute;
  inset: auto -10% -60% 40%;
  z-index: 0;
  height: 160%;
  pointer-events: none;
  background: radial-gradient(
    45% 45% at 50% 50%,
    rgba(229, 169, 124, 0.16),
    transparent 70%
  );
}

.page-hero > .wrap {
  position: relative;
  z-index: 1;
}

/* 12. Reduced motion: keep tints, drop movement ------------ */
@media (prefers-reduced-motion: reduce) {
  .hero::before,
  .hero__stamp,
  .marquee__track,
  .section--dark::after,
  .note-row .dot::after {
    animation: none;
  }

  html.enter-ready .hero__copy > *,
  html.enter-ready .hero__media,
  html.enter-ready .page-hero > .wrap > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .card:hover .card__media,
  .filter:hover,
  .filter:active,
  .filter[aria-pressed="true"],
  .filter[aria-pressed="true"]:active,
  .btn:hover,
  .btn:active,
  .btn:focus-visible,
  .socials a:hover,
  .socials a:active,
  .btn:hover .ico,
  .btn:focus-visible .ico,
  .link-arrow:hover svg,
  .link-arrow:focus-visible svg,
  .play-facade:hover .play-facade__btn,
  .play-facade:active .play-facade__btn,
  .feature__media:hover img,
  .hero__card:hover .hero__card__play,
  .hero__card:focus-visible .hero__card__play,
  .hero__card:active .hero__card__play,
  .nav-toggle:active {
    transform: none;
  }

  /* The hover fill still shows, it just appears instead of moving. */
  .btn::before {
    opacity: 0;
  }

  .btn:hover::before,
  .btn:focus-visible::before {
    opacity: 1;
  }

  /* The gloss sweep is pure decoration — drop it entirely. */
  .btn--solid::after {
    display: none;
  }
}
