/*
  Motion layer for /studio2/.

  Everything here is additive: strip this file and the page is still a correct,
  readable daylight-system page. Every effect is disabled under
  prefers-reduced-motion — that rule lives at the bottom so it always wins.
*/

/* ── scroll reveal ─────────────────────────────────────────────────────── */
/*
  Driven by animation, not transition, on purpose: components like .wall-tile
  and .tilt declare their own `transition` shorthand, which resets
  transition-delay and would silently kill both the fade and the stagger.
  An animation cannot be clobbered that way.
*/
.reveal { opacity: 0; }
.reveal.in {
  animation: reveal-rise .7s cubic-bezier(.22, .61, .36, 1) var(--reveal-delay, 0ms) both;
  will-change: opacity, transform;
}
/* Once played we drop the animation, otherwise its `transform: none` end state
   outranks the hover transforms on .wall-tile / .tilt for the rest of the page. */
.reveal.done { opacity: 1; animation: none; will-change: auto; }

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

/* ── hero word stagger ─────────────────────────────────────────────────── */
.word {
  display: inline-block;
  opacity: 0;
  transform: translateY(.5em) rotate(1.5deg);
  animation: word-rise .85s cubic-bezier(.22, .61, .36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 65ms);
}
@keyframes word-rise {
  to { opacity: 1; transform: none; }
}

/* ── drifting accent bloom ─────────────────────────────────────────────── */
.aurora {
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 70%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(closest-side, rgba(200, 243, 29, .40), transparent 70%) 18% 30% / 46% 78% no-repeat,
    radial-gradient(closest-side, rgba(200, 243, 29, .22), transparent 70%) 74% 12% / 52% 66% no-repeat;
  filter: blur(6px);
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-3%, 0, 0) scale(1); }
  to   { transform: translate3d(4%, 4%, 0) scale(1.12); }
}

/* ── logo marquee ──────────────────────────────────────────────────────── */
.marquee {
  overflow: hidden;
  /* fade the ends instead of hard-cutting them */
  -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;
  width: max-content;
  animation: slide var(--speed, 46s) linear infinite;
  animation-direction: var(--dir, normal);
}
/*
  Spacing is margin, NOT gap, and that is load-bearing.
  The track holds the row twice and slides by -50%. With `gap`, a doubled row of
  n items is 2S + (2n-1)g wide, so half of it is half a gap short of one full
  copy — the loop drifts by 6px every pass and the seam visibly stutters.
  A trailing margin makes each copy exactly S + n*g, so -50% lands dead on it.
*/
.marquee-track > * { margin-right: .75rem; }
.marquee:hover .marquee-track { animation-play-state: paused; }
/* the track holds the row twice; -50% lands exactly on the seam */
@keyframes slide {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* ── tech marks ────────────────────────────────────────────────────────── */
.tech {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1.15rem;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--lift);
  white-space: nowrap;
  transition: transform .25s cubic-bezier(.22, .61, .36, 1), box-shadow .25s ease;
}
.tech:hover { transform: translateY(-3px); box-shadow: var(--lift-hi); }
.tech .mark {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  /* calm at rest, brand colour on hover */
  fill: var(--ink);
  opacity: .55;
  transition: fill .25s ease, opacity .25s ease, transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.tech:hover .mark {
  fill: var(--brand, var(--ink));
  opacity: 1;
  transform: scale(1.14) rotate(-6deg);
}
.tech-label { font-size: .875rem; font-weight: 600; }

/* ── logo wall: spotlight follows the cursor ───────────────────────────── */
.wall { position: relative; }
.wall::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 2rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s ease;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%),
              rgba(200, 243, 29, .30), transparent 70%);
}
.wall:hover::before { opacity: 1; }

