/* ============================================================
   DYNAMICS.CSS — Framer-inspired motion layer
   Adds: blur-up hero text, parallax, scroll reveals,
   ambient orbs, nav glass transition, staggered entries.
   All colors and content are untouched.
   ============================================================ */

/* ── Reduced-motion safety ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .dyn-char, .dyn-word { opacity: 1 !important; transform: none !important; filter: none !important; }
  .reveal, .reveal-left, .reveal-right, .reveal-up, .reveal-stagger > * { opacity: 1 !important; transform: none !important; }
}

/* ─────────────────────────────────────────────
   1. NAV — Transparent on top, glass on scroll
   ───────────────────────────────────────────── */
body[data-page="home"] nav {
  transition:
    background 0.45s ease,
    box-shadow 0.45s ease,
    backdrop-filter 0.45s ease,
    border-color 0.45s ease;
}

/* At the very top, nav is slightly more transparent */
body[data-page="home"] nav:not(.nav-scrolled) {
  background: rgba(75, 109, 157, 0.55);
  border-bottom-color: rgba(255,255,255,0.06);
  box-shadow: none;
}

/* After scrolling, nav gets the solid glass look */
body[data-page="home"] nav.nav-scrolled {
  background: rgba(21, 22, 69, 0.92);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border-bottom-color: rgba(203, 144, 34, 0.3);
  box-shadow: 0 4px 32px rgba(0,0,0,0.28);
}

/* ─────────────────────────────────────────────
   2. BANNER SLIDESHOW
   ───────────────────────────────────────────── */
.banner-slide {
  transform-origin: center center;
  will-change: transform;
}
/* Hero banner needs preserve-3d for the mouse tilt */
.hero-banner {
  transform-style: preserve-3d;
}

/* Cinematic vignette over banner */
.banner-slideshow::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(10,10,30,0.55) 100%),
    linear-gradient(to bottom, rgba(10,10,30,0.18) 0%, transparent 30%, transparent 70%, rgba(10,10,30,0.42) 100%);
}

/* ─────────────────────────────────────────────
   3. HERO — Blur-up character animation
   ───────────────────────────────────────────── */
.dyn-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(14px) skewX(-2deg);
  filter: blur(8px);
  animation: charIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: opacity, transform, filter;
}
@keyframes charIn {
  to {
    opacity: 1;
    transform: translateY(0) skewX(0);
    filter: blur(0);
  }
}

/* Word-level animation for subtitles */
.dyn-word {
  display: inline-block;
  opacity: 0;
  transform: translateY(22px);
  animation: wordIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: opacity, transform;
}
@keyframes wordIn {
  to { opacity: 1; transform: translateY(0); }
}

/* Hero section entrance */
.hero-section-enter {
  opacity: 0;
  transform: translateY(28px);
  animation: sectionEnter 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes sectionEnter {
  to { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────────
   4. SCROLL REVEALS
   ───────────────────────────────────────────── */
.reveal,
.reveal-left,
.reveal-right,
.reveal-up {
  opacity: 0;
  transition:
    opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.72s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal       { transform: translateY(40px); }
.reveal-left  { transform: translateX(-42px); }
.reveal-right { transform: translateX(42px); }
.reveal-up    { transform: translateY(28px); }

.reveal.in-view,
.reveal-left.in-view,
.reveal-right.in-view,
.reveal-up.in-view {
  opacity: 1;
  transform: translate(0, 0);
}

/* Stagger children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.62s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.62s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-stagger.in-view > *:nth-child(1) { opacity:1; transform:none; transition-delay: 0.05s; }
.reveal-stagger.in-view > *:nth-child(2) { opacity:1; transform:none; transition-delay: 0.13s; }
.reveal-stagger.in-view > *:nth-child(3) { opacity:1; transform:none; transition-delay: 0.21s; }
.reveal-stagger.in-view > *:nth-child(4) { opacity:1; transform:none; transition-delay: 0.29s; }
.reveal-stagger.in-view > *:nth-child(5) { opacity:1; transform:none; transition-delay: 0.37s; }
.reveal-stagger.in-view > *:nth-child(6) { opacity:1; transform:none; transition-delay: 0.45s; }

/* ─────────────────────────────────────────────
   5. AMBIENT GLOW ORBS (home only)
   ───────────────────────────────────────────── */
.ambient-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
body[data-page="home"] .ambient-orbs { display: block; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0;
  animation: orbFloat 18s ease-in-out infinite;
  will-change: transform, opacity;
}
.orb-1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(203,144,34,0.18) 0%, transparent 70%);
  top: -80px; left: -120px;
  animation-delay: 0s;
  animation-duration: 22s;
}
.orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(75,109,157,0.22) 0%, transparent 70%);
  bottom: 10%; right: -100px;
  animation-delay: -7s;
  animation-duration: 19s;
}
.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(236,206,167,0.12) 0%, transparent 70%);
  top: 50%; left: 40%;
  animation-delay: -13s;
  animation-duration: 25s;
}
@keyframes orbFloat {
  0%   { opacity: 0.6; transform: translate(0, 0) scale(1); }
  33%  { opacity: 0.9; transform: translate(30px, -20px) scale(1.06); }
  66%  { opacity: 0.5; transform: translate(-20px, 15px) scale(0.95); }
  100% { opacity: 0.6; transform: translate(0, 0) scale(1); }
}

