/* ========================================
   MACOWA — Animation System
   Keyframes, scroll reveals, kinetic effects,
   hover choreography, & reduced-motion safety
   ======================================== */


/* ─────────────────────────────────────────
   KEYFRAMES
   ───────────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

@keyframes floatXY {
  0%   { transform: translate(0, 0) rotate(0deg); }
  33%  { transform: translate(20px, -30px) rotate(4deg); }
  66%  { transform: translate(-15px, 25px) rotate(-3deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(31, 168, 224, 0.25); }
  50%      { box-shadow: 0 0 50px rgba(31, 168, 224, 0.45); }
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes gradient-pan {
  0%   { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

@keyframes draw {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

@keyframes draw-fade-fill {
  0%   { stroke-dashoffset: 200; fill-opacity: 0; }
  60%  { stroke-dashoffset: 0;   fill-opacity: 0; }
  100% { stroke-dashoffset: 0;   fill-opacity: 1; }
}

@keyframes typewriter {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes rotate-gradient {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Marquee: smooth -50% loop using a duplicated track */
@keyframes marquee {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

@keyframes marquee-reverse {
  0%   { transform: translate3d(-50%, 0, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Aurora blob drift */
@keyframes aurora-drift-1 {
  0%   { transform: translate(-10%, -10%) scale(1); }
  50%  { transform: translate(8%, 12%) scale(1.15); }
  100% { transform: translate(-10%, -10%) scale(1); }
}

@keyframes aurora-drift-2 {
  0%   { transform: translate(10%, 5%)  scale(1.05); }
  50%  { transform: translate(-12%, -8%) scale(0.9); }
  100% { transform: translate(10%, 5%)  scale(1.05); }
}

@keyframes aurora-drift-3 {
  0%   { transform: translate(0, 15%) scale(0.95); }
  50%  { transform: translate(15%, -10%) scale(1.1); }
  100% { transform: translate(0, 15%) scale(0.95); }
}

/* Hero gradient orb pulse — opacity only (JS owns transform) */
@keyframes orb-pulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 0.9; }
}

/* Number-row shimmer pass */
@keyframes count-glow {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); }
  50%      { filter: drop-shadow(0 0 20px rgba(31, 168, 224, 0.6)); }
}

/* Soft icon bob */
@keyframes icon-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(2deg); }
}

/* Badge dot ping */
@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.6; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* Word reveal with mask */
@keyframes word-rise {
  from { transform: translateY(110%) skewY(6deg); opacity: 0; }
  to   { transform: translateY(0)    skewY(0);    opacity: 1; }
}

/* Subtle glitch slide for the headline accent */
@keyframes glitch-slide {
  0%, 92%, 100% { transform: translate(0, 0); filter: none; }
  93% { transform: translate(2px, -1px); filter: hue-rotate(20deg); }
  94% { transform: translate(-2px, 1px); filter: hue-rotate(-20deg); }
  95% { transform: translate(1px, 0);    filter: none; }
}


/* ─────────────────────────────────────────
   SCROLL REVEAL CLASSES
   ───────────────────────────────────────── */

.reveal,
.reveal-left,
.reveal-right,
.reveal-scale {
  opacity: 0;
  transition:
    opacity 0.9s var(--ease-out-expo),
    transform 0.9s var(--ease-out-expo);
  will-change: opacity, transform;
}

.reveal       { transform: translateY(40px); }
.reveal-left  { transform: translateX(-60px); }
.reveal-right { transform: translateX(60px); }
.reveal-scale { transform: scale(0.92); }

.reveal.revealed,
.reveal-left.revealed,
.reveal-right.revealed,
.reveal-scale.revealed {
  opacity: 1;
  transform: none;
}


/* ─────────────────────────────────────────
   STAGGER DELAYS
   ───────────────────────────────────────── */

.stagger-children > *:nth-child(1)  { transition-delay: 0.00s; }
.stagger-children > *:nth-child(2)  { transition-delay: 0.08s; }
.stagger-children > *:nth-child(3)  { transition-delay: 0.16s; }
.stagger-children > *:nth-child(4)  { transition-delay: 0.24s; }
.stagger-children > *:nth-child(5)  { transition-delay: 0.32s; }
.stagger-children > *:nth-child(6)  { transition-delay: 0.40s; }
.stagger-children > *:nth-child(7)  { transition-delay: 0.48s; }
.stagger-children > *:nth-child(8)  { transition-delay: 0.56s; }


