/* =====================================================================
   30 · One section = one screen (home page, desktop/laptop only)
   ---------------------------------------------------------------------
   Every home section is sized to the visible screen below the sticky
   nav, so a whole section is visible at once and scrolling settles on
   the next one (gentle "proximity" snap: never traps the user).

   --nav-h / --ann-h are measured by js/section-fit.js (fallbacks below).
   That script also scales a section down (min 55%) when its content
   still doesn't fit: short laptop screens, DevTools open, browser zoom.
   Phones/tablets (< 1024px wide) keep the normal flowing layout.

   Selectors start with .page[data-route="/"] so they beat the inline
   <style> blocks inside src/pages/home.html.
   ===================================================================== */

:root{
  --nav-h:81px;
  --ann-h:36px;
  --screen:calc(100svh - var(--nav-h));   /* usable height of one screen */
  --fit-pad:clamp(24px,4svh,48px);        /* top/bottom breathing room   */
}

@media (min-width:1024px){   /* keep in sync with js/section-fit.js */

  /* ---------- snap scrolling, only while the home page is showing ---------- */
  html:has(.page[data-route="/"]:not([hidden])){
    scroll-snap-type:y proximity;
    scroll-padding-top:var(--nav-h);
  }

  /* ---------- shared: each section fills one screen, content centred ---------- */
  .page[data-route="/"] > :is(#m3,#p3,#p2s,#opt3,.home-festive,.svc,#how,#w3,.home-faq,.contact){
    min-height:var(--screen);
    box-sizing:border-box;
    display:flex;
    flex-direction:column;
    justify-content:center;
    scroll-snap-align:start;
    /* css/15-inner-hero.css gives every [id] scroll-margin-top:96px; with the
       nav offset above that made #m3 etc. snap ~60-95px short (last line cut) */
    scroll-margin-top:0;
    padding-top:var(--fit-pad);
    padding-bottom:var(--fit-pad);
  }
  /* keep inner wrappers full width inside the flex column */
  .page[data-route="/"] > :is(#m3,#p3,#p2s,#opt3,.home-festive,.svc,#w3,.home-faq,.contact) > *{
    width:100%;
  }

  /* ---------- 1. Hero: screen 1 = intro, screen 2 = franchise models ---------- */
  /* The hero is two screens tall, so it must NOT be one snap area: a snap area
     taller than the screen lets the browser stop anywhere inside it, which left
     the next section (#m3) ~85px short and cut off its last line.
     Instead each of its two screens snaps on its own. */
  .page[data-route="/"] > .hero{
    padding-top:0;
    padding-bottom:0;
    scroll-snap-align:none;
  }
  .page[data-route="/"] > .hero > .wrap{
    /* first screen also has the announce bar above the nav */
    min-height:calc(100svh - var(--nav-h) - var(--ann-h));
    display:flex;
    flex-direction:column;
    justify-content:center;
    box-sizing:border-box;
    padding-top:var(--fit-pad);
    padding-bottom:var(--fit-pad);
    scroll-snap-align:start;
    scroll-margin-top:var(--ann-h);   /* snap position = very top of the page */
  }
  /* franchise strip + trust bar + marquee share screen 2 */
  .page[data-route="/"] > .hero > .fm{
    margin-top:0;
    padding-top:var(--fit-pad);
    padding-bottom:clamp(10px,2svh,28px);
    scroll-snap-align:start;
  }

  .page[data-route="/"] > .hero .fm-head{margin-bottom:clamp(8px,1.5svh,22px)}
  .page[data-route="/"] > .hero .fm-view{padding-top:clamp(8px,1.5svh,20px); padding-bottom:clamp(10px,2svh,30px)}

  /* ---------- 2. What is Macis Infi 3DX (#m3) ---------- */
  .page[data-route="/"] #m3 .m3-wrap{padding-top:0}
  .page[data-route="/"] #m3 .m3-panel{margin-top:clamp(18px,3svh,32px)}
  .page[data-route="/"] #m3 .m3-tag{
    margin-top:clamp(14px,2.5svh,24px);
    padding:clamp(14px,2.5svh,22px) 0 0;
  }

  /* ---------- 3. Three ways to work with us (#p3) ---------- */
  .page[data-route="/"] #p3{--mh:clamp(170px,27svh,260px)}
  .page[data-route="/"] #p3 .p3-wrap{padding:0}
  .page[data-route="/"] #p3 .p3-h{margin-bottom:clamp(18px,3svh,32px)}

  /* ---------- 4. Best seller: P2S Combo (#p2s) ---------- */
  /* not a full screen: just its content + 5px top/bottom */
  .page[data-route="/"] > #p2s{min-height:0; padding-top:20px; padding-bottom:20px}
  .page[data-route="/"] #p2s .p2-wrap{padding:0}
  .page[data-route="/"] #p2s .p2-head{margin-bottom:clamp(14px,2.5svh,28px)}
  .page[data-route="/"] #p2s .p2-media{height:clamp(220px,46svh,420px)}
  .page[data-route="/"] #p2s .p2-buy{
    margin-top:clamp(10px,1.8svh,18px);
    padding-top:clamp(10px,1.8svh,18px);
  }

  /* count strip is a thin band between sections: no screen of its own */
  .page[data-route="/"] > .count-strip-wrap{padding-top:12px; padding-bottom:12px}

  /* ---------- 5. Franchise option cards carousel (#opt3) ---------- */
  .page[data-route="/"] #opt3 .sec-head{margin-bottom:0}
  .page[data-route="/"] #opt3 .oc-stage{margin-top:0}

  /* ---------- 6. Festive banner / 7. Services ---------- */
  .page[data-route="/"] .svc .sec-head{margin-bottom:clamp(16px,2.5svh,30px)}

  /* ---------- 8. How it works (#how) ----------
     The stage is a fixed-ratio artwork (1600x876) with the step cards placed on
     it, so instead of cropping its height we narrow it until it fits one screen. */
  .page[data-route="/"] > #how{padding-top:0; padding-bottom:0; align-items:center; min-height:0}  /* height = artwork only, no black bands */
  @media (min-width:1101px){
    /* --how-h is set in src/pages/home.html (#how .hsx-stage) */
    .page[data-route="/"] #how .hsx-stage{width:min(100%, calc(var(--screen) * 1600 / var(--how-h, 876)))}
  }
  /* 1024-1100px: the site stacks this section; drop the tall empty card boxes */
  @media (max-width:1100px){
    .page[data-route="/"] > #how > .hsx-stage{width:100%; padding-top:var(--fit-pad); padding-bottom:var(--fit-pad)}
    .page[data-route="/"] #how .hsx-glass{min-height:0 !important}
  }

  /* ---------- 9. Why partner (#w3) ---------- */
  /* compact: don't stretch to a full screen, just tight padding around the content */
  .page[data-route="/"] > #w3{min-height:0; padding-top:56px; padding-bottom:56px}
  .page[data-route="/"] #w3 .w3-wrap{padding-top:0; padding-bottom:0}
  .page[data-route="/"] #w3 .w3-head{margin-bottom:28px}
  /* keep 4 cards in one row (the site drops to 2 rows below 1100px) */
  .page[data-route="/"] #w3 .w3-grid{grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px}

  /* ---------- 10–11. FAQ / Contact ---------- */
  /* FAQ: compact, no full-screen stretch (change the 48px values for more/less space) */
  .page[data-route="/"] > .home-faq{min-height:0; padding-top:48px; padding-bottom:48px}
  .page[data-route="/"] .home-faq .sec-head{margin-bottom:clamp(16px,2.5svh,30px)}
}

/* Users who prefer less motion get normal scrolling (no snap). */
@media (prefers-reduced-motion:reduce){
  html:has(.page[data-route="/"]:not([hidden])){scroll-snap-type:none}
}
