/* Unlock 1 — line trace + light-up, camera follows the line. Copy this file whole; change only ▶ ADAPT lines.
   A glowing line comes down onto the first board, splits and runs round its border both ways, meets at the bottom
   — the board lights up (grey → colour, frame brightens, flash, shine) while the line runs on to the next board.
   The camera follows the line's head; with .ul-tilt it tilts like poe2mt.com (top-down → 50° → flat overview).
   Everything is drawn from ONE number (progress 0 → 1) that unlock.js sets, so the same frame shows whether it
   plays by itself or the scroll moves it.
   Works with glow-edge.css (Glow 3) for the optional border glow: add class="glow-edge" to a board.

   Board markup (rectangle = .ul-rect, circle = .ul-circle; left / top = its CENTRE on the floor, in px):
     <div class="ul-board ul-rect glow-edge" style="left: 420px; top: 600px">   ← glow-edge = optional border glow
       <img class="ul-pic" src="any-picture.webp" alt="">  ← any picture, any shape (object-fit: cover)
       <img class="ul-frame" src="frame.png" alt="">       ← optional frame picture on top (transparent middle)
       <div class="ul-fx"><i class="ul-flash"></i><i class="ul-shine"></i></div>
     </div>
   Section markup: see unlock.js. unlock.js adds the two line layers (<svg>) itself. */

/* ▶ ADAPT — tokens, set on the section or ANY parent (never defined on .ul-board, so a parent value wins):
     --unlock-line    line colour, also the spark, flash tint and border glow   default #c99a45 (gold); cyan = #3fd6e8
     --unlock-track   the empty path before the line arrives                    default grey 22%
     --unlock-lead    how far above the first board the line starts (floor px)  default 360px
     --unlock-w       line thickness (floor px — the camera zoom scales it)     default 4px
     --unlock-blur    glow size around the line (Glow 1 recipe)                 default 6px
     --unlock-radius  rectangle corner radius — the line follows it             default 14px
     --unlock-edge-blur  border glow size (Glow 3)                              default 12px
     --unlock-safe-bottom  space at the bottom of the stage the camera keeps clear (a caption / control bar)  default 0
     --unlock-top     a fixed header's height: the stage sticks under it and is that much shorter    default 0px */

/* registered so unlock.js reads them back as px */
@property --unlock-lead { syntax: '<length>'; inherits: true; initial-value: 360px; }
@property --unlock-w { syntax: '<length>'; inherits: true; initial-value: 4px; }

/* the scroll section: one screen + the pinned scroll length (unlock.js sets --ul-run from the journey length × UL_SCROLL_PX_PER_SEC) */
.ul { position: relative; height: calc(100vh - var(--unlock-top, 0px) + var(--ul-run, 4000px)); height: calc(100svh - var(--unlock-top, 0px) + var(--ul-run, 4000px)); }
.ul-stage { position: sticky; top: var(--unlock-top, 0px); overflow: hidden;   /* fixed header → set --unlock-top, not these lines */
  height: calc(100vh - var(--unlock-top, 0px)); height: calc(100svh - var(--unlock-top, 0px)); }
/* the floor: unlock.js moves it as the camera (transform round its top-left corner) */
.ul-plane { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-origin: 0 0; }
.ul-ground { position: absolute; inset: -2500px; pointer-events: none; }   /* optional floor picture / pattern (demo-page.css) */

.ul-board {
  --glow-edge: var(--unlock-line, #c99a45);             /* Glow 3 border glow follows the line colour */
  --glow-edge-blur: var(--unlock-edge-blur, 12px);
  position: absolute; translate: -50% -50%;             /* left / top in the markup = the board's centre */
}
.ul-rect { width: 320px; aspect-ratio: 4 / 3; border-radius: var(--unlock-radius, 14px); }   /* ▶ ADAPT size (floor px) */
.ul-circle { width: 200px; aspect-ratio: 1; border-radius: 50%; }                            /* ▶ ADAPT size (floor px) */

/* picture + frame: grey and dim → full colour; the flash pushes them brighter for a moment */
.ul-pic, .ul-frame { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; display: block;
  pointer-events: none; user-select: none; }
.ul-pic { object-fit: cover;
  filter: grayscale(calc(1 - var(--ul-lit, 0))) brightness(calc(.4 + .6 * var(--ul-lit, 0) + .55 * var(--ul-flash, 0))); }
.ul-frame { object-fit: fill;
  filter: grayscale(calc(.85 - .85 * var(--ul-lit, 0))) brightness(calc(.5 + .55 * var(--ul-lit, 0) + .45 * var(--ul-flash, 0))); }

/* flash + shine are clipped by this inner layer — never overflow:hidden on the board (it would cut the glows) */
.ul-fx { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.ul-flash { position: absolute; inset: -20%; opacity: var(--ul-flash, 0); mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), color-mix(in srgb, var(--unlock-line, #c99a45) 60%, transparent) 50%, transparent); }
.ul-shine { position: absolute; top: -60%; bottom: -60%; left: 0; width: 38%; opacity: var(--ul-shine-o, 0); mix-blend-mode: screen;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16) 35%, rgba(255, 255, 255, .75) 50%, rgba(255, 255, 255, .16) 65%, transparent);
  transform: translateX(calc(-130% + var(--ul-shine, 0) * 400%)) rotate(24deg); }

/* the line: blurred copy under the sharp one (Glow 1 recipe), spark on each moving head */
.ul-line, .ul-line-glow { position: absolute; overflow: visible; pointer-events: none; fill: none; stroke-linecap: round; }
.ul-line-glow { filter: blur(var(--unlock-blur, 6px)); opacity: .9; }
.ul-line .ul-track { stroke: var(--unlock-track, rgba(128, 128, 128, .22)); }
.ul-line .ul-run, .ul-line-glow .ul-run { stroke: var(--unlock-line, #c99a45); }
.ul-spark { opacity: 0; transition: opacity .2s; }
.ul-line .ul-spark { fill: #fff; }
.ul-line-glow .ul-spark { fill: var(--unlock-line, #c99a45); }
.is-moving .ul-spark.on { opacity: 1; }

/* Glow 3 on the board: only the lit state glows — no hover glow before it is unlocked */
.ul-board.glow-edge:not(.is-selected):is(:hover, :focus-visible)::before,
.ul-board.glow-edge:not(.is-selected):is(:hover, :focus-visible)::after { opacity: 0; }
.ul-board.glow-edge::after { inset: -2px; border-width: 2px; }   /* a bit stronger edge than a hover card */

/* app's "Reduce animation" (#12): unlock.js jumps straight to the lit overview — no flash, shine or spark */
.reduce-unlock .ul-spark { transition: none; }