.wall-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  aspect-ratio: 1;
  border-radius: 1.25rem;
  background: var(--card);
  box-shadow: var(--lift);
  transition: transform .3s cubic-bezier(.22, .61, .36, 1), box-shadow .3s ease;
}
.wall-tile:hover { transform: translateY(-4px) scale(1.04); box-shadow: var(--lift-hi); }
.wall-tile .mark {
  width: 1.85rem;
  height: 1.85rem;
  fill: var(--ink);
  opacity: .5;
  transition: fill .28s ease, opacity .28s ease, transform .45s cubic-bezier(.34, 1.56, .64, 1);
}
.wall-tile:hover .mark { fill: var(--brand); opacity: 1; transform: scale(1.16); }
.wall-tile span {
  font-size: .6875rem;
  font-weight: 600;
  color: var(--muted);
  transition: color .28s ease;
}
.wall-tile:hover span { color: var(--ink); }

/* ── big type ticker ───────────────────────────────────────────────────── */
.ticker { overflow: hidden; }
.ticker-track {
  display: flex;
  width: max-content;
  align-items: center;
  animation: slide 34s linear infinite;
}
.ticker-track > * { margin-right: 2.5rem; }   /* margin not gap — see .marquee-track */
.ticker-item {
  font-weight: 800;
  letter-spacing: -.03em;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
  white-space: nowrap;
}
.ticker-dot { width: .55rem; height: .55rem; border-radius: 999px; background: var(--accent-dark); flex: none; }

/* ── counters + card tilt ──────────────────────────────────────────────── */
.count { font-variant-numeric: tabular-nums; }

.tilt { transition: transform .35s cubic-bezier(.22, .61, .36, 1), box-shadow .35s ease; transform-style: preserve-3d; }
.tilt:hover { box-shadow: var(--lift-hi); }

/* ── drawn networks (city, transit line) ───────────────────────────────── */
/* rails are palette blue, never near-black — they must read on slate */
.rail { stroke: var(--muted, #7a92a2); stroke-opacity: .55; stroke-width: 1.5; fill: none; }
.flow {
  stroke: var(--candy, #b2d5e5);
  stroke-width: 1.5;
  fill: none;
  stroke-dasharray: .012 .075;   /* pathLength="1" on the path makes these unit-relative */
  animation: flow-dash 3.2s linear infinite;
}
@keyframes flow-dash { to { stroke-dashoffset: -1; } }

/* rails draw themselves in when their .reveal parent enters the viewport */
.draw { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.reveal.in .draw { animation: draw-path .9s cubic-bezier(.4, 0, .2, 1) var(--draw-delay, 0ms) forwards; }
@keyframes draw-path { to { stroke-dashoffset: 0; } }

.halo {
  transform-box: fill-box;
  transform-origin: center;
  animation: halo-ping 2.8s ease-out infinite;
}
@keyframes halo-ping {
  0% { transform: scale(.55); opacity: .9; }
  70%, 100% { transform: scale(1.9); opacity: 0; }
}

.float-y { animation: float-y 7s ease-in-out infinite alternate; }
@keyframes float-y { to { transform: translateY(-9px); } }

/* pointer parallax: motion.js writes the transform, this eases it */
[data-parallax] { transition: transform .25s ease-out; will-change: transform; }

/* storefront windows light up one by one on load */
.winlight { opacity: 0; animation: light-on .5s ease calc(var(--i, 0) * 120ms + .4s) forwards; }
@keyframes light-on { to { opacity: .55; } }

/* ── the one thing that overrides everything ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.in { opacity: 1; transform: none; animation: none; }
  .word { opacity: 1; transform: none; animation: none; }
  .aurora { animation: none; }
  .marquee-track,
  .ticker-track { animation: none; transform: none; }
  .marquee { -webkit-mask-image: none; mask-image: none; }
  .marquee-track { flex-wrap: wrap; width: auto; justify-content: center; }
  .marquee-track > * { margin: 0 .375rem .5rem; }
  .tech, .wall-tile, .tilt { transition: none; }
  .tech:hover, .wall-tile:hover { transform: none; }
  .flow { animation: none; stroke-dasharray: none; opacity: .45; }
  .draw { stroke-dashoffset: 0; }
  .reveal.in .draw { animation: none; }
  .halo, .float-y { animation: none; }
  .flow-dot { display: none; }   /* SMIL ignores this media query; hide the dots instead */
  .winlight { animation: none; opacity: .55; }
  [data-parallax] { transition: none; }
}
