/* ============================================================
   SAFE MOVE — the 3D scroll story on Home (contract §17)
   White Flyer layout, picked by Taras 2026-11-06 from the mock
   docs/mocks/2026-10-18-white/option-1 (branch mock/flyer-3d-2026-10-18): the framed engine
   layout (.story--framed) with the immersive mode on top (.story--immersive).
   Section-scoped: every selector starts at .story. Colours and type are site.css tokens; the rgba
   values on the map chips are the scene's own map navy (18,29,54) and cream (244,238,226), which
   story.js paints the map in.

   Two modes, set by the inline loader in assets/story/section.html before the section paints:
   - .story--3d   motion allowed and WebGL2: the picture fills the window under the site header and
                  holds for 5 screen heights of scroll while story.js scrubs the timeline. The first
                  80vh of that is the intro (story.js INTRO = 80 / 500): the page is white with only the
                  truck and its load on it, and the street paints in around them. The poster sits
                  under the canvas until the first frame is drawn (.story--live), then fades. The four
                  steps sit on a white panel over the bottom of the picture, hidden during the intro
                  (.story--intro). Moving the pointer, or a sideways drag on a phone, turns the camera a
                  few degrees.
   - (default)    no JavaScript, prefers-reduced-motion: reduce, no WebGL2, or story.js failed: the
                  four still frames, one above each step's copy. The picture box is not shown.
   ============================================================ */

.story{ position:relative; overflow:visible; padding:0 0 var(--sec); background:var(--white); }
.story .story__stage{ max-width:calc(var(--wrap) + 2 * var(--gut)); margin:0 auto; padding:0 var(--gut); }

/* ---------- the four steps (both modes) ----------
   story.js toggles is-on / is-done on each li and scales each bar 0..1 */
.story .story__steps{ display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:28px; margin:0; padding:0; list-style:none; }
.story .story__steps li{ position:relative; padding-top:16px; }
.story .story__bar{ position:absolute; top:0; left:0; right:0; height:4px; overflow:hidden; background:var(--line); }
.story .story__bar i{ position:absolute; inset:0; background:var(--orange); transform-origin:0 50%; transform:scaleX(0); }
.story .story__num{ margin:0; font:700 20px/1 var(--fd); letter-spacing:.04em; color:var(--orange-ink); }
.story .story__steps h3{ margin-top:8px; font-size:clamp(30px, 2.8vw, 40px); }
.story .story__line{ margin-top:6px; font-size:17px; }
.story .story__arrow{ display:inline-block; width:.95em; height:.62em; margin:0 .1em; vertical-align:.02em; color:var(--orange-ink); }
.story .story__odo{ display:none; margin-top:2px; font-size:14px; line-height:1.4; color:var(--mute); }
.story .story__mi{ font-weight:600; color:var(--navy); font-variant-numeric:tabular-nums; }
.story .story__cta{ display:flex; flex-wrap:wrap; align-items:center; gap:10px 14px; margin-top:12px; }
.story .story__tel{ font:600 16px/1.2 var(--fb); color:var(--navy); white-space:nowrap; text-decoration:underline; text-decoration-thickness:1.5px; text-underline-offset:5px; transition:text-decoration-color .18s var(--ease); }
@media (hover:hover){ .story .story__tel:hover{ text-decoration-color:var(--orange); } }

/* ---------- default mode: still frames ---------- */
.story:not(.story--3d) .story__view{ display:none; }
.story:not(.story--3d) .story__steps li .story__bar i{ transform:scaleX(1); }
.story .story__still{ display:block; margin:6px 0 16px; }
.story .story__still img{ width:100%; height:auto; aspect-ratio:16 / 9; object-fit:cover; border-radius:4px; background:var(--mist); }
.story--3d .story__still{ display:none; }

