/* adiverse polish layer
   Shared interaction + motion layer, loaded on every page after the page's own <style>.
   Principles (Apple "Designing Fluid Interfaces"):
   - feedback on press, not release
   - motion that settles like a critically damped spring, no lingering ease-in
   - enter and exit along the same path
   - restraint: nothing loops forever to grab attention
   - reduced motion / transparency / contrast are respected everywhere */

:root {
  --pl-spring: cubic-bezier(0.22, 1, 0.36, 1);   /* ~ damping 1.0, response 0.35 */
  --pl-exit: cubic-bezier(0.4, 0, 1, 1);         /* mirror of the entry curve */
  --pl-press: 90ms;
}

/* ─── Type: balanced headings, no orphans, tabular numbers on stats ─── */
h1, h2, h3 { text-wrap: balance; font-optical-sizing: auto; }
p, li { text-wrap: pretty; }
.rt-num, .stat-number, .hv-v, .hv-pill-v, .hv-table, .compare-table td,
[class*="stat"] strong { font-variant-numeric: tabular-nums; }

/* ─── Press feedback: instant on pointer-down, springy release ─── */
.btn-primary, .btn-outline, .submit-btn, .footer-email-form button,
.nav-cta a, .nav-link, .faq-question, .faq-item summary, .close-btn,
.mobile-nav-close, .hamburger, .pl-menu-btn {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-primary, .btn-outline, .submit-btn, .footer-email-form button {
  transition: transform 0.45s var(--pl-spring), opacity 0.2s ease,
              background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.3s ease, color 0.2s ease;
}
.btn-primary:active, .btn-outline:active, .submit-btn:active,
.footer-email-form button:active, .close-btn:active, .mobile-nav-close:active,
.hamburger:active, .pl-menu-btn:active {
  transform: scale(0.97) !important;
  transition-duration: var(--pl-press) !important;
}
.faq-question:active, .faq-item summary:active { background: rgba(255,255,255,0.025); }

/* Cards: lift settles like a spring rather than a linear 0.25s */
.result-tile, .diff-card, .service-card, .proof-card, .how-step, .stat-card {
  transition-timing-function: var(--pl-spring) !important;
  transition-duration: 0.45s !important;
}

/* Focus you can actually see (keyboard users only) */
:focus-visible { outline: 2px solid var(--lime, #BCF362); outline-offset: 3px; border-radius: 8px; }
.btn-primary:focus-visible, .btn-outline:focus-visible { border-radius: 100px; }

/* ─── Audit button glow: present, but not pulsing forever ───
   Static halo + one sheen pass after load, replays on hover. */
.btn-glow {
  animation: none !important;
  box-shadow: 0 0 0 1px rgba(188,243,98,0.18), 0 0 22px rgba(188,243,98,0.18);
}
.btn-glow:hover { box-shadow: 0 0 0 1px rgba(188,243,98,0.35), 0 0 30px rgba(188,243,98,0.3); }
.btn-glow::after {
  background-position: 180% 0;
  animation: plSheen 1.5s var(--pl-spring) 1.4s 1 both !important;
}
.btn-glow:hover::after { animation: plSheenHover 0.9s var(--pl-spring) 1 both !important; }
@keyframes plSheen { from { background-position: 180% 0; } to { background-position: -60% 0; } }
@keyframes plSheenHover { from { background-position: 180% 0; } to { background-position: -60% 0; } }

/* ─── Nav: translucent material, edge appears only once content scrolls under ─── */
nav, .site-nav {
  background: rgba(6,6,6,0.72) !important;
  -webkit-backdrop-filter: blur(20px) saturate(170%) !important;
  backdrop-filter: blur(20px) saturate(170%) !important;
  border-bottom-color: transparent !important;
  transition: border-color 0.3s ease, background-color 0.3s ease, top 0.3s ease;
}
nav.pl-scrolled, .site-nav.pl-scrolled { border-bottom-color: rgba(255,255,255,0.07) !important; }

/* Services dropdown grows out of its trigger */
.nav-drop-menu {
  transform-origin: 28px top;
  transform: translateY(-4px) scale(0.96) !important;
  transition: opacity 0.18s ease, transform 0.35s var(--pl-spring), visibility 0.18s !important;
  background: rgba(14,14,14,0.86) !important;
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
}
.nav-dropdown:hover .nav-drop-menu,
.nav-dropdown:focus-within .nav-drop-menu { transform: none !important; }

/* ─── Mobile menu sheet (index drawer + injected on inner pages) ───
   Slides in from the right, leaves to the right, follows your finger. */
.mobile-nav.pl-ready { display: block !important; visibility: hidden; pointer-events: none; }
.mobile-nav.pl-ready.open, .mobile-nav.pl-ready.pl-animating { visibility: visible; pointer-events: auto; }
.mobile-nav.pl-ready .mobile-nav-overlay { opacity: 0; will-change: opacity; }
.mobile-nav.pl-ready .mobile-nav-drawer {
  transform: translate3d(100%,0,0); will-change: transform;
  touch-action: pan-y; overscroll-behavior: contain;
  box-shadow: -24px 0 60px rgba(0,0,0,0.55);
}
.mobile-nav.pl-ready .mobile-nav-drawer::before {
  /* grab affordance on the leading edge */
  content: ''; position: absolute; left: 7px; top: 50%; width: 4px; height: 40px;
  margin-top: -20px; border-radius: 4px; background: rgba(255,255,255,0.12);
}
.mobile-nav-close { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
.hamburger { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; border-radius: 12px; background: none; border: 0; }

/* Injected menu for pages that hide their links on mobile and had no way back */
.pl-menu-btn {
  display: none; width: 44px; height: 44px; border-radius: 12px;
  background: none; border: 0; cursor: pointer; padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.pl-menu-btn span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; }
@media (max-width: 900px) { .pl-menu-btn { display: inline-flex; margin-left: 4px; margin-right: -10px; } }
@media (max-width: 480px) {
  .nav-inner:has(.pl-menu-btn) .nav-cta { gap: 0; }
  .nav-inner:has(.pl-menu-btn) .nav-cta a { padding: 9px 14px !important; font-size: 12.5px !important; }
  .nav-inner:has(.pl-menu-btn) .logo { font-size: 16px; gap: 6px; }
}
.pl-menu-btn:focus-visible { outline-offset: -2px; }

.pl-injected { position: fixed; inset: 0; z-index: 300; }
.pl-injected .mobile-nav-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.pl-injected .mobile-nav-drawer {
  position: absolute; top: 0; right: 0; height: 100%; width: min(320px, 86vw);
  background: rgba(10,10,10,0.94);
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  border-left: 1px solid rgba(255,255,255,0.06);
  padding: 20px 24px 40px; display: flex; flex-direction: column; overflow-y: auto;
}
.pl-injected .mobile-nav-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.pl-injected .mobile-nav-top .logo { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; letter-spacing: -0.03em; color: #fff; }
.pl-injected .mobile-nav-close { background: none; border: 0; color: #999; font-size: 26px; line-height: 1; cursor: pointer; }
.pl-injected .mobile-nav-links { list-style: none; margin: 0 0 28px; padding: 0; }
.pl-injected .mobile-nav-links li { border-bottom: 1px solid rgba(255,255,255,0.06); }
.pl-injected .mobile-nav-links a { display: flex; align-items: center; min-height: 52px; font-size: 16px; font-weight: 600; color: #fff; }
.pl-injected .mobile-nav-links a.active { color: var(--lime, #BCF362); }
.pl-injected .mobile-nav-actions { display: flex; flex-direction: column; gap: 12px; }
.pl-injected .mobile-nav-actions a { width: 100%; justify-content: center; text-align: center; font-size: 15px !important; padding: 15px 20px !important; }

/* ─── Popup: leaves the way it arrived ─── */
.overlay.pl-closing { display: flex !important; animation: plFadeOut 0.22s ease forwards !important; }
.overlay.pl-closing .modal { animation: plSlideDown 0.22s var(--pl-exit) forwards !important; }
@keyframes plFadeOut { to { opacity: 0; } }
@keyframes plSlideDown { from { transform: none; opacity: 1; } to { transform: translateY(20px); opacity: 0; } }

/* ─── FAQ: height follows the content, never clipped ─── */
.faq-answer { transition: max-height 0.45s var(--pl-spring), padding 0.3s ease !important; }

/* ─── Accessibility: motion ─── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .bg-orb, .bg-corner-br, .lq-flow, .lq-bob, .btn-glow::after, [class*="pulse"] { animation: none !important; }
  .hv-line { animation: none !important; stroke-dashoffset: 0 !important; }
  .hv-area { animation: none !important; opacity: 1 !important; }
  .reveal, .reveal-stagger > * { transform: none !important; transition: opacity 0.2s ease !important; }
  .btn-primary, .btn-outline, .result-tile, .diff-card, .service-card, .proof-card, .how-step {
    transition-property: opacity, background-color, border-color, color, box-shadow !important;
  }
  .btn-primary:hover, .btn-primary:active, .btn-outline:active, .result-tile:hover,
  .diff-card:hover, .service-card:hover, .proof-card:hover { transform: none !important; }
  .nav-drop-menu, .nav-dropdown:hover .nav-drop-menu { transform: none !important; }
  .overlay.open, .overlay.open .modal, .overlay.pl-closing, .overlay.pl-closing .modal { animation-duration: 0.01s !important; transform: none !important; }
  .faq-answer { transition: none !important; }
}

/* ─── Accessibility: transparency ─── */
@media (prefers-reduced-transparency: reduce) {
  nav, .site-nav, .nav-drop-menu, .pl-injected .mobile-nav-drawer {
    background: #0A0A0A !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  }
  .overlay, .mobile-nav-overlay { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: rgba(0,0,0,0.92) !important; }
  .lq-river, .bg-grain, .bg-scanlines { display: none !important; }
}

/* ─── Accessibility: contrast ─── */
@media (prefers-contrast: more) {
  :root { --muted: #C8C8C8; --muted2: #BDBDBD; --border: #3A3A3A; }
  nav, .site-nav { background: #000 !important; border-bottom: 1px solid #444 !important; }
  .btn-outline { border-color: #777 !important; }
}
