/* =========================================================
   Phoenix Capitals | Motion layer (GSAP + Three.js)
   Everything here is scoped under html.js, which an inline <head> script adds.
   If JavaScript or the CDN fails, nothing is hidden and the site renders as normal.
   ========================================================= */

/* ---------- Pre-reveal: hide animated elements until GSAP has set their start state ---------- */
/* Keep this list in sync with REVEAL_SELECTORS in js/motion/reveal.js */
html.js:not(.motion-ready) :is(
  .pc-eyebrow, .pc-section-title, .pc-hero-title, .pc-hero-lead, .pc-hero-sub, .pc-hero-inner .d-flex, .pc-strip-item,
  .pc-banner h1, .pc-banner p, .pc-crumb, .pc-lead, .pc-divider, .pc-section-head p,
  .pc-card, .pc-listing, .pc-cat, .pc-industry, .pc-benefit, .pc-challenge, .pc-quote, .pc-post, .pc-step,
  .pc-info, .pc-fact, .pc-panel-navy, .pc-side-box, .pc-stat, .pc-photo, .pc-detail-img, .pc-cta h2
) { visibility: hidden; }

/* Early cover so the preloader / page-transition panel shows before the first paint */
html.js.pc-preload body::after,
html.js.pc-arriving body::after { position: fixed; inset: 0; z-index: 1001; background: var(--pc-navy); content: ""; }

/* ---------- Lenis ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* ---------- Preloader (GSAP driven) ---------- */
.pc-preloader.is-gsap { opacity: 1; visibility: visible; pointer-events: auto; transition: none; }
.pc-preloader.is-gsap .pc-preloader-line { background: rgba(247, 245, 239, .14); }
.pc-preloader.is-gsap .pc-preloader-line::after { width: 100%; animation: none; transform: scaleX(var(--pc-progress, 0)); transform-origin: left center; }

/* ---------- Page transition wipe ---------- */
.pc-wipe { position: fixed; inset: 0; z-index: 999; background: var(--pc-navy); border-right: 3px solid var(--pc-gold); transform: scaleX(0); transform-origin: left center; pointer-events: none; }
.pc-wipe.is-covering { pointer-events: auto; }

/* ---------- Split text lines ---------- */
.pc-line-mask { padding-bottom: .08em; margin-bottom: -.08em; }

/* ---------- Buttons ---------- */
.motion-ready .pc-btn { position: relative; isolation: isolate; overflow: hidden; }
.motion-ready .pc-btn::before { position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: rgba(255, 255, 255, .16); content: ""; transform: scaleX(0); transform-origin: right center; transition: transform .45s cubic-bezier(.76, 0, .24, 1); }
.motion-ready .pc-btn:hover::before { transform: scaleX(1); transform-origin: left center; }

/* ---------- Hover lift once a card has finished its reveal ---------- */
.motion-ready .is-revealed:is(.pc-card, .pc-listing, .pc-cat, .pc-post) { transition: border-color .25s, box-shadow .25s, transform .35s cubic-bezier(.2, .7, .2, 1); }
.motion-ready .is-revealed:is(.pc-card, .pc-listing, .pc-post):hover { transform: translateY(-6px); }
.motion-ready .is-revealed.pc-cat:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(11, 22, 44, .08); }
.motion-ready :is(.pc-listing-img, .pc-industry, .pc-post-img) { overflow: hidden; }
.motion-ready :is(.pc-listing-img, .pc-industry, .pc-post-img) img { transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.motion-ready :is(.pc-listing, .pc-industry, .pc-post):hover img { transform: scale(1.06); }

/* ---------- Site-wide 3D scroll world ---------- */
.pc-world { position: fixed; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 1.4s ease; }
html.has-world .pc-world { opacity: 1; }
/* Section backgrounds paint below the canvas, section content paints above it */
html.has-world main > section > .container,
html.has-world .pc-footer > .container,
html.has-world .pc-hero-strip { position: relative; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .pc-world { display: none; }
  .motion-ready .pc-btn::before, .motion-ready .is-revealed, .motion-ready :is(.pc-listing-img, .pc-industry, .pc-post-img) img { transition: none; }
  .motion-ready .is-revealed:hover, .motion-ready :is(.pc-listing, .pc-industry, .pc-post):hover img { transform: none; }
}