/* ---------- 3D mode: the pinned, full-window picture ---------- */
.story--3d{ height:580vh; height:calc(100svh + 500vh); padding:0; }
.story--3d .story__stage{ position:sticky; top:0; display:block; max-width:none; height:100vh; height:100svh; padding:0; }
.story--3d .story__view{ position:absolute; inset:0; overflow:hidden; background:var(--white); touch-action:pan-y; }
.story--3d .story__canvas{ position:absolute; inset:0; display:block; width:100%; height:100%; opacity:0; transition:opacity .9s var(--ease); }
.story--live .story__canvas{ opacity:1; }
.story--3d .story__poster{ position:absolute; inset:0; display:block; transition:opacity .7s var(--ease), visibility 0s linear .7s; }
.story--3d .story__poster img{ width:100%; height:100%; max-width:none; object-fit:cover; }
.story--live .story__poster{ opacity:0; visibility:hidden; }

/* the steps panel over the bottom of the picture */
/* the last column may grow to keep step 04's button and phone on one line. 3D mode only: in the still
   frames a 1200px picture sits in that column, and max-content would size it to the picture */
.story--3d .story__steps{ grid-template-columns:repeat(3, minmax(0, 1fr)) minmax(max-content, 1fr); }
.story--3d .story__steps{ position:absolute; left:50%; bottom:20px; width:min(calc(100% - 2 * var(--gut)), 1120px); padding:14px 22px 16px; gap:24px; border-radius:8px; background:rgba(255,255,255,.95); box-shadow:0 10px 32px rgba(1,42,86,.18); transform:translateX(-50%); transition:opacity .5s var(--ease), transform .5s var(--ease), visibility 0s; }
.story--intro .story__steps, .story--3d:not(.story--live) .story__steps{ opacity:0; visibility:hidden; transform:translate(-50%, 18px); pointer-events:none; transition:opacity .35s var(--ease), transform .35s var(--ease), visibility 0s linear .35s; }
.story--3d .story__steps li{ padding-top:12px; }
.story--3d .story__num{ font-size:16px; }
.story--3d .story__steps h3{ margin-top:4px; font-size:clamp(26px, 2.1vw, 32px); }
.story--3d .story__line{ margin-top:2px; font-size:15px; }
.story--3d .story__cta{ margin-top:8px; }
.story--3d .story__odo{ display:block; }
/* steps not reached yet sit back a little, by their heading only: it is large text (3:1 needed, 6.0:1
   at .74 over the panel). At .74 the 16px orange step number fell to 3.4:1, the 15px line to 4.3:1
   and the 14px mileage to 3.0:1 over the step-03 map, all under AA, so they stay at full strength. */
.story--3d .story__steps li>h3{ opacity:.74; transition:opacity .4s var(--ease); }
.story--3d .story__steps li.is-on>h3, .story--3d .story__steps li.is-done>h3{ opacity:1; }

