/* ============================================================
   OUT OF DESPAIR — Animations
   Curtain panels, parallax, reveals, micro-interactions
   ============================================================ */

/* ------------------------------------------------------------
   Panel Curtain System
   Each panel is 100vh sticky. Panels stack on z-axis.
   The "curtain" effect: next panel slides up over current.
   ------------------------------------------------------------ */
.panels-wrapper {
  position: relative;
}

.panel {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  will-change: transform;
}

/* Z-index stack — panels are direct siblings, each slides over the previous */
.panel:nth-child(1) { z-index: 1; }
.panel:nth-child(2) { z-index: 2; }
.panel:nth-child(3) { z-index: 3; }
.panel:nth-child(4) { z-index: 4; }
.panel:nth-child(5) { z-index: 5; }

/* ------------------------------------------------------------
   Panel Background
   ------------------------------------------------------------ */
.panel-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
  transform: scale(1.08); /* slight overscan for parallax room */
  transition: transform 0.1s linear;
}

.panel-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Panel content sits above bg and overlay */
.panel-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ------------------------------------------------------------
   Reveal Animations — triggered by .is-visible class (JS adds)
   ------------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.75s var(--ease-out),
    transform 0.75s var(--ease-out);
}

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

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.65s var(--ease-out),
    transform 0.65s var(--ease-out);
}

.reveal-stagger.is-visible > *:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0ms; }
.reveal-stagger.is-visible > *:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 100ms; }
.reveal-stagger.is-visible > *:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 200ms; }
.reveal-stagger.is-visible > *:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 300ms; }
.reveal-stagger.is-visible > *:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 400ms; }

/* Fade only (no translate) */
.reveal-fade {
  opacity: 0;
  transition: opacity 0.9s var(--ease-out);
}
.reveal-fade.is-visible { opacity: 1; }

/* Slide from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-32px);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out);
}
.reveal-left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* Scale in */
.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition:
    opacity 0.65s var(--ease-out),
    transform 0.65s var(--ease-spring);
}
.reveal-scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* ------------------------------------------------------------
   Hero entry animation — runs on page load
   ------------------------------------------------------------ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(184,131,42,0.30); }
  50%       { box-shadow: 0 4px 32px rgba(184,131,42,0.55); }
}

.hero-entry-logo   { animation: fadeIn   0.9s var(--ease-out)  0.1s both; }
.hero-entry-line1  { animation: fadeUp   0.9s var(--ease-out)  0.3s both; }
.hero-entry-line2  { animation: fadeUp   0.9s var(--ease-out)  0.5s both; }
.hero-entry-cta    { animation: fadeUp   0.9s var(--ease-out)  0.75s both; }
.hero-entry-crisis { animation: fadeIn   1.2s var(--ease-out)  1.1s both; }
.nav-entry         { animation: slideDown 0.7s var(--ease-out) 0.0s both; }

/* CTA button pulse — draws eye gently */
.btn-primary {
  animation: goldPulse 3.5s ease-in-out 2s infinite;
}
.btn-primary:hover {
  animation: none;
}

/* ------------------------------------------------------------
   Parallax elements — moved by JS via CSS custom property
   ------------------------------------------------------------ */
[data-parallax] {
  will-change: transform;
  transform: translateY(var(--parallax-y, 0px));
  transition: transform 0.05s linear;
}

/* Slower drift — for large display text */
[data-parallax="slow"] {
  --parallax-speed: 0.08;
}

/* Normal drift */
[data-parallax="normal"] {
  --parallax-speed: 0.15;
}

/* Faster drift — for smaller/decorative elements */
[data-parallax="fast"] {
  --parallax-speed: 0.25;
}

/* ------------------------------------------------------------
   Nav transitions
   ------------------------------------------------------------ */
.site-nav {
  transition:
    background var(--duration-normal) var(--ease-out),
    backdrop-filter var(--duration-normal) var(--ease-out),
    transform var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out);
}

.site-nav.nav-scrolled {
  background: rgba(17, 30, 74, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(17,30,74,0.25);
}

.site-nav.nav-hidden {
  transform: translateY(-100%);
}

.site-nav.nav-visible {
  transform: translateY(0);
}

/* ------------------------------------------------------------
   Service cards
   ------------------------------------------------------------ */
.service-card {
  transition:
    transform var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out);
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* ------------------------------------------------------------
   Stat counter — the "11 lives" moment
   ------------------------------------------------------------ */
@keyframes countUp {
  from { opacity: 0; transform: translateY(16px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.stat-number {
  display: inline-block;
}

.stat-number.is-visible {
  animation: countUp 0.8s var(--ease-spring) both;
}

/* ------------------------------------------------------------
   Gold accent line — decorative divider that draws in
   ------------------------------------------------------------ */
@keyframes drawLine {
  from { width: 0; opacity: 0; }
  to   { width: 48px; opacity: 1; }
}

.divider.is-visible {
  animation: drawLine 0.6s var(--ease-out) 0.2s both;
}

/* ------------------------------------------------------------
   Mobile overrides — reduce motion
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-stagger > *,
  .reveal-fade,
  .reveal-left,
  .reveal-scale,
  [data-parallax] {
    transition: none !important;
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .btn-primary {
    animation: none !important;
  }
}
