/* ============================================================
   Franklin & Partners — static site custom CSS.
   Only the handful of behaviours that the compiled Tailwind bundle
   (styles.css) doesn't already cover: the JS-driven chrome that used
   to be framer-motion (mobile nav, cookie banner, sticky CTA).
   Loaded AFTER styles.css so equal-specificity rules win.
   ============================================================ */

/* ---- Mobile nav dropdown (replaces framer height 0->auto) ---- */
.fp-mobile-menu {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}
.fp-mobile-menu > div { overflow: hidden; min-height: 0; }
.fp-mobile-menu.is-open { grid-template-rows: 1fr; opacity: 1; }

/* hamburger icon swap */
[data-nav-toggle] .fp-icon-close { display: none; }
[data-nav-toggle][aria-expanded="true"] .fp-icon-open { display: none; }
[data-nav-toggle][aria-expanded="true"] .fp-icon-close { display: inline; }

/* ---- Mobile menu backdrop (replaces framer opacity fade) ---- */
.fp-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.fp-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ---- Sticky CTA bars (mobile-cta + page-level bars) ----
   markup ships with translate-y-full (hidden); JS adds .is-visible. */
/* translate-y-full ships via Tailwind v4's `translate` property (not `transform`),
   so the reveal must reset `translate` — overriding only `transform` was a no-op. */
.fp-sticky-cta { transition: translate 0.3s ease, transform 0.3s ease; }
.fp-sticky-cta.is-visible { translate: 0 0 !important; transform: translateY(0) !important; }

/* ---- Cookie banner (replaces framer spring + AnimatePresence) ---- */
.fp-cookie-root[hidden] { display: none !important; }
.fp-cookie-backdrop {
  opacity: 0;
  transition: opacity 0.25s ease;
}
.fp-cookie-root.is-open .fp-cookie-backdrop { opacity: 1; }
.fp-cookie-panel {
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.fp-cookie-root.is-open .fp-cookie-panel { transform: translateY(0); }
.fp-cookie-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}
.fp-cookie-details > div { overflow: hidden; min-height: 0; }
.fp-cookie-details.is-open { grid-template-rows: 1fr; }

@media (prefers-reduced-motion: reduce) {
  .fp-mobile-menu, .fp-backdrop, .fp-sticky-cta,
  .fp-cookie-backdrop, .fp-cookie-panel, .fp-cookie-details {
    transition: none !important;
  }
}

/* ── iOS Safari white-screen fix (mobile) ───────────────────────────────────
   Symptom: on a real iPhone the page paints WHITE and stays white as you scroll
   (worse in Low Power Mode), while it renders perfectly in every desktop / headless
   engine. Cause: the decorative ".mesh-orb" gradient glows use huge blurs
   (blur-[120px] on 300–700px elements) and are each forced into their own GPU
   compositing layer (will-change + translateZ(0) + contain). 8 per page × 117
   pages, on a ~19,000px-tall page, blows past iOS Safari's per-tab tile-memory
   budget, so WebKit drops tiles and paints white. The orbs are faint ambiance
   (opacity 10–30%), so on phones/tablets we drop the GPU cost entirely; desktop
   (which has the memory headroom and no reported issue) keeps the full design. */
@media (max-width: 1024px) {
  .mesh-orb { display: none !important; }                 /* kill the 120px-blur GPU layers */
  /* Decorative round "glow" orbs (rounded-full + blur-3xl / blur-[120px]) relied
     on a huge GPU blur for their soft edge — that's what whited out iOS Safari.
     Drop the blur but keep the SOFT look by feathering the edge with a radial
     mask instead: no offscreen blur buffer, color-agnostic, cheap. Same vibe as
     the hero's radial-gradient glows, none of the GPU cost. */
  [class*="rounded-full"][class*="blur"] {
    filter: none !important;
    -webkit-mask-image: radial-gradient(closest-side, #000 32%, transparent 80%) !important;
            mask-image: radial-gradient(closest-side, #000 32%, transparent 80%) !important;
  }
  /* Everything else blurred (backdrop-blur UI panels, glass-light) just loses the
     blur — those keep their own solid/translucent background. */
  [class*="blur"]:not([class*="rounded-full"]), .glass-light {
    filter: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* ── Long-page render fix (mobile): paint sections on demand ─────────────────
   content-visibility:auto lets WebKit SKIP painting off-screen sections until
   they're scrolled near — so a ~19,000px page only ever holds ~2 screens in the
   compositor instead of all 25. That's what stops iOS Safari from exhausting its
   per-tab tile memory and painting white on the long home page (the orbs above
   were one cost; the page's painted HEIGHT is the other). All content stays — it
   just renders as you reach it.
     • first section (hero) excluded → above-the-fold paints instantly, no placeholder
     • contain-intrinsic-size 'auto' remembers each section's real height after its
       first render, so scrolling stays stable (the 800px is only the first guess)
     • footer included; mobile only — desktop has the headroom and is untouched. */
@media (max-width: 1024px) {
  main > section:not(:first-of-type),
  body > footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 800px;
  }
}
