/* fx layer, doors: the opening (first visit of a session, or ?intro=1) and the door-cut on in-page jumps.

   Opening. Shown only while <html> has class "intro", which the boot script in <head> sets (never under reduced
   motion or ?nointro). The layer carries the hidden attribute in index.html, so if this file fails to load it simply
   stays hidden. Everything here runs on CSS alone: if no script runs, the doors still open and the layer hides itself
   (each wall's own life, and the fx-doors-gone failsafe). fx/doors.js only adds the fast-forward on input, drops the
   intro class at the end and paints the kit patterns.

   A fall through five rooms. Each wall is a doorway set in its own room (ceiling, plaster, tatami), drawn 140% of the
   viewport so the room shows around the doorway while the wall is still far away. The wall behind waits small (0.74)
   and dim; as the wall in front starts to part, it rushes up to full size with a stepped stop, then is passed through
   (1 to 1.08) while its own panels fly off. Each beat starts before the last one has landed, and the beats get
   shorter: 520, 320, 240, 190, 150 ms apart.
     0 ms     wall 1: two shoji meet; the studio seal stamps onto the seam (40 to 440 ms)
     520 ms   wall 1 parts sideways (400 ms): one-frame jolt inward, near-linear flight, hard stop, three-frame rebound
     840 ms   wall 2: fusuma (seigaiha), split at mid-height, upper up and lower down (330 ms)
     1080 ms  wall 3: a lattice wall with a round window, cut on the diagonal, the halves fly to opposite corners (290 ms)
     1270 ms  wall 4: plank doors in four quarters, each to its own corner (250 ms)
     1420 ms  wall 5: four paper fusuma (shippo) telescope out to both sides (240 ms); the page is behind it
     1300 ms  hero lines rise, the lantern drops in, the page pushes in from 1.04 to 1; all settled by 2400 ms
   Door-cut. .fx-doors-cut is built by fx/doors.js for a moment and removed again.
   Every time scales with --fx-slow (the boot script sets it early from ?slow=N, site.js sets it again). */

.fx-doors-layer,.fx-doors-cut{
  --fx-doors-paper:#faf4e8; --fx-doors-fibre:#e6d9c0; --fx-doors-bar:#7a5434; --fx-doors-wood:#a77446; --fx-doors-grain:#84582f;
  --fx-doors-ink:#2b2420; --fx-doors-fu:#2f3f5e; --fx-doors-pat-fg:#3d5079; --fx-doors-lacquer:#1c1916; --fx-doors-gold:#c99a44;
  --fx-doors-mon:#4a5f8c; --fx-doors-dust:#f3ead9; --fx-doors-streak:#fffaf0; --fx-doors-seal:#c5452b;
  /* the rooms */
  --fx-doors-ceil:#5a3b23; --fx-doors-beam:#7b5232; --fx-doors-plaster:#e4d4b4; --fx-doors-tatami:#cbb978; --fx-doors-heri:#2f3f5e;
  --fx-doors-void:#140f0b;
  /* wall 3: lattice with a round window */
  --fx-doors-lat3:#4a2c1c; --fx-doors-asa-fg:#b9893c; --fx-doors-moon:#f3e3c2; --fx-doors-moon-bar:#5a3a22;
  /* wall 4: plank doors */
  --fx-doors-plank:#b57c48; --fx-doors-plank-2:#a46c3c; --fx-doors-plank-line:#5b3a20; --fx-doors-rail:#2b2420; --fx-doors-kik-fg:#c99a44; --fx-doors-iron:#2b2420;
  /* wall 5: paper fusuma */
  --fx-doors-wash:#f1e4c9; --fx-doors-shi-fg:#d2a556; --fx-doors-t-edge:#6b2a1e;
  --fx-doors-mon-size:150px; --fx-doors-seal-size:96px;
}
:root[data-theme="night"] .fx-doors-layer,:root[data-theme="night"] .fx-doors-cut{
  /* by night the rooms are lit by lanterns: warm paper, dark wood, indigo shadows */
  --fx-doors-paper:#efd39c; --fx-doors-fibre:#e2bf7f; --fx-doors-bar:#3b2818; --fx-doors-wood:#5c3c22; --fx-doors-grain:#3f2815;
  --fx-doors-ink:#1a120c; --fx-doors-fu:#5e2419; --fx-doors-pat-fg:#6f2f22; --fx-doors-lacquer:#120d0a; --fx-doors-gold:#e0a84e;
  --fx-doors-mon:#8a3c2a; --fx-doors-dust:#f0dcb4; --fx-doors-streak:#fff3da; --fx-doors-seal:#d14e30;
  --fx-doors-ceil:#1c140e; --fx-doors-beam:#33231a; --fx-doors-plaster:#3a2d25; --fx-doors-tatami:#5a5035; --fx-doors-heri:#161b2c;
  --fx-doors-void:#07080d;
  --fx-doors-lat3:#1d2540; --fx-doors-asa-fg:#c99a52; --fx-doors-moon:#f0cf8e; --fx-doors-moon-bar:#2a1d14;
  --fx-doors-plank:#5e3f25; --fx-doors-plank-2:#533620; --fx-doors-plank-line:#22160d; --fx-doors-rail:#120d0a; --fx-doors-kik-fg:#d9a24c; --fx-doors-iron:#0d0a08;
  --fx-doors-wash:#262d46; --fx-doors-shi-fg:#8c9bc4; --fx-doors-t-edge:#e0a84e;
}
@media (max-width:600px){
  .fx-doors-layer,.fx-doors-cut{--fx-doors-mon-size:112px;--fx-doors-seal-size:78px}
}
/* ---------- the drawings (shared by the opening and the cut) ---------- */
.fx-doors-layer{display:none}
.fx-doors-sh,.fx-doors-fu{position:absolute}
.fx-doors-sh{top:0;bottom:0;width:calc(50% + 1px)}
.fx-doors-l{left:0}
.fx-doors-r{right:0}
.fx-doors-fu{left:0;right:0;height:calc(50% + 1px)}
.fx-doors-up{top:0}
.fx-doors-down{bottom:0}
.fx-doors-face{position:absolute;inset:0;overflow:hidden}

