/* Wolo Labs — motion
   Entrance animations for the home page, driven by assets/js/main.js.
   Nothing is hidden unless <html> carries `wl-motion`, which the inline script in
   <head> only sets when the visitor has not asked for reduced motion. With scripts
   off, or motion off, the page renders exactly as the static export.

   Animations use the individual `translate` / `scale` / `rotate` properties so they
   compose with the inline `transform`s the design canvas exported. */

:root {
  --wl-ease:     cubic-bezier(.2, .7, .3, 1);  /* same curve as the product panels */
  --wl-ease-out: cubic-bezier(.16, 1, .3, 1);  /* longer, softer landing for big moves */
  --wl-wipe:     cubic-bezier(.7, 0, .2, 1);
}

/* Side-entering blocks start 44px off to the right; don't let that widen the page.
   Clip on the page wrapper, not <body>: body overflow is handed to the viewport,
   which on phones leaves the layout 44px wider while the block slides in. */
.wl-motion .wl-home { overflow-x: clip; }

/* ---- Keyframes ---------------------------------------------------------- */
/* Most only declare `from`: they animate back to whatever the element already is. */
@keyframes wl-up       { from { opacity: 0; translate: 0 36px; } }
@keyframes wl-down     { from { opacity: 0; translate: 0 -18px; } }
@keyframes wl-left     { from { opacity: 0; translate: -44px 0; } }
@keyframes wl-right    { from { opacity: 0; translate: 44px 0; } }
@keyframes wl-fade     { from { opacity: 0; } }
@keyframes wl-rise     { from { translate: 0 140%; } }
@keyframes wl-curtain  { from { clip-path: inset(100% 0 0 0); } }
@keyframes wl-settle   { from { scale: 1.18; } }
@keyframes wl-draw     { from { clip-path: inset(0 100% 0 0); } }
@keyframes wl-unwhite  { from { color: #f4f4f4; } }
@keyframes wl-grow     { from { scale: 0 1; } }
@keyframes wl-pop {
  0%  { opacity: 0; scale: .3; rotate: -90deg; }
  70% { opacity: 1; scale: 1.08; }
}
@keyframes wl-piece-in {
  from { opacity: 0; translate: 0 70px; scale: .6; filter: blur(10px); }
}
@keyframes wl-float    { to { translate: 0 -14px; } }
@keyframes wl-marquee  { to { translate: -50% 0; } }
@keyframes wl-pulse    { from { opacity: .7; scale: 1; } to { opacity: 0; scale: 1.7; } }
@keyframes wl-chev     { 0%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---- Hero: plays once, when fonts are in (`is-ready`) ------------------- */
/* Headline lines rise out of a mask. The padding/negative margin pair keeps
   ascenders and the italic descenders of "play" from being clipped. */
.wl-line { display: block; overflow: hidden; padding: .14em 0 .22em; margin: -.14em 0 -.22em; }
.wl-line > span { display: block; }

.wl-motion:not(.is-ready) :is(.wl-nav, .wl-hero-up, .wl-piece, .wl-board) { opacity: 0; }
.wl-motion:not(.is-ready) .wl-line > span { translate: 0 140%; }
.wl-motion:not(.is-ready) .wl-strike { clip-path: inset(0 100% 0 0); }

.wl-motion.is-ready .wl-nav       { animation: wl-down .9s var(--wl-ease-out) .1s both; }
.wl-motion.is-ready .wl-line > span { animation: wl-rise 1.1s var(--wl-ease-out) var(--d, 0s) both; }
.wl-motion.is-ready .wl-strike    { animation: wl-draw .6s var(--wl-wipe) 1s both; }
.wl-motion.is-ready .wl-struck    { animation: wl-unwhite .6s ease 1.05s both; }
.wl-motion.is-ready .wl-hero-up   { animation: wl-up 1s var(--wl-ease-out) var(--d, 0s) both; }
.wl-motion.is-ready .wl-board     { animation: wl-fade 1.6s ease .2s both; }
.wl-motion.is-ready .wl-piece {
  animation:
    wl-piece-in 1.3s var(--wl-ease-out) var(--d, .4s) both,
    wl-float var(--float, 6s) ease-in-out calc(var(--d, .4s) + 1.3s) infinite alternate;
}

/* The Atlas 64 board, lying flat behind the headline. Cells are added by main.js. */
.wl-board {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: -14%;
  width: min(1100px, 160vw);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  transform: translateX(-50%) perspective(1400px) rotateX(64deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 30%, transparent 100%);
  pointer-events: none;
}
.wl-board > span {
  border-radius: 6px;
  background: rgba(244, 244, 244, .03);
  border: 1px solid rgba(244, 244, 244, .06);
  transition: background-color 1.6s ease, box-shadow 1.6s ease;
}
.wl-board > span.is-lit {
  background: rgba(144, 215, 0, .42);
  box-shadow: 0 0 28px rgba(144, 215, 0, .35);
  transition-duration: .15s;
}

/* ---- Ticker ------------------------------------------------------------- */
/* Without motion: one centred, wrapping row. With motion: an endless marquee
   (main.js clones the set until it covers two screen widths). */
.wl-ticker-track { display: flex; justify-content: center; }
.wl-ticker-set   { display: flex; flex-wrap: wrap; justify-content: center; gap: 36px; padding: 0 24px; }

.wl-motion .wl-ticker-track.is-filled {
  justify-content: flex-start;
  width: max-content;
  animation: wl-marquee 40s linear infinite;
}
.wl-motion .is-filled .wl-ticker-set { flex: none; flex-wrap: nowrap; padding: 0 36px 0 0; }
.wl-motion .wl-ticker:hover .wl-ticker-track { animation-play-state: paused; }

/* ---- Scroll reveals ----------------------------------------------------- */
/* data-reveal="up|left|right|fade|curtain|pop"  animates the element itself.
   data-reveal-group="up|left|right"             staggers its direct children.
   --delay on either shifts the start. main.js adds `is-in` on first sight. */
.wl-motion [data-reveal]:not(.is-in),
.wl-motion [data-reveal-group]:not(.is-in) > * { opacity: 0; }

.wl-motion .is-in[data-reveal],
.wl-motion .is-in[data-reveal-group] > * {
  animation: wl-up .95s var(--wl-ease-out) calc(var(--delay, 0s) + var(--i, 0) * 90ms) both;
}
.wl-motion :is(.is-in[data-reveal="left"],  .is-in[data-reveal-group="left"] > *)  { animation-name: wl-left; }
.wl-motion :is(.is-in[data-reveal="right"], .is-in[data-reveal-group="right"] > *) { animation-name: wl-right; }
.wl-motion .is-in[data-reveal="fade"] { animation-name: wl-fade; }

/* Product panels wipe up from the bottom while the photo settles. */
.wl-motion .is-in[data-reveal="curtain"] {
  animation: wl-curtain 1.3s var(--wl-wipe) var(--delay, 0s) both;
}
.wl-motion .is-in[data-reveal="curtain"] .wl-shot {
  animation: wl-settle 1.8s var(--wl-ease-out) var(--delay, 0s) both;
}
.wl-motion .is-in[data-reveal="curtain"] .wl-prod-body {
  animation: wl-up 1s var(--wl-ease-out) calc(var(--delay, 0s) + .55s) both;
}

.wl-motion .is-in[data-reveal="pop"] {
  animation: wl-pop .8s var(--wl-ease-out) var(--delay, 0s) both;
}

/* System loop: the >>> between steps keeps pulsing once visible. */
.wl-motion .is-in .wl-chev > span { animation: wl-chev 1.6s ease-in-out infinite; }
.wl-motion .is-in .wl-chev > span:nth-child(2) { animation-delay: .2s; }
.wl-motion .is-in .wl-chev > span:nth-child(3) { animation-delay: .4s; }

/* Manifesto axis: both worlds slide in, their lines meet, Wolo pops in between. */
.wl-motion [data-reveal="axis"]:not(.is-in) { opacity: 1; }
.wl-motion .is-in[data-reveal="axis"] { animation: none; }
.wl-motion [data-reveal="axis"]:not(.is-in) :is(.wl-axis-from, .wl-axis-to, .wl-axis-badge, .wl-axis-tag) { opacity: 0; }
.wl-motion [data-reveal="axis"]:not(.is-in) .wl-axis-line { scale: 0 1; }

.wl-axis-l { transform-origin: left center; }
.wl-axis-r { transform-origin: right center; }
.wl-axis-badge { position: relative; }

.wl-motion .is-in .wl-axis-from  { animation: wl-left .9s var(--wl-ease-out) both; }
.wl-motion .is-in .wl-axis-to    { animation: wl-right .9s var(--wl-ease-out) both; }
.wl-motion .is-in .wl-axis-line  { animation: wl-grow 1s var(--wl-wipe) .35s both; }
.wl-motion .is-in .wl-axis-badge { animation: wl-pop .9s var(--wl-ease-out) 1.15s both; }
.wl-motion .is-in .wl-axis-tag   { animation: wl-up .8s var(--wl-ease-out) 1.45s both; }

/* Stacked axis on phones: the lines grow vertically toward the badge. */
@keyframes wl-grow-y { from { scale: 1 0; } }
@media (max-width: 900px) {
  .wl-axis-l { transform-origin: center top; }
  .wl-axis-r { transform-origin: center bottom; }
  .wl-motion [data-reveal="axis"]:not(.is-in) .wl-axis-line { scale: 1 0; }
  .wl-motion .is-in .wl-axis-line { animation-name: wl-grow-y; }
}

/* Mobile menu links drop in one after another. */
.wl-motion .wl-nav.is-open .wl-menu a {
  animation: wl-down .45s var(--wl-ease-out) calc(var(--i, 0) * 40ms) both;
}

.wl-motion .is-in .wl-axis-badge::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--spring-bud);
  border-radius: inherit;
  animation: wl-pulse 2.4s ease-out 2s infinite;
  opacity: 0;
}
