/* Stacked panels. panels.js marks the sections from the hero to the FAQ as
   panels. Each fills the window below the header; it waits when its last line
   reaches the bottom of the window, and the next panel rises over it. The page
   snaps: it comes to rest on each panel, and a fast scroll stops at the next
   one instead of running past it. The FAQ ends the stack: it covers the
   privacy panel, then scrolls away with About and the closing band. Wide
   windows at least 600px tall only, and never with Reduce Motion. Without the
   script the page is an ordinary page. */

.jw-snaps { display:none; }

/* The hero fills the window below the header, from 560px to 1100px tall.
   The phone is the one flexible part of the composition, so it shrinks with
   the window's height (to 196px wide) for everything to fit. */
@media screen and (min-width:1051px) and (min-height:600px) {
  :root { --hero-fit:clamp(560px, calc(100svh - var(--site-header-height, 85px)), 1100px); --hero-phone-max:240px; }
  .hero { display:flex; flex-direction:column; min-height:var(--hero-fit); }
  .hero > .hero-grid { flex:1 0 auto; min-height:0; padding-block:clamp(28px, 6svh, 56px) clamp(24px, 5svh, 48px); }
  .hero-phone { width:clamp(196px, calc((var(--hero-fit) - 298px) * .49), var(--hero-phone-max)); }
}
@media screen and (min-width:1600px) {
  :root { --hero-phone-max:255px; }
}

@media screen and (min-width:1000px) and (min-height:600px) and (prefers-reduced-motion:no-preference) {
  :root { --panel-edge:#0c162847; --panel-shade:#0b1322; --panel-shade-max:.28; }
  :root[data-theme="dark"] { --panel-edge:#000000b8; --panel-shade:#000; --panel-shade-max:.6; }

  html.has-panels { scroll-padding-top:var(--site-header-height, 85px); }
  html.has-panels .jw-panel [id] { scroll-margin-top:16px; }

  /* Every panel after the hero is at least a window tall, so it covers the one
     below it completely. Short content sits in the middle. The hero keeps its
     own limits above: nothing lies beneath it. */
  html.has-panels .jw-panel {
    position:relative;
    z-index:var(--panel-z);
    display:flex;
    flex-direction:column;
    justify-content:center;
  }
  html.has-panels .jw-panel:not(.hero) { min-height:calc(100svh - var(--site-header-height, 85px)); }
  html.has-panels .jw-tail { position:relative; z-index:var(--panel-z); }
  /* Opaque, so nothing shows through; zero specificity, so .soft keeps its tint. */
  :where(html.has-panels .jw-panel, html.has-panels .jw-tail) { background-color:var(--bg); }
  html.has-panels .jw-panel + .jw-panel { box-shadow:0 -1px 0 var(--line), 0 -28px 48px -28px var(--panel-edge); }

  /* panels.js sets --panel-top: the header's height when the panel fits the
     window, otherwise the offset that keeps its bottom at the window's foot.
     A panel lets go once the next one has covered it. */
  html.has-panels .jw-panel:not(.jw-panel-last):not(.is-released) { position:sticky; top:var(--panel-top, var(--site-header-height, 85px)); }
  html.has-panels.panels-measuring .jw-panel { position:relative !important; top:auto !important; }

  /* The panel underneath dims as the next one covers it. */
  html.has-panels .jw-panel:not(.jw-panel-last)::after {
    content:"";
    position:absolute;
    inset:0;
    z-index:9;
    background:var(--panel-shade);
    opacity:calc(var(--cover, 0) * var(--panel-shade-max));
    pointer-events:none;
  }

  /* Snap stops, placed by panels.js on invisible 1px markers that follow the
     panels' places in the page (a waiting panel is drawn somewhere else). A
     landing stop puts a panel's top under the header; a rest stop puts a tall
     panel's foot at the window's foot. Both hold a fast scroll, except a rest
     stop with little below the fold. Soft stops every few pixels fill a tall
     panel between its two stops and the page from the FAQ down, so the page
     can rest anywhere there. No marker is taller than the window: Safari
     before mid-2026 pulls a reader inside such a snap area back to its top
     after any layout. */
  html.has-panels { scroll-snap-type:y mandatory; }
  html.has-panels .jw-snaps { display:block; position:absolute; top:0; left:0; width:1px; height:0; pointer-events:none; }
  html.has-panels .jw-snap { position:absolute; left:0; width:1px; height:1px; scroll-snap-align:start; scroll-snap-stop:always; }
  html.has-panels .jw-snap-rest { scroll-snap-align:end; }
  html.has-panels .jw-snap-soft { scroll-snap-stop:normal; }
  html.has-panels.panels-measuring .jw-snap { display:none; }

  /* The holds in viewport-sections.js did this job for two sections. */
  html.has-panels .jw-panel .section-hold.can-hold { min-height:0; }
  html.has-panels .jw-panel .section-hold.can-hold > :first-child { position:static; }
}
