  /* ══ The last page ═══════════════════════════════════════════════════
     A white field, one screen, that closes the site: «Мы ждём Вас!» in the
     display serif with a short see-you line under it, the pair centred on the
     screen, and along the foot the invitation's two swans, which swim in from
     the edges and meet as a heart.

     Built to the Figma phone frame «iPhone 18 Pro - 3» (402 × 874, the whole
     screen). On a phone every size is the frame's px ÷ 402 in vw:

       title   PF Regal Text 52px, line-height 1.15, black
       note    ALS Hauss Next (wght 400, wdth 385) 20px, line-height 1.4,
               black at 60%, its cap top 27px under the title's baseline
       swans   248 × 87, centred, their feet 58px above the foot of the frame

     The two lines are trimmed to cap height and baseline (text-box), as the
     frame's are, and sit as one block on the screen's centre (the frame's
     399–475 of 874).

     The page is pure white, and so is the swan clip: it is the invitation's
     clip cut down to the swans' band and re-encoded with its white pushed to
     reference white (Y 235, decoded as 255), so the clip has no visible frame
     and the swans sit straight on the page — no filter needed. */
  .closing{
    --closing-vh: 1vh;                       /* iOS Safari < 15.4 lacks svh */
    --closing-bg: #fff;
    --closing-fs: clamp(40px, min(12.94vw, var(--closing-vh) * 16), 132px);   /* 52px of 402; the vh term eases it on a short, wide screen */

    /* The swans. The clip is 1920 × 1080 and in its last frame the pair spans
       1018 of those 1920, so a pair 248px wide needs the clip 468px wide —
       116.54vw: wider than the phone, and the swans come in from beyond the
       screen's own edges. On a wide screen the pair is capped at a fifth of
       the height instead (107.5vh of clip). */
    --closing-clip-w: min(116.54vw, var(--closing-vh) * 107.5);
    --closing-stage-h: calc(var(--closing-clip-w) * 460 / 1920);
    /* the stage's foot: 44px of 402 above the foot of the screen (the pair's
       own feet are another 14px up inside it — 58px in all) */
    --closing-stage-b: max(min(10.87vw, var(--closing-vh) * 5), env(safe-area-inset-bottom));
    /* the strip the swans own at the foot, plus a little air over it */
    --closing-zone: calc(var(--closing-stage-b) + var(--closing-stage-h) + clamp(12px, 4vw, 32px));

    position: relative;
    z-index: 1;                              /* paint above the fixed #gl shader */
    min-height: 100vh;
    min-height: 100svh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    /* the same strip is held clear at the top, so the two lines sit on the
       screen's exact centre — and on a screen too short for all of it the
       section grows rather than letting the swans swim through the words */
    padding: var(--closing-zone)
             max(clamp(20px, 6.4vw, 96px), env(safe-area-inset-left), env(safe-area-inset-right));
    background: var(--closing-bg);
    color: #000;
    overflow: hidden;
  }
  @supports (height: 1svh){
    .closing{ --closing-vh: 1svh; }
  }
  /* Past the end of the document a phone paints the page's own background —
     the paper, #FAFAFA — and behind Safari's toolbar that showed as a grey
     strip under this white section. While the section is on screen
     (js/closing.js sets the class) the page's background is its white. */
  html.at-closing,
  html.at-closing body{ background-color: #fff; }

  .closing__title,
  .closing__note{
    letter-spacing: 0;
    white-space: nowrap;
    text-box: trim-both cap alphabetic;
  }
  .closing__title{
    font-family: 'PF Regal Text', Georgia, 'Times New Roman', serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-size: var(--closing-fs);
    line-height: 1.15;
  }
  .closing__note{
    margin-top: calc(var(--closing-fs) * .519);   /* 27px under a 52px title */
    font-family: 'ALS Hauss Next Text', 'Inter', system-ui, sans-serif;
    font-weight: 400;
    font-size: clamp(16px, var(--closing-fs) * .3846, 32px);   /* 20px beside a 52px title, and in step with it */
    line-height: 1.4;
    color: rgba(0,0,0,.6);
  }
  /* 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){
    .closing__title{ margin-block: -.151em -.325em; }
    .closing__note { margin-top: calc(var(--closing-fs) * .519 - .391em); margin-bottom: -.305em; }
  }

  /* ── The swans ───────────────────────────────────────────────────────
     The invitation's clip is 1920 × 1080 with the swans in a band across its
     middle (y 376–733). closing-swans.mp4 is that band only — rows 330–790,
     1920 × 460 — so the stage shows the whole file. It is pinned to the foot
     of the section, centred, and on a phone runs past both edges of the
     screen (the section clips it). */
  .closing__swans{
    position: absolute;
    left: 50%;
    bottom: var(--closing-stage-b);
    width: var(--closing-clip-w);
    height: var(--closing-stage-h);
    transform: translateX(-50%);
    overflow: hidden;
    pointer-events: none;
  }
  .closing__clip,
  .closing__still{
    position: absolute;
    left: 0; bottom: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
  }
  /* the still (the clip's last frame — the heart) stands in until JS takes
     over, and again if the clip can't play (reduced motion, Low Power Mode) */
  .closing__clip{ display: none; }
  .closing.swans-live .closing__clip { display: block; }
  .closing.swans-live .closing__still{ display: none; }

  /* feathered ends — only when the stage is narrower than the screen (the
     107.5vh cap, so anything wider than about 43:40), so the swans fade in
     rather than pop out of nowhere. A mask on the stage, not a gradient laid
     over the clip: Chrome composites a video under an overlay differently,
     and the overlay showed as two faint grey panels. */
  @media (min-aspect-ratio: 43/40){
    .closing__swans{
      -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
              mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
    }
  }

  /* entrance — armed by JS (.closing-ready), released on .is-in: the two
     lines rise and fade in turn. The swans make their own entrance. */
  .closing.closing-ready > :not(.closing__swans){
    opacity: 0; transform: translateY(18px);
    transition: opacity .9s ease, transform 1.1s cubic-bezier(.2,.7,.2,1);
  }
  .closing.closing-ready.is-in > :not(.closing__swans){ opacity: 1; transform: none; }
  .closing.closing-ready.is-in .closing__note{ transition-delay: .14s; }

  @media (prefers-reduced-motion: reduce){
    .closing.closing-ready > :not(.closing__swans){ opacity: 1; transform: none; transition: none; }
  }