/* shoji: ink-edged wooden frame, kumiko lattice on paper, a wooden kick board, a finger pull by the seam */
.fx-doors-sh .fx-doors-face{background:var(--fx-doors-paper);
  box-shadow:inset 0 0 0 3px var(--fx-doors-ink),inset 0 0 0 13px var(--fx-doors-wood),inset 0 0 0 16px var(--fx-doors-ink)}
.fx-doors-lat{position:absolute;left:16px;top:16px;width:calc(100% - 32px);height:calc(85% - 16px);overflow:visible}
.fx-doors-lat path{fill:none;vector-effect:non-scaling-stroke;stroke-linecap:butt}
.fx-doors-lat .fx-doors-tate{stroke:var(--fx-doors-bar);stroke-width:4.2px}
.fx-doors-lat .fx-doors-yoko{stroke:var(--fx-doors-bar);stroke-width:2.8px}
.fx-doors-lat .fx-doors-fib{stroke:var(--fx-doors-fibre);stroke-width:1.4px}
.fx-doors-kosh{position:absolute;left:16px;right:16px;bottom:16px;height:calc(15% - 16px);background:var(--fx-doors-wood);border-top:3.5px solid var(--fx-doors-ink)}
.fx-doors-kosh svg{position:absolute;inset:8% 0;width:100%;height:84%}
.fx-doors-kosh path{fill:none;stroke:var(--fx-doors-grain);stroke-width:1.6px;vector-effect:non-scaling-stroke}
.fx-doors-pull{position:absolute;top:57%;width:15px;height:42px;border-radius:8px 7px 9px 7px;background:var(--fx-doors-bar);
  box-shadow:inset 0 0 0 2.5px var(--fx-doors-ink),inset 0 0 0 5px var(--fx-doors-wood)}
.fx-doors-l .fx-doors-pull{right:30px}
.fx-doors-r .fx-doors-pull{left:30px}

/* the studio seal sits on the seam: each panel carries one half of it (the face clips the other half) */
.fx-doors-face .seal{position:absolute;top:50%;width:var(--fx-doors-seal-size);height:var(--fx-doors-seal-size);
  margin:calc(var(--fx-doors-seal-size) / -2) 0 0 calc(var(--fx-doors-seal-size) / -2);
  font-size:calc(var(--fx-doors-seal-size) * .6);border-radius:14px 18px 12px 20px;background:var(--fx-doors-seal);
  box-shadow:0 0 0 3px var(--fx-doors-ink),inset 0 0 0 5px var(--fx-doors-seal),inset 0 0 0 7px rgba(255,247,234,.88)}
.fx-doors-l .seal{left:100%}
.fx-doors-r .seal{left:0}

/* fusuma: lacquer and gold edge, a quiet tone-on-tone pattern (painted by fx/doors.js), a crest split by the seam */
.fx-doors-fu .fx-doors-face{background:var(--fx-doors-pat,none),var(--fx-doors-fu);
  box-shadow:inset 0 0 0 5px var(--fx-doors-lacquer),inset 0 0 0 7.5px var(--fx-doors-gold),inset 0 0 0 11px var(--fx-doors-lacquer)}
.fx-doors-down .fx-doors-face{background-position:0 calc(var(--fx-doors-pat-size,56px) / 2),0 0}
.fx-doors-mon{position:absolute;left:50%;width:var(--fx-doors-mon-size);height:var(--fx-doors-mon-size);margin-left:calc(var(--fx-doors-mon-size) / -2);
  border-radius:50%;display:grid;place-items:center;font-weight:800;font-size:calc(var(--fx-doors-mon-size) * .5);line-height:1;color:var(--fx-doors-mon);
  background:var(--fx-doors-fu);
  box-shadow:inset 0 0 0 3px var(--fx-doors-gold),inset 0 0 0 9px var(--fx-doors-fu),inset 0 0 0 11px var(--fx-doors-gold),0 0 0 2.5px var(--fx-doors-lacquer)}
