/* Hero backgrounds. ONE source for the promo website AND the portal's live previews
 * (the app serves this folder at /site-bg/). Driven by CSS variables that bg.js sets:
 *   --bg-a --bg-b --bg-c  colours      --dot  pixel / bulb size      --speed  base period (0s = still)
 *   --angle  gradient angle            --overlay  0..0.85 darkening for readable text
 * Performance: animations use transform / opacity (compositor) wherever possible, no filters, no
 * canvas, no images. They pause off screen (.paused) and stop for reduced motion (.still). */
.hero-bg { --stage: #0b0714; position: absolute; inset: 0; overflow: hidden; contain: paint; z-index: 0;
  background-color: var(--stage); background-size: cover; background-position: center; }
.hero-bg > i { position: absolute; display: block; pointer-events: none; }
.hero-bg::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: rgba(11, 7, 20, var(--overlay, 0)); }

/* ---------- classic backgrounds ---------- */
/* LED dots (the original look, kept as it was) */
.bg-leds { background:
  radial-gradient(circle at 20% 30%, rgba(166, 77, 255, .55), transparent 45%),
  radial-gradient(circle at 80% 70%, rgba(255, 61, 154, .45), transparent 45%), var(--stage); /* fallback without color-mix */ }
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .bg-leds { background:
    radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--bg-a) 55%, transparent), transparent 45%),
    radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--bg-b) 45%, transparent), transparent 45%), var(--stage); }
}
.bg-leds::before { content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(11, 7, 20, .92) 38%, transparent 42%); background-size: var(--dot, 14px) var(--dot, 14px);
  animation: bg-drift var(--speed, 14s) linear infinite; }
