/* ============================================
   GENN.TECH — effects.css
   Heavy mode visual effects: scanlines, glitch,
   flicker, phosphor glow, matrix canvas, hover
   lifts. Lite mode never downloads this file
   (stage four gates loading on data-mode).
   All animation touches transform/opacity only.
   ============================================ */

/* ── Scanline overlay ── single fixed pseudo layer, composited once ── */
#scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    var(--scanline) 2px,
    var(--scanline) 4px
  );
}

/* ── Matrix canvas ── driven by effects.js, rAF capped, paused when
   the tab is hidden (see script). Sits behind all content. ── */
#matrix-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: 0.07;
  pointer-events: none;
}

/* ── Phosphor persistence flicker ── opacity only, composited ── */
@keyframes phosphor-persistence {
  0%, 95%, 100% { opacity: 1; }
  96% { opacity: 0.97; }
  97% { opacity: 1; }
  98% { opacity: 0.96; }
  99% { opacity: 1; }
}

/* ── Glitch hero ── chromatic aberration layers, transform + opacity ── */
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  pointer-events: none;
}

.glitch::before {
  color: var(--link);
  animation: glitch-top 3s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
  color: var(--danger);
  animation: glitch-bot 3s infinite;
  clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

@keyframes glitch-top {
  0%, 90%, 100% { transform: translate(0); opacity: 0; }
  91% { transform: translate(-3px, -2px); opacity: 0.8; }
  93% { transform: translate(3px, 2px); opacity: 0.8; }
  95% { transform: translate(-2px, 0); opacity: 0.8; }
  97% { transform: translate(0); opacity: 0; }
}

@keyframes glitch-bot {
  0%, 85%, 100% { transform: translate(0); opacity: 0; }
  86% { transform: translate(3px, 1px); opacity: 0.8; }
  88% { transform: translate(-3px, -1px); opacity: 0.8; }
  90% { transform: translate(0); opacity: 0; }
}

/* Hero glow + persistence. Text shadow is paint cost, acceptable in
   Heavy only because it never animates. */
.glitch {
  text-shadow:
    0 0 20px var(--glow),
    0 0 40px var(--glow),
    0 0 80px rgba(0, 255, 65, 0.1);
  animation: phosphor-persistence 8s infinite;
}

/* ── Glows on headings and accents ── static paint, no animation ── */
.section-header h2,
.footer-logo {
  text-shadow: 0 0 20px var(--glow);
}

#hero-tagline { text-shadow: 0 0 12px var(--link-glow); }
.stat-num      { text-shadow: 0 0 12px var(--link-glow); }
.service-price { text-shadow: 0 0 8px var(--link-glow); }
.pricing-amount { text-shadow: 0 0 16px var(--glow); }

/* ── Animated link underline ── transform scaled pseudo, composited ── */
.footer-links a,
#footer-social a {
  position: relative;
}
.footer-links a::after,
#footer-social a::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.footer-links a:hover::after,
#footer-social a:hover::after,
.footer-links a:focus-visible::after,
#footer-social a:focus-visible::after {
  transform: scaleX(1);
}

/* ── Card lift hovers ── transform + shadow, gentle ── */
.service-card:hover,
.pillar-card-pub:hover,
.pricing-card:hover,
.now-card:hover,
.tip-card:hover,
.skill-card:hover,
.social-pill:hover {
  border-color: var(--border-strong);
  box-shadow: 0 0 20px var(--glow);
  transform: translateY(-3px);
}

.skill-card:hover { transform: translateX(4px); }
.now-card:hover,
.tip-card:hover { transform: translateY(-2px); }

.btn-primary:hover {
  box-shadow: 0 0 20px var(--glow), 0 0 40px var(--glow);
  transform: translateY(-1px);
}

.contact-item a:hover { text-shadow: 0 0 10px var(--glow); }

/* Service card accent bar on hover */
.service-card:hover::before { opacity: 1; }

/* Blinking cursor for the hero terminal line */
.cursor {
  animation: blink 1s step-end infinite;
  color: var(--accent);
}
@keyframes blink { 50% { opacity: 0; } }

/* Uptime pulse — CSS animation replaces the old 2 second setInterval */
#footer-uptime {
  animation: uptime-pulse 2s ease-in-out infinite;
}
@keyframes uptime-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Reduced motion ── keep static effects (scanlines, glow), drop
   everything that moves. Honoured even in Heavy mode. ── */
@media (prefers-reduced-motion: reduce) {
  .glitch::before,
  .glitch::after,
  .glitch,
  .cursor,
  #footer-uptime {
    animation: none;
  }
  .glitch::before,
  .glitch::after { display: none; }
  * {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
