/* =========================================================
   Flow layer: ambient light, scroll rail, marquee connectors
   and the pinned projects showcase. Everything here animates
   transform/opacity only, so it stays smooth on phones.
   The .flow class is added by JS when motion is allowed;
   without it the page falls back to a plain static layout.
   ========================================================= */

/* ---------- Ambient light that travels with the scroll ---------- */
.flow-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.flow-bg__orb { position: absolute; width: 90vmax; height: 90vmax; will-change: transform; }
.flow-bg__orb i { display: block; width: 100%; height: 100%; border-radius: 50%; animation: orb-drift 14s ease-in-out infinite alternate; }
.flow-bg__orb--a { top: -45vmax; right: -40vmax; }
.flow-bg__orb--a i { background: radial-gradient(closest-side, rgba(34,211,238,0.20), transparent 70%); }
.flow-bg__orb--b { bottom: -50vmax; left: -45vmax; }
.flow-bg__orb--b i { background: radial-gradient(closest-side, rgba(34,211,238,0.13), transparent 70%); animation-duration: 19s; animation-direction: alternate-reverse; }
@keyframes orb-drift {
  from { transform: translate3d(-4%, -3%, 0) scale(1); }
  to   { transform: translate3d(5%, 6%, 0) scale(1.12); }
}

/* ---------- Scroll rail ---------- */
.rail { position: fixed; top: calc(var(--nav-h) + 14px); bottom: 14px; left: 7px; width: 2px; z-index: 40; background: rgba(255,255,255,0.07); border-radius: 2px; pointer-events: none; display: none; }
.flow .rail { display: block; }
.rail__fill { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent, var(--accent)); transform: scaleY(0); transform-origin: top; border-radius: 2px; }
.rail__dot { position: absolute; top: -4px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-strong); box-shadow: 0 0 14px 3px var(--glow); }
@media (min-width: 900px) { .rail { left: 16px; } }

/* ---------- Marquee connectors ---------- */
.marquee { direction: ltr; overflow: hidden; padding-block: 22px; border-block: 1px solid var(--line); }
.proof + .marquee { border-top: 0; }
.marquee__track { display: flex; width: max-content; will-change: transform; }
.marquee__row { display: flex; align-items: center; flex: none; }
.marquee span {
  font-size: clamp(40px, 9vw, 96px); font-weight: 900; line-height: 1.1; letter-spacing: -0.02em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,0.28);
}
.marquee span:nth-of-type(3n+1) { color: var(--text); -webkit-text-stroke: 0; }
.marquee b { color: var(--accent); font-size: clamp(18px, 3vw, 30px); margin-inline: clamp(18px, 4vw, 44px); font-weight: 400; }

/* ---------- Section title accent ---------- */
.section__title::after {
  content: ""; display: block; width: 64px; height: 3px; margin-top: 14px; border-radius: 3px;
  background: var(--accent); transform: scaleX(0); transform-origin: right;
  transition: transform 700ms cubic-bezier(.2,.7,.2,1) 150ms;
}
.section__title.is-in::after, html:not(.flow) .section__title::after { transform: scaleX(1); }

/* ---------- Projects showcase ---------- */
.showcase { padding-block: 88px 72px; }
.showcase__more { margin-top: 28px; }
.phone-wrap, .showcase__ghost { display: none; }