.bg-aurora { background: linear-gradient(120deg, var(--bg-a), var(--bg-c), var(--bg-b), var(--bg-c), var(--bg-a)); background-size: 300% 300%; animation: bg-aurora calc(var(--speed, 14s) * 2) ease-in-out infinite; }
.bg-gradient { background: linear-gradient(var(--angle, 135deg), var(--bg-a), var(--bg-b)); }
.bg-solid { background: var(--bg-a); }
.bg-image, .bg-video, .bg-slideshow { background-color: #000; }
.bg-image::after, .bg-video::after, .bg-slideshow::after { background: linear-gradient(180deg, rgba(11, 7, 20, calc(var(--overlay, 0) + .35)), var(--stage)); }
.bg-empty { background: var(--stage); }
.hero-bg video { width: 100%; height: 100%; object-fit: cover; }
.hero-bg .slide { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.2s ease; }
.hero-bg .slide.on { opacity: 1; }

/* ---------- LED panel backgrounds ---------- */
/* Left side stays calm so the headline is readable */
.hero-bg .fx-v { inset: 0; background: linear-gradient(90deg, rgba(11, 7, 20, .84) 0%, rgba(11, 7, 20, .56) 48%, rgba(11, 7, 20, 0) 100%); }
/* on phones the text spans the whole width, so darken evenly */
@media (max-width: 767px) { .hero-bg .fx-v { background: rgba(11, 7, 20, .66); } }
/* LED pixels, the same build as the bulb wall, shared by every pixel style:
   .fx-px   mask drawn over the lit layers: each --dot cell becomes one LED with a
            hard round edge, a small hot core and dark board around it, so colour
            only shows through the LEDs (lit pixel = glass + core, unlit = dim glass)
   .fx-seam cabinet seams every 8 pixels, like real LED panels */
.hero-bg .fx-px { inset: 0; background-size: var(--dot, 14px) var(--dot, 14px); background-image:
  radial-gradient(circle, rgba(255, 255, 255, .34) 0 6%, rgba(255, 255, 255, .08) 12%, rgba(255, 255, 255, 0) 18% 40%, rgba(5, 3, 10, .55) 42%, rgba(11, 7, 20, .94) 47%); }
.hero-bg .fx-seam { inset: 0; background-position: 1.5px 1.5px; background-image:
  repeating-linear-gradient(90deg, transparent 0 calc(var(--dot, 14px) * 8 - 3px), rgba(0, 0, 0, .78) calc(var(--dot, 14px) * 8 - 3px) calc(var(--dot, 14px) * 8 - 2px), rgba(255, 255, 255, .1) calc(var(--dot, 14px) * 8 - 2px) calc(var(--dot, 14px) * 8)),
  repeating-linear-gradient(0deg, transparent 0 calc(var(--dot, 14px) * 8 - 3px), rgba(0, 0, 0, .78) calc(var(--dot, 14px) * 8 - 3px) calc(var(--dot, 14px) * 8 - 2px), rgba(255, 255, 255, .1) calc(var(--dot, 14px) * 8 - 2px) calc(var(--dot, 14px) * 8)); }
/* soft colour bloom over the board, like light spilling between LEDs (no filters allowed, so a wide faint gradient) */
.hero-bg .fx-halo { inset: 0; opacity: .2;
  background: radial-gradient(ellipse at 70% 45%, var(--bg-a), transparent 62%), radial-gradient(ellipse at 35% 90%, var(--bg-b), transparent 55%); }

/* LED panel wall: a colour show seen through crisp LED pixels with cabinet seams, and a light beam sweeping across */
.bg-ledpanel .fx-wash { top: 0; bottom: 0; left: 0; width: 200%;
  background: linear-gradient(90deg, var(--bg-a), var(--bg-c), var(--bg-b), var(--bg-c), var(--bg-a), var(--bg-c), var(--bg-b), var(--bg-c), var(--bg-a));
  animation: bg-pan calc(var(--speed, 14s) * 3) linear infinite; }
.bg-ledpanel .fx-beam { top: 0; bottom: 0; left: 0; width: 26%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
  animation: bg-beam calc(var(--speed, 14s) * .6) ease-in-out infinite; }

/* Bulb wall: a board of real-looking bulbs. Dark sockets always show; two sets
   (a / b, offset half a step) snap on and off in turn like a chase. Each lit bulb
   = hot white core, coloured glass with a hard edge, and a soft glow ring.
   Plain rgba / var() values first; color-mix only inside @supports, because a
   var() + color-mix value would override the fallback and then fail to nothing. */
.bg-bulbs { --bulb-t: max(1.2s, calc(var(--speed, 14s) / 4)); background:
  radial-gradient(ellipse at 75% 40%, rgba(166, 77, 255, .22), transparent 60%),
  radial-gradient(ellipse at 30% 85%, rgba(255, 61, 154, .16), transparent 55%), var(--stage); }
.bg-bulbs .fx-off, .bg-bulbs .fx-a, .bg-bulbs .fx-b { inset: 0; background-size: calc(var(--dot, 14px) * 2) calc(var(--dot, 14px) * 2); }
/* unlit socket: dim glass + darker rim, crisp edge (both grids) */
.bg-bulbs .fx-off { background-image:
  radial-gradient(circle, var(--sk-1, rgba(255, 255, 255, .13)) 0 22%, var(--sk-2, rgba(255, 255, 255, .05)) 30%, var(--sk-3, rgba(0, 0, 0, .55)) 34% 38%, transparent 40%),
  radial-gradient(circle, var(--sk-1, rgba(255, 255, 255, .13)) 0 22%, var(--sk-2, rgba(255, 255, 255, .05)) 30%, var(--sk-3, rgba(0, 0, 0, .55)) 34% 38%, transparent 40%);
  background-position: 0 0, var(--dot, 14px) var(--dot, 14px); }
/* a calm chase: 3.5 s per cycle at movement 1, never under 1.2 s; b runs half a period behind a */
.bg-bulbs .fx-a, .bg-bulbs .fx-b { animation: bg-bulb var(--bulb-t) linear infinite; }
.bg-bulbs .fx-a { background-image: radial-gradient(circle, #fff 0 7%, var(--bg-a) 16% 32%, transparent 34%); }
.bg-bulbs .fx-b { background-position: var(--dot, 14px) var(--dot, 14px); animation-delay: calc(var(--bulb-t) / -2);
  background-image: radial-gradient(circle, #fff 0 7%, var(--bg-b) 16% 32%, transparent 34%); }
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .bg-bulbs { background:
    radial-gradient(ellipse at 75% 40%, color-mix(in srgb, var(--bg-a) 22%, transparent), transparent 60%),
    radial-gradient(ellipse at 30% 85%, color-mix(in srgb, var(--bg-b) 16%, transparent), transparent 55%), var(--stage); }
  .bg-bulbs .fx-a { background-image: radial-gradient(circle, #fff 0 7%, color-mix(in srgb, var(--bg-a) 55%, #fff) 13%, var(--bg-a) 20% 32%,
    color-mix(in srgb, var(--bg-a) 38%, transparent) 36%, transparent 58%); }
  .bg-bulbs .fx-b { background-image: radial-gradient(circle, #fff 0 7%, color-mix(in srgb, var(--bg-b) 55%, #fff) 13%, var(--bg-b) 20% 32%,
    color-mix(in srgb, var(--bg-b) 38%, transparent) 36%, transparent 58%); }
}

/* Pixel wave: an unlit LED board with a wave of colour lighting the pixels it passes */
.bg-scan .fx-dim, .bg-equalizer .fx-dim { inset: 0; background: rgba(255, 255, 255, .07); }
.bg-scan .fx-band { top: 0; bottom: 0; left: 0; width: 55%; background: linear-gradient(90deg, transparent, var(--bg-a) 35%, var(--bg-b) 65%, transparent);
  animation: bg-sweep calc(var(--speed, 14s) * .6) linear infinite; }

/* Equaliser: LED level bars rising and falling. Bars are plain colour; the shared
   .fx-px mask on top turns bars and the dim board into one grid of crisp LEDs.
   Bars move with clip-path (the one style that repaints; 30 small bars, cheap enough). */
.bg-equalizer .fx-eq { left: 0; right: 0; bottom: 0; height: 66%; display: flex; align-items: flex-end;
  gap: min(var(--dot, 14px), 1.2%); padding: 0 min(calc(var(--dot, 14px) * 1.5), 3%); } /* % caps keep 30 bars visible on phones and small tiles */
.bg-equalizer .fx-bar { position: static; flex: 1; height: 100%; background: linear-gradient(to top, var(--bg-a), var(--bg-b));
  clip-path: inset(var(--t, 40%) 0 0 0); animation: bg-eq max(.55s, calc(var(--speed, 14s) / 12)) ease-in-out infinite alternate; animation-delay: calc(var(--i, 0) * -.31s); }

/* Marquee: a theatre-style frame of bulbs chasing around the banner — the same bulbs
   and timing as the bulb wall: sockets always show, two sets snap on and off in turn.
   One tile (4 dots long) holds an A bulb at 25% and a B bulb at 75%, so bulbs sit 2 dots
   apart; `round` fits whole tiles to the edge (no half bulb at the end). */
.bg-marquee { --bulb-t: max(1.2s, calc(var(--speed, 14s) / 4)); }
.bg-marquee .fx-glow { inset: 0; background: radial-gradient(ellipse at 70% 50%, var(--bg-a), transparent 62%); opacity: .28; }
.bg-marquee .fx-top, .bg-marquee .fx-bottom { left: calc(var(--dot, 14px) * 3.2); right: calc(var(--dot, 14px) * 3.2); height: calc(var(--dot, 14px) * 2); }
.bg-marquee .fx-top { top: calc(var(--dot, 14px) * .8); } .bg-marquee .fx-bottom { bottom: calc(var(--dot, 14px) * .8); }
.bg-marquee .fx-left, .bg-marquee .fx-right { top: calc(var(--dot, 14px) * 1.2); bottom: calc(var(--dot, 14px) * 1.2); width: calc(var(--dot, 14px) * 2); }
.bg-marquee .fx-left { left: calc(var(--dot, 14px) * .8); } .bg-marquee .fx-right { right: calc(var(--dot, 14px) * .8); }
.bg-marquee .fx-edge::before, .bg-marquee .fx-edge::after { content: ""; position: absolute; inset: 0; background-size: inherit; background-repeat: inherit;
  animation: bg-bulb var(--bulb-t) linear infinite; }
.bg-marquee .fx-edge::after { animation-delay: calc(var(--bulb-t) / -2); }
.bg-marquee .fx-top, .bg-marquee .fx-bottom { background-size: calc(var(--dot, 14px) * 4) 100%; background-repeat: round no-repeat; }
.bg-marquee .fx-left, .bg-marquee .fx-right { background-size: 100% calc(var(--dot, 14px) * 4); background-repeat: no-repeat round; }
.bg-marquee .fx-top, .bg-marquee .fx-bottom { background-image: radial-gradient(circle calc(var(--dot, 14px) * .57) at 25% 50%, var(--sk-1, rgba(255, 255, 255, .13)) 0 55%, var(--sk-2, rgba(255, 255, 255, .05)) 75%, var(--sk-3, rgba(0, 0, 0, .55)) 85% 95%, transparent 100%), radial-gradient(circle calc(var(--dot, 14px) * .57) at 75% 50%, var(--sk-1, rgba(255, 255, 255, .13)) 0 55%, var(--sk-2, rgba(255, 255, 255, .05)) 75%, var(--sk-3, rgba(0, 0, 0, .55)) 85% 95%, transparent 100%); }
.bg-marquee .fx-top::before, .bg-marquee .fx-bottom::before { background-image: radial-gradient(circle calc(var(--dot, 14px) * .48) at 25% 50%, #fff 0 15%, var(--bg-a) 33% 92%, transparent 100%); }
.bg-marquee .fx-top::after, .bg-marquee .fx-bottom::after { background-image: radial-gradient(circle calc(var(--dot, 14px) * .48) at 75% 50%, #fff 0 15%, var(--bg-b) 33% 92%, transparent 100%); }
.bg-marquee .fx-left, .bg-marquee .fx-right { background-image: radial-gradient(circle calc(var(--dot, 14px) * .57) at 50% 25%, var(--sk-1, rgba(255, 255, 255, .13)) 0 55%, var(--sk-2, rgba(255, 255, 255, .05)) 75%, var(--sk-3, rgba(0, 0, 0, .55)) 85% 95%, transparent 100%), radial-gradient(circle calc(var(--dot, 14px) * .57) at 50% 75%, var(--sk-1, rgba(255, 255, 255, .13)) 0 55%, var(--sk-2, rgba(255, 255, 255, .05)) 75%, var(--sk-3, rgba(0, 0, 0, .55)) 85% 95%, transparent 100%); }
.bg-marquee .fx-left::before, .bg-marquee .fx-right::before { background-image: radial-gradient(circle calc(var(--dot, 14px) * .48) at 50% 25%, #fff 0 15%, var(--bg-a) 33% 92%, transparent 100%); }
.bg-marquee .fx-left::after, .bg-marquee .fx-right::after { background-image: radial-gradient(circle calc(var(--dot, 14px) * .48) at 50% 75%, #fff 0 15%, var(--bg-b) 33% 92%, transparent 100%); }
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .bg-marquee .fx-top::before, .bg-marquee .fx-bottom::before { background-image: radial-gradient(circle calc(var(--dot, 14px) * .82) at 25% 50%, #fff 0 9%, color-mix(in srgb, var(--bg-a) 55%, #fff) 16%, var(--bg-a) 24% 55%, color-mix(in srgb, var(--bg-a) 38%, transparent) 62%, transparent 100%); }
  .bg-marquee .fx-top::after, .bg-marquee .fx-bottom::after { background-image: radial-gradient(circle calc(var(--dot, 14px) * .82) at 75% 50%, #fff 0 9%, color-mix(in srgb, var(--bg-b) 55%, #fff) 16%, var(--bg-b) 24% 55%, color-mix(in srgb, var(--bg-b) 38%, transparent) 62%, transparent 100%); }
  .bg-marquee .fx-left::before, .bg-marquee .fx-right::before { background-image: radial-gradient(circle calc(var(--dot, 14px) * .82) at 50% 25%, #fff 0 9%, color-mix(in srgb, var(--bg-a) 55%, #fff) 16%, var(--bg-a) 24% 55%, color-mix(in srgb, var(--bg-a) 38%, transparent) 62%, transparent 100%); }
  .bg-marquee .fx-left::after, .bg-marquee .fx-right::after { background-image: radial-gradient(circle calc(var(--dot, 14px) * .82) at 50% 75%, #fff 0 9%, color-mix(in srgb, var(--bg-b) 55%, #fff) 16%, var(--bg-b) 24% 55%, color-mix(in srgb, var(--bg-b) 38%, transparent) 62%, transparent 100%); }
}

/* Stage spotlights: coloured beams sweeping from the top */
.bg-spotlights .fx-haze { inset: 0; background: radial-gradient(ellipse at 50% 0, var(--bg-c), transparent 70%); opacity: .55; }
.bg-spotlights .fx-beam { top: -6%; width: 58%; height: 118%; transform-origin: 50% 0; opacity: .55;
  background: linear-gradient(to bottom, var(--c), transparent 86%); clip-path: polygon(46% 0, 54% 0, 100% 100%, 0 100%);
  animation: bg-swing calc(var(--speed, 14s) * .55) ease-in-out infinite alternate; }
.bg-spotlights .fx-b1 { --c: var(--bg-a); left: -4%; --r: 16deg; }
.bg-spotlights .fx-b2 { --c: var(--bg-b); left: 21%; --r: -14deg; animation-delay: calc(var(--speed, 14s) * -.2); }
.bg-spotlights .fx-b3 { --c: var(--bg-c); left: 46%; --r: 18deg; animation-delay: calc(var(--speed, 14s) * -.35); opacity: .68; }

/* ---------- motion control ---------- */
/* still (reduced motion, movement 0, portal tiles): park moving light on the right, not behind the headline */
.hero-bg.still .fx-band { transform: translateX(80%); }
.bg-ledpanel.still .fx-beam { transform: translateX(260%); }
.hero-bg.still, .hero-bg.still *, .hero-bg.still::before, .hero-bg.still *::before, .hero-bg.still *::after { animation: none !important; }
.hero-bg.paused, .hero-bg.paused *, .hero-bg.paused::before, .hero-bg.paused *::before, .hero-bg.paused *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .hero-bg, .hero-bg *, .hero-bg::before, .hero-bg *::before, .hero-bg *::after { animation: none !important; }
  .hero-bg .slide { transition: none; }
}
@keyframes bg-drift { to { background-position: 140px 0; } }
@keyframes bg-aurora { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes bg-pan { to { transform: translateX(-50%); } }
@keyframes bg-beam { from { transform: translateX(-100%); } to { transform: translateX(480%); } }
@keyframes bg-sweep { from { transform: translateX(-110%); } to { transform: translateX(190%); } }
/* bulbs: quick warm-up, hold, quick cut — reads as a bulb switching, not a fade. A cuts
   while B warms up (B is half a period behind), so the board never goes dark at once. */
@keyframes bg-bulb { 0% { opacity: .04; } 6%, 50% { opacity: 1; } 56%, 100% { opacity: .04; } }
@keyframes bg-eq { from { clip-path: inset(88% 0 0 0); } to { clip-path: inset(var(--t, 30%) 0 0 0); } }
@keyframes bg-swing { from { transform: rotate(calc(var(--r, 14deg) * -1)); } to { transform: rotate(var(--r, 14deg)); } }

/* ---------- on the website's white page ---------- */
/* The styles above are drawn on a dark board. On a white page (no data-mode="dark" on <html>) the site's .hero gets a light version of
   each one: a light board, your colours softened to pastels, white LED masks. Scoped to .hero, so the portal's previews keep the dark look.
   Browsers without color-mix just fade the dark board. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  html:not([data-mode="dark"]) .hero .hero-bg { opacity: .2; }
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
  html:not([data-mode="dark"]) .hero .hero-bg { --stage: #f3effa; --la: color-mix(in srgb, var(--bg-a) 38%, #fff); --lb: color-mix(in srgb, var(--bg-b) 38%, #fff); --lc: color-mix(in srgb, var(--bg-c) 22%, #fff);
    --sk-1: rgba(110, 90, 160, .14); --sk-2: rgba(110, 90, 160, .06); --sk-3: rgba(110, 90, 160, .3); }
  html:not([data-mode="dark"]) .hero .bg-leds { background:
    radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--bg-a) 48%, transparent), transparent 52%),
    radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--bg-b) 42%, transparent), transparent 52%), var(--stage); }
  html:not([data-mode="dark"]) .hero .bg-leds::before { background-image: radial-gradient(circle, rgba(255, 255, 255, .92) 38%, transparent 42%); }
  html:not([data-mode="dark"]) .hero .fx-v { background: linear-gradient(90deg, rgba(243, 239, 250, .9) 0%, rgba(243, 239, 250, .5) 48%, rgba(243, 239, 250, 0) 100%); }
  html:not([data-mode="dark"]) .hero .fx-px { background-image: radial-gradient(circle, rgba(255, 255, 255, .55) 0 6%, rgba(255, 255, 255, .12) 12%, rgba(255, 255, 255, 0) 18% 40%, rgba(222, 214, 240, .6) 42%, rgba(243, 239, 250, .96) 47%); }
  html:not([data-mode="dark"]) .hero .fx-seam { background-image:
    repeating-linear-gradient(90deg, transparent 0 calc(var(--dot, 14px) * 8 - 3px), rgba(150, 135, 190, .5) calc(var(--dot, 14px) * 8 - 3px) calc(var(--dot, 14px) * 8 - 2px), rgba(255, 255, 255, .7) calc(var(--dot, 14px) * 8 - 2px) calc(var(--dot, 14px) * 8)),
    repeating-linear-gradient(0deg, transparent 0 calc(var(--dot, 14px) * 8 - 3px), rgba(150, 135, 190, .5) calc(var(--dot, 14px) * 8 - 3px) calc(var(--dot, 14px) * 8 - 2px), rgba(255, 255, 255, .7) calc(var(--dot, 14px) * 8 - 2px) calc(var(--dot, 14px) * 8)); }
  html:not([data-mode="dark"]) .hero .fx-halo { opacity: .4; }
  html:not([data-mode="dark"]) .hero .bg-scan .fx-dim, html:not([data-mode="dark"]) .hero .bg-equalizer .fx-dim { background: rgba(110, 90, 160, .08); }
  html:not([data-mode="dark"]) .hero .bg-aurora { background-image: linear-gradient(120deg, var(--la), var(--lc), var(--lb), var(--lc), var(--la)); }
  html:not([data-mode="dark"]) .hero .bg-gradient { background: linear-gradient(var(--angle, 135deg), var(--la), var(--lb)); }
  html:not([data-mode="dark"]) .hero .bg-solid { background: var(--la); }
  html:not([data-mode="dark"]) .hero .bg-image, html:not([data-mode="dark"]) .hero .bg-video, html:not([data-mode="dark"]) .hero .bg-slideshow { background-color: var(--stage); }
  html:not([data-mode="dark"]) .hero .bg-image::after, html:not([data-mode="dark"]) .hero .bg-video::after, html:not([data-mode="dark"]) .hero .bg-slideshow::after { background: linear-gradient(90deg, rgba(243, 239, 250, calc(var(--overlay, 0) + .8)), rgba(243, 239, 250, calc(var(--overlay, 0) + .35)) 55%, rgba(243, 239, 250, calc(var(--overlay, 0) + .1))); }
  html:not([data-mode="dark"]) .hero .bg-spotlights .fx-haze { background: radial-gradient(ellipse at 50% 0, var(--lc), transparent 70%); }
  html:not([data-mode="dark"]) .hero .bg-spotlights .fx-b1 { --c: var(--la); }
  html:not([data-mode="dark"]) .hero .bg-spotlights .fx-b2 { --c: var(--lb); }
  html:not([data-mode="dark"]) .hero .bg-spotlights .fx-b3 { --c: var(--lc); }
}
