/**
 * Mobile conversion sprint — ≤768px only. Desktop unchanged.
 */

@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100svh;
    max-width: 100%;
  }

  /* ── Mobile landing scroll (atmosphere stays fixed behind content) ── */
  html[data-split-landing] #page-landing {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    z-index: 4;
    min-height: 100svh;
    height: auto !important;
    overflow: visible !important;
  }

  html[data-split-landing] #splitLandingMount,
  html[data-split-landing] #page-landing .split-landing-mount {
    position: relative !important;
    inset: auto !important;
    min-height: 100svh;
    height: auto !important;
    overflow: visible !important;
    pointer-events: none;
  }

  html[data-split-landing] .cw,
  html[data-split-landing] .cw--mobile-static {
    min-height: 100svh;
    height: auto !important;
    overflow: visible !important;
  }

  html[data-split-landing] .cw-scenes,
  html[data-split-landing] .cw-scenes--mobile {
    height: auto !important;
    overflow: visible !important;
  }

  /* ── Phase 1: Navigation bar ─────────────────────────────────── */
  .nav.nav-a {
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    min-height: 56px;
    z-index: 200 !important;
    pointer-events: auto;
  }

  .nav-a__end,
  .nav-a__end .auth-signup-btn,
  .nav-a__menu-btn {
    pointer-events: auto;
  }

  .nav-a__start {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    min-width: 0;
  }

  .nav-a__start .split-brand {
    max-width: min(48vw, 180px);
  }

  .nav-a__start .nav-a__links {
    display: none !important;
  }

  .nav-a__end {
    flex: 0 0 auto;
    margin-left: 0;
    padding-top: 0;
    width: auto;
    gap: 8px;
    align-items: center;
  }

  .nav-a__end .auth-signin-btn {
    display: none !important;
  }

  .nav-a__end .auth-signup-btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 10px;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  .nav-a__end .nav-settings {
    display: none !important;
  }

  html[data-mobile-conversion] .nav-a__end #authSignedOut {
    display: flex !important;
  }

  html[data-mobile-conversion] .nav-a__end #authSignedIn {
    display: none !important;
  }

  html[data-mobile-conversion] body.bt-mobile-authed .nav-a__end #authSignedOut {
    display: none !important;
  }

  html[data-mobile-conversion] body.bt-mobile-authed .nav-a__end #authSignedIn {
    display: flex !important;
    align-items: center;
    gap: 8px;
  }

  html[data-mobile-conversion] body.bt-mobile-authed .nav-a__end .auth-signup-btn {
    display: none !important;
  }

  html[data-mobile-conversion] body.bt-mobile-authed .nav-a__end .auth-plan-badge {
    display: none !important;
  }

  .nav-a__menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(212, 168, 90, 0.28);
    border-radius: 10px;
    background: rgba(8, 12, 20, 0.55);
    color: rgba(232, 236, 245, 0.9);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s;
  }

  .nav-a__menu-btn:active,
  .nav-a__menu-btn:focus-visible {
    border-color: rgba(212, 168, 90, 0.55);
    background: rgba(212, 168, 90, 0.1);
    outline: none;
  }

  .nav-a__menu-icon,
  .nav-a__menu-icon::before,
  .nav-a__menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
    position: relative;
  }

  .nav-a__menu-icon::before,
  .nav-a__menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .nav-a__menu-icon::before {
    top: -6px;
  }

  .nav-a__menu-icon::after {
    top: 6px;
  }

  /* Drawer — hidden on desktop */
  .nav-a__drawer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
    visibility: hidden;
  }

  .nav-a__drawer.is-open {
    pointer-events: auto;
    visibility: visible;
  }

  .nav-a__drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 6, 12, 0.62);
    opacity: 0;
    transition: opacity 0.28s ease;
  }

  .nav-a__drawer.is-open .nav-a__drawer-backdrop {
    opacity: 1;
  }

  .nav-a__drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(88vw, 320px);
    height: 100%;
    background: linear-gradient(180deg, rgba(14, 18, 28, 0.98), rgba(8, 10, 16, 0.99));
    border-left: 1px solid rgba(212, 168, 90, 0.18);
    box-shadow: -16px 0 48px rgba(0, 0, 0, 0.45);
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 20px 20px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .nav-a__drawer.is-open .nav-a__drawer-panel {
    transform: translateX(0);
  }

  .nav-a__drawer-close {
    align-self: flex-end;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(232, 236, 245, 0.85);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }

  .nav-a__drawer-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .nav.nav-a .nav-link--drawer {
    display: block;
    width: 100%;
    text-align: left;
    min-height: 44px;
    padding: 12px 14px;
    font-size: 15px;
    border-radius: 10px;
    color: rgba(232, 236, 245, 0.82);
  }

  .nav.nav-a .nav-link--drawer:active {
    background: rgba(212, 168, 90, 0.1);
    color: var(--gold, #d4a85a);
  }

  .nav-a__drawer-auth {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-a__drawer-auth .auth-signin-btn,
  .nav-a__drawer-auth .nav-drawer-signin,
  .nav-a__drawer-auth .auth-signup-btn,
  .nav-a__drawer-auth .nav-drawer-signup,
  .nav-a__drawer-auth .nav-drawer-dashboard {
    min-height: 48px;
    width: 100%;
    justify-content: center;
    text-align: center;
    border-radius: 12px;
  }

  /* Clerk modal must sit above drawer + landing atmosphere on mobile */
  .cl-modalBackdrop,
  .cl-modalContent,
  #clerk-components {
    pointer-events: auto !important;
  }

  .cl-modalContent {
    z-index: 10001 !important;
  }

  .cl-formButtonPrimary,
  .cl-socialButtonsBlockButton,
  .cl-formFieldInput {
    touch-action: manipulation;
  }

  /* Briefing + intelligence wheels — taps must not be swallowed by pulse strip / overlays */
  .wheel-pulse-strip {
    pointer-events: none !important;
  }

  #page-dashboard.active .intel-wheel__viewport,
  #page-why.active .intel-wheel__viewport,
  #page-why.active #whmWheelViewport,
  #page-dashboard.active #wheelViewport {
    pointer-events: auto !important;
    touch-action: manipulation;
    position: relative;
    z-index: 5;
  }

  #page-dashboard.active .intel-wheel__chip,
  #page-why.active .intel-wheel__chip {
    pointer-events: auto !important;
    touch-action: manipulation;
    cursor: pointer;
  }

  #page-why.active .briefing-rail__wheel {
    position: relative;
    z-index: 3;
  }

  #page-why.active .briefing-main,
  #page-dashboard.active .wheel-module-viewport {
    position: relative;
    z-index: 1;
    pointer-events: auto;
  }

  body.nav-drawer-open {
    overflow: hidden;
  }

  /* ── Phase 2: Hero CTAs ──────────────────────────────────────── */
  .cw-hero-ctas--mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin: 20px 0 8px;
  }

  .cw-hero-ctas--mobile .cw-hero-cta-btn {
    min-height: 48px;
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 12px;
    cursor: pointer;
    border: none;
    font-family: inherit;
  }

  .cw-hero-ctas--mobile .cw-cta-pri.cw-hero-cta-btn {
    background: linear-gradient(135deg, var(--gold, #d4a85a), var(--gold-bright, #e8c178));
    color: #0a0c10;
  }

  .cw-hero-ctas--mobile .cw-cta-sec.cw-hero-cta-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(212, 168, 90, 0.35);
    color: rgba(232, 236, 245, 0.92);
  }

  .cw-hero-ctas--mobile .cw-hero-cta-btn:active {
    transform: scale(0.98);
    opacity: 0.92;
  }

  /* ── Phase 3: Hide visual noise ─────────────────────────────── */
  .cw-hud,
  .cw-float,
  .cw-scan,
  .cw-particles,
  .cw-dual,
  .cw-river,
  .cw-phrases,
  .cw-grid,
  .cw-react-glow,
  .cw-fog,
  .cw-progress {
    display: none !important;
  }

  .cw--mobile-static .cw-env,
  .cw--mobile-static .cw-cam {
    display: none !important;
  }

  /* ── Mobile immersive atmosphere (CSS-only, no canvas/GSAP) ── */
  .cw-mobile-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    isolation: isolate;
    background:
      radial-gradient(ellipse 100% 85% at 50% 42%, transparent 28%, rgba(0, 0, 0, 0.62) 100%),
      radial-gradient(circle at 18% 35%, rgba(40, 80, 140, 0.24), transparent 42%),
      radial-gradient(circle at 82% 30%, rgba(185, 135, 55, 0.2), transparent 45%),
      radial-gradient(ellipse 55% 40% at 50% 18%, rgba(78, 120, 200, 0.08), transparent 62%),
      linear-gradient(180deg, #050608 0%, #08090b 48%, #040506 100%);
  }

  .cw-mobile-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.4;
    background:
      repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent calc(14% - 0.5px),
        rgba(100, 145, 210, 0.035) calc(14% - 0.5px),
        rgba(100, 145, 210, 0.065) 14%,
        transparent calc(14% + 14px)
      ),
      repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent calc(34% - 0.5px),
        rgba(130, 165, 220, 0.025) calc(34% - 0.5px),
        rgba(130, 165, 220, 0.05) 34%,
        transparent calc(34% + 10px)
      ),
      repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent calc(52% - 0.5px),
        rgba(170, 195, 235, 0.02) calc(52% - 0.5px),
        rgba(170, 195, 235, 0.045) 52%,
        transparent calc(52% + 8px)
      ),
      repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent calc(72% - 0.5px),
        rgba(212, 168, 90, 0.02) calc(72% - 0.5px),
        rgba(212, 168, 90, 0.04) 72%,
        transparent calc(72% + 12px)
      ),
      repeating-linear-gradient(
        90deg,
        transparent 0,
        transparent calc(88% - 0.5px),
        rgba(185, 135, 55, 0.018) calc(88% - 0.5px),
        rgba(185, 135, 55, 0.038) 88%,
        transparent calc(88% + 9px)
      ),
      linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 22%, transparent 72%, rgba(0, 0, 0, 0.14) 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 58%, transparent 92%);
    mask-image: linear-gradient(180deg, #000 0%, #000 58%, transparent 92%);
  }

  .cw-mobile-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.14;
    background-image:
      url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E"),
      radial-gradient(circle at 8% 14%, rgba(255, 255, 255, 0.42) 0.45px, transparent 0.55px),
      radial-gradient(circle at 22% 68%, rgba(255, 255, 255, 0.28) 0.4px, transparent 0.5px),
      radial-gradient(circle at 41% 28%, rgba(255, 255, 255, 0.32) 0.35px, transparent 0.45px),
      radial-gradient(circle at 63% 52%, rgba(212, 168, 90, 0.35) 0.4px, transparent 0.5px),
      radial-gradient(circle at 79% 22%, rgba(255, 255, 255, 0.3) 0.35px, transparent 0.45px),
      radial-gradient(circle at 91% 74%, rgba(255, 255, 255, 0.25) 0.35px, transparent 0.45px);
    background-size: 180px 180px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
    mix-blend-mode: overlay;
  }

  html[data-split-landing] .split-landing-mount {
    position: relative;
    z-index: 0;
    overflow: visible;
    pointer-events: none;
  }

  html[data-split-landing] .split-landing-mount .cw-mobile-bg {
    pointer-events: none;
  }

  html[data-split-about] #splitAboutMount .cw-env {
    pointer-events: none;
  }

  /* About mount: absolute inside page (Safari fixed overlay bug) */
  html[data-mobile-conversion][data-split-about] #page-about.active #splitAboutMount {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    min-height: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
  }

  html[data-mobile-conversion][data-split-about] #page-about.active #splitAboutMount .cw-mobile-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100svh;
  }

  /* About phone: pull background mount to viewport top (main padding leaves void band) */
  @media (max-width: 480px) {
    html[data-mobile-conversion][data-split-about] #page-about.active #splitAboutMount {
      position: fixed !important;
      inset: 0;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      width: 100%;
      min-height: 100svh;
      height: auto;
    }
  }

  html[data-split-landing] #page-landing:not(.active) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  html[data-split-landing] .split-atmosphere,
  html[data-split-about] .split-atmosphere,
  html[data-split-landing] body > .split-river,
  html[data-split-about] body > .split-river {
    display: none !important;
  }

  html[data-split-about] #page-about {
    background: #050608;
  }

  html[data-split-about] #page-about .about-wrap {
    position: relative;
    z-index: 2;
  }

  .cw--mobile-static {
    position: relative;
    z-index: 1;
    pointer-events: auto;
  }

  .cw--mobile-static .cw-scenes,
  .cw--mobile-static .cw-scene,
  .cw--mobile-static .cw-scene-inner,
  .cw--mobile-static .cw-hero-ctas--mobile,
  .cw--mobile-static .cw-hero-cta-btn,
  .cw--mobile-static button,
  .cw--mobile-static a {
    pointer-events: auto;
  }

  .cw-scene--hero .cw-ed-line__curtain {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .cw-scene--hero.has-revealed .cw-hero-copy--stable,
  .cw-scene--hero .cw-hero-copy--stable {
    opacity: 1 !important;
  }

  .cw-scene--hero .cw-hero-editorial {
    font-size: clamp(2rem, 9.5vw, 2.65rem) !important;
    line-height: 0.95 !important;
  }

  .cw-sub {
    font-size: 15px !important;
    line-height: 1.55 !important;
  }

  .cw-proof-item span {
    font-size: 11px !important;
  }

  /* ── Phase 4: Performance — disable motion layers ───────────── */
  .cw--snap {
    scroll-snap-type: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  .cw-cam,
  .cw-particles i,
  .cw-river--b .cw-river-track,
  .cw-vert-stream-inner,
  .cw-type-line {
    animation: none !important;
    transform: none !important;
  }

  /* ── Phase 5: About page ───────────────────────────────────── */
  #page-about {
    overflow-x: hidden !important;
    max-width: 100vw;
  }

  #page-about .about-wrap,
  #page-about .about-section,
  #page-about .about-hero,
  #page-about .about-principles {
    max-width: 100%;
    overflow-x: hidden;
  }

  #page-about .about-principles {
    grid-template-columns: 1fr !important;
  }

  #page-about .about-wrap,
  #page-about .about-section p {
    max-width: 100%;
    box-sizing: border-box;
  }

  #page-about .about-hero h1,
  #page-about .about-hero h1 span,
  #page-about .about-hero h1 em {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .about-wrap {
    padding: 24px 18px 72px;
    overflow-x: hidden;
  }

  .about-hero {
    margin-bottom: 28px;
    padding-bottom: 0;
    border-bottom: none;
  }

  .about-hero-desc--full {
    display: none;
  }

  .about-hero-desc--short {
    display: block;
    font-size: 15px;
    line-height: 1.65;
    color: var(--ink-dim, rgba(232, 236, 245, 0.72));
    margin: 0 0 4px;
  }

  .about-stat-row {
    flex-wrap: wrap;
    overflow-x: hidden;
    gap: 12px;
  }

  .about-stat {
    min-width: 0;
    flex: 1 1 calc(50% - 8px);
  }

  #page-about .about-wrap,
  #page-about .about-hero-cta--mobile,
  #page-about .about-hero-cta__btn,
  #page-about .about-hero-cta__continue {
    pointer-events: auto;
  }

  .about-hero-cta--mobile {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0 8px;
  }

  .about-hero-cta--mobile .btn-primary {
    min-height: 48px;
    width: 100%;
    font-size: 14px;
    border-radius: 12px;
  }

  .about-hero-cta__continue {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    font-size: 13px;
    color: rgba(212, 168, 90, 0.85);
    text-decoration: none;
    letter-spacing: 0.02em;
  }

  .about-hero-cta__continue:active {
    color: var(--gold, #d4a85a);
  }

  html[data-split-about] #splitAboutMount .cw--immersive {
    display: none !important;
  }

  /* Prevent horizontal overflow sitewide on marketing pages */
  html[data-mobile-conversion] body,
  html[data-mobile-conversion] .page.active {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100svh;
    max-width: 100vw;
  }

  /* About/Pricing: stay above any stale landing stack when routed on mobile */
  html[data-mobile-conversion] #page-about.active,
  html[data-mobile-conversion] #page-pricing.active {
    position: relative;
    z-index: 5;
    display: block !important;
    min-height: 100svh;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    isolation: isolate;
  }

  html[data-mobile-conversion] #page-about.active {
    overflow: visible !important;
  }

  html[data-split-about] #page-about.active .about-wrap,
  html[data-split-pricing] #page-pricing.active .pricing {
    position: relative;
    z-index: 10;
    isolation: isolate;
    pointer-events: auto;
  }
}

/* Desktop: hide mobile-only chrome */
@media (min-width: 769px) {
  .nav-a__menu-btn,
  .nav-a__drawer,
  .about-hero-cta--mobile,
  .cw-hero-ctas--mobile,
  .about-hero-desc--short {
    display: none !important;
  }
}
