/* Subtle compositor-only animations, View Transitions, and ambient hero motion
 * Strictly opted-in via @media (prefers-reduced-motion: no-preference).
 * All elements default to their final visible state.
 */

.scroll-progress {
  position: absolute;
  inset-block-end: -1px;
  inset-inline: 0;
  block-size: 3px;
  background: linear-gradient(90deg, var(--brand-native), var(--brand-canvas), var(--brand-signal));
  transform-origin: left center;
  scale: 0 1;
  pointer-events: none;
}

.hero-section { overflow: clip; }
.hero-content { position: relative; z-index: 1; }
.hero-ambient { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }

.hero-grid-mesh {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in oklab, var(--ink) 11%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(70% 60% at 50% 35%, black 20%, transparent 100%);
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.34;
  will-change: transform;
}

.hero-orb-1 { inline-size: 34rem; block-size: 34rem; inset-block-start: -8rem; inset-inline-start: 12%; background: radial-gradient(circle, var(--brand-native), transparent 70%); }
.hero-orb-2 { inline-size: 32rem; block-size: 32rem; inset-block-start: 4rem; inset-inline-end: 10%; background: radial-gradient(circle, var(--brand-canvas), transparent 70%); }
.hero-orb-3 { inline-size: 24rem; block-size: 24rem; inset-block-end: -6rem; inset-inline-start: 40%; background: radial-gradient(circle, var(--brand-signal), transparent 70%); opacity: 0.22; }

.hero-streams { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; opacity: 0.26; }
.stream-track { stroke: color-mix(in oklab, var(--ink) 4%, transparent); stroke-width: 1; }
.stream-beam { stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 240 1560; stroke-dashoffset: 1800; }

@media (prefers-reduced-motion: no-preference) {
  main {
    animation: page-enter 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  body, .site-header, .prose-section, .prose-card, .site-footer {
    transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease;
  }

  .tabpanels-stack > [role="tabpanel"]:not([hidden]) .tabpanel-inner {
    animation: tab-panel-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  @supports (animation-timeline: scroll()) {
    .scroll-progress { animation: progress-grow linear both; animation-timeline: scroll(root); }
  }

  @supports (animation-timeline: view()) {
    .reveal-on-scroll { animation: scroll-reveal linear both; animation-timeline: view(); animation-range: entry 0% cover 24%; }
  }

  .hero-animate { animation: rise-in 620ms cubic-bezier(0.22, 1, 0.36, 1) both; }
  .hero-delay-1 { animation-delay: 80ms; }
  .hero-delay-2 { animation-delay: 160ms; }
  .hero-delay-3 { animation-delay: 240ms; }

  .hero-orb-1 { animation: orb-drift-a 11s ease-in-out infinite alternate; }
  .hero-orb-2 { animation: orb-drift-b 13s ease-in-out infinite alternate; }
  .hero-orb-3 { animation: orb-drift-c 15s ease-in-out infinite alternate; }
  .stream-beam-1 { animation: beam-flow 7.5s linear infinite; }
  .stream-beam-2 { animation: beam-flow 9.5s linear infinite -3.2s; }
  .stream-beam-3 { animation: beam-flow 11.5s linear infinite -6.4s; }

  .device-desktop, .device-phone { transition: translate 320ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 320ms ease; }
  .device-phone:hover { translate: 0 -8px; }
  .device-desktop:hover { translate: 0 -5px; }

  .showcase-media img, .blog-card-media img { transition: scale 420ms cubic-bezier(0.22, 1, 0.36, 1); }
  .showcase-figure:hover .showcase-media img, .blog-card:hover .blog-card-media img { scale: 1.03; }

  .showcase-figure, .video-card, .prose-card, .spectrum-card { transition: translate 240ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 240ms ease, border-color 200ms ease; }
  .showcase-figure:hover, .video-card:hover, .cmp-card:hover { translate: 0 -4px; }
}

@keyframes page-enter { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
@keyframes tab-panel-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0 0; } }
@keyframes beam-flow { from { stroke-dashoffset: 1800; } to { stroke-dashoffset: 0; } }
@keyframes orb-drift-a { from { translate: -30px -15px; scale: 0.96; } to { translate: 95px 55px; scale: 1.18; } }
@keyframes orb-drift-b { from { translate: 25px -10px; scale: 1.02; } to { translate: -90px 65px; scale: 1.15; } }
@keyframes orb-drift-c { from { translate: -25px 15px; scale: 0.92; } to { translate: 75px -50px; scale: 1.16; } }
@keyframes progress-grow { from { scale: 0 1; } to { scale: 1 1; } }
@keyframes rise-in { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
@keyframes scroll-reveal { from { opacity: 0.15; translate: 0 22px; scale: 0.985; } to { opacity: 1; translate: 0 0; scale: 1; } }
