/* =====================================================================
   FRGE NEXUS — Advanced Animations & Effects
   Layered on top of index-v2.html styles. Zero layout impact.
   ===================================================================== */

/* ---------- 5. NOISE GRAIN OVERLAY ---------- */
.fx-grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 200px 200px;
  animation: grainShift 8s steps(10) infinite;
}
@keyframes grainShift {
  0%   { transform: translate(0,0); }
  10%  { transform: translate(-5%,-5%); }
  20%  { transform: translate(-10%,5%); }
  30%  { transform: translate(5%,-10%); }
  40%  { transform: translate(-5%,15%); }
  50%  { transform: translate(-10%,5%); }
  60%  { transform: translate(15%,0); }
  70%  { transform: translate(0,10%); }
  80%  { transform: translate(-15%,0); }
  90%  { transform: translate(10%,5%); }
  100% { transform: translate(0,0); }
}

/* ---------- 7. AMBIENT AURORA per section ---------- */
.fx-aurora-ambient {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0.55;
  background:
    radial-gradient(600px 400px at var(--aurora-x, 50%) var(--aurora-y, 30%),
      var(--aurora-c, rgba(255,255,255,0.04)), transparent 60%);
  transition: background 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- 1. KINETIC HERO TYPOGRAPHY ---------- */
.hero-wordmark .line {
  display: block; overflow: hidden;
}
.hero-wordmark .line > span {
  display: inline-block;
}
/* split-letter reveal — selector specificity (0,2,2) beats `.line span` (0,2,1)
   from index-v2.html so heroRise doesn't hijack the inner glyphs. */
.hero-wordmark .line {
  white-space: nowrap;
}
.hero-wordmark .line span.glyph {
  display: inline-block !important;
  transform: translateY(110%);
  opacity: 0;
  animation: glyphRise 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
  will-change: transform, opacity;
}
@keyframes glyphRise {
  0%   { transform: translateY(110%); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}
.hero-wordmark .line span.glyph[data-glyph-hover] {
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), color 0.4s ease;
  cursor: default;
}

/* ---------- 2. SECTION CHAPTER TRANSITIONS ---------- */
/* Fine, soft: a numbered rule that sweeps in with the section title */
.sec-head {
  position: relative;
  overflow: hidden;
}
.sec-head::before {
  content: '';
  position: absolute;
  left: 0; bottom: -1px; height: 1px; width: 0;
  background: linear-gradient(90deg, transparent, #fff 30%, #fff 70%, transparent);
  transition: width 1.4s cubic-bezier(0.22, 1, 0.36, 1) 0.1s;
}
.sec-head.in::before { width: 100%; }

/* Chapter card moment — big number flashes briefly on scroll */
.fx-chapter {
  position: fixed; inset: 0; pointer-events: none; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.5s ease;
}
.fx-chapter.show { opacity: 1; }
.fx-chapter-num {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(120px, 18vw, 280px);
  color: rgba(255,255,255,0.04);
  letter-spacing: -0.05em; line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ---------- 3. ROSTER DOSSIER HOVER ---------- */
.agent-card { position: relative; }
.agent-dossier {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 18px 18px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.88) 40%, rgba(0,0,0,0.96));
  transform: translateY(calc(100% - 1px));
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 3;
}
.agent-card:hover .agent-dossier { transform: translateY(0); }
.dossier-label {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.22em;
  color: #737373; text-transform: uppercase;
}
.dossier-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-family: var(--font-mono); font-size: 11px; color: #a3a3a3;
  line-height: 1.5;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
  padding-bottom: 6px;
}
.dossier-row:last-child { border-bottom: none; padding-bottom: 0; }
.dossier-row .k { color: #525252; text-transform: uppercase; letter-spacing: 0.14em; font-size: 9px; }
.dossier-row .v { color: #fff; text-align: right; }
.dossier-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.22em;
  color: #6fa16f; text-transform: uppercase;
}
.dossier-status::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #6fa16f; box-shadow: 0 0 8px #6fa16f;
  animation: livePulse 1.6s ease-in-out infinite;
}

/* ---------- 4. DROPPED LETTER — (strike/typewriter removed per feedback) ---------- */
.dropped-mark .strike { display: none !important; }
.dropped-mark .slot::after { display: none !important; }