/* map town labels (story.js builds them on the navy map): dark chips with cream text, never below 12px */
.story .story__labels, .story .story__tags, .story .story__area, .story .story__cue{ display:none; }
.story--3d .story__labels{ position:absolute; inset:0; display:block; pointer-events:none; opacity:0; }
.story .story__dot, .story .story__lead, .story .story__lbl{ position:absolute; left:0; top:0; will-change:transform, opacity; }
.story .story__dot{ width:8px; height:8px; border-radius:50%; background:var(--orange); box-shadow:0 0 0 2px rgba(18,29,54,.9); }
.story .story__dot::after, .story .story__lbl::after{ content:""; position:absolute; pointer-events:none; opacity:0; transition:opacity .5s var(--ease); }
.story .story__dot::after{ inset:0; border-radius:50%; box-shadow:0 0 0 5px rgba(253,92,2,.3), 0 0 14px 5px rgba(253,92,2,.45); }
.story .story__lbl::after{ left:0; right:0; bottom:0; height:2px; background:var(--orange); }
.story .story__dot.is-lit::after, .story .story__lbl.is-lit::after{ opacity:1; }
.story .story__lead{ height:1px; transform-origin:0 50%; background:rgba(185,194,212,.75); box-shadow:0 0 0 1px rgba(18,29,54,.45); }
.story .story__lbl{ padding:2px 6px 1px; border-radius:2px; background:rgba(18,29,54,.82); font:600 14px/16px var(--fd); letter-spacing:.04em; text-transform:uppercase; white-space:nowrap; color:#F4EEE2; text-shadow:0 0 3px rgba(18,29,54,.95); }
.story .story__lbl.is-end{ font-weight:700; }
.story .story__lbl.is-2line{ white-space:normal; width:min-content; }
.story .story__labels.is-small .story__lbl{ font-size:12px; line-height:14px; }

/* object labels: story.js builds a dot, a leader and a chip per tag and moves them every frame;
   it measures the chip, so nothing here transitions transform */
.story--3d .story__tags{ position:absolute; inset:0; display:block; pointer-events:none; }
.story .story__tdot, .story .story__tlead, .story .story__tag{ position:absolute; left:0; top:0; opacity:0; will-change:transform, opacity; }
.story .story__tdot{ width:10px; height:10px; border-radius:50%; background:var(--orange); box-shadow:0 0 0 2px #fff, 0 1px 4px rgba(1,42,86,.35); }
.story .story__tlead{ height:1.5px; transform-origin:0 50%; background:#fff; box-shadow:0 0 0 .5px rgba(1,42,86,.35); }
.story .story__tag{ padding:6px 10px 5px; border-radius:3px; background:#fff; color:var(--navy); font:600 15px/18px var(--fb); font-style:normal; white-space:nowrap; box-shadow:0 4px 14px rgba(1,42,86,.22); }

/* service-area caption, faded in with the map by story.js */
.story--3d .story__area{ position:absolute; top:calc(var(--head) + 16px); left:var(--gut); display:block; max-width:calc(100% - 2 * var(--gut)); margin:0; padding:6px 10px; border-left:3px solid var(--orange); border-radius:3px; background:#fff; color:var(--navy); font:600 14px/1.3 var(--fb); opacity:0; pointer-events:none; }

/* scroll cue, faded out by story.js as the scroll starts */
.story--3d .story__cue{ position:absolute; top:40%; left:0; right:0; display:flex; align-items:center; gap:8px; width:max-content; max-width:calc(100% - 24px); margin:0 auto; padding:9px 16px 9px 18px; border-radius:999px; background:#fff; color:var(--navy); font:600 15px/1 var(--fb); white-space:nowrap; box-shadow:0 6px 20px rgba(1,42,86,.18); pointer-events:none; }
.story .story__cue svg{ width:18px; height:18px; flex:none; color:var(--orange-ink); }

@media (prefers-reduced-motion:no-preference){
  .story--3d .story__cue svg{ animation:story-nudge 1.6s ease-in-out infinite; }
}
@keyframes story-nudge{ 0%, 100%{ transform:translateY(0); } 50%{ transform:translateY(4px); } }

/* ---------- phones and narrow windows ---------- */
@media (max-width:860px){
  .story .story__steps{ grid-template-columns:repeat(2, minmax(0, 1fr)); gap:28px 20px; }
}
@media (max-width:760px){
  .story .story__still img{ aspect-ratio:2 / 3; }
  /* 3D on phones: the steps panel sits above the thumb bar (68px + the home indicator), and only the
     current step's text shows. All four share one grid cell, so a swap is a crossfade with no layout
     jump (the cell keeps the tallest step's height). */
  .story--3d .story__steps{ bottom:calc(68px + env(safe-area-inset-bottom) + 10px); width:calc(100% - 24px); padding:10px 16px 12px; grid-template-columns:minmax(0, 1fr); gap:0; }
  .story--3d .story__steps .story__cta{ display:none; }   /* the thumb bar already carries Call and Get a price */
  .story--3d .story__steps li, .story--3d .story__steps li.is-done{ grid-area:1 / 1; opacity:0; visibility:hidden; transition:opacity .4s var(--ease), visibility 0s linear .4s; }
  .story--3d .story__steps li.is-on{ opacity:1; visibility:visible; transition:opacity .4s var(--ease), visibility 0s; }
  .story--3d .story__area{ top:calc(var(--head) + 10px); left:12px; max-width:calc(100% - 24px); }
  .story .story__lbl{ padding:2px 4px 1px; letter-spacing:.02em; }
  .story .story__tag{ font-size:14px; line-height:17px; padding:5px 8px 4px; }
}