.fx-doors-up .fx-doors-mon{bottom:calc(var(--fx-doors-mon-size) / -2)}
.fx-doors-down .fx-doors-mon{top:calc(var(--fx-doors-mon-size) / -2)}

/* speed streaks on the trailing edges: pale, tapered, ink-edged (they cross both the dark fusuma and the page) */
.fx-doors-sk{position:absolute;opacity:0;overflow:visible;pointer-events:none}
.fx-doors-sk path{fill:var(--fx-doors-streak);stroke:var(--fx-doors-ink);stroke-width:1.6px;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.fx-doors-sh .fx-doors-sk{top:var(--y);width:var(--l);height:var(--w);margin-top:calc(var(--w) / -2);transform-origin:0 50%}
.fx-doors-l .fx-doors-sk{left:100%}
.fx-doors-r .fx-doors-sk{left:0;transform:scaleX(-1)}
.fx-doors-fu .fx-doors-sk{left:var(--x);width:var(--w);height:var(--l);margin-left:calc(var(--w) / -2);transform-origin:50% 0}
.fx-doors-up .fx-doors-sk{top:100%}
.fx-doors-down .fx-doors-sk{top:0;transform:scaleY(-1)}

/* dust puffs where a panel stops */
.fx-doors-puff{position:absolute;width:140px;height:88px;opacity:0;overflow:visible;pointer-events:none}
@media (max-width:600px){.fx-doors-puff{width:96px;height:60px}}
.fx-doors-puff path,.fx-doors-puff circle{fill:var(--fx-doors-dust);stroke:var(--fx-doors-ink);stroke-width:2.4px;stroke-linejoin:round}
.fx-doors-puff .fx-doors-curl{fill:none;stroke-width:1.8px;stroke-linecap:round}
.fx-doors-sh .fx-doors-pa{top:10px}
.fx-doors-sh .fx-doors-pb{bottom:8px}
.fx-doors-l .fx-doors-puff{left:calc(100% - 6px)}
.fx-doors-l .fx-doors-pa{transform:scaleY(-1)}
.fx-doors-r .fx-doors-puff{right:calc(100% - 6px)}
.fx-doors-r .fx-doors-pa{transform:scale(-1,-1)}
.fx-doors-r .fx-doors-pb{transform:scaleX(-1)}
.fx-doors-up .fx-doors-puff{top:calc(100% - 4px);transform:scaleY(-1)}
.fx-doors-down .fx-doors-puff{bottom:calc(100% - 4px)}
.fx-doors-fu .fx-doors-pa{left:7%}
.fx-doors-fu .fx-doors-pb{right:9%}

/* ink specks flung when the seal lands */
.fx-doors-pop{position:absolute;left:50%;top:50%;width:200px;height:200px;margin:-100px 0 0 -100px;opacity:0;overflow:visible}
.fx-doors-pop circle,.fx-doors-pop path{fill:var(--fx-doors-ink)}
@media (max-width:600px){.fx-doors-pop{scale:.8}}

/* ---------- the rooms (opening only) ---------- */
/* A wall is 140% of the viewport, centred, so its doorway (the middle 100/140) is exactly the viewport at scale 1.
   Outside the doorway: a ceiling band, plaster to the sides, a tatami floor with its border, all flat colour.
   The doorway itself is transparent, so whatever is behind shows once the panels part. */
.fx-doors-wall{position:absolute;left:-20%;top:-20%;width:140%;height:140%;
  background:
    linear-gradient(to bottom,var(--fx-doors-ceil) 0 12.4%,var(--fx-doors-beam) 12.4% 14.29%,transparent 14.29% 85.71%,var(--fx-doors-heri) 85.71% 87.2%,var(--fx-doors-tatami) 87.2% 100%),
    linear-gradient(to right,var(--fx-doors-plaster) 0 14.29%,transparent 14.29% 85.71%,var(--fx-doors-plaster) 85.71% 100%)}
.fx-doors-door{position:absolute;inset:14.2857%;overflow:hidden}
/* posts and lintel around the doorway (outside it, so they show only while the wall is still far away) */
.fx-doors-wall::before{content:"";position:absolute;inset:14.2857%;
  box-shadow:0 0 0 3px var(--fx-doors-ink),0 0 0 calc(1.6vmin + 3px) var(--fx-doors-wood),0 0 0 calc(1.6vmin + 6px) var(--fx-doors-ink)}
/* the far wall's shade: a flat dark sheet that lifts as the wall comes forward */
.fx-doors-dim{position:absolute;inset:0;background:var(--fx-doors-void);opacity:0}
.fx-doors-w1{z-index:5}.fx-doors-w2{z-index:4}.fx-doors-w3{z-index:3}.fx-doors-w4{z-index:2}.fx-doors-w5{z-index:1}
.fx-doors-pop{z-index:6}
/* the dark interior beyond the far rooms: shown only while a far wall is smaller than the viewport */
.fx-doors-deep{position:absolute;inset:0;z-index:0;background:var(--fx-doors-void)}

/* wall 3: a lattice wall with a round window, cut on the diagonal (the clip is static; only transform moves) */
.fx-doors-dg{position:absolute;inset:0}
.fx-doors-dga{clip-path:polygon(0 0,100% 0,0 100%)}
.fx-doors-dgb{clip-path:polygon(100% 0,100% 100%,0 100%)}
.fx-doors-dg .fx-doors-face{background:var(--fx-doors-pat-asa,none),var(--fx-doors-lat3);
  box-shadow:inset 0 0 0 4px var(--fx-doors-ink),inset 0 0 0 12px var(--fx-doors-wood),inset 0 0 0 15px var(--fx-doors-ink)}
.fx-doors-ring{position:absolute;left:50%;top:50%;width:56vmin;height:56vmin;margin:-28vmin 0 0 -28vmin;border-radius:50%;
  background:
    repeating-linear-gradient(90deg,transparent 0 calc(25% - 3px),var(--fx-doors-moon-bar) calc(25% - 3px) 25%),
    repeating-linear-gradient(0deg,transparent 0 calc(16.66% - 2px),var(--fx-doors-moon-bar) calc(16.66% - 2px) 16.66%),
    var(--fx-doors-moon);
  box-shadow:0 0 0 4px var(--fx-doors-ink),0 0 0 14px var(--fx-doors-wood),0 0 0 17px var(--fx-doors-ink)}
.fx-doors-seam{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.fx-doors-seam path{fill:none;stroke:var(--fx-doors-ink);stroke-width:10px;vector-effect:non-scaling-stroke}
.fx-doors-seam .fx-doors-seam-in{stroke:var(--fx-doors-gold);stroke-width:3px}

/* wall 4: plank doors in quarters, with a cross rail (kikko band) and an iron boss where the four meet */
.fx-doors-q{position:absolute;width:calc(50% + 1px);height:calc(50% + 1px)}
.fx-doors-q1{left:0;top:0}.fx-doors-q2{right:0;top:0}.fx-doors-q3{left:0;bottom:0}.fx-doors-q4{right:0;bottom:0}
.fx-doors-q .fx-doors-face{
  background:repeating-linear-gradient(90deg,var(--fx-doors-plank) 0 calc(11% - 3px),var(--fx-doors-plank-line) calc(11% - 3px) 11%,var(--fx-doors-plank-2) 11% calc(22% - 3px),var(--fx-doors-plank-line) calc(22% - 3px) 22%);
  box-shadow:inset 0 0 0 4px var(--fx-doors-ink),inset 0 0 0 11px var(--fx-doors-plank-line),inset 0 0 0 14px var(--fx-doors-ink)}
.fx-doors-q2 .fx-doors-face,.fx-doors-q4 .fx-doors-face{background-position:5.5vw 0}
.fx-doors-rail{position:absolute;background:var(--fx-doors-pat-kik,none),var(--fx-doors-rail);box-shadow:0 0 0 3px var(--fx-doors-ink)}
.fx-doors-rh{left:0;right:0;height:7vmin}
.fx-doors-rv{top:0;bottom:0;width:7vmin}
.fx-doors-q1 .fx-doors-rh,.fx-doors-q2 .fx-doors-rh{bottom:0}
.fx-doors-q3 .fx-doors-rh,.fx-doors-q4 .fx-doors-rh{top:0}
.fx-doors-q1 .fx-doors-rv,.fx-doors-q3 .fx-doors-rv{right:0}
.fx-doors-q2 .fx-doors-rv,.fx-doors-q4 .fx-doors-rv{left:0}
.fx-doors-boss{position:absolute;width:20vmin;height:20vmin;border-radius:50%;background:var(--fx-doors-iron);
  box-shadow:inset 0 0 0 3px var(--fx-doors-gold),inset 0 0 0 2.4vmin var(--fx-doors-iron),inset 0 0 0 calc(2.4vmin + 3px) var(--fx-doors-gold)}
.fx-doors-q1 .fx-doors-boss{right:-10vmin;bottom:-10vmin}
.fx-doors-q2 .fx-doors-boss{left:-10vmin;bottom:-10vmin}
.fx-doors-q3 .fx-doors-boss{right:-10vmin;top:-10vmin}
.fx-doors-q4 .fx-doors-boss{left:-10vmin;top:-10vmin}

/* wall 5: four paper fusuma (shippo) on two tracks; the inner pair runs over the outer pair */
.fx-doors-t{position:absolute;top:0;bottom:0;width:calc(25% + 1px)}
.fx-doors-t1{left:0}.fx-doors-t2{left:25%;z-index:1}.fx-doors-t3{right:25%;z-index:1}.fx-doors-t4{right:0}
.fx-doors-t .fx-doors-face{background:var(--fx-doors-pat-shi,none),var(--fx-doors-wash);
  box-shadow:inset 0 0 0 4px var(--fx-doors-lacquer),inset 0 0 0 7px var(--fx-doors-t-edge),inset 0 0 0 10px var(--fx-doors-lacquer)}
.fx-doors-hiki{position:absolute;top:50%;width:26px;height:26px;margin-top:-13px;border-radius:50%;background:var(--fx-doors-lacquer);
  box-shadow:inset 0 0 0 3px var(--fx-doors-gold),inset 0 0 0 7px var(--fx-doors-lacquer)}
.fx-doors-t1 .fx-doors-hiki,.fx-doors-t2 .fx-doors-hiki{right:22px}
.fx-doors-t3 .fx-doors-hiki,.fx-doors-t4 .fx-doors-hiki{left:22px}

/* ---------- the opening ---------- */
html.intro .fx-doors-layer{display:block;position:fixed;inset:0;z-index:60;pointer-events:none;overflow:hidden;
  animation:fx-doors-gone 1ms calc(1720ms * var(--fx-slow,1)) forwards}   /* failsafe: gone even if no script runs */
/* each wall is shown only from when it can first be glimpsed until its panels are gone (no fill: hidden outside) */
html.intro .fx-doors-wall,html.intro .fx-doors-deep{visibility:hidden}
html.intro .fx-doors-deep{animation:fx-doors-life calc(880ms * var(--fx-slow,1)) calc(520ms * var(--fx-slow,1))}
html.intro .fx-doors-w1{animation:fx-doors-life calc(1050ms * var(--fx-slow,1)) 0ms,
  fx-doors-pass calc(400ms * var(--fx-slow,1)) cubic-bezier(.5,0,1,1) calc(520ms * var(--fx-slow,1)) forwards}
html.intro .fx-doors-w2{animation:fx-doors-life calc(790ms * var(--fx-slow,1)) calc(520ms * var(--fx-slow,1)),
  fx-doors-near calc(260ms * var(--fx-slow,1)) calc(560ms * var(--fx-slow,1)) both,
  fx-doors-pass calc(330ms * var(--fx-slow,1)) cubic-bezier(.5,0,1,1) calc(840ms * var(--fx-slow,1)) forwards}
html.intro .fx-doors-w3{animation:fx-doors-life calc(580ms * var(--fx-slow,1)) calc(840ms * var(--fx-slow,1)),
  fx-doors-near calc(180ms * var(--fx-slow,1)) calc(880ms * var(--fx-slow,1)) both,
  fx-doors-pass calc(290ms * var(--fx-slow,1)) cubic-bezier(.5,0,1,1) calc(1080ms * var(--fx-slow,1)) forwards}
html.intro .fx-doors-w4{animation:fx-doors-life calc(500ms * var(--fx-slow,1)) calc(1080ms * var(--fx-slow,1)),
  fx-doors-near calc(130ms * var(--fx-slow,1)) calc(1120ms * var(--fx-slow,1)) both,
  fx-doors-pass calc(250ms * var(--fx-slow,1)) cubic-bezier(.5,0,1,1) calc(1270ms * var(--fx-slow,1)) forwards}
html.intro .fx-doors-w5{animation:fx-doors-life calc(420ms * var(--fx-slow,1)) calc(1270ms * var(--fx-slow,1)),
  fx-doors-near calc(90ms * var(--fx-slow,1)) calc(1310ms * var(--fx-slow,1)) both,
  fx-doors-pass calc(240ms * var(--fx-slow,1)) cubic-bezier(.5,0,1,1) calc(1420ms * var(--fx-slow,1)) forwards}
html.intro .fx-doors-w2 .fx-doors-dim{animation:fx-doors-undim calc(260ms * var(--fx-slow,1)) steps(4,end) calc(560ms * var(--fx-slow,1)) both}
html.intro .fx-doors-w3 .fx-doors-dim{animation:fx-doors-undim calc(180ms * var(--fx-slow,1)) steps(3,end) calc(880ms * var(--fx-slow,1)) both}
html.intro .fx-doors-w4 .fx-doors-dim{animation:fx-doors-undim calc(130ms * var(--fx-slow,1)) steps(3,end) calc(1120ms * var(--fx-slow,1)) both}
html.intro .fx-doors-w5 .fx-doors-dim{animation:fx-doors-undim calc(90ms * var(--fx-slow,1)) steps(2,end) calc(1310ms * var(--fx-slow,1)) both}

/* wall 1: the seal, then the shoji part sideways */
html.intro .fx-doors-layer .seal{animation:fx-doors-stamp calc(400ms * var(--fx-slow,1)) calc(40ms * var(--fx-slow,1)) both}
html.intro .fx-doors-pop{animation:fx-doors-pop calc(260ms * var(--fx-slow,1)) steps(1,end) calc(230ms * var(--fx-slow,1)) forwards}
html.intro .fx-doors-layer .fx-doors-l{animation:fx-doors-go-l calc(400ms * var(--fx-slow,1)) calc(520ms * var(--fx-slow,1)) both}
html.intro .fx-doors-layer .fx-doors-r{animation:fx-doors-go-r calc(400ms * var(--fx-slow,1)) calc(520ms * var(--fx-slow,1)) both}
html.intro .fx-doors-layer .fx-doors-sh .fx-doors-sk{animation:fx-doors-streak-x calc(400ms * var(--fx-slow,1)) steps(1,end) calc(560ms * var(--fx-slow,1)) forwards}
html.intro .fx-doors-layer .fx-doors-sh .fx-doors-puff{animation:fx-doors-puff calc(220ms * var(--fx-slow,1)) steps(1,end) calc(820ms * var(--fx-slow,1)) forwards}
/* wall 2: fusuma, up and down */
html.intro .fx-doors-layer .fx-doors-up{animation:fx-doors-go-u calc(330ms * var(--fx-slow,1)) calc(840ms * var(--fx-slow,1)) both}
html.intro .fx-doors-layer .fx-doors-down{animation:fx-doors-go-d calc(330ms * var(--fx-slow,1)) calc(840ms * var(--fx-slow,1)) both}
html.intro .fx-doors-layer .fx-doors-fu .fx-doors-sk{animation:fx-doors-streak-y calc(330ms * var(--fx-slow,1)) steps(1,end) calc(880ms * var(--fx-slow,1)) forwards}
html.intro .fx-doors-layer .fx-doors-fu .fx-doors-puff{animation:fx-doors-puff calc(200ms * var(--fx-slow,1)) steps(1,end) calc(1100ms * var(--fx-slow,1)) forwards}
/* wall 3: diagonal */
html.intro .fx-doors-dga{animation:fx-doors-go-ul calc(290ms * var(--fx-slow,1)) calc(1080ms * var(--fx-slow,1)) both}
html.intro .fx-doors-dgb{animation:fx-doors-go-dr calc(290ms * var(--fx-slow,1)) calc(1080ms * var(--fx-slow,1)) both}
/* wall 4: four corners */
html.intro .fx-doors-q1{animation:fx-doors-go-ul calc(250ms * var(--fx-slow,1)) calc(1270ms * var(--fx-slow,1)) both}
html.intro .fx-doors-q2{animation:fx-doors-go-ur calc(250ms * var(--fx-slow,1)) calc(1270ms * var(--fx-slow,1)) both}
html.intro .fx-doors-q3{animation:fx-doors-go-dl calc(250ms * var(--fx-slow,1)) calc(1270ms * var(--fx-slow,1)) both}
html.intro .fx-doors-q4{animation:fx-doors-go-dr calc(250ms * var(--fx-slow,1)) calc(1270ms * var(--fx-slow,1)) both}
/* wall 5: telescoping out to both sides */
html.intro .fx-doors-t1{animation:fx-doors-go-l calc(240ms * var(--fx-slow,1)) calc(1420ms * var(--fx-slow,1)) both}
html.intro .fx-doors-t2{animation:fx-doors-go-l2 calc(240ms * var(--fx-slow,1)) calc(1420ms * var(--fx-slow,1)) both}
html.intro .fx-doors-t3{animation:fx-doors-go-r2 calc(240ms * var(--fx-slow,1)) calc(1420ms * var(--fx-slow,1)) both}
html.intro .fx-doors-t4{animation:fx-doors-go-r calc(240ms * var(--fx-slow,1)) calc(1420ms * var(--fx-slow,1)) both}
/* fast-forward (fx/doors.js, on the visitor's first input): two stepped frames out */
html.intro.fx-doors-ff .fx-doors-layer{opacity:0;transition:opacity calc(110ms * var(--fx-slow,1)) steps(2,end)}

/* the page behind: a slight push-in as the last wall parts, hero and lantern re-timed to overlap it */
/* (the hero only: main clips it sideways, so the push never widens the page on a phone) */
html.intro .hero{transform-origin:50% 45%;animation:fx-doors-push calc(600ms * var(--fx-slow,1)) cubic-bezier(.16,1,.3,1) calc(1380ms * var(--fx-slow,1)) both}
html.intro h1 .ln>span{animation-duration:calc(.9s * var(--fx-slow,1));animation-delay:calc(1.36s * var(--fx-slow,1))}
html.intro h1 .ln:nth-child(2)>span{animation-delay:calc(1.43s * var(--fx-slow,1))}
html.intro h1 .ln:nth-child(3)>span{animation-delay:calc(1.5s * var(--fx-slow,1))}
html.intro .lantern{animation:fx-doors-lantern calc(1.1s * var(--fx-slow,1)) cubic-bezier(.2,.9,.3,1) calc(1.3s * var(--fx-slow,1)) both,sway 7s ease-in-out calc(2.4s * var(--fx-slow,1)) infinite}
html.intro .nav .seal{animation-duration:calc(.6s * var(--fx-slow,1));animation-delay:calc(1.55s * var(--fx-slow,1))}

/* ---------- the door-cut ---------- */
.fx-doors-cut{position:fixed;inset:0;z-index:60;pointer-events:none;overflow:hidden;
  animation:fx-doors-gone 1ms calc(900ms * var(--fx-slow,1)) forwards}    /* failsafe: gone even if the script stops half-way */
.fx-doors-cut .fx-doors-fu{visibility:hidden}
.fx-doors-cut .fx-doors-l{transform:translateX(-101%)}
.fx-doors-cut .fx-doors-r{transform:translateX(101%)}
.fx-doors-cut.fx-doors-shut .fx-doors-l{animation:fx-doors-shut-l calc(170ms * var(--fx-slow,1)) cubic-bezier(.6,0,.9,.5) forwards}
.fx-doors-cut.fx-doors-shut .fx-doors-r{animation:fx-doors-shut-r calc(170ms * var(--fx-slow,1)) cubic-bezier(.6,0,.9,.5) forwards}
.fx-doors-cut.fx-doors-shut .fx-doors-sh .fx-doors-puff{animation:fx-doors-puff calc(240ms * var(--fx-slow,1)) steps(1,end) calc(165ms * var(--fx-slow,1)) forwards}
.fx-doors-cut.fx-doors-swap .fx-doors-sh{visibility:hidden}
.fx-doors-cut.fx-doors-swap .fx-doors-fu{visibility:visible}
.fx-doors-cut.fx-doors-swap .fx-doors-up{animation:fx-doors-open-up calc(290ms * var(--fx-slow,1)) calc(45ms * var(--fx-slow,1)) both}
.fx-doors-cut.fx-doors-swap .fx-doors-down{animation:fx-doors-open-down calc(290ms * var(--fx-slow,1)) calc(45ms * var(--fx-slow,1)) both}
.fx-doors-cut.fx-doors-swap .fx-doors-fu .fx-doors-sk{animation:fx-doors-streak-y calc(360ms * var(--fx-slow,1)) steps(1,end) calc(65ms * var(--fx-slow,1)) forwards}
.fx-doors-cut.fx-doors-swap .fx-doors-fu .fx-doors-puff{animation:fx-doors-puff calc(240ms * var(--fx-slow,1)) steps(1,end) calc(280ms * var(--fx-slow,1)) forwards}

/* ---------- keyframes ---------- */
@keyframes fx-doors-gone{to{visibility:hidden}}
@keyframes fx-doors-life{from,to{visibility:visible}}
/* the far wall rushes up to full size: it accelerates toward the viewer, stops just past the mark, two stepped frames back */
@keyframes fx-doors-near{
  0%{transform:scale(.6);animation-timing-function:cubic-bezier(.5,0,.8,.55)}
  78%{transform:scale(1.018);animation-timing-function:steps(1,end)}
  89%{transform:scale(.994);animation-timing-function:steps(1,end)}
  100%{transform:scale(1)}}
@keyframes fx-doors-pass{from{transform:scale(1)}to{transform:scale(1.08)}}
@keyframes fx-doors-undim{from{opacity:.62}to{opacity:0}}
@keyframes fx-doors-stamp{
  0%{opacity:0;transform:rotate(-15deg) scale(1.9);animation-timing-function:cubic-bezier(.7,0,.84,0)}
  48%{opacity:1;transform:rotate(-3deg) scale(.88);animation-timing-function:steps(1,end)}
  64%{transform:rotate(-5deg) scale(1.06);animation-timing-function:steps(1,end)}
  80%{transform:rotate(-3.6deg) scale(.97);animation-timing-function:steps(1,end)}
  100%{opacity:1;transform:rotate(-4deg) scale(1)}}
@keyframes fx-doors-pop{0%{opacity:1;scale:.72}33%{opacity:1;scale:.96;rotate:4deg}66%{opacity:.6;scale:1.12;rotate:7deg}100%{opacity:0;scale:1.2}}
/* a strum: one-frame jolt inward, nearly linear flight, hard stop past the doorway edge, three stepped frames of rebound */
@keyframes fx-doors-go-l{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(6px,0);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(-100%,0);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(calc(-100% + 18px),0);animation-timing-function:steps(1,end)}
  94.2%{transform:translate(calc(-100% + 6px),0);animation-timing-function:steps(1,end)}
  100%{transform:translate(-101%,0)}}
@keyframes fx-doors-go-r{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(-6px,0);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(100%,0);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(calc(100% - 18px),0);animation-timing-function:steps(1,end)}
  94.2%{transform:translate(calc(100% - 6px),0);animation-timing-function:steps(1,end)}
  100%{transform:translate(101%,0)}}
