/* ============================================================
   WEED SAMURAI -- Animations & scroll reveals
   ============================================================ */

/* ---- Scroll reveal (driven by IntersectionObserver in site.js) ---- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
  will-change: opacity, transform;
}
[data-reveal="left"]  { transform: translateX(-36px); }
[data-reveal="right"] { transform: translateX(36px); }
[data-reveal="scale"] { transform: scale(0.94); }
[data-reveal].is-in { opacity: 1; transform: none; }

/* stagger children */
[data-reveal-stagger] > * {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
[data-reveal-stagger].is-in > * { opacity: 1; transform: none; }
[data-reveal-stagger].is-in > *:nth-child(1) { transition-delay: 0.05s; }
[data-reveal-stagger].is-in > *:nth-child(2) { transition-delay: 0.13s; }
[data-reveal-stagger].is-in > *:nth-child(3) { transition-delay: 0.21s; }
[data-reveal-stagger].is-in > *:nth-child(4) { transition-delay: 0.29s; }
[data-reveal-stagger].is-in > *:nth-child(5) { transition-delay: 0.37s; }
[data-reveal-stagger].is-in > *:nth-child(6) { transition-delay: 0.45s; }
[data-reveal-stagger].is-in > *:nth-child(7) { transition-delay: 0.53s; }
[data-reveal-stagger].is-in > *:nth-child(8) { transition-delay: 0.61s; }

/* ---- Blade-wipe reveal (a slash that uncovers content) ---- */
.blade-wipe { position: relative; overflow: hidden; }
.blade-wipe::after {
  content: ""; position: absolute; inset: 0; background: var(--ink-900);
  transform-origin: right; transition: transform 0.8s var(--ease-blade);
}
.blade-wipe.is-in::after { transform: scaleX(0); }

/* ---- Hero ambient: drifting mist + glow pulse ---- */
@keyframes drift {
  0%   { transform: translate3d(0,0,0); }
  50%  { transform: translate3d(-3%, 2%, 0); }
  100% { transform: translate3d(0,0,0); }
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.9; }
}
@keyframes float-y {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
@keyframes scan {
  0%   { transform: translateY(-100%); opacity: 0; }
  10%  { opacity: 0.6; }
  100% { transform: translateY(100%); opacity: 0; }
}
@keyframes spin-slow { to { transform: rotate(360deg); } }

.float { animation: float-y 6s var(--ease-out) infinite; }
.float--slow { animation-duration: 9s; }

.hero-mist {
  position: absolute; inset: -10%;
  background:
    radial-gradient(40% 30% at 70% 20%, rgba(52,245,163,0.10), transparent 70%),
    radial-gradient(35% 28% at 20% 60%, rgba(255,77,77,0.07), transparent 70%);
  animation: drift 14s ease-in-out infinite; pointer-events: none; z-index: 0;
}

/* katana scanline that sweeps over TV frames */
.scanline { position: relative; overflow: hidden; }
.scanline::before {
  content: ""; position: absolute; left: 0; right: 0; height: 40%;
  background: linear-gradient(180deg, transparent, rgba(52,245,163,0.12), transparent);
  animation: scan 5s linear infinite; pointer-events: none; z-index: 3;
}

/* ---- Animated gradient text shimmer for hero word ---- */
@keyframes shimmer { to { background-position: 200% center; } }
.shimmer {
  background: linear-gradient(100deg, var(--mist) 20%, var(--jade-400) 40%, var(--jade-600) 50%, var(--jade-400) 60%, var(--mist) 80%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 6s linear infinite;
}

/* ---- Marquee (logos / vendor strip) ---- */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee__track { display: flex; gap: 3rem; width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---- Animated counter baseline (JS adds numbers) ---- */
.count { font-variant-numeric: tabular-nums; }

/* ---- Ink-brush underline that draws in ---- */
.brush-underline { position: relative; display: inline-block; }
.brush-underline::after {
  content: ""; position: absolute; left: 0; bottom: -0.12em; height: 0.18em; width: 100%;
  background: var(--grad-dawn); border-radius: 2px;
  transform: scaleX(0); transform-origin: left; transition: transform 0.7s var(--ease-blade) 0.3s;
}
.brush-underline.is-in::after, [data-reveal].is-in .brush-underline::after { transform: scaleX(1); }

/* ---- Reduced motion: respect user preference ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  [data-reveal], [data-reveal-stagger] > * { opacity: 1 !important; transform: none !important; }
  .blade-wipe::after { display: none; }
}

/* ---- Screenshot mode: force-paint reveals + suppress animated chrome.
       Belt + suspenders for the Playwright screenshotter -- the JS force-paint
       in scripts/screenshot-all-pages.py is the primary mechanism, this CSS
       guarantees the void can't reappear if that JS glitches or a future page
       adds a new reveal class without updating the screenshotter. ---- */
body[data-screenshot] [data-reveal],
body[data-screenshot] [data-reveal-stagger],
body[data-screenshot] [data-reveal-stagger] > *,
body[data-screenshot] .blade-wipe,
body[data-screenshot] .brush-underline { opacity: 1 !important; transform: none !important; }
body[data-screenshot] .blade-wipe::after { display: none !important; }
body[data-screenshot] .tw-caret,
body[data-screenshot] #arcCaret { display: none !important; }
body[data-screenshot] .ws-ab { display: none !important; }