/* ─────────────────────────────────────────
   HERO KINETIC TYPOGRAPHY
   ───────────────────────────────────────── */

/* Each word gets wrapped in a .word-mask > .word by JS */
.word-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  line-height: 1.05;
}

.word {
  display: inline-block;
  transform: translateY(110%) skewY(6deg);
  opacity: 0;
  animation: word-rise 0.9s var(--ease-out-expo) forwards;
}

.word-mask:nth-child(1) .word { animation-delay: 0.05s; }
.word-mask:nth-child(2) .word { animation-delay: 0.15s; }
.word-mask:nth-child(3) .word { animation-delay: 0.25s; }
.word-mask:nth-child(4) .word { animation-delay: 0.35s; }
.word-mask:nth-child(5) .word { animation-delay: 0.45s; }
.word-mask:nth-child(6) .word { animation-delay: 0.55s; }
.word-mask:nth-child(7) .word { animation-delay: 0.65s; }
.word-mask:nth-child(8) .word { animation-delay: 0.75s; }


/* ─────────────────────────────────────────
   HOVER EFFECTS
   ───────────────────────────────────────── */

.hover-lift   { transition: transform var(--transition-base); }
.hover-lift:hover  { transform: translateY(-4px); }

.hover-glow   { transition: box-shadow var(--transition-base); }
.hover-glow:hover  { box-shadow: var(--shadow-glow); }

.hover-scale  { transition: transform var(--transition-base); }
.hover-scale:hover { transform: scale(1.03); }


/* ─────────────────────────────────────────
   UTILITIES
   ───────────────────────────────────────── */

.float          { animation: float 3s ease-in-out infinite; }
.float-slow     { animation: float 5s ease-in-out infinite; }
.float-delayed  { animation: float 3s ease-in-out 1s infinite; }

.animate-gradient {
  background-size: 200% 200%;
  animation: gradient-shift 6s ease infinite;
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 25%,
    var(--bg-elevated) 50%,
    var(--bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* Shimmer SWEEP across text (legible white base + traveling highlight) */
.shimmer-text {
  background: linear-gradient(
    100deg,
    var(--text-primary) 0%,
    var(--text-primary) 35%,
    var(--accent-cyan) 50%,
    var(--text-primary) 65%,
    var(--text-primary) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s linear infinite;
}


/* ─────────────────────────────────────────
   PULSE DOT (live badge)
   ───────────────────────────────────────── */

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  position: relative;
  box-shadow: 0 0 12px var(--accent-cyan);
}

.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent-cyan);
  animation: pulse-ring 1.6s ease-out infinite;
}


/* ─────────────────────────────────────────
   ROTATING GRADIENT BORDER
   ───────────────────────────────────────── */

.gradient-border {
  position: relative;
  border-radius: var(--radius-lg);
  isolation: isolate;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  background: conic-gradient(
    from 0deg,
    var(--accent-violet),
    var(--accent-cyan),
    var(--accent-blue),
    var(--accent-pink),
    var(--accent-violet)
  );
  border-radius: inherit;
  animation: rotate-gradient 6s linear infinite;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.gradient-border:hover::before { opacity: 1; }

.gradient-border::after {
  content: '';
  position: absolute;
  inset: 1px;
  background: var(--bg-surface);
  border-radius: inherit;
  z-index: -1;
}


/* ─────────────────────────────────────────
   AURORA BACKDROP
   Pure-CSS animated mesh-gradient blobs.
   Lives in a fixed layer behind everything.
   ───────────────────────────────────────── */

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora__blob {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.55;
  mix-blend-mode: screen;
  will-change: transform;
}

.aurora__blob--violet {
  top: -20%; left: -10%;
  background: radial-gradient(circle, rgba(31, 168, 224, 0.6), transparent 70%);
  animation: aurora-drift-1 22s ease-in-out infinite;
}

.aurora__blob--cyan {
  top: 30%; right: -15%;
  background: radial-gradient(circle, rgba(31, 168, 224, 0.55), transparent 70%);
  animation: aurora-drift-2 26s ease-in-out infinite;
}

.aurora__blob--pink {
  bottom: -25%; left: 20%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.40), transparent 70%);
  animation: aurora-drift-3 30s ease-in-out infinite;
}

