/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE POLISH  (dx-sim-fix-mobile-polish)
   Loaded after seek-next-adnav.css / seek-next-adah.css. Two mobile-only fixes:
     A. the phone nav menu: a readable surface, a soft scrim behind it, and an
        open/close motion that grows from under the nav;
     B. See it in action (#orb, <=759.98px): every state's device fits whole
        inside the stage instead of running off its top edge.
   Desktop (>860px nav, >=760px demo) is not touched by any rule here.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────── A. THE MENU ──────────────────────────────
   WHY THE OLD ONE READ BADLY: the panel lived INSIDE the pill, and the pill has
   its own backdrop-filter — which makes it the panel's backdrop root, so the
   panel's blur had nothing to blur but the pill. What reached the eye was a
   62-72% tint over perfectly crisp page type. In this candidate the panel is
   the pill's SIBLING inside the .nav wrapper, so its material samples the real
   page (and the scrim), and the surface itself is far more opaque. */
.adnav__panel {
  --adm-bg: rgba(24, 22, 32, .92);
  --adm-line: rgba(255, 255, 255, .09);
  --adm-ink: #F4F1F6;
  --adm-press: rgba(255, 255, 255, .08);
}
html[data-theme="light"] .adnav__panel {
  --adm-bg: rgba(251, 251, 249, .93);
  --adm-line: rgba(21, 20, 25, .08);
  --adm-ink: #151419;
  --adm-press: rgba(21, 20, 25, .06);
}
/* the scrim: dims the page behind the open menu. Colour only — no full-screen
   backdrop-filter, which would re-sample the page (and the hero clip) on every
   frame under it. It lives on the wrapper's ::before, below the pill and the
   panel in the nav's own stacking context, and never takes a pointer. */
.nav { --adm-scrim: rgba(6, 5, 10, .40); }
html[data-theme="light"] .nav { --adm-scrim: rgba(22, 21, 28, .18); }

@media (max-width: 860px) {
  .nav::before {
    content: ""; position: absolute; z-index: -1;
    inset: -110vh -110vw;
    background: var(--adm-scrim);
    opacity: 0; pointer-events: none;
    transition: opacity 200ms cubic-bezier(.4, 0, .6, 1);
  }
  html.adnav-open .nav::before {
    opacity: 1;
    transition: opacity 260ms cubic-bezier(.2, .8, .2, 1);
  }

  /* the surface: same rounded shape and position under the pill (a clean
     10px gap), now nearly opaque with a soft blur of what is behind it */
  .adnav__panel {
    position: absolute; top: calc(100% + 10px); left: 0; right: 0;
    display: flex; flex-direction: column; gap: 2px; padding: 8px;
    border-radius: 24px;
    background: var(--adm-bg); color: var(--adm-ink);
    border: 1px solid var(--adm-line);
    -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
    box-shadow: 0 24px 48px -22px rgba(0, 0, 0, .55), 0 4px 14px -8px rgba(0, 0, 0, .22);
    font-family: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    /* CLOSED POSE (and the way out): tucked 8px up toward the nav, a hair
       smaller, transparent. Origin = the menu button (set by the script). */
    opacity: 0;
    transform: translate3d(0, -8px, 0) scale(.985);
    transform-origin: var(--adm-ox, 50%) 0;
    transition: opacity 180ms cubic-bezier(.4, 0, 1, 1), transform 220ms cubic-bezier(.4, 0, .6, 1);
  }
  html.adnav-open .adnav__panel {
    opacity: 1; transform: none;
    transition: opacity 240ms cubic-bezier(.2, .8, .2, 1), transform 280ms cubic-bezier(.2, .8, .2, 1);
  }
  /* rows: calm and easy to hit — 50px targets, 17px type, no icons */
  .adnav__panel a {
    display: flex; align-items: center; min-height: 50px; padding: 0 16px;
    border-radius: 16px; color: var(--adm-ink); text-decoration: none;
    font-size: 17px; font-weight: 500; letter-spacing: -.005em;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 120ms ease-out;
  }
  .adnav__panel a:active { background: var(--adm-press); }
  .adnav__panel a:focus-visible { outline: 2px solid #1FD3AE; outline-offset: -2px; }
}

/* ───────────────────── B. SEE IT IN ACTION: THE WHOLE DEVICE ───────────────
   THE CROP: the stage was 100svh - 132px tall with overflow hidden, the device
   anchored to its foot over a ~193px caption reserve, and the device was sized
   from the viewport WIDTH only. On a real iPhone 15 Pro (svh 695) that left
   ~370px for a ~407px device, so its top — bezel and Dynamic Island — ran 23-42px
   past the stage edge and was cut.

   THE FIT: the section keeps its exact height (margin 96 -> 40, card +56), so
   nothing below it moves. The card now spans the small viewport minus the
   nav's band (100svh - 76px): svh does not change as Safari's toolbar comes
   and goes, so the stage never resizes under a scroll. seek-next-mpol.js turns
   that stable box into one scale factor per state (--fit1..3: the largest that
   keeps the whole composition inside the device area, capped so a tall screen
   does not over-grow it) and centres all three states on the SAME midline, so
   switching states never moves the stage. Nothing is hidden to make it fit. */
@media (max-width: 759.98px) {
  .orb__card[data-orb-live] {
    height: clamp(576px, calc(100svh - 76px), 876px);
    margin-top: 40px;
  }
  .orb__card[data-orb-fit] .stage--1 .phone { --pw: calc(var(--pw1) * .73 * var(--fit1, 1)); }
  .orb__card[data-orb-fit] .stage--2 .phone { --pw: calc(var(--pw2) * .63 * var(--fit2, 1)); }
  .orb__card[data-orb-fit] .stage--3 .phone { --pw: calc(var(--pw3) * .88 * var(--fit3, 1)); }
  .orb__card[data-orb-fit] .stage--3 .phone--left {
    margin-left: calc(var(--pw3) * .26px * var(--fit3, 1));
    margin-right: calc(var(--lap3) * -1 * var(--fit3, 1));
    margin-bottom: calc(var(--top3) * var(--fit3, 1));
  }
  /* one device area for all three states: [top gap, caption - gap] */
  .orb__card[data-orb-fit] .stage--1,
  .orb__card[data-orb-fit] .stage--2,
  .orb__card[data-orb-fit] .stage--3 { align-items: center; }
  .orb__card[data-orb-fit] .stage--1 { padding-top: var(--dz-t1); padding-bottom: var(--dz-b1); }
  .orb__card[data-orb-fit] .stage--2 { padding-top: var(--dz-t2); padding-bottom: var(--dz-b2); }
  .orb__card[data-orb-fit] .stage--3 { padding-top: var(--dz-t3); padding-bottom: var(--dz-b3); }
}
