/* =====================================================================
   SIGNAL — animations.css
   keyframes · custom cursor · preloader · reduced-motion
   ===================================================================== */

/* ----------------------------- PRELOADER ----------------------------- */
.preloader {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.preloader__inner {
  width: min(640px, 80vw);
  display: flex; flex-direction: column; gap: var(--s-4);
}
.preloader__name {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.6rem, 5vw, 3rem); letter-spacing: -0.02em;
  text-transform: uppercase; text-align: center;
}
.preloader__meta {
  display: flex; align-items: baseline; justify-content: space-between;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--text-dim);
}
.preloader__count { color: var(--signal-br); font-variant-numeric: tabular-nums; }
.preloader__bar { width: 100%; height: 1px; background: var(--line); overflow: hidden; }
.preloader__fill {
  display: block; width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--signal-deep), var(--signal-br));
  box-shadow: 0 0 12px var(--signal-glow);
}
.preloader.is-done { pointer-events: none; }

/* ----------------------------- CUSTOM CURSOR ----------------------------- */
.cursor {
  position: fixed; top: 0; left: 0; z-index: 9500;
  pointer-events: none;
  opacity: 0; visibility: hidden;
}
/* dot — tight follower, always visible on the dark theme */
.cursor__dot {
  position: fixed; top: 0; left: 0;
  width: 7px; height: 7px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(139,92,255,0.5);
  will-change: transform;
  transition: opacity 0.3s var(--ease);
}
/* ring — lagging follower, morphs per state */
.cursor__ring {
  position: fixed; top: 0; left: 0;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(245,245,245,0.5);
  transform: translate(-50%, -50%);
  will-change: transform;
  transition: width 0.4s var(--ease), height 0.4s var(--ease),
              background-color 0.4s var(--ease), border-color 0.4s var(--ease);
}
/* label — rides with the ring, shown in disc states */
.cursor__label {
  position: fixed; top: 0; left: 0;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: #050505; opacity: 0; white-space: nowrap;
  transition: opacity 0.3s var(--ease);
  will-change: transform;
}

/* hover — ring grows, soft fill */
.cursor.is-hover .cursor__ring { width: 62px; height: 62px; background: rgba(245,245,245,0.08); border-color: rgba(245,245,245,0.7); }

/* view / explore / drag — filled accent disc with a label */
.cursor.is-view .cursor__ring,
.cursor.is-explore .cursor__ring,
.cursor.is-drag .cursor__ring {
  width: 92px; height: 92px; background: var(--signal-br); border-color: var(--signal-br);
}
.cursor.is-view .cursor__dot,
.cursor.is-explore .cursor__dot,
.cursor.is-drag .cursor__dot { opacity: 0; }
.cursor.is-view .cursor__label,
.cursor.is-explore .cursor__label,
.cursor.is-drag .cursor__label { opacity: 1; }

/* scroll — hollow accent ring with a quiet label */
.cursor.is-scroll .cursor__ring { width: 70px; height: 70px; border-color: var(--signal-br); }
.cursor.is-scroll .cursor__label { opacity: 1; color: var(--signal-br); }

/* ----------------------------- KEYFRAMES ----------------------------- */
@keyframes scrollPulse {
  0%   { transform: translateY(0); }
  100% { transform: translateY(300%); }
}
@keyframes scrollPulseH {
  0%   { transform: translateX(0); }
  100% { transform: translateX(300%); }
}
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -14px, 0); }
}

/* element kept idle-floating (ambient) */
.float-ambient { animation: float 7s ease-in-out infinite; }

/* generic reveal initial states (JS animates them in).
   Hidden ONLY when JS+GSAP confirmed ready (html.signal-ready) — so if the
   GSAP CDN fails or an init throws, content stays fully visible, never blank. */
.signal-ready [data-reveal] { opacity: 0; transform: translateY(28px); will-change: opacity, transform; }

/* graceful degradation — any init failure force-reveals animation-hidden content */
.signal-degraded [data-reveal] { opacity: 1 !important; transform: none !important; }
.signal-degraded .char,
.signal-degraded .char-mask { transform: none !important; opacity: 1 !important; }

/* ----------------------------- REDUCED MOTION ----------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .cursor { display: none !important; }
  body, a, button { cursor: auto !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .hero__signal, .hero__layer { opacity: 0.15 !important; }
  .preloader { display: none !important; }
}
