/* ============================================================================
   FRAME — homepage story + motion support (Phase 4)
   Loaded by index.html only. Phase 4 moved ALL homepage scroll choreography
   to GSAP 3.15 + ScrollTrigger (assets/home-experience.js). The Phase 1
   native scroll-timeline animations, keyframes and observer fallback that
   used to live here have been removed so two motion systems never compete.

   What remains is static styling: the how-to "story stage" component (one
   product object, states via data-s="1|2|3"), the static trust strip, and the
   desktop pinned layout. Gating classes, set on <html>:
     .hx-motion   set before first paint when reduced motion is NOT requested
     .hx-gsap     set by home-experience.js once GSAP has initialised
   Reduced motion / no JS: the story is three static stacked states.
   ========================================================================= */

:root{
  --hm-ease-std:cubic-bezier(.2,.8,.2,1);
  --hm-line:#F39A2C;                /* Frame orange line motif */
  --hm-navy:#17130E;                /* warm ink */
}
/* ------------------------------------------------------------ 1. header */
/* The bar's white surface and its hairline live on two pseudo layers so they
   can fade with scroll (opacity only) instead of snapping at 20px. */
#page-home .nav::before{
  content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:rgba(255,255,255,.93);
  -webkit-backdrop-filter:saturate(150%) blur(8px);backdrop-filter:saturate(150%) blur(8px);
  opacity:0;
}
#page-home .nav::after{
  content:'';position:absolute;left:0;right:0;bottom:0;height:1px;pointer-events:none;
  background:rgba(15,34,51,.09);
  box-shadow:0 10px 24px -14px rgba(15,34,51,.24);
  opacity:0;
}
#page-home .nav.scrolled::before,
#page-home .nav.scrolled::after{opacity:1;}
#page-home .nav.scrolled{
  background:transparent!important;box-shadow:none!important;
  -webkit-backdrop-filter:none!important;backdrop-filter:none!important;
  border-bottom-color:transparent!important;
}
.hx-motion #page-home .nav::before,
.hx-motion #page-home .nav::after{transition:opacity .3s var(--hm-ease-std);}

/* -------------------------------------------- 2. how-to story: the stage */
/* One product object that evolves: content -> design -> export. The same
   markup appears once pinned (desktop) and once per step (stacked flow);
   data-s="1|2|3" sets its state. The QR art is a real, scannable code for
   https://qrcode-frame.com, pre-rendered as static SVG (no QR generation). */
#page-home .howto-step-visual,
#page-home .howto-step-visual:hover{
  padding:0;border:0;background:none;min-height:0;display:block;
}
#page-home .hs-pin{display:none;}

.hs-stage{
  --q:clamp(150px,15vw,200px);
  position:relative;width:100%;max-width:560px;margin-inline:auto;
  background:linear-gradient(180deg,#2A2118 0%,#1B1610 100%);
  border:1px solid rgba(255,255,255,.1);border-radius:20px;
  padding:20px 22px 22px;color:#C9D6E0;
  font-family:'Inter','Inter Fallback','Inter Fallback Android',sans-serif;text-align:left;
  box-shadow:0 30px 60px -32px rgba(0,0,0,.7),inset 0 1px 0 rgba(255,255,255,.05);
}
.hs-head{display:flex;align-items:center;justify-content:space-between;gap:12px;}
.hs-labels{display:grid;overflow:hidden;height:24px;min-width:0;}
.hs-label,.hs-l2w{grid-area:1/1;display:flex;align-items:center;}
.hs-label{
  gap:9px;white-space:nowrap;
  font-family:'Manrope','Manrope Fallback','Manrope Fallback Android',sans-serif;font-size:14px;font-weight:700;color:#fff;
}
.hs-label b{
  display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;
  background:var(--hm-line);color:var(--hm-navy);font-size:11px;font-weight:800;
}
.hs-live{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;color:#8FA6B8;white-space:nowrap;}
.hs-live i{width:6px;height:6px;border-radius:50%;background:var(--hm-line);}

.hs-prog{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin:14px 0 18px;}
.hs-prog span{height:2px;border-radius:2px;background:rgba(255,255,255,.1);overflow:hidden;}
.hs-prog i{display:block;height:100%;background:var(--hm-line);transform-origin:0 50%;scale:0 1;}
.hs-prog .hs-seg1{scale:1 1;}

.hs-tabs{display:flex;gap:6px;overflow:hidden;}
.hs-tab{
  display:inline-flex;align-items:center;height:28px;padding:0 11px;border-radius:8px;flex-shrink:0;
  border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.04);
  font-size:12px;font-weight:600;color:#C9D6E0;
}
.hs-tab.is-on{background:var(--hm-line);border-color:var(--hm-line);color:var(--hm-navy);}
.hs-field{
  display:flex;align-items:center;gap:8px;height:38px;margin-top:10px;padding:0 12px;
  border-radius:9px;background:rgba(255,255,255,.05);border:1px solid rgba(243,154,44,.5);
  font-size:12.5px;color:#E6EDF3;min-width:0;
}
.hs-field svg{width:14px;height:14px;flex-shrink:0;color:var(--hm-line);}
.hs-field span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}

