/* ==========================================================================
   ForgeNova Labs — Animations & Micro-interactions
   Light, spark, and energy as visual metaphors.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */
@keyframes spark-pulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(232, 130, 12, 0.35)); }
  50%      { filter: drop-shadow(0 0 42px rgba(232, 130, 12, 0.65)); }
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.06); }
}

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

@keyframes cue-drop {
  0%   { transform: translateY(-100%); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}

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

@keyframes ember-rise {
  0%   { transform: translateY(0) scale(1); opacity: 0; }
  12%  { opacity: 1; }
  100% { transform: translateY(-130px) scale(0.2); opacity: 0; }
}

@keyframes forge-flicker {
  0%, 100% { opacity: 1; }
  92%      { opacity: 1; }
  93%      { opacity: 0.6; }
  94%      { opacity: 1; }
  97%      { opacity: 0.8; }
  98%      { opacity: 1; }
}

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

@keyframes success-pop {
  0%   { transform: scale(0.4); opacity: 0; }
  65%  { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

@keyframes node-ring {
  0%   { box-shadow: 0 0 0 0 rgba(232, 130, 12, 0.45); }
  100% { box-shadow: 0 0 0 18px rgba(232, 130, 12, 0); }
}

/* --------------------------------------------------------------------------
   Applied animation classes
   -------------------------------------------------------------------------- */

/* Hero mark — breathing forge glow */
.hero-mark svg {
  animation: spark-pulse 4.5s ease-in-out infinite;
}

.hero-mark::before {
  animation: glow-breathe 4.5s ease-in-out infinite;
}

/* Animated gradient text (CTA headlines) */
.text-forge-flow {
  background: linear-gradient(110deg,
    var(--steel-300) 0%,
    var(--white) 22%,
    var(--spark-300) 48%,
    var(--spark-500) 64%,
    var(--spark-300) 80%,
    var(--white) 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-slide 7s ease-in-out infinite;
}

/* Scroll cue line drop */
.scroll-cue::after {
  overflow: hidden;
  animation: none;
  position: relative;
}

.scroll-cue i {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 42px;
  overflow: hidden;
}

.scroll-cue i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, var(--spark-400), transparent);
  animation: cue-drop 2.2s var(--ease-forge) infinite;
}

/* Pure-CSS ember field (CTA band) */
.ember-field {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.ember-field span {
  position: absolute;
  bottom: -8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--spark-400);
  box-shadow: 0 0 8px 2px rgba(232, 130, 12, 0.6);
  opacity: 0;
  animation: ember-rise 5s ease-out infinite;
}

.ember-field span:nth-child(1)  { left: 8%;  animation-delay: 0s;    animation-duration: 5.2s; }
.ember-field span:nth-child(2)  { left: 18%; animation-delay: 1.4s;  animation-duration: 6.1s; width: 3px; height: 3px; }
.ember-field span:nth-child(3)  { left: 27%; animation-delay: 2.8s;  animation-duration: 4.6s; }
.ember-field span:nth-child(4)  { left: 36%; animation-delay: 0.7s;  animation-duration: 5.8s; width: 5px; height: 5px; }
.ember-field span:nth-child(5)  { left: 47%; animation-delay: 2.1s;  animation-duration: 5s; }
.ember-field span:nth-child(6)  { left: 55%; animation-delay: 3.5s;  animation-duration: 6.4s; width: 3px; height: 3px; }
.ember-field span:nth-child(7)  { left: 64%; animation-delay: 1.1s;  animation-duration: 4.9s; }
.ember-field span:nth-child(8)  { left: 73%; animation-delay: 2.6s;  animation-duration: 5.6s; width: 5px; height: 5px; }
.ember-field span:nth-child(9)  { left: 84%; animation-delay: 0.4s;  animation-duration: 5.3s; }
.ember-field span:nth-child(10) { left: 92%; animation-delay: 1.9s;  animation-duration: 6s;   width: 3px; height: 3px; }

/* Process node ignition ring */
.process-track.lit .process-node {
  animation: node-ring 1.2s var(--ease-forge) 1;
}

.process-track.lit .process-step:nth-child(3) .process-node { animation-delay: 0.35s; }
.process-track.lit .process-step:nth-child(4) .process-node { animation-delay: 0.7s; }
.process-track.lit .process-step:nth-child(5) .process-node { animation-delay: 1.05s; }

/* Form success */
.contact-form-shell.sent .success-spark {
  animation: success-pop 0.6s var(--ease-forge) both;
}

.contact-form-shell.sent .success-spark svg path {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw-check 0.7s var(--ease-forge) 0.45s forwards;
}

/* Submit button "forging" spinner */
.form-submit.sending .btn-arrow { display: none; }

.form-submit .forge-spinner {
  display: none;
  width: 16px;
  height: 17px;
  background: var(--navy-950);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: spin-slow 0.9s linear infinite;
}

.form-submit.sending .forge-spinner { display: block; }

/* Vault card heat shimmer sweep */
.vault-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(232, 130, 12, 0.06) 50%, transparent 70%);
  transform: translateX(-130%);
  transition: transform 1s var(--ease-forge);
  pointer-events: none;
}

.vault-card:hover::after { transform: translateX(130%); }

/* Subtle flicker on flagship badge — forge light */
.flagship-badge { animation: forge-flicker 6s linear infinite; }

/* --------------------------------------------------------------------------
   Scroll reveal system (driven by js/main.js IntersectionObserver)
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease-forge), transform 0.8s var(--ease-forge);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}

[data-reveal="left"]  { transform: translateX(-36px); }
[data-reveal="right"] { transform: translateX(36px); }
[data-reveal="scale"] { transform: scale(0.94); }

[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

/* Children stagger: parent carries data-reveal-children; JS assigns delays */
[data-reveal-children] > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-forge), transform 0.7s var(--ease-forge);
  transition-delay: var(--reveal-delay, 0s);
}

[data-reveal-children].revealed > * {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Reduced motion — kill it all, content first
   -------------------------------------------------------------------------- */
@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;
  }

  [data-reveal],
  [data-reveal-children] > * {
    opacity: 1;
    transform: none;
  }

  .process-line i { transform: scaleX(1); }
  .ember-field { display: none; }
}