.aurora__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 75%);
}

.aurora__noise {
  position: absolute;
  inset: 0;
  background-image: var(--noise-bg);
  opacity: 0.35;
  mix-blend-mode: overlay;
}


/* ─────────────────────────────────────────
   CUSTOM CURSOR
   ───────────────────────────────────────── */

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 10000;
  border-radius: 50%;
  transform: translate3d(-50%, -50%, 0);
  will-change: transform;
}

.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan);
  transition: transform 0.12s var(--ease-out-quart),
              width 0.2s var(--ease-out-quart),
              height 0.2s var(--ease-out-quart);
}

.cursor-ring {
  width: 38px; height: 38px;
  border: 1.5px solid rgba(31, 168, 224, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  background: rgba(31, 168, 224, 0.04);
  transition: width 0.25s var(--ease-spring),
              height 0.25s var(--ease-spring),
              border-color 0.25s var(--ease-out-quart),
              background 0.25s var(--ease-out-quart),
              opacity 0.25s var(--ease-out-quart);
}

.cursor-ring.is-hover {
  width: 70px; height: 70px;
  border-color: var(--accent-cyan);
  background: rgba(31, 168, 224, 0.08);
}

.cursor-ring.is-press {
  width: 26px; height: 26px;
}

/* Hide native cursor only when our cursor is live (set by JS) */
body.cursor-on,
body.cursor-on * {
  cursor: none !important;
}

/* Keep text I-beam on editable fields for real UX */
body.cursor-on input[type="text"],
body.cursor-on input[type="email"],
body.cursor-on input[type="tel"],
body.cursor-on input[type="number"],
body.cursor-on input[type="search"],
body.cursor-on input[type="url"],
body.cursor-on textarea {
  cursor: text !important;
}

/* Don't double up on touch / coarse pointers */
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
  body.cursor-on, body.cursor-on * { cursor: auto !important; }
}


/* ─────────────────────────────────────────
   CARD SPOTLIGHT (mouse-tracked radial glow)
   Driven by --mx / --my custom props in JS.
   ───────────────────────────────────────── */

.spotlight {
  position: relative;
  overflow: hidden;
}

.spotlight::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: radial-gradient(
    400px circle at var(--mx, 50%) var(--my, 50%),
    rgba(31, 168, 224, 0.18),
    transparent 40%
  );
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
  z-index: 0;
}

.spotlight:hover::before { opacity: 1; }

.spotlight > * { position: relative; z-index: 1; }


/* ─────────────────────────────────────────
   3D TILT CARD
   JS sets --rx / --ry on mousemove
   ───────────────────────────────────────── */

.tilt {
  transform-style: preserve-3d;
  transform:
    perspective(900px)
    rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg))
    translateZ(0);
  transition: transform 0.2s var(--ease-out-quart);
}

.tilt > * { transform-style: preserve-3d; }
.tilt .tilt-lift { transform: translateZ(40px); }

/* When .tilt is combined with .reveal, drop the transform-translate part of
   the reveal animation and only fade. Tilt keeps owning the transform. */
.tilt.reveal {
  opacity: 0;
  transition: opacity 0.9s var(--ease-out-expo);
}
.tilt.reveal.revealed {
  opacity: 1;
  transition: transform 0.2s var(--ease-out-quart),
              opacity   0.9s var(--ease-out-expo);
}


/* ─────────────────────────────────────────
   MAGNETIC BUTTONS
   JS sets --tx / --ty (pixels)
   ───────────────────────────────────────── */

.magnetic {
  transform: translate3d(var(--tx, 0px), var(--ty, 0px), 0);
  transition: transform 0.35s var(--ease-spring);
}


/* ─────────────────────────────────────────
   GLITCH HOVER
   ───────────────────────────────────────── */

.glitch:hover { animation: glitch-slide 0.6s steps(2) 1; }


/* ─────────────────────────────────────────
   REDUCED MOTION — ACCESSIBILITY
   ───────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal, .reveal-left, .reveal-right, .reveal-scale {
    opacity: 1; transform: none;
  }

  .word { opacity: 1; transform: none; }

  .typewriter { overflow: visible; border-right: none; }

  .float, .float-slow, .float-delayed,
  .aurora__blob { animation: none; }

  .cursor-dot, .cursor-ring { display: none; }
}
