/* ALZAN wave-1 roots background cap — 2026-11-30 (Maher1)  v=20261130-rbg4
   New file only. Do not edit ab2-premium.css, alz-motion-v2.css,
   the audit hotfix, wave1.css, or any other existing CSS.

   Evidence (live cache = live motion-v2.css?v=20261129-pm2, byte-identical
   to the local copy; alz-motion-v2.js?v=20261129-pm2; ab2-premium.css
   ?v=20261129-prem-r01b). Peak scale was sampled every frame over a
   full scroll cycle (home/products/ASD, 390 and 1440): peak 1.04,
   min 1.03, never above 1.04. The scale is MOTION, so it is kept.

   - JS adds class `alz-roots` to `<div class="alz-roots-bg">`.
   - html.alz-go .alz-roots { transform: scale(1.04); transform-origin: 50% 40%; }
   - Scroll-driven: @keyframes alz-roots-depth
       from scale(1.04) → to scale(1.03) plus translate3d(0,-1.4%,0)
   - Fallback (alz-nosda): scale(calc(1.04 - var(--alz-rp,0) * .01))
       with --alz-rp clamped 0..1 in JS, so 1.04 → 1.03
   - Ivory sweep on ::before is translateX only (no scale).
   - Audit hotfix CSS/JS does not touch roots scale.

   Caps (unchanged in rbg2–rbg4):
     desk roots-bg-desk.webp 2560×1707 → half 1280 → floor(1280/1.04) = 1230px
     mob  roots-bg-mob.webp  1080×1920 → half  540 → floor( 540/1.04) =  519px
   background-size: min(<cap>px, 100%) auto; center; no-repeat;
   charcoal #202124 around the image.

   rbg2 (Maher3 review): add a VERTICAL fade at the image's top and
   bottom, in addition to the horizontal fade, at ALL breakpoints,
   so the image dissolves into #202124 on all four sides. The hard
   bottom/top edge was visible at 1920 and at 390. Sizes, motion and
   centering are untouched. Two mask gradients on the empty decorative
   div, combined with mask-composite:intersect / -webkit-mask-composite:
   source-in. Text and chrome are not on this div, so they are not clipped.
   Masked-away margins reveal html's background, also #202124.

   rbg3 (maher4 on live techlib afe02a8a): at 1440×1100, cover × 1.04
   paints ~1716px (1100 × 2560/1707 × 1.04) because cover sizes by
   the taller viewport. The cap must also apply on technical-library
   (hook sits before alz-static-techlib CSS). background-size,
   background-position and background-repeat are therefore !important
   so a later page sheet cannot restore cover. Caps, motion, mask and
   centering are unchanged.

   rbg4 (Maher3, 390 line under the buttons): at 390×844 the painted
   mob image is 693.33px tall (390 × 1920/1080), 721.07px after
   scale(1.04) from origin 50% 40%. The visual bitmap bottom sits at
   y=785.91 (maps to ~y=850 in the 64px-labelled side-by-side).
   Culprit is .alz-roots-bg itself, not a hero/section/border.
   rbg2/rbg3 set --alz-rbg-h: calc(min(cap,100%) * ratio) and then
   used that value in the vertical mask gradient, so 100% resolved
   against the box HEIGHT (844px), not the image width. At 390 that
   yields min(519,844)*1920/1080 = 922.67px, taller than the real
   693.33px image. The mask's bottom transparent stop therefore sat
   at 50%+922.67/2 = 883.3px — below the bitmap edge at 768.67px —
   and the 50.64px fade never reached the edge, which stayed hard.
   Motion translate is 0 at scroll 0. Fix: compute --alz-rbg-h from
   100vw (a width basis, same number as background-size) so the
   mask stops sit on the painted image; and on <768px lengthen the
   bottom fade to 35% of that painted height (≈242.7px). The top
   fade stays clamp(40px,6vh,96px). From 768px up, both fades stay
   that clamp. Caps, motion, centering and !important
   size/position/repeat are unchanged.

   under prefers-reduced-motion: JS never adds html.alz-go, so the
   scale/sweep do not apply. Belt-and-braces rules below also cancel
   roots animation and transform if alz-go is somehow present.
*/