/* ---------- 8. SIGNAL CARD ASCII GLYPHS ---------- */
.sig-card { position: relative; overflow: hidden; }
.sig-glyph {
  position: absolute; top: 20px; right: 20px;
  font-family: var(--font-mono); font-size: 18px;
  color: #262626;
  transition: color 0.4s ease, transform 0.5s var(--ease-out);
  pointer-events: none;
}
.sig-card:hover .sig-glyph {
  color: #fff;
  transform: rotate(20deg) scale(1.15);
}

/* ---------- 9. MARQUEE HOVER SLOWDOWN ---------- */
.marquee:hover .marquee-track {
  animation-duration: 240s;
  transition: animation-duration 0.6s ease;
}

/* ---------- 11. PILLAR LASER BORDER ---------- */
.pillar { position: relative; }
.pillar .pillar-laser {
  position: absolute; inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0; transition: opacity 0.3s ease;
}
.pillar:hover .pillar-laser { opacity: 1; }
.pillar .pillar-laser::before {
  content: ''; position: absolute;
  left: calc(var(--pmx, 50%) - 40px); top: calc(var(--pmy, 50%) - 40px);
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(255,255,255,0.6), transparent 70%);
  filter: blur(10px);
  mix-blend-mode: overlay;
}

/* ---------- 12. PROCESS CONNECT-THE-LINE ---------- */
.process-rule { overflow: hidden; position: relative; }
.process-rule::after {
  content: '';
  position: absolute; left: 0; right: 0; top: 0;
  height: 0; background: linear-gradient(180deg, transparent, #fff 50%, transparent);
  transition: height 1.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.process-rule.in-progress::after { height: 100%; }
.step-ring {
  transition: border-color 0.6s ease, background 0.6s ease, box-shadow 0.6s ease;
}
.step.in .step-ring {
  border-color: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.04), 0 0 20px rgba(255,255,255,0.08);
}
.step.in .step-num { color: #fff; }

/* ---------- 13. FAQ TYPEWRITER ---------- */
.faq-body.typing p { opacity: 0.3; }
.faq-body .tw-char {
  opacity: 0;
  animation: twIn 0.02s linear forwards;
}
@keyframes twIn { to { opacity: 1; } }
.faq-body .tw-done p { opacity: 1; }

/* ---------- 14. NEWS LIVE PULSE ---------- */
.news-live {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em;
  color: #6fa16f; text-transform: uppercase;
  padding: 4px 10px; border: 1px solid rgba(111, 161, 111, 0.3);
  border-radius: 3px; background: rgba(111, 161, 111, 0.06);
  margin-bottom: 16px;
}
.news-live::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: #6fa16f;
  box-shadow: 0 0 10px #6fa16f, 0 0 20px rgba(111, 161, 111, 0.5);
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ---------- 15. LOGO PARTICLE CANVAS ---------- */
#fxParticles {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0.8;
}

/* ---------- 16. BOOT SEQUENCE ---------- */
.fx-boot {
  position: fixed; inset: 0; z-index: 9999;
  background: #000;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(24px, 6vw, 80px);
  color: #a3a3a3; font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 0.05em; line-height: 1.9;
  transition: opacity 0.6s ease, visibility 0s linear 0.6s;
}
.fx-boot.done { opacity: 0; visibility: hidden; pointer-events: none; }
.fx-boot-line {
  opacity: 0; transform: translateX(-6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.fx-boot-line.in { opacity: 1; transform: translateX(0); }
.fx-boot-line .prompt { color: #fff; margin-right: 8px; }
.fx-boot-line .ok { color: #6fa16f; }
.fx-boot-line .progress {
  display: inline-block; min-width: 200px; margin-left: 8px;
  color: #525252;
}
.fx-boot-cursor { display: inline-block; width: 8px; height: 14px; background: #fff; margin-left: 4px; animation: bootBlink 0.8s steps(2) infinite; vertical-align: middle; }
@keyframes bootBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.fx-boot-brand {
  margin-top: 48px;
  font-family: var(--font-display); font-weight: 800; font-size: 14px;
  letter-spacing: 0.3em; color: #fff;
  opacity: 0; transition: opacity 0.5s ease;
}
.fx-boot-brand.in { opacity: 1; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .fx-grain, .fx-aurora-ambient { display: none; }
  .hero-wordmark .line span.glyph { animation: none; transform: none; opacity: 1; }
  .fx-boot { display: none; }
  .dropped-mark .strike, .dropped-mark .slot::before, .dropped-mark .slot::after { transition: none; }
}