/* ─────────────────────────────────────────────
   6. HERO CARD — Float animation
   ───────────────────────────────────────────── */
.hero-card {
  animation: cardFloat 6s ease-in-out infinite;
  will-change: transform;
}
@media (prefers-reduced-motion: no-preference) {
  .hero-card {
    animation: cardFloat 6s ease-in-out infinite;
  }
}
@keyframes cardFloat {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

/* ─────────────────────────────────────────────
   7. BUTTON INTERACTIONS — Magnetic feel
   ───────────────────────────────────────────── */
.btn, .nav-btn {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.2s ease;
}
.btn::after, .nav-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.2s ease;
  border-radius: inherit;
  pointer-events: none;
}
.btn:hover::after, .nav-btn:hover::after {
  background: rgba(255,255,255,0.08);
}
.btn.primary:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 18px 38px rgba(203,144,34,0.32);
}
.btn.secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(21,22,69,0.18);
}

/* ─────────────────────────────────────────────
   8. STAT CARDS — Hover lift
   ───────────────────────────────────────────── */
.stat {
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
}
.stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
}

/* ─────────────────────────────────────────────
   9. HERO SECTION — Parallax scroll layer
   ───────────────────────────────────────────── */
.hero-parallax-wrap {
  will-change: transform;
}

/* ─────────────────────────────────────────────
   10. ANNOUNCEMENT — Pulse border
   ───────────────────────────────────────────── */
.announcement {
  animation: announcePulse 3.5s ease-in-out infinite;
}
@keyframes announcePulse {
  0%, 100% { box-shadow: 0 18px 48px rgba(0,61,165,0.10), 0 0 0 0 rgba(203,144,34,0); }
  50%       { box-shadow: 0 18px 48px rgba(0,61,165,0.10), 0 0 0 5px rgba(203,144,34,0.12); }
}

/* ─────────────────────────────────────────────
   11. GRAIN TEXTURE OVERLAY
   ───────────────────────────────────────────── */
body[data-page="home"]::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* ─────────────────────────────────────────────
   12. PAGE TRANSITIONS — no white flash
   ───────────────────────────────────────────── */

/* Dark background on html itself prevents any white flash */
html {
  background: #151645;
}

/* Exit animation class added by JS before navigation */
body.page-leaving {
  pointer-events: none !important;
}

/* ─────────────────────────────────────────────
   13. MINI GALLERY — staggered image reveal
   ───────────────────────────────────────────── */
.mini-gallery img {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease;
}
.mini-gallery img:hover {
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 14px 32px rgba(0,0,0,0.22);
}

/* ─────────────────────────────────────────────
   14. HERO GRID — Entry stagger
   ───────────────────────────────────────────── */
.hero-grid > :first-child {
  opacity: 0;
  animation: heroLeftIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.15s forwards;
}
.hero-grid > :last-child {
  opacity: 0;
  animation: heroRightIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards;
}
@keyframes heroLeftIn {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes heroRightIn {
  from { opacity: 0; transform: translateX(24px) translateY(10px); }
  to   { opacity: 1; transform: translateX(0) translateY(0); }
}

/* Override the card float while entering */
.hero-card {
  animation: heroRightIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.35s forwards,
             cardFloat 6s ease-in-out 1.5s infinite;
}