.hs-body{
  display:grid;grid-template-columns:var(--q) minmax(0,1fr);gap:26px;align-items:center;
  margin:24px 0 26px;padding:0 0 8px 7px;
}
.hs-tile{
  position:relative;width:var(--q);aspect-ratio:1;border-radius:14px;background:#fff;
  box-shadow:0 22px 44px -22px rgba(0,0,0,.7);
}
.hs-qr{display:block;width:100%;height:100%;}
.hs-q-design{opacity:0;}
.hs-logo{opacity:0;scale:.55;transform-box:fill-box;transform-origin:center;}
.hs-ring{
  position:absolute;inset:-7px;border:2px solid var(--hm-line);border-radius:20px;
  opacity:0;pointer-events:none;
}
.hs-caption{
  position:absolute;left:50%;bottom:-11px;transform:translateX(-50%);translate:0 8px;opacity:0;
  background:var(--hm-line);color:var(--hm-navy);white-space:nowrap;
  font-family:'Manrope','Manrope Fallback','Manrope Fallback Android',sans-serif;font-size:11px;font-weight:800;
  padding:4px 12px;border-radius:999px;
}
.hs-zbw{opacity:.3;min-width:0;}
.hs-row{display:flex;align-items:center;gap:8px;}
.hs-row + .hs-row{margin-top:14px;}
.hs-k{width:46px;flex-shrink:0;font-size:11.5px;color:#8FA6B8;}
.hs-sw{width:20px;height:20px;border-radius:50%;flex-shrink:0;box-shadow:inset 0 0 0 1px rgba(255,255,255,.2);}
.hs-sw-grad{background:linear-gradient(135deg,#16181D,#B4610A);}
.hs-sw-navy{background:var(--hm-navy);}
.hs-sw-teal{background:#C8862B;}
.hs-sw.is-on{outline:2px solid var(--hm-line);outline-offset:2px;}
.hs-chip{
  display:grid;place-items:center;width:24px;height:24px;border-radius:7px;flex-shrink:0;
  border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.04);
}
.hs-chip::before{content:'';width:9px;height:9px;background:#C9D6E0;}
.hs-chip-dot::before{border-radius:50%;}
.hs-chip.is-on{background:var(--hm-line);border-color:var(--hm-line);}
.hs-chip.is-on::before{background:var(--hm-navy);}
.hs-pill{
  display:inline-flex;align-items:center;gap:5px;white-space:nowrap;
  font-size:11.5px;font-weight:600;color:#5FE0A6;
  background:rgba(60,200,140,.14);border:1px solid rgba(60,200,140,.35);
  padding:4px 9px;border-radius:999px;
}
.hs-pill svg{width:12px;height:12px;}

.hs-zc{opacity:.3;}
.hs-export{display:flex;gap:8px;}
.hs-res{
  flex:1;min-width:0;display:flex;align-items:center;height:38px;padding:0 12px;
  border-radius:9px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.14);
  font-size:12.5px;color:#C9D6E0;white-space:nowrap;
}
.hs-dl,.hs-dl-on{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  font-size:13px;font-weight:700;white-space:nowrap;
}
.hs-dl{
  position:relative;flex-shrink:0;height:38px;padding:0 16px;border-radius:9px;overflow:hidden;
  border:1px solid rgba(243,154,44,.55);color:var(--hm-line);
}
.hs-dl-on{position:absolute;inset:-1px;background:var(--hm-line);color:#17130E;opacity:0;}
.hs-dl svg,.hs-dl-on svg{width:14px;height:14px;}
.hs-ready{display:flex;align-items:center;gap:10px;margin-top:14px;}
.hs-ready-track{flex:1;height:2px;border-radius:2px;background:rgba(255,255,255,.1);overflow:hidden;}
.hs-ready-line{display:block;height:100%;background:var(--hm-line);transform-origin:0 50%;scale:0 1;}
.hs-ready-check{
  display:grid;place-items:center;width:22px;height:22px;border-radius:50%;flex-shrink:0;
  background:var(--hm-line);color:var(--hm-navy);opacity:0;scale:.5;
}
.hs-ready-check svg{width:12px;height:12px;}
.hs-ready-txt{font-size:12px;font-weight:600;color:#E6EDF3;white-space:nowrap;opacity:0;}

/* state 2 — design */
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-l1{opacity:0;translate:0 -60%;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-l2{opacity:1;translate:none;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-za{opacity:.38;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-zbw{opacity:1;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-q-plain{opacity:0;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-q-design{opacity:1;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-logo{opacity:1;scale:1;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-ring{opacity:1;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-caption{opacity:1;translate:none;}
.hs-stage:is([data-s="2"],[data-s="3"]) .hs-seg2{scale:1 1;}
/* state 3 — export */
.hs-stage[data-s="3"] .hs-l2w{opacity:0;translate:0 -60%;}
.hs-stage[data-s="3"] .hs-l3{opacity:1;translate:none;}
.hs-stage[data-s="3"] .hs-zb{opacity:.38;}
.hs-stage[data-s="3"] .hs-zc{opacity:1;}
.hs-stage[data-s="3"] .hs-seg3{scale:1 1;}
.hs-stage[data-s="3"] .hs-dl-on{opacity:1;}
.hs-stage[data-s="3"] .hs-ready-line{scale:1 1;}
.hs-stage[data-s="3"] .hs-ready-check{opacity:1;scale:1;}
.hs-stage[data-s="3"] .hs-ready-txt{opacity:1;}
.hs-stage[data-s="3"] .hs-tile{translate:0 -4px;}
/* labels 2/3 start below their mask window */
.hs-l2,.hs-l3{opacity:0;translate:0 60%;}

/* stacked flow (mobile, tablet, reduced motion): text first, then its visual */
@media (max-width:1180px){
  #page-home .howto-step-text,#page-home .howto-step-rev .howto-step-text{order:1;}
  #page-home .howto-step-visual,#page-home .howto-step-rev .howto-step-visual{order:2;}
}
@media (max-width:560px){
  .hs-stage{--q:128px;padding:16px 16px 18px;border-radius:16px;}
  .hs-body{gap:18px;margin:20px 0 22px;}
  .hs-tab:nth-child(5){display:none;}
  .hs-k{width:42px;}
  .hs-label{font-size:13px;}
}
@media (max-width:380px){
  .hs-stage{--q:116px;}
  .hs-body{gap:14px;}
  .hs-live{display:none;}
}

/* ------------------------------------- 3. trust strip: no endless marquee */
/* Default (mobile, reduced motion, no scroll timelines): a calm, static,
   wrapped row. The duplicate marquee row is hidden. */
#page-home .trust-strip-track{
  animation:none;display:block;width:auto;
  -webkit-mask-image:none;mask-image:none;
}
#page-home .trust-strip-row{flex-wrap:wrap;justify-content:center;gap:12px 30px;padding-right:0;max-width:920px;margin:0 auto;}
#page-home .trust-strip-row[aria-hidden="true"]{display:none;}
@media (max-width:640px){
  #page-home .trust-strip-row{gap:10px 20px;}
  #page-home .trust-mark{font-size:14px;}
}


/* ---------------------------------------- 4. desktop pinned how-to story */
@media (min-width:1024px){
  .hx-motion #page-home .howto-steps{
    display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.12fr);
    column-gap:clamp(40px,6vw,96px);row-gap:0;margin-bottom:40px;
  }
  .hx-motion #page-home .hs-pin{display:block;grid-column:2;grid-row:1 / span 3;}
  .hx-motion #page-home .hs-pin .hs-stage{margin-inline:auto 0;}
  .hx-motion #page-home .howto-steps > .howto-step{
    grid-column:1;display:flex;align-items:center;min-height:max(440px,74svh);
  }
  .hx-motion #page-home .howto-steps > .howto-step .howto-step-visual{display:none;}
  /* GSAP pins the stage; if GSAP never initialises, plain CSS sticky keeps
     the same layout working (stage then shows step 1 only) */
  html.hx-motion:not(.hx-gsap) #page-home .hs-pin-sticky{position:sticky;top:max(96px,calc(50svh - 260px));}
  /* step marker before "Step 0X": an orange rule GSAP draws per step */
  .hx-motion #page-home .howto-steps .howto-step-num::before{
    content:'';display:inline-block;vertical-align:middle;width:28px;height:2px;margin:-2px 12px 0 0;
    background:var(--hm-line);border-radius:2px;transform-origin:0 50%;
  }
  /* while GSAP drives the pinned stage it owns every transform: the static
     per-state translate/scale properties are neutralised so they never stack
     on top of GSAP's transform */
  .hx-gsap #page-home .hs-pin .hs-stage *{translate:none!important;scale:none!important;transition:none!important;}
}

/* ------------------------------------------------- reduced motion, print */
@media (prefers-reduced-motion:reduce){
  #page-home .hs-stage,#page-home .hs-stage *,#page-home .hs-pin-sticky,#page-home .howto-step-num::before{
    animation:none!important;transition:none!important;
  }
}
