/* =========================================================================
   Animations, scroll reveal, micro-interactions
   ========================================================================= */

html.js [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.9s var(--ease) var(--d, 0ms),
    transform 1s var(--ease) var(--d, 0ms);
  will-change: opacity, transform;
}
html.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

@keyframes plDraw {
  to { stroke-dashoffset: 0; }
}
@keyframes plFailsafe {
  to { opacity: 0; visibility: hidden; }
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(56, 225, 164, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(56, 225, 164, 0); }
}
@keyframes marquee {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-50%, 0, 0); }
}
@keyframes floatY {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -10px, 0); }
}
@keyframes orbitSpin {
  from { rotate: 0deg; }
  to { rotate: 360deg; }
}
@keyframes auroraDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(30px, 24px, 0) scale(1.06); }
}
@keyframes borderShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

/* Portrait ambience */
.orbit span { animation: orbitSpin 70s linear infinite; }
.orbit span:nth-child(2) { animation-duration: 48s; animation-direction: reverse; }
.aurora.a1 { animation: auroraDrift 18s ease-in-out infinite; }
.aurora.a2 { animation: auroraDrift 22s ease-in-out infinite reverse; }
.aurora.a3 { animation: auroraDrift 26s ease-in-out infinite; }

.chip { animation: floatY 7s ease-in-out infinite; }
.chip-1 { animation-delay: -0.4s; }
.chip-2 { animation-delay: -2.1s; }
.chip-3 { animation-delay: -3.6s; }
.chip-4 { animation-delay: -5.2s; }

/* Cards: pointer spotlight + lift */
.tech-card,
.build-card,
.why-card,
.format-card,
.panel-card {
  position: relative;
  transition:
    transform 0.45s var(--ease),
    border-color 0.45s,
    background-color 0.45s,
    box-shadow 0.5s;
}
.tech-card::before,
.build-card::before,
.why-card::before,
.format-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 0%),
    rgba(107, 160, 255, 0.16),
    transparent 65%
  );
}
.tech-card:hover::before,
.build-card:hover::before,
.why-card:hover::before,
.format-card:hover::before { opacity: 1; }

.tech-card:hover,
.build-card:hover,
.why-card:hover,
.format-card:hover {
  transform: translateY(-4px);
  border-color: rgba(140, 175, 255, 0.28);
}

/* Marquee pauses on hover */
.marquee:hover .marquee-track { animation-play-state: paused; }

/* Timeline accordion */
.timeline-item .timeline-body {
  overflow: hidden;
  transition: opacity 0.4s var(--ease);
}
.timeline-item .timeline-body[hidden] { display: none; }
.timeline-item.is-open .tl-toggle { transform: rotate(180deg); }
.tl-toggle { transition: transform 0.4s var(--ease); }

/* Tech filter — hidden cards must not leave gaps in the grid */
.tech-card.is-filtered-out { display: none; }

/* Roadmap panel */
.rm-panel.is-active { animation: panelIn 0.55s var(--ease) both; }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Buttons sheen on hover */
.btn-primary { background-size: 160% 160%; }
.btn-primary:hover { animation: borderShift 3s linear infinite; }

/* Header CTA pulse ring */
.header-cta::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(150, 185, 255, 0.5);
  opacity: 0;
  animation: glowPulse 3.6s ease-in-out infinite;
  pointer-events: none;
}

/* Lazy logo fallback */
.tech-logo img.is-missing { opacity: 0; visibility: hidden; }

/* To-top entrance */
.to-top {
  transition: opacity 0.35s, transform 0.35s var(--ease), visibility 0.35s, box-shadow 0.35s;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  html.js [data-reveal] { opacity: 1; transform: none; }
  .cursor-dot, .cursor-ring { display: none; }
}
