html.lenis,
html.lenis body {
  height: auto;
}

.lenis:not(.lenis-autoToggle).lenis-stopped {
  overflow: clip;
}

.lenis [data-lenis-prevent],
.lenis [data-lenis-prevent-wheel],
.lenis [data-lenis-prevent-touch],
.lenis [data-lenis-prevent-vertical],
.lenis [data-lenis-prevent-horizontal] {
  overscroll-behavior: contain;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

.lenis.lenis-autoToggle {
  transition-property: overflow;
  transition-duration: 1ms;
  transition-behavior: allow-discrete;
}

/* ===== LOCAL OVERRIDES — ours, not Lenis's =====
   Everything above this line is Lenis 1.3.26 verbatim
   (https://unpkg.com/lenis@1.3.26/dist/lenis.css). Re-check the two rules below
   when upgrading. The file is an override layer and is loaded last on every
   page, after css/mobile.css. */

/* Lenis drives the page by calling window.scrollTo() on every frame. A
   scrollTo() with no explicit behaviour resolves against the element's computed
   `scroll-behavior`, so the `scroll-behavior: smooth` on html in base.css:9
   would turn every one of those frames into its own competing smooth animation.

   Scoped to html.lenis — the class Lenis adds on construction and removes on
   destroy() — so the phones and the reduced-motion path, which never start
   Lenis, keep exactly the smooth scrolling they have today. Deliberately NOT a
   blanket `html { scroll-behavior: auto }`: .carousel-track (css/home.css:296)
   sets smooth for its own horizontal scrolling and would lose it. */
html.lenis { scroll-behavior: auto; }

/* Upstream freezes a stopped page by putting `overflow: clip` on html. We
   cannot have that here.

   `clip` makes html no longer `overflow: visible`, so body's overflow stops
   propagating to the viewport and body becomes a scroll container in its own
   right. That is precisely the state the comment on `body` in css/base.css:26-30
   warns about, and it is what `.page-home .header.scrolled`'s `position: sticky`
   depends on (css/base.css:205-207). It also removes the scrollport the current
   scroll offset lives in.

   The freeze is done by our own body lock instead (see lockScroll in
   js/smooth-scroll.js); lenis.stop() still does its real job, which is to stop
   Lenis consuming wheel events.

   !important is required: upstream's selector is
   `.lenis:not(.lenis-autoToggle).lenis-stopped`, specificity (0,3,0), which
   beats `html.lenis.lenis-stopped` at (0,2,1). */
html.lenis.lenis-stopped { overflow: visible !important; }
