/* ============================================================
   SPIDER SAFETY NETS — ANIMATIONS
   Keyframes, micro-interactions, scroll-driven effects
   ============================================================ */

/* ============================================================
   CORE KEYFRAMES
   ============================================================ */

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

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

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

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

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

/* Net strand draw */
@keyframes drawStrand {
  from { stroke-dashoffset: 1000; opacity: 0; }
  to   { stroke-dashoffset: 0; opacity: 1; }
}

/* Spider thread travel */
@keyframes threadTravel {
  0%   { stroke-dashoffset: 200; }
  100% { stroke-dashoffset: 0; }
}

/* Pulse glow */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(192,57,43,0.2); }
  50%       { box-shadow: 0 0 24px rgba(192,57,43,0.45); }
}

/* Line expand */
@keyframes lineExpand {
  from { width: 0; }
  to   { width: 60px; }
}

@keyframes lineExpandFull {
  from { opacity: 0; transform: scaleX(0); }
  to   { opacity: 1; transform: scaleX(1); }
}

/* Float subtle */
@keyframes floatSubtle {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

/* Rotate slow */
@keyframes rotateSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Shimmer */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* Counter slide */
@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Net tension */
@keyframes netTension {
  0%   { stroke-dashoffset: 300; opacity: 0; }
  30%  { opacity: 0.6; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}

/* Spider walk */
@keyframes spiderWalk {
  0%   { offset-distance: 0%; }
  100% { offset-distance: 100%; }
}

/* Blink cursor */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Gradient shift — used by quote strip */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================================
   SCROLL REVEAL CLASSES
   Driven by IntersectionObserver in main.js
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1), transform 0.7s cubic-bezier(0.4,0,0.2,1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1), transform 0.7s cubic-bezier(0.4,0,0.2,1);
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(28px);
  transition: opacity 0.7s cubic-bezier(0.4,0,0.2,1), transform 0.7s cubic-bezier(0.4,0,0.2,1);
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Delay utilities */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }

/* ============================================================
   HERO ANIMATIONS — applied on load
   ============================================================ */
.hero-label {
  animation: fadeInUp 0.8s ease 0.2s both;
}

.hero-headline {
  animation: fadeInUp 0.9s ease 0.4s both;
}

.hero-subtext {
  animation: fadeInUp 0.8s ease 0.6s both;
}

.hero-actions {
  animation: fadeInUp 0.8s ease 0.8s both;
}

.hero-meta {
  animation: fadeInUp 0.8s ease 1s both;
}

/* ============================================================
   SPIDER LINE ANIMATION
   ============================================================ */
.spider-line {
  animation: lineExpand 0.8s ease both;
}

.spider-line-full {
  animation: lineExpandFull 1.2s ease both;
  transform-origin: left center;
}

/* ============================================================
   SECTION LABEL
   ============================================================ */
.section-label {
  animation: fadeInLeft 0.6s ease both;
}

/* ============================================================
   SHIMMER EFFECT (loading placeholders)
   ============================================================ */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--graphite) 25%,
    var(--graphite-2) 50%,
    var(--graphite) 75%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
}

/* ============================================================
   COUNTER ANIMATION
   ============================================================ */
.counter-animated {
  animation: countUp 0.6s ease both;
}

/* ============================================================
   NET CANVAS GLOW (canvas element styling)
   ============================================================ */
.hero-canvas {
  pointer-events: all; /* Allow mouse interaction */
  opacity: 0;
  animation: fadeIn 1.5s ease 0.8s forwards;
}

/* ============================================================
   SCROLL PROGRESS — Spider Thread
   ============================================================ */
#scroll-progress {
  background: linear-gradient(90deg, var(--red), var(--orange));
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  z-index: 9999;
  transition: width 0.1s linear;
}

/* Thread dot (spider at head of thread) */
#scroll-progress::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 6px var(--orange);
}

/* ============================================================
   STAGGER ANIMATION HELPER
   ============================================================ */
.stagger-container > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-container.triggered > *:nth-child(1) { animation: fadeInUp 0.6s ease 0.05s forwards; }
.stagger-container.triggered > *:nth-child(2) { animation: fadeInUp 0.6s ease 0.15s forwards; }
.stagger-container.triggered > *:nth-child(3) { animation: fadeInUp 0.6s ease 0.25s forwards; }
.stagger-container.triggered > *:nth-child(4) { animation: fadeInUp 0.6s ease 0.35s forwards; }
.stagger-container.triggered > *:nth-child(5) { animation: fadeInUp 0.6s ease 0.45s forwards; }
.stagger-container.triggered > *:nth-child(6) { animation: fadeInUp 0.6s ease 0.55s forwards; }
.stagger-container.triggered > *:nth-child(7) { animation: fadeInUp 0.6s ease 0.65s forwards; }
.stagger-container.triggered > *:nth-child(8) { animation: fadeInUp 0.6s ease 0.75s forwards; }
.stagger-container.triggered > *:nth-child(n+9) { animation: fadeInUp 0.6s ease 0.85s forwards; }

/* ============================================================
   HOVER: NET TENSION EFFECT
   ============================================================ */
.tension-hover {
  position: relative;
  overflow: hidden;
}

.tension-hover::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}

.tension-hover:hover::before {
  left: 150%;
}

/* ============================================================
   FLOATING ANIMATION
   ============================================================ */
.float-anim {
  animation: floatSubtle 3s ease-in-out infinite;
}

.float-anim-slow {
  animation: floatSubtle 5s ease-in-out infinite;
}

/* ============================================================
   CTA GLOW EFFECT
   ============================================================ */
.btn-primary {
  position: relative;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-sm) + 2px);
  background: linear-gradient(45deg, var(--red), var(--orange));
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: -1;
  filter: blur(8px);
}

.btn-primary:hover::before {
  opacity: 0.5;
}

/* ============================================================
   LOGO HOVER METALLIC EFFECT
   ============================================================ */
.nav-logo:hover .brand-name {
  background: linear-gradient(90deg, #fff, #c8cdd8, #fff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 1.5s linear forwards;
}

/* ============================================================
   CARD REVEAL ON SCROLL
   ============================================================ */
.service-card,
.wall-card,
.pillar-card {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.service-card.visible,
.wall-card.visible,
.pillar-card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   MOBILE MENU LINK STAGGER
   ============================================================ */
.mobile-nav-link {
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.35s ease, color 0.15s ease;
}

.mobile-menu.open .mobile-nav-link:nth-child(1) { opacity: 1; transform: translateX(0); transition-delay: 0.1s; }
.mobile-menu.open .mobile-nav-link:nth-child(2) { opacity: 1; transform: translateX(0); transition-delay: 0.15s; }
.mobile-menu.open .mobile-nav-link:nth-child(3) { opacity: 1; transform: translateX(0); transition-delay: 0.2s; }
.mobile-menu.open .mobile-nav-link:nth-child(4) { opacity: 1; transform: translateX(0); transition-delay: 0.25s; }
.mobile-menu.open .mobile-nav-link:nth-child(5) { opacity: 1; transform: translateX(0); transition-delay: 0.3s; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-canvas { opacity: 0.5 !important; animation: none !important; }
  .reveal, .reveal-left, .reveal-right { opacity: 1 !important; transform: none !important; }
  .service-card, .wall-card, .pillar-card { opacity: 1 !important; transform: none !important; }
}