html{background:#202124}

.alz-roots-bg{
  --alz-rbg-cap:1230px;
  --alz-rbg-ratio:calc(1707 / 2560);
  --alz-rbg-w:min(var(--alz-rbg-cap),100%);
  --alz-rbg-h:calc(min(var(--alz-rbg-cap),100vw) * 1707 / 2560);
  --alz-rbg-fade-x:clamp(40px,4vw,80px);
  --alz-rbg-fade-y:clamp(40px,6vh,96px);
  --alz-rbg-fade-y-bottom:var(--alz-rbg-fade-y);
  background-color:#202124;
  background-size:min(var(--alz-rbg-cap),100%) auto !important;
  background-position:center !important;
  background-repeat:no-repeat !important;
  /* Horizontal fade at the image's left/right, vertical fade at its
     top/bottom. Intersect so both apply. Used at every breakpoint.
     Bottom stop uses --alz-rbg-fade-y-bottom (same as top from 768px
     up; 35% of --alz-rbg-h under 768px). */
  -webkit-mask-image:
    linear-gradient(
      to right,
      transparent 0,
      transparent max(0px,calc(50% - var(--alz-rbg-w) / 2)),
      #000 max(0px,calc(50% - var(--alz-rbg-w) / 2 + var(--alz-rbg-fade-x))),
      #000 calc(50% + var(--alz-rbg-w) / 2 - var(--alz-rbg-fade-x)),
      transparent calc(50% + var(--alz-rbg-w) / 2),
      transparent 100%
    ),
    linear-gradient(
      to bottom,
      transparent 0,
      transparent max(0px,calc(50% - var(--alz-rbg-h) / 2)),
      #000 max(0px,calc(50% - var(--alz-rbg-h) / 2 + var(--alz-rbg-fade-y))),
      #000 calc(50% + var(--alz-rbg-h) / 2 - var(--alz-rbg-fade-y-bottom)),
      transparent calc(50% + var(--alz-rbg-h) / 2),
      transparent 100%
    );
  mask-image:
    linear-gradient(
      to right,
      transparent 0,
      transparent max(0px,calc(50% - var(--alz-rbg-w) / 2)),
      #000 max(0px,calc(50% - var(--alz-rbg-w) / 2 + var(--alz-rbg-fade-x))),
      #000 calc(50% + var(--alz-rbg-w) / 2 - var(--alz-rbg-fade-x)),
      transparent calc(50% + var(--alz-rbg-w) / 2),
      transparent 100%
    ),
    linear-gradient(
      to bottom,
      transparent 0,
      transparent max(0px,calc(50% - var(--alz-rbg-h) / 2)),
      #000 max(0px,calc(50% - var(--alz-rbg-h) / 2 + var(--alz-rbg-fade-y))),
      #000 calc(50% + var(--alz-rbg-h) / 2 - var(--alz-rbg-fade-y-bottom)),
      transparent calc(50% + var(--alz-rbg-h) / 2),
      transparent 100%
    );
  -webkit-mask-size:100% 100%,100% 100%;
  mask-size:100% 100%,100% 100%;
  -webkit-mask-repeat:no-repeat,no-repeat;
  mask-repeat:no-repeat,no-repeat;
  -webkit-mask-position:center,center;
  mask-position:center,center;
  mask-mode:alpha,alpha;
  -webkit-mask-composite:source-in;
  mask-composite:intersect;
}

/* Mobile still uses --alz-roots-mob (premium.css, max-width 767px). */
@media (max-width:767px){
  .alz-roots-bg{
    --alz-rbg-cap:519px;
    --alz-rbg-ratio:calc(1920 / 1080);
    --alz-rbg-h:calc(min(var(--alz-rbg-cap),100vw) * 1920 / 1080);
    --alz-rbg-fade-y-bottom:calc(var(--alz-rbg-h) * 0.35);
  }
}

@media (prefers-reduced-motion:reduce){
  html.alz-go .alz-roots,
  html.alz-go.alz-nosda .alz-roots,
  html.alz-go.alz-sda .alz-roots{
    animation:none !important;
    transform:none;
  }
  html.alz-go .alz-roots::before{
    animation:none !important;
  }
}