@keyframes fx-doors-go-u{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(0,6px);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(0,-100%);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(0,calc(-100% + 18px));animation-timing-function:steps(1,end)}
  94.2%{transform:translate(0,calc(-100% + 6px));animation-timing-function:steps(1,end)}
  100%{transform:translate(0,-101%)}}
@keyframes fx-doors-go-d{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(0,-6px);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(0,100%);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(0,calc(100% - 18px));animation-timing-function:steps(1,end)}
  94.2%{transform:translate(0,calc(100% - 6px));animation-timing-function:steps(1,end)}
  100%{transform:translate(0,101%)}}
@keyframes fx-doors-go-ul{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(6px,6px);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(-100%,-100%);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(calc(-100% + 18px),calc(-100% + 18px));animation-timing-function:steps(1,end)}
  94.2%{transform:translate(calc(-100% + 6px),calc(-100% + 6px));animation-timing-function:steps(1,end)}
  100%{transform:translate(-101%,-101%)}}
@keyframes fx-doors-go-ur{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(-6px,6px);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(100%,-100%);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(calc(100% - 18px),calc(-100% + 18px));animation-timing-function:steps(1,end)}
  94.2%{transform:translate(calc(100% - 6px),calc(-100% + 6px));animation-timing-function:steps(1,end)}
  100%{transform:translate(101%,-101%)}}
