
  /* ══ Our Story ═══════════════════════════════════════════════════
     A full-bleed paper section built to the Figma frame "iPhone 18 Pro - 2"
     (402 × 874, the whole screen). Two paragraphs at the top left — the
     lead in the display serif, the rest in small grey ALS Hauss Next — and,
     low down, the Tajik ikat "knot" (its black ground keyed out to alpha):
     a braid running the width of the screen whose threads fan up at the
     edges. On a phone every size is the frame's px ÷ 402 in vw, and the
     heights are the frame's px ÷ 874 in svh:

       lead     PF Regal Text 28px, line-height 1.15, black, 328px wide,
                cap top 174px (19.9svh)
       note     ALS Hauss Next (wght 400, wdth 385) 14px, line-height 1.4,
                black at 60%, 354px wide; cap top 25px below the lead's
                last baseline
       knot     ~1005px wide (250vw); the braid's top edge 669px down
                (76.5svh), the knot running off the bottom of the section

     The text boxes are trimmed to cap height and baseline (text-box), as the
     frame's are; browsers without text-box get the same trim from negative
     margins worked out of each font's metrics (the @supports block).

     The note is in the flow and the knot is in the flow under it: the note's
     box is at least 76.5svh tall and the knot is pulled up so its braid's top
     edge meets the bottom of that box, then pulled up again at the foot so
     the section ends at 100svh. If the note ever runs longer than that (a
     very short screen), the box grows and pushes the knot down with it, so
     text and weave never collide; the section just grows past one screen. */
  .story{
    --knot-w: 250vw;                     /* ~1005px of 402: the braid spans the screen, the fans only rise at its edges */
    --story-pad-x: max(clamp(24px, 7.2vw, 64px), env(safe-area-inset-left), env(safe-area-inset-right));   /* 29px of 402 */
    position: relative;
    z-index: 1;                          /* paint above the fixed #gl shader */
    background: var(--paper);
    min-height: 100vh;                   /* fallback: iOS Safari < 15.4 lacks svh */
    min-height: 100svh;
    display: flex; flex-direction: column;
    overflow: hidden;
  }
  .story__art{
    order: 2;                            /* under the note (it comes first in the markup) */
    flex: none;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: var(--knot-w);
    aspect-ratio: 2600 / 1348;           /* full keyed bowtie — braid in the weave centre */
    /* the braid's top edge is 27.19% of the art's WIDTH below its top edge
       (52.4% of its height); above it, between the fans, the art is clear */
    margin-top: calc(var(--knot-w) * -.2719);
    /* and 24.65% of its width from the braid's top edge to the art's foot:
       let all but 23.5svh of that run off the bottom (874 − 669 = 205px) */
    margin-bottom: min(0px, calc(23.5svh - var(--knot-w) * .2465));
    background: url('../assets/img/our-story-knot.webp') center / contain no-repeat;
    pointer-events: none;
    z-index: 0;
  }
  .story__inner{
    order: 1;
    flex: none;
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 76.5vh;                  /* fallback: iOS Safari < 15.4 lacks svh */
    min-height: 76.5svh;                 /* its foot is where the braid's top edge lands */
    padding: clamp(56px, 19.9svh, 200px) var(--story-pad-x) clamp(56px, 9svh, 96px);   /* foot: least air between the note and the braid (the fans rise ~40px above it at the edges) */
    text-align: start;
  }
  .story__copy{
    position: relative;
    width: 100%;
    margin: 0;
    display: flex; flex-direction: column;
    gap: clamp(20px, 6.3vw, 32px);       /* 25px of 402: the lead's last baseline → the note's cap top */
  }
  .story__copy p{
    letter-spacing: 0;
    text-box: trim-both cap alphabetic;
    /* paper halo: invisible over open paper; keeps the words legible if a
       fan tip ever reaches up beside them on an odd screen */
    text-shadow: 0 0 6px var(--paper), 0 0 12px var(--paper);
  }
  .story__copy .lead{
    max-width: 12em;                     /* the frame's box is 328px (11.72em) for «любовь - желание»; the proper em dash is wider, so 336px keeps the frame's five lines */
    font-family: 'PF Regal Text', Georgia, 'Times New Roman', serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-size: clamp(22px, 6.97vw, 40px);   /* 28px of 402 */
    line-height: 1.15;
    color: #000;
  }
  .story__copy .story__note{
    max-width: 354px;                    /* sets the frame's line breaks, with the <br>s in the copy */
    font-family: 'ALS Hauss Next Text', 'Inter', system-ui, sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.4;
    color: rgba(0,0,0,.6);
  }
  /* the note is 14px at every phone width, so its frame line breaks only fit
     from ~400px. Under that it drops to 13px, which keeps the same breaks down
     to 360px; under 360px the two line-shaping <br>s (.br-soft) drop out and
     the note simply wraps. */
  @media (max-width: 399px){
    .story__copy .story__note{ font-size: 13px; }
  }
  @media (max-width: 359px){
    .story__note .br-soft{ display: none; }
    .story__copy .story__note{ text-wrap: pretty; }
  }
  /* no text-box: trim the same amount by hand (hhea metrics at these line-heights):
       PF Regal Text  ascent .75  descent .25  cap .674 → above .151em, below .325em at 1.15
       ALS Hauss Next ascent .98  descent .19  cap .704 → above .391em, below .305em at 1.4 */
  @supports not (text-box: trim-both cap alphabetic){
    .story__copy .lead       { margin-block: -.151em -.325em; }
    .story__copy .story__note{ margin-block: -.391em -.305em; }
  }

  /* opacity-only fade as the section scrolls in — nothing moves, so the knot
     never drifts independently of the text (no parallax). Armed by JS. */
  .story.story-ready .story__inner > *,
  .story.story-ready .story__art{
    opacity: 0;
    transition: opacity .7s ease;
  }
  .story.story-ready.is-in .story__inner > *,
  .story.story-ready.is-in .story__art{ opacity: 1; }

  /* ── Our Story — center-out burning-paper reveal of the ikat knot ──
     A WebGL <canvas> laid over .story__art samples the keyed knot webp and burns
     it into being from the vertical CENTRE outward to BOTH edges, then hands off
     to the native CSS background. Progressive enhancement: .story--burning is set
     only when WebGL + motion are allowed; otherwise the plain opacity fade above
     stays in charge. The canvas sits at the knot's own z-index 0 (below the note,
     which is z-index 1), so the weave burns in behind the legible text. */
  .story__burn{ position:absolute; pointer-events:none; z-index:0; }
  /* hidden under the canvas while it burns. will-change keeps it on its own
     layer, so the 3200px knot is decoded and painted there ahead of time (an
     element at opacity 0 is otherwise not painted at all) and the handoff is a
     plain opacity switch on a layer that is already on the GPU — not a first
     paint of a 5-megapixel image in the frame the fire goes out. */
  .story.story--burning .story__art{ opacity:0 !important; transition:none !important; will-change: opacity; }
  .story.story--burning.story--handed .story__art{ opacity:1 !important; }                /* instant handoff — no fade-dip */

  /* ── rich body-copy reveal ──
     JS splits the note's paragraphs into word spans (.story--rich); each word
     rises + fades in reading order, and the PARAGRAPHS cascade as one sequence
     into view (so nothing sits blank ahead of you while scrolling). Deliberately
     NO per-word blur — animating blur() across dozens of elements glitches/flickers
     on mobile Safari; opacity + rise + a hair of scale reads just as rich and is
     rock-solid everywhere. GSAP drives it when present; a per-word CSS-transition
     stagger is the identical fallback. The copy BLOCK stays visible so the paper
     halo behind the text never flash. */
  .story--rich .story__copy{ opacity: 1 !important; }
  /* resting (revealed) state IS the default .word — GSAP clearProps lands here.
     No permanent will-change: it would promote ~88 word-layers for the whole
     session (GSAP's clearProps can't clear a CSS rule). The reveal's own
     transform/transition promotes each word transiently while it animates, then
     releases it — same motion, no idle GPU-memory tax. (Cf. the audio-icon note.) */
  .story--rich .story__copy .word{ display: inline-block; }
  /* hidden until each paragraph gets .is-revealed (painted before GSAP loads) */
  .story--rich .story__copy p:not(.is-revealed) .word{
    opacity: 0;
    transform: translateY(16%);
  }
  /* GSAP-less fallback: per-word delayed transition toward the resting state.
     Snug stagger so the wave resolves quickly (no lone trailing word hanging). */
  .story--rich.story--css .story__copy p.is-revealed .word{
    transition: opacity .42s cubic-bezier(.22,.61,.36,1),
                transform .5s cubic-bezier(.22,.61,.36,1);
    transition-delay: calc(var(--i, 0) * 17ms);
  }

  @media (prefers-reduced-motion: reduce){
    .story.story-ready .story__inner > *,
    .story.story-ready .story__art{ opacity: 1; transition: none; }
  }
  /* wider screens (no frame for these): the same page, scaled. The note keeps
     its frame line breaks in a centred column, the braid's top edge stays at
     76.5svh, and the knot is at least 1320px wide: its straight waist (~35%
     of its width) then runs under the whole text column, so the fans only
     rise outside it — as on the phone. */
  @media (min-width: 700px){
    .story{ --knot-w: clamp(1320px, 112vw, 2600px); }
    .story__inner{ display: flex; flex-direction: column; align-items: center; }
    .story__copy{ width: auto; }
    .story__copy .lead{ font-size: clamp(30px, 3.4vw, 46px); }
    .story__copy .story__note{ font-size: clamp(14px, 1.15vw, 17px); max-width: 25.3em; }
  }
