/* The first screen: the opening film, never cropped (see hero.js). Markup: .hx > .hx-box (> .hx-stage, .hx-ctl), .hx-title.
   data-mode="wave"   the ident plays once on the night; its last wave opens the page title
   data-mode="blur"   the ident and the film's first seconds loop; a blurred copy of the frame fills the screen
   data-mode="screen" the film sits in a framed screen; the title and links sit under it */
:root { --night: #0a080f; --hx-base: #0a080f; --hx-veil: rgba(10,8,15,.80); --hx-spot: rgba(10,8,15,.55); --hx-ink: #f5f5f7; --hx-ink2: #c8c8cd; --hx-ink3: #86868b; }
:root[data-theme=light] { --hx-base: #f7f4ee; --hx-veil: rgba(247,244,238,.74); --hx-spot: rgba(247,244,238,.62); --hx-ink: #1d1d1f; --hx-ink2: #48484d; --hx-ink3: #6e6e73; }   /* the ident's night as decoded (INK 11,9,16 comes back as 10,8,15) */
.hx { position: relative; height: 100vh; height: 100svh; overflow: hidden; background: var(--night); color: #f5f5f7; }
.hx-stage { position: absolute; inset: 0; overflow: hidden; }
.hx-stage video { position: absolute; display: block; max-width: none; }
/* where the film does not reach an edge of the screen, its own edge fades into what is behind it */
.hx-stage video.fx { -webkit-mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent); mask-image: linear-gradient(to right, transparent, #000 5%, #000 95%, transparent); }
.hx-stage video.fy { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 5%, #000 95%, transparent); }
.hx-stage video.fx.fy { -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, #000 80%, transparent); mask-image: radial-gradient(ellipse 60% 60% at 50% 50%, #000 80%, transparent); }
.hx-blur { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.12); }   /* softened and dimmed in hero.js, no CSS filter */

.hx-title { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 24px; pointer-events: none; clip-path: circle(0px at 50% 50%); }
.hx-title > * { pointer-events: auto; }
.hx-title.fade { clip-path: none; opacity: 0; transition: opacity .9s; }
.hx.done .hx-title.fade { opacity: 1; }
.hx-title h1 { font-size: clamp(60px, 12vw, 176px); letter-spacing: -.05em; line-height: .9; margin: 0; }
.hx-title { color: var(--hx-ink); }
.hx-title p { font-size: clamp(17px, 2vw, 24px); color: var(--hx-ink2); margin: 20px 0 32px; letter-spacing: -.015em; }
.hx-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hx-btns .pillbtn { margin: 0; }
.hx-cue { margin-top: 34px; color: var(--hx-ink3); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
:root[data-theme=light] .hx-title .pillbtn { background: #1d1d1f; color: #fff; }
:root[data-theme=light] .hx-title .pillbtn.ghost { background: rgba(0,0,0,.07); color: #1d1d1f; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* wave: the end state, the IsaacWave wall under a veil of the visitor's theme (opened by the same circle as the title) */
.hx-end { position: absolute; inset: 0; z-index: 1; overflow: hidden; background: var(--hx-base); clip-path: circle(0px at 50% 50%); }
.hx-end.fade { clip-path: none; opacity: 0; transition: opacity .9s; }
.hx.done .hx-end.fade { opacity: 1; }
/* exactly 8 x 8 clips filling the film's box under the 48 px bar: nothing is cut at an edge, the count never changes */
.hx-wall { position: absolute; inset: 48px 0 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); }
.hx-wall video { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; }
.hx-veil { position: absolute; inset: 0; background: radial-gradient(ellipse 48% 36% at 50% 50%, var(--hx-spot), transparent 72%), var(--hx-veil); transition: background .3s; }
:root[data-theme=light] .hx.done .hx-ctl button:not(.on) { background: rgba(0,0,0,.08); color: #1d1d1f; }
/* wave: the title block is sized in the film's frame too (--s = the film's scale), so it scales with the wall; floors keep it legible and tappable on phones */
.hx[data-mode=wave] .hx-title h1 { font-size: max(40px, calc(176px * var(--s, 1))); }
.hx[data-mode=wave] .hx-title p { font-size: max(14px, calc(30px * var(--s, 1))); margin: calc(22px * var(--s, 1)) 0 calc(36px * var(--s, 1)); }
.hx[data-mode=wave] .hx-btns { gap: max(8px, calc(14px * var(--s, 1))); }
.hx[data-mode=wave] .hx-btns .pillbtn { height: max(40px, calc(60px * var(--s, 1))); padding: 0 max(18px, calc(30px * var(--s, 1))); font-size: max(14px, calc(21px * var(--s, 1))); gap: max(6px, calc(10px * var(--s, 1))); }
.hx[data-mode=wave] .hx-btns .pillbtn img { height: max(16px, calc(22px * var(--s, 1))); }
.hx[data-mode=wave] .hx-cue { font-size: max(11px, calc(15px * var(--s, 1))); margin-top: calc(40px * var(--s, 1)); }

.hx-ctl { position: absolute; right: 22px; bottom: 22px; z-index: 3; display: flex; gap: 10px; }
.hx-ctl button { width: 44px; height: 44px; border: 0; border-radius: 50%; color: #fff; background: rgba(255,255,255,.13); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.hx-ctl button.on { background: rgba(255,255,255,.92); color: #1d1d1f; }
/* sound was refused by the browser: the button breathes until pressed */
.hx-ctl button.nudge { animation: hx-nudge 1.6s ease-in-out infinite; }
@keyframes hx-nudge { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,.55); } 50% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } }
.hx-ctl svg { width: 20px; height: 20px; }
.hx-ctl .hx-replay { opacity: 0; pointer-events: none; transition: opacity .5s; }
.hx.done .hx-ctl .hx-replay { opacity: 1; pointer-events: auto; }

.bar { transition: opacity .6s, background .4s; }
body.hx-quiet .bar { opacity: 0; pointer-events: none; }
.hx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* blur: no title over the film (the film has its own); the two buttons come up while the film's title card is on */
.hx[data-mode=blur] .hx-title { clip-path: none; justify-content: flex-end; padding-bottom: 30px; opacity: 0; transition: opacity .6s; }
.hx[data-mode=blur] .hx-title.show { opacity: 1; }
.hx[data-mode=blur] .hx-title h1, .hx[data-mode=blur] .hx-title p, .hx[data-mode=blur] .hx-cue { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
body.hx-blur .bar { background: transparent; border-bottom-color: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
body.hx-blur.hx-scrolled .bar { background: rgba(0,0,0,.62); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }

/* screen: the film in a frame, everything else under it */
.hx[data-mode=screen] { height: auto; min-height: 100vh; min-height: 100svh; padding: 84px 0 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hx[data-mode=screen] .hx-stage { position: relative; inset: auto; width: min(1280px, 92vw, calc((100vh - 330px) * 16 / 9)); width: min(1280px, 92vw, calc((100svh - 330px) * 16 / 9)); min-width: min(92vw, 520px); aspect-ratio: 16 / 9; border-radius: 18px; box-shadow: 0 40px 90px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.07); background: #000; }
.hx[data-mode=screen] .hx-stage video { inset: 0; width: 100%; height: 100%; object-fit: contain; }
.hx[data-mode=screen] .hx-title { position: relative; inset: auto; clip-path: none; padding: 28px 24px 0; }
.hx[data-mode=screen] .hx-title h1 { font-size: clamp(36px, 4.4vw, 60px); letter-spacing: -.04em; }
.hx[data-mode=screen] .hx-title p { margin: 10px 0 20px; font-size: clamp(16px, 1.6vw, 19px); }
.hx[data-mode=screen] .hx-cue { display: none; }
.hx[data-mode=screen] .hx-ctl { right: 14px; bottom: 14px; }
.hx[data-mode=screen] .hx-ctl button { width: 38px; height: 38px; }

/* wave: the hero is never taller than 16:9 (on a tall window the page continues under it); the film's box carries the night */
.hx[data-mode=wave] { height: min(100vh, 56.25vw); height: min(100svh, 56.25vw); }
.hx-box { position: absolute; inset: 0; }
.hx[data-mode=wave] .hx-box { background: var(--night); overflow: hidden; }
/* phones: the film is a 16:9 band under the bar and the title sits under the band, on the page */
@media (max-width: 640px) {
  .hx[data-mode=wave] { height: auto; overflow: visible; background: transparent; padding-top: 48px; }
  .hx[data-mode=wave] .hx-box { position: relative; inset: auto; height: 56.25vw; }
  .hx[data-mode=wave] .hx-wall { inset: 0; }
  .hx[data-mode=wave] .hx-title { position: relative; inset: auto; clip-path: none !important; opacity: 1 !important; padding: 24px 20px 6px; }
  .hx[data-mode=wave] .hx-cue { display: none; }
}