@keyframes fx-doors-go-dl{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(6px,-6px);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(-100%,100%);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(calc(-100% + 18px),calc(100% - 18px));animation-timing-function:steps(1,end)}
  94.2%{transform:translate(calc(-100% + 6px),calc(100% - 6px));animation-timing-function:steps(1,end)}
  100%{transform:translate(-101%,101%)}}
@keyframes fx-doors-go-dr{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(-6px,-6px);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(100%,100%);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(calc(100% - 18px),calc(100% - 18px));animation-timing-function:steps(1,end)}
  94.2%{transform:translate(calc(100% - 6px),calc(100% - 6px));animation-timing-function:steps(1,end)}
  100%{transform:translate(101%,101%)}}
@keyframes fx-doors-go-l2{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(6px,0);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(-200%,0);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(calc(-200% + 18px),0);animation-timing-function:steps(1,end)}
  94.2%{transform:translate(calc(-200% + 6px),0);animation-timing-function:steps(1,end)}
  100%{transform:translate(-201%,0)}}
@keyframes fx-doors-go-r2{
  0%{transform:translate(0,0);animation-timing-function:steps(1,start)}
  10%{transform:translate(-6px,0);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  82.5%{transform:translate(200%,0);animation-timing-function:steps(1,end)}
  88.3%{transform:translate(calc(200% - 18px),0);animation-timing-function:steps(1,end)}
  94.2%{transform:translate(calc(200% - 6px),0);animation-timing-function:steps(1,end)}
  100%{transform:translate(201%,0)}}
/* the door-cut keeps its own two strums */
@keyframes fx-doors-open-up{
  0%{transform:translateY(0);animation-timing-function:steps(1,start)}
  11.4%{transform:translateY(5px);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  80%{transform:translateY(-100%);animation-timing-function:steps(1,end)}
  86.6%{transform:translateY(calc(-100% + 16px));animation-timing-function:steps(1,end)}
  93.3%{transform:translateY(calc(-100% + 5px));animation-timing-function:steps(1,end)}
  100%{transform:translateY(-101%)}}
@keyframes fx-doors-open-down{
  0%{transform:translateY(0);animation-timing-function:steps(1,start)}
  11.4%{transform:translateY(-5px);animation-timing-function:cubic-bezier(.35,.15,.65,.65)}
  80%{transform:translateY(100%);animation-timing-function:steps(1,end)}
  86.6%{transform:translateY(calc(100% - 16px));animation-timing-function:steps(1,end)}
  93.3%{transform:translateY(calc(100% - 5px));animation-timing-function:steps(1,end)}
  100%{transform:translateY(101%)}}
@keyframes fx-doors-shut-l{from{transform:translateX(-101%)}to{transform:translateX(0)}}
@keyframes fx-doors-shut-r{from{transform:translateX(101%)}to{transform:translateX(0)}}
/* streaks grow on twos while the panel flies, hold at the stop, then the tips retract in steps */
@keyframes fx-doors-streak-x{
  0%{opacity:1;scale:.3 1}18%{opacity:1;scale:.62 1;rotate:.4deg}38%{opacity:1;scale:.86 1;rotate:-.3deg}
  60%{opacity:1;scale:1 1;rotate:0deg}72%{opacity:.85;scale:.78 1;rotate:.3deg}86%{opacity:.5;scale:.5 1;rotate:0deg}100%{opacity:0;scale:.3 1}}
@keyframes fx-doors-streak-y{
  0%{opacity:1;scale:1 .3}18%{opacity:1;scale:1 .62;rotate:-.4deg}38%{opacity:1;scale:1 .86;rotate:.3deg}
  58%{opacity:1;scale:1 1;rotate:0deg}72%{opacity:.85;scale:1 .78;rotate:-.3deg}86%{opacity:.5;scale:1 .5;rotate:0deg}100%{opacity:0;scale:1 .3}}
@keyframes fx-doors-puff{0%{opacity:1;scale:.45}25%{opacity:1;scale:.82}50%{opacity:.9;scale:1.04}75%{opacity:.55;scale:1.2}100%{opacity:0;scale:1.3}}
@keyframes fx-doors-push{from{scale:1.03}to{scale:1}}
@keyframes fx-doors-lantern{0%{transform:translateY(-120%) rotate(0deg)}70%{transform:translateY(0) rotate(4deg)}85%{transform:rotate(-3deg)}100%{transform:rotate(-2.4deg)}}

/* reduced motion: no doors at all (the boot script never sets the intro class then; this is the second lock) */
@media (prefers-reduced-motion:reduce){
  html.intro .fx-doors-layer,.fx-doors-cut{display:none}
  html.intro .hero{animation:none}
}
