/* =============================================================
   INCENSION PORTAL — ANIMATIONS
   =============================================================
   All keyframe animations lifted from the funnel.
   Load AFTER brand-tokens.css and components.css.
   ============================================================= */

/* =============================================================
   RISE — staggered entrance animation for hero elements
   Used on page load to bring elements in sequentially.
   ============================================================= */

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

.rise {
  opacity: 0;
  animation: rise 0.8s ease forwards;
}

.rise-1 { animation-delay: 0.1s; }
.rise-2 { animation-delay: 0.25s; }
.rise-3 { animation-delay: 0.4s; }
.rise-4 { animation-delay: 0.55s; }
.rise-5 { animation-delay: 0.7s; }

/* =============================================================
   SCREEN TRANSITIONS — for multi-step flows
   Apply .screen to a section, .screen.active to show it,
   .screen.leaving to animate out.
   ============================================================= */

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

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

.screen {
  display: none;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: slideInRight 0.45s cubic-bezier(0.33, 1, 0.68, 1);
}

.screen.leaving {
  animation: slideOutLeft 0.3s cubic-bezier(0.32, 0, 0.67, 0) forwards !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
}

/* =============================================================
   CLOUD DRIFT — three independent atmospheric animations
   These power the .cloud-1, .cloud-2, .cloud-3 elements.
   Different timings (28s, 34s, 42s) ensure they never sync.
   ============================================================= */

@keyframes driftCloudOne {
  0%   { transform: translate(-5%, 0%) scale(1); }
  50%  { transform: translate(15%, 10%) scale(1.15); }
  100% { transform: translate(-5%, 0%) scale(1); }
}

@keyframes driftCloudTwo {
  0%   { transform: translate(5%, 5%) scale(1.1); }
  50%  { transform: translate(-12%, -8%) scale(0.95); }
  100% { transform: translate(5%, 5%) scale(1.1); }
}

@keyframes driftCloudThree {
  0%   { transform: translate(0%, -3%) scale(1); }
  50%  { transform: translate(-8%, 12%) scale(1.2); }
  100% { transform: translate(0%, -3%) scale(1); }
}

/* =============================================================
   CHECKPOINT BREATH — for progress/unchecked state indicators
   Subtle glow expansion to signal "waiting, alive, cued up"
   ============================================================= */

@keyframes checkpointBreath {
  0%, 100% {
    border-color: rgba(74,143,181,0.45);
    box-shadow: 0 0 0 0 rgba(74,143,181,0);
  }
  50% {
    border-color: rgba(74,143,181,0.75);
    box-shadow: 0 0 0 3px rgba(74,143,181,0.08);
  }
}

/* Stagger three checkpoints for a cascading wave effect */
.checkpoint-list li:nth-child(1)::before {
  animation: checkpointBreath 4s ease-in-out infinite;
}
.checkpoint-list li:nth-child(2)::before {
  animation: checkpointBreath 4s ease-in-out 1.3s infinite;
}
.checkpoint-list li:nth-child(3)::before {
  animation: checkpointBreath 4s ease-in-out 2.6s infinite;
}

/* =============================================================
   COMPLETION CHECKMARK — hand-drawn SVG circle + check
   Apply to an SVG with .draw-circle and .draw-check paths.
   ============================================================= */

@keyframes drawCircle {
  from { stroke-dashoffset: 138; }
  to   { stroke-dashoffset: 0; }
}

@keyframes drawCheck {
  from { stroke-dashoffset: 30; }
  to   { stroke-dashoffset: 0; }
}

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

.complete-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 32px;
  animation: fadeIn 0.4s ease 0.2s both;
}

.complete-mark svg {
  width: 100%;
  height: 100%;
}

.complete-mark .draw-circle,
.complete-mark .draw-check {
  fill: none;
  stroke: var(--color-deep-navy);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.complete-mark .draw-circle {
  stroke-dasharray: 138;
  stroke-dashoffset: 138;
  animation: drawCircle 0.9s ease 0.3s forwards;
}

.complete-mark .draw-check {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: drawCheck 0.4s ease 1.1s forwards;
}

/* =============================================================
   BUILD THEATER — for "we're building your X" loading states
   Used in the funnel's archetype reveal sequence.
   Can be reused on the dashboard for any loading-feels-personalized moment.
   ============================================================= */

@keyframes spinRing {
  to { transform: rotate(360deg); }
}

@keyframes popIn {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.build-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: var(--weight-thin);
  color: var(--color-text-caption);
  line-height: 1.4;
  text-align: left;
  border-bottom: 1px solid rgba(74,143,181,0.12);
  transition: color var(--transition-medium), background var(--transition-medium);
}

.build-step:last-child {
  border-bottom: none;
}

.build-step.active {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.5);
}

.build-step.done {
  color: var(--color-text-body);
}

.step-indicator {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-indicator::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(106,173,208,0.4);
  border-radius: 50%;
  box-sizing: border-box;
  transition: all var(--transition-medium);
}

.build-step.active .step-indicator::before {
  border-color: rgba(106,173,208,0.2);
  border-top-color: var(--color-deep-navy);
  animation: spinRing 0.9s linear infinite;
}

.build-step.done .step-indicator::before {
  width: 18px;
  height: 18px;
  background: var(--color-deep-navy);
  border-color: var(--color-deep-navy);
  animation: popIn 0.3s ease;
}

.build-step.done .step-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 8px;
  border: solid var(--color-white);
  border-width: 0 1.5px 1.5px 0;
  transform: translate(-50%, -60%) rotate(45deg);
  animation: rise 0.25s ease;
}

/* =============================================================
   REDUCED MOTION — respect OS-level preference
   ============================================================= */

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