/* Lyss – "How it works" section (Figma Lysstyle 560:107), Elementor 4.3 atomic elements.
   Layout and typography live in the mx-hw-* Global Classes that travel with the template (exact Figma geometry, 1209px
   frame); this file holds only what Elementor Free can't store in a class, the step show/hide states and the scroll-pin
   editor fallback. The pinned section is anchored to the BOTTOM of the window by how-it-works.js (sticky top =
   window height − section height, never above 0), so the card and the quote stay in view and the title scrolls away
   on windows shorter than the frame. Hooks are element ids (#how, #how-track, #how-space, #how-steps, #how-card,
   #how-badge, #how-title, #how-eyebrow, #how-sign) — they survive template import in every mode — with the class
   names as fallback. */

/* stored by Elementor as Pro-only custom_css (doesn't render on Free) */
#how img,
.elementor .mx-hw-card-shape,
.elementor .mx-hw-quote-shape,
.elementor .mx-hw-quote-mark,
.elementor .mx-hw-badge{max-width:none;}

/* Archivo Expanded (Figma) = Archivo variable at wdth 125 */
#how-title,
#how-steps h3,
.elementor .mx-hw-title,
.elementor .mx-hw-step-title{font-stretch:125%;}
#how-eyebrow,
#how-sign,
#how-steps>div>p:first-child,
.elementor .mx-hw-eyebrow,
.elementor .mx-hw-step-num,
.elementor .mx-hw-quote-sign{white-space:nowrap;}
#how hr,
.elementor .mx-hw-line{flex:0 0 auto;}

/* Step card: the four steps share one grid cell; only the active one is shown (switched by scroll in how-it-works.js).
   Without JS the first step shows. Inactive steps stay in the accessibility tree. */
#how-steps,
.elementor .mx-hw-steps{display:grid;}
#how-steps>div,
.elementor .mx-hw-steps>.mx-hw-step{grid-area:1/1;align-self:center;opacity:0;pointer-events:none;transform:translateY(14px);transition:opacity .45s ease,transform .45s ease;}
#how-steps:not(.js-on)>div:first-child,
#how-steps>div.is-active,
.elementor .mx-hw-steps:not(.js-on)>.mx-hw-step:first-child,
.elementor .mx-hw-steps>.mx-hw-step.is-active{opacity:1;pointer-events:auto;transform:none;}
#how-badge,
.elementor .mx-hw-badge{will-change:transform;}

/* Phones (no Figma mobile frame exists for this section): fit the whole section on one screen while pinned — one small
   viewport tall (svh = height with the browser bars visible), smaller title, card and quote scaled and overlapping. The
   track carries the pink so nothing white shows under the section when the browser bars hide. Desktop stays exact Figma. */
@media (max-width:767px){
  #how-track,
  .elementor .mx-hw-track{background-color:#EEA3BE;}
  #how{min-height:0;height:100svh;padding:20px 16px 24px;}
  #how-head{gap:10px;}
  #how-title{font-size:30px;line-height:30px;letter-spacing:-0.3px;}
  #how-card{margin-top:12px;transform:translateX(-50%) scale(.9);transform-origin:top center;}
  #how-quote{margin-top:-96px;transform:scale(.85);transform-origin:top right;}
}
@media (max-width:767px) and (max-height:700px){
  #how-title{font-size:28px;line-height:28px;}
  #how-card{transform:translateX(-50%) scale(.82);}
  #how-quote{margin-top:-124px;transform:scale(.78);}
}

/* Phones, final layout (overrides the scales/overlap above): title, step card and quote card stacked with a 24px gap
   between the two cards (no overlap), centred vertically in the one-screen section. One size factor --hw-k (set by
   how-it-works.js from the real screen height and width, default .8) scales both cards: the card is drawn at k (355px box),
   the quote at .9·k (260px box), both from their top edges. Because a scaled box keeps its unscaled height, the margins
   subtract the invisible part so the 24px gap and the centring are exact:
     quote margin-top    = 24px − 355px·(1 − k)
     quote margin-bottom = −260px·(1 − .9k)
   Auto margins (head top, empty ::after) centre the stack and collapse to 0 on screens too short for it, so it then starts
   at the title and is never cut off at the top. Parts never shrink (fixed Figma sizes). */
@media (max-width:767px){
  body:not(.elementor-editor-active) #how{display:flex;flex-direction:column;--hw-k:.8;}
  body:not(.elementor-editor-active) #how>*{flex-shrink:0;}
  body:not(.elementor-editor-active) #how-head{margin-top:auto;gap:12px;}
  body:not(.elementor-editor-active) #how-card{margin-top:20px;transform:translateX(-50%) scale(var(--hw-k));}
  body:not(.elementor-editor-active) #how-quote{transform:scale(calc(var(--hw-k) * .9));margin-top:calc(24px - 355px * (1 - var(--hw-k)));margin-bottom:calc(-260px * (1 - var(--hw-k) * .9));}
  body:not(.elementor-editor-active) #how::after{content:'';display:block;position:static;flex:0 0 0;margin-top:auto;}
}
/* Very short phones (e.g. 320×568): 3-line title instead of 5. */
@media (max-width:767px) and (max-height:600px){
  body:not(.elementor-editor-active) #how-title{font-size:22px;line-height:22px;letter-spacing:-0.22px;}
}

/* Tall windows (big monitors, zoomed-out browsers), tablet and up: while pinned the section fills the whole window and the
   1209px Figma frame is centred in it, so no empty band shows under the section. Its parts are absolutely positioned at
   Figma coordinates, so one equal top margin moves them together. Windows shorter than the frame are unaffected
   (the max() terms resolve to 1209px / 0px) and keep the bottom-anchored pin from how-it-works.js. */
@media (min-width:768px){
  body:not(.elementor-editor-active) #how{min-height:max(1209px,100vh);}
  body:not(.elementor-editor-active) #how>*{margin-top:max(0px,calc((100vh - 1209px) / 2));}
}

/* Elementor editor canvas: no pin (scroll spacer collapsed, section back in flow, natural height) and list all four steps so each one can be edited in place */
body.elementor-editor-active #how{height:auto;min-height:0;}
body.elementor-editor-active #how-space,
body.elementor-editor-active .elementor .mx-hw-space{height:0;}
body.elementor-editor-active #how,
body.elementor-editor-active .elementor .mx-hw{position:relative;top:0;}
body.elementor-editor-active #how-steps,
body.elementor-editor-active .elementor .mx-hw-steps{display:flex;flex-direction:column;gap:28px;}
body.elementor-editor-active #how-steps>div,
body.elementor-editor-active .elementor .mx-hw-steps>.mx-hw-step{opacity:1;pointer-events:auto;transform:none;}

@media (prefers-reduced-motion:reduce){
  #how-steps>div,
  .elementor .mx-hw-steps>.mx-hw-step{transition:none;transform:none;}
}
