/* Page transitions */
@view-transition { navigation: auto; }

.header { view-transition-name: site-header; }

::view-transition-old(root) { animation: vt-out 0.28s var(--ease) both; }
::view-transition-new(root) { animation: vt-in 0.5s var(--ease) both; }

@supports not (view-transition-name: none) {
  main, .footer { animation: page-in 0.6s var(--ease) both; }
}

body.is-leaving main,
body.is-leaving .footer { opacity: 0; transform: translateY(-12px); transition: opacity 0.28s, transform 0.28s var(--ease); }

/* Entrance & scroll reveal */
.enter { animation: rise 0.9s var(--ease) backwards; animation-delay: calc(var(--d, 0) * 120ms + 100ms); }

.reveal { opacity: 0; }
.reveal.is-visible { opacity: 1; animation: rise 0.8s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 90ms); }

.section__head.is-visible .section__title::after { animation: grow-x 0.8s var(--ease) 0.3s backwards; }

/* Hero */
.hero::before,
.page-hero::before { animation: grid-pan 22s linear infinite; }

.hero__orbs span:nth-child(1) { animation: drift 14s ease-in-out infinite alternate; }
.hero__orbs span:nth-child(2) { animation: drift 18s ease-in-out infinite alternate-reverse; }
.hero__orbs span:nth-child(3) { animation: drift 11s ease-in-out infinite alternate; }

.hero__panel {
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.4s var(--ease);
  animation: panel-in 1.1s var(--ease) 0.45s backwards;
}
.hero__panel::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / 0.4) 50%, transparent 65%);
  transform: translateX(-120%); animation: shine 7s ease-in-out 2s infinite;
}
.hero__logo { animation: float 6s ease-in-out infinite; }

.scroll-cue span { animation: scroll-dot 1.8s ease-in-out infinite; }

/* Header */
.progress { transition: transform 0.1s linear; }

@media (min-width: 960px) {
  .nav__menu a:not(.btn) { position: relative; }
  .nav__menu a:not(.btn)::after {
    content: ""; position: absolute; left: 0.8rem; right: 0.8rem; bottom: 0.15rem; height: 2px; border-radius: 2px;
    background: var(--gold-600); transform: scaleX(0); transform-origin: left; transition: transform 0.3s var(--ease);
  }
  .nav__menu a:not(.btn):hover::after,
  .nav__menu a[aria-current="page"]::after { transform: scaleX(1); }
}

@media (max-width: 959px) {
  .nav__menu.is-open li { animation: slide-in 0.45s var(--ease) backwards; }
  .nav__menu.is-open li:nth-child(2) { animation-delay: 50ms; }
  .nav__menu.is-open li:nth-child(3) { animation-delay: 100ms; }
  .nav__menu.is-open li:nth-child(4) { animation-delay: 150ms; }
  .nav__menu.is-open li:nth-child(5) { animation-delay: 200ms; }
}

/* Buttons */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, transparent 30%, rgb(255 255 255 / 0.35) 50%, transparent 70%);
  transform: translateX(-100%); transition: transform 0.6s var(--ease);
}
.btn:hover::after { transform: translateX(100%); }
.btn .icon { transition: transform 0.25s var(--ease); }
.btn:hover .icon { transform: translateX(4px); }

/* Cards */
.card { position: relative; overflow: hidden; transition: transform 0.35s var(--ease), box-shadow 0.35s, border-color 0.35s, background-color 0.35s; }
.card::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold-600), var(--gold-300));
  transform: scaleX(0); transform-origin: left; transition: transform 0.45s var(--ease);
}
.card:hover::before { transform: scaleX(1); }
.card__icon { transition: transform 0.4s var(--ease), background-color 0.3s, color 0.3s; }
.card:hover .card__icon { transform: rotate(-8deg) scale(1.08); background: var(--navy-800); color: var(--gold-300); }

.why, .step, .panel, .vm__item, .director, .stat { transition: transform 0.35s var(--ease), box-shadow 0.35s; }
.why:hover, .step:hover, .director:hover, .stat:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.why__num { transition: color 0.35s, transform 0.5s var(--ease); }
.why:hover .why__num { color: var(--gold-300); transform: scale(1.15) rotate(-6deg); }

.step.is-visible .step__num { animation: pop 0.6s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 90ms + 250ms); }

.panel.is-visible .flow li { animation: pop 0.5s var(--ease) backwards; }
.panel.is-visible .flow li:nth-child(2) { animation-delay: 0.15s; }
.panel.is-visible .flow li:nth-child(3) { animation-delay: 0.25s; }
.panel.is-visible .flow li:nth-child(4) { animation-delay: 0.35s; }
.panel.is-visible .flow li:nth-child(5) { animation-delay: 0.45s; }
.panel.is-visible .flow li:nth-child(6) { animation-delay: 0.55s; }
.panel.is-visible .flow li:nth-child(7) { animation-delay: 0.65s; }
.panel.is-visible .flow li:nth-child(8) { animation-delay: 0.75s; }
.panel.is-visible .flow li:nth-child(9) { animation-delay: 0.85s; }

.director__avatar { animation: pulse-ring 2.8s ease-out infinite; }

/* Gradient bands */
.commitment, .cta { background-size: 200% 200%; animation: gradient-shift 12s ease-in-out infinite; }

/* Form */
.form.is-shaking { animation: shake 0.45s ease-in-out; }

/* Keyframes */
@keyframes rise { from { opacity: 0; transform: translateY(28px); } }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes vt-out { to { opacity: 0; transform: translateY(-14px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(18px); } }
@keyframes grow-x { from { transform: scaleX(0); } }
@keyframes grid-pan { to { transform: translate(40px, 40px); } }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.15); } }
@keyframes panel-in { from { opacity: 0; transform: perspective(1000px) translateY(40px) rotateX(12deg); } }
@keyframes shine { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes float { 50% { transform: translateY(-10px); } }
@keyframes scroll-dot { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(30px); } }
@keyframes pop { from { opacity: 0; transform: scale(0.6); } }
@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgb(201 162 39 / 0.45); }
  70%, 100% { box-shadow: 0 0 0 16px rgb(201 162 39 / 0); }
}
@keyframes gradient-shift { 50% { background-position: 100% 50%; } }
@keyframes shake {
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) {
    animation: none !important; transition: none !important;
  }
  .reveal { opacity: 1; }
}
