/* Open Ice Initiative: scrolling and motion layer. Loaded right after nx.css
   on every page. Owned by the motion work; page CSS should not need to touch
   anything here. */

/* 1. The page itself must scroll. site.css has an old ".nx" card rule
   (display:flex, overflow:hidden, a border) and every inner page puts class
   "nx" on <body>, so the body became a clipped flex box and the wheel,
   trackpad and keyboard could not scroll the page at all. */
body.nx{display:block;overflow:visible;border:0;transform:none;transform-style:flat;transition:none}
body.nx:hover{border-color:transparent}

/* 2. main clips its decorations without becoming a scroll container, so
   position:sticky inside it (.nx-toc, sticky photos, sub navs) keeps working */
body.nx main{overflow:clip}

/* 3. Same page links land below the sticky header. Pages that set their own
   scroll-margin-top keep theirs (this has no specificity). */
:where(main [id], main [name]){scroll-margin-top:96px}
@media (max-width:700px){:where(main [id], main [name]){scroll-margin-top:84px}}

/* 4. The header collapses its top row once the page has scrolled. Without
   this the whole page jumped up by that height mid scroll (layout shift):
   the margin grows by exactly what the header loses, on the same curve. The
   amount is measured by motion.js into --oii-hc. */
header.shell{transition:transform .3s var(--ease-move,cubic-bezier(.2,.7,.2,1)),margin-bottom .3s var(--ease-move,cubic-bezier(.2,.7,.2,1))}
body.cond header.shell{margin-bottom:var(--oii-hc,0px)}
html.oii-measure header.shell,html.oii-measure header.shell *{transition:none!important}

/* 5. Smooth wheel scrolling (assets/js/smooth.js + vendor Lenis). Lenis
   animates the scroll itself, so CSS smooth scrolling must stand down while
   it runs, or every frame is eased twice. */
html.lenis,html.lenis body{height:auto}
html.lenis,html.lenis-smooth,html.oii-smooth{scroll-behavior:auto!important}
.lenis:not(.lenis-autoToggle).lenis-stopped{overflow:clip}
.lenis [data-lenis-prevent]{overscroll-behavior:contain}
.lenis.lenis-smooth iframe{pointer-events:none}
html[data-motion="less"],html[data-motion="reduced"]{scroll-behavior:auto}

/* 6. Horizontal scrollers: a sideways swipe stays in the strip (no browser
   back gesture), a vertical swipe always scrolls the page. */
.nx-car-track,.nx-strip,.greel,.nx-tl-bar,.nxs-tabs,.nxn-sub .nx-wrap{overscroll-behavior-x:contain;touch-action:pan-x pan-y}
.pk-row{touch-action:pan-y}

/* 7. Never a sideways page scroll on a phone because something is a few
   pixels too wide. clip (not hidden) so sticky still works. */
html,body{overflow-x:clip}

/* 8. Safety nets. If motion.js never runs (blocked, failed to load), the
   intro gets out of the way and the page unlocks after a few seconds, and
   anything waiting to be revealed shows. */
@keyframes oii-intro-gone{to{opacity:0;visibility:hidden;pointer-events:none}}
@keyframes oii-unlock{to{overflow:visible}}
body.introing{animation:oii-unlock 0s 3.6s forwards}
#intro{animation:oii-intro-gone .3s 3.6s forwards}
html.oii-reveal-all [data-m]{opacity:1!important;transform:none!important}
html.oii-reveal-all [data-m="wipe"]>span{transform:none!important}
@media print{[data-m]{opacity:1!important;transform:none!important}#intro{display:none!important}}

/* 9. Reduced motion, either from the device or from Settings */
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