/* Static layout (no JS / reduced motion): cards with a still from each video */
.showcase__panels { display: grid; gap: 18px; padding-inline: 20px; max-width: var(--container); margin: 40px auto 0; }
.panel { display: flex; gap: 18px; align-items: flex-start; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-3); }
.panel__thumb { width: 96px; height: auto; border-radius: 12px; flex: none; }
.panel__body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel__label { color: var(--accent); font-size: 14px; font-weight: 700; }
.panel__head { display: flex; align-items: center; gap: 12px; }
.panel__head h3 { font-size: clamp(26px, 5vw, 44px); font-weight: 900; line-height: 1.1; letter-spacing: -0.01em; }
.panel__logo { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.panel__logo--round { border-radius: 50%; }
.panel__logo--icon { display: grid; place-items: center; background: rgba(34,211,238,0.12); color: var(--accent); font-size: 24px; }
.panel__desc { color: var(--muted); font-size: 16px; max-width: 46ch; }
.panel .tile__link { margin-top: 2px; padding-top: 4px; }

/* Flow layout: sticky stage, one phone, everything driven by scroll */
.flow .showcase__track { height: calc((100svh - var(--nav-h)) + (var(--n) - 1) * 90svh); }
.flow .showcase__stage {
  position: sticky; top: var(--nav-h); height: calc(100svh - var(--nav-h)); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 14px 20px 18px; perspective: 1200px;
}
.flow .showcase__ghost {
  display: block; position: absolute; left: 0; top: 26%; z-index: 0; direction: ltr; white-space: nowrap; pointer-events: none;
  font-size: clamp(110px, 30vw, 300px); font-weight: 900; line-height: 1; letter-spacing: -0.03em;
  color: transparent; -webkit-text-stroke: 1px rgba(255,255,255,0.09); will-change: transform;
}
.flow .phone-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; z-index: 1; flex: none; }
.showcase__bars { display: flex; gap: 5px; width: 100%; direction: ltr; }
.showcase__bars span { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,0.16); overflow: hidden; }
.showcase__bars i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }
.phone {
  height: min(46svh, 520px); aspect-ratio: 9 / 16; padding: 6px; border-radius: 30px;
  background: #0b0c0e; border: 1px solid var(--line-strong);
  box-shadow: 0 30px 80px -20px rgba(34,211,238,0.35), 0 0 0 1px rgba(0,0,0,0.6);
  will-change: transform;
}
.phone__screen { position: relative; width: 100%; height: 100%; border-radius: 24px; overflow: hidden; background: #000; isolation: isolate; }
.phone__screen::after { content: ""; position: absolute; top: 8px; left: 50%; width: 30%; height: 14px; margin-left: -15%; border-radius: 10px; background: #000; z-index: 5; }
.phone__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.flow .showcase__panels { position: relative; z-index: 1; display: block; width: 100%; max-width: 520px; margin: 0; padding: 0; flex: 1 1 0; min-height: 0; }
.flow .panel { position: absolute; inset: 0 0 auto 0; padding: 0; border: 0; background: none; display: block; }
.flow .panel__thumb { display: none; }
.flow .panel__body { gap: 8px; align-items: center; text-align: center; }
.flow .panel .tile__stack { justify-content: center; }
.flow .panel__desc { font-size: 15px; line-height: 1.5; }
.flow .panel__logo { width: 36px; height: 36px; border-radius: 10px; }
.flow .panel__logo--round { border-radius: 50%; }
@media (max-width: 899px) and (max-height: 720px) {
  .flow .panel .tile__stack { display: none; }
  .phone { height: 42svh; }
}
@media (min-width: 900px) {
  .showcase { padding-block: 120px 96px; }
  .flow .showcase__stage { flex-direction: row; gap: 88px; padding: 24px 32px; }
  .flow .phone-wrap { order: 2; }
  .phone { height: min(72svh, 660px); border-radius: 38px; padding: 8px; }
  .phone__screen { border-radius: 30px; }
  .flow .showcase__panels { flex: 0 1 480px; height: 360px; }
  .flow .panel__body { align-items: flex-start; text-align: start; gap: 14px; }
  .flow .panel .tile__stack { justify-content: flex-start; }
  .flow .panel__desc { font-size: 18px; line-height: 1.6; }
  .flow .panel__logo { width: 52px; height: 52px; }
  .flow .showcase__ghost { top: 50%; margin-top: -0.5em; }
}
@media (prefers-reduced-motion: reduce) { .flow-bg__orb i { animation: none; } }
