/* =====================================================================================================================
   JAI hero — styles.
   The geometry variables (--stick, --sw, --sh, --tx, --ty, --bx, --by, --bw, --bh, --L, --Lx) are set by
   js/page-controller.js; the defaults below only matter for the first paint before the script runs.
   ===================================================================================================================== */

/* We compensate the scroll position ourselves when the pin is removed; the browser must not "help". */
html.jai-hero-page { overflow-anchor: none; }
/* "lock" (see PAGE.mode), overlay scrollbars only (phones, macOS): the page does not scroll at all while the film plays. */
html.jai-hero-locked { overflow: hidden; }

/* "lock": progress line (+ "Scroll to skip") at the bottom of the pinned stage while the page waits. */
.jai-hero__hint { position: absolute; z-index: 5; left: 50%; bottom: 22px; transform: translate(-50%, 6px); display: flex; flex-direction: column; align-items: center; gap: 9px;
  opacity: 0; transition: opacity .35s ease, transform .35s ease; pointer-events: none; font: 600 11px/1 "Gilroy", sans-serif; letter-spacing: .16em; text-transform: uppercase; color: #17151C; }
.jai-hero.is-locked .jai-hero__hint { opacity: 1; transform: translate(-50%, 0); }
.jai-hero__hint span { opacity: .5; }
.jai-hero__hint-bar { display: block; width: 120px; height: 2px; border-radius: 2px; background: rgba(23, 21, 28, .12); overflow: hidden; }
.jai-hero__hint-bar i { display: block; height: 100%; background: #17151C; transform: scaleX(var(--p, 0)); transform-origin: 0 50%; }

/* ---- intro screen (variant "intro", js/intro.js) ----------------------------------------------------------------------
   A white layer covers the site; the hero is lifted above it (is-intro) and its stage moved up by --introY, so the banner
   stands in the middle of the screen. There the hero's own preloader loads, the film plays, and the logo shows above.
   Landing (is-landing): the stage glides back (--introY -> 0), the logo rolls to the header, the white opens as a
   circle from the robot (a mask set by intro.js, the yellow ring on its edge), the site's pieces come in. */
html.jai-intro-pending body { visibility: hidden; }                                  /* until the hero decides (see functions.php) */
html.jai-intro-on .site-branding img { opacity: 0; }                                 /* the flying logo lands here */
.jai-hero.is-3d.is-intro { --fly: 1s; z-index: 100001; visibility: visible; }
.jai-hero.is-intro .jai-hero__track { transform: translate3d(0, var(--introY, 0px), 0); }
.jai-hero.is-intro:not(.is-intro-placed) .jai-hero__track, .jai-hero.is-intro:not(.is-intro-placed) .jai-intro__logo { visibility: hidden; }
.jai-intro__logo { position: fixed; z-index: 6; left: 50%; top: 16px; width: clamp(150px, 12vw, 200px); aspect-ratio: 1024 / 315; transform-origin: 0 0; pointer-events: none; }
.jai-intro__logo img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
/* the logo: the badge rolls in with a bounce, the word wipes in after it; while loading the badge nods now and then;
   it waves along with the robot in the film (is-waving, set by intro.js) */
.jai-intro__badge { clip-path: inset(0 68% 0 0); transform-origin: 15.4% 50%; }
.jai-intro__word { clip-path: inset(0 0 0 33%); }
.jai-hero.is-intro-placed .jai-intro__badge { animation: jai-badge-in .8s cubic-bezier(.3, 1.4, .5, 1) both, jai-badge-nod 4.2s ease-in-out 2s infinite; }
.jai-hero.is-intro-placed .jai-intro__word { animation: jai-word-in .7s cubic-bezier(.2, .8, .2, 1) .35s both; }
.jai-intro__logo.is-waving .jai-intro__badge { animation: jai-badge-wave 1.6s ease-in-out both; }
.jai-hero.is-landing .jai-intro__badge { animation: none; transform: rotate(var(--roll, 0deg)); transition: transform var(--fly) cubic-bezier(.65, 0, .25, 1); }   /* rolls like a wheel */
@keyframes jai-badge-in { 0% { transform: translateX(-40%) scale(.2) rotate(-200deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes jai-word-in { from { clip-path: inset(0 100% 0 33%); transform: translateX(-3%); } to { clip-path: inset(0 0 0 33%); transform: none; } }
@keyframes jai-badge-nod { 0%, 78%, 100% { transform: none; } 84% { transform: rotate(-12deg); } 90% { transform: rotate(7deg); } 95% { transform: rotate(-3deg); } }
@keyframes jai-badge-wave { 0%, 100% { transform: none; } 15% { transform: rotate(-16deg); } 35% { transform: rotate(13deg); } 55% { transform: rotate(-11deg); } 75% { transform: rotate(6deg); } }
.jai-intro { position: fixed; z-index: 100000; inset: 0; background: #fff; visibility: visible; }
/* landing */
.jai-hero.is-landing .jai-hero__track { transition: transform var(--fly) cubic-bezier(.65, 0, .25, 1); }
.jai-hero.is-landing .jai-intro__logo { transition: transform var(--fly) cubic-bezier(.65, 0, .25, 1); }
.jai-intro.is-fading { opacity: 0; transition: opacity .8s ease .1s; }                  /* no masks / reduced motion: a plain fade */
.jai-intro.is-cancelled { opacity: 0; transition: opacity .35s ease; }
.jai-intro__ring { position: fixed; z-index: 100000; box-sizing: border-box; border: 2px solid #FCFF50; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 28px 4px rgba(252, 255, 80, .45), inset 0 0 18px rgba(252, 255, 80, .35); }
/* the site's pieces: down and blurred under the white, each comes in when the ring reaches it (--delay, set by intro.js) */
.jai-w { display: inline-block; }
.jai-piece { opacity: 0; transform: translate3d(0, 18px, 0) scale(.96); filter: blur(6px); }
.jai-piece.is-in { opacity: 1; transform: none; filter: none;
  transition: opacity var(--assemble, .6s) ease var(--delay, 0s), transform var(--assemble, .6s) cubic-bezier(.2, .9, .3, 1.25) var(--delay, 0s), filter var(--assemble, .6s) ease var(--delay, 0s); }
/* the menu items: dominoes, dropping in from above one after the other (--delay) and bouncing as they land */
.jai-drop { opacity: 0; transform: translate3d(0, -70px, 0) rotate(-6deg); transform-origin: 50% 100%; }
.jai-drop.is-in { animation: jai-drop var(--menu-drop, .8s) var(--delay, 0s) both; }
@keyframes jai-drop {
  0%   { opacity: 0; transform: translate3d(0, -70px, 0) rotate(-6deg); animation-timing-function: cubic-bezier(.55, 0, 1, .45); }   /* falls */
  10%  { opacity: 1; }
  50%  { transform: translate3d(0, 0, 0) rotate(1.5deg); animation-timing-function: cubic-bezier(0, .55, .45, 1); }               /* lands */
  68%  { transform: translate3d(0, -12px, 0) rotate(-1deg); animation-timing-function: cubic-bezier(.55, 0, 1, .45); }            /* bounces */
  84%  { transform: translate3d(0, 0, 0) rotate(.4deg); animation-timing-function: cubic-bezier(0, .55, .45, 1); }
  92%  { transform: translate3d(0, -3px, 0); animation-timing-function: cubic-bezier(.55, 0, 1, .45); }
  100% { opacity: 1; transform: none; }
}
/* the headline: each line slides in from its side (--from: -1 left, 1 right), blurred by the speed */
.typed-text.jai-slide { display: inline-block; }
.jai-slide { opacity: 0; transform: translate3d(calc(var(--from, -1) * 45vw), 0, 0); filter: blur(10px); }
.jai-slide.is-in { opacity: 1; transform: none; filter: none;
  transition: transform var(--slide, .9s) cubic-bezier(.16, 1, .3, 1) var(--delay, 0s), opacity calc(var(--slide, .9s) * .4) ease var(--delay, 0s), filter calc(var(--slide, .9s) * .7) ease var(--delay, 0s); }
/* the button: its thin outline appears first, then it fills with its black from the left, then the label slides in
   (the fill is a gradient of the button's own colour: when the classes go, nothing changes on the screen) */
.jai-btn { transition: none; opacity: 0; transform: scale(.94); background-color: transparent; background-image: linear-gradient(#17151C, #17151C);
  background-repeat: no-repeat; background-size: 0% 100%; box-shadow: inset 0 0 0 1.5px #17151C; }
.jai-btn > span { opacity: 0; transform: translate3d(-16px, 0, 0); }
.jai-btn.is-in { animation: jai-btn-frame .4s cubic-bezier(.2, .9, .3, 1.2) var(--delay, 0s) both,
  jai-btn-fill var(--button, .55s) cubic-bezier(.65, 0, .35, 1) calc(var(--delay, 0s) + .3s) both; }
.jai-btn.is-in > span { opacity: 1; transform: none;
  transition: opacity .4s ease calc(var(--delay, 0s) + .3s + var(--button, .55s) * .7), transform .6s cubic-bezier(.16, 1, .3, 1) calc(var(--delay, 0s) + .3s + var(--button, .55s) * .7); }
@keyframes jai-btn-frame { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes jai-btn-fill { from { background-size: 0% 100%; } to { background-size: 100% 100%; } }
/* the cookie banner (Complianz: the banner and its dimming wall live in this container) waits until the site is together */
html.jai-intro-on #cmplz-cookiebanner-container { opacity: 0; visibility: hidden; }
#cmplz-cookiebanner-container { transition: opacity .4s ease; }
/* the header logo, as the rolling logo lands on it */
.site-branding img.jai-landed { transform-origin: 0 50%; animation: jai-logo-land .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes jai-logo-land { 0% { transform: scale(1.12, .86); } 45% { transform: scale(.95, 1.05); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .jai-hero.is-intro { --fly: .01s; } }

/* Review panel of js/variants.js (only with ?hero=… in the address). */
.jai-variants { position: fixed; z-index: 10000; left: 16px; bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: calc(100vw - 32px); box-sizing: border-box;
  padding: 8px 10px; border-radius: 10px; background: #17151C; color: #fff; font: 600 13px/1.2 "Gilroy", system-ui, sans-serif; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.jai-variants b { margin-right: 4px; color: #FCFF50; }
.jai-variants a { padding: 6px 10px; border-radius: 6px; color: #fff; text-decoration: none; background: rgba(255, 255, 255, .08); }
.jai-variants a:hover { background: rgba(255, 255, 255, .18); }
.jai-variants a[aria-current] { background: #FCFF50; color: #17151C; }
.jai-variants small { flex-basis: 100%; font-weight: 400; font-size: 12px; opacity: .7; }

/* Phones: the robot right under the headline, the "Let's talk" button under the robot (the hero's bottom margin keeps
   room for the big robot, so the button comes after it). */
@media (max-width: 991px) {
  .demo-text .wrapper { display: flex; flex-direction: column; }
  .demo-text .jai-hero { order: 1; }
  .demo-text .demo-text-button { order: 2; margin-top: 24px; }
}

/* The banner box. Its size comes from the banner image inside it — the scene's first frame. By default (search bots,
   no JavaScript) only the image is shown. `is-3d` (set by the page for real visitors) keeps the image in the flow but
   invisible, and shows the 3D stage. The bottom margin is the pin length (+ extra room for the big robot on phones). */
.jai-hero { position: relative; }
/* z-index: the scene may reach past the banner (camera turns, drag) and must stay above the next sections
   (juzzzt theme: .services 8, .text-block 9), below the site header (999). The canvas lets the mouse through. */
.jai-hero.is-3d { z-index: 10; margin-bottom: calc(var(--L, 0px) + var(--Lx, 0px)); }
.jai-hero__image { display: block; width: 100%; height: auto; }
.jai-hero.is-3d .jai-hero__image { visibility: hidden; }
.jai-hero:not(.is-3d) .jai-hero__track { display: none; }
.jai-hero.is-fallback { margin-bottom: 0; }
.jai-hero.is-fallback .jai-hero__image { visibility: visible; }
.jai-hero.is-fallback .jai-hero__track { display: none; }

/* The track is as tall as the stage + the pin; the stage sticks under the header for the length of the pin. */
/* Before the script has measured the page, the defaults put the stage (and so the preloader) exactly over the banner. */
.jai-hero__track { position: absolute; z-index: 1; left: var(--tx, 0px); top: var(--ty, 0px); width: var(--sw, 100%); height: calc(var(--sh, 100%) + var(--L, 0px)); pointer-events: none; }
.jai-hero__stage { position: sticky; top: var(--stick, 0px); width: 100%; height: var(--sh, 100%); }

/* The 3D canvas: the whole stage, transparent, fades in once the scene is ready. */
.jai-hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; pointer-events: none; transition: opacity .9s ease; }
.jai-hero.is-ready .jai-hero__canvas { opacity: 1; }

/* The banner box inside the stage: holds the preloader (on phones the script enlarges it, see placePreloader). */
.jai-hero__box { position: absolute; z-index: 3; left: var(--bx, 0px); top: var(--by, 0px); width: var(--bw, 100%); height: var(--bh, 100%); pointer-events: none; }

/* The hand: drag to look around, click the TV. Active once the scene is live. Vertical swipes still scroll the page. */
.jai-hero__hit { position: absolute; z-index: 4; left: var(--bx, 0px); top: var(--by, 0px); width: var(--bw, 100%); height: var(--bh, 100%); pointer-events: none; touch-action: pan-y; cursor: grab; }
.jai-hero.is-live .jai-hero__hit { pointer-events: auto; }
.jai-hero__hit.is-grabbing { cursor: grabbing; }
.jai-hero__hit.is-over-tv { cursor: pointer; }

/* ---- preloader ------------------------------------------------------------------------------------------------------
   The robot picture is placed exactly where the 3D robot stands in the opening shot: left / top / width / height as
   fractions of the banner box (measured from the scene; re-measure if the robot, the camera or the banner changes). */
.jai-hero__loader { --l: 0.46295; --t: 0.16525; --w: 0.14018; --h: 0.69746; position: absolute; inset: 0; pointer-events: none; }
.jai-hero.is-live .jai-hero__loader { opacity: 0; transition: opacity .3s ease; }
.jai-hero.is-fallback .jai-hero__loader { opacity: 0; }
.jai-hero__loader-robot { position: absolute; left: calc(var(--l) * 100%); top: calc(var(--t) * 100%); width: calc(var(--w) * 100%); height: calc(var(--h) * 100%); }
.jai-hero__loader-robot img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.jai-hero__sil { animation: jai-breathe 2.4s ease-in-out infinite; }
/* colour rises from the feet: a compositor transition on transform toward --pp (0..1) */
.jai-hero__fill, .jai-hero__scanbox { position: absolute; left: 0; right: 0; top: 0; height: 100%; transform: translateY(calc((1 - var(--pp, 0)) * 100%)); transition: transform .9s cubic-bezier(.33, .1, .25, 1); will-change: transform; }
.jai-hero__fill { overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 3.5%); mask-image: linear-gradient(to bottom, transparent 0, #000 3.5%); }
.jai-hero__fill img { transform: translateY(calc((var(--pp, 0) - 1) * 100%)); transition: transform .9s cubic-bezier(.33, .1, .25, 1); will-change: transform; }
.jai-hero__scan { position: absolute; left: -14%; right: -14%; top: 0; height: 2px; transform: translateY(-1px); transition: opacity .4s ease;
  background: linear-gradient(90deg, rgba(252,255,80,0) 0%, #FCFF50 22%, #FCFF50 78%, rgba(252,255,80,0) 100%); box-shadow: 0 0 14px 3px rgba(252,255,80,.55); }
.jai-hero.is-full .jai-hero__scan, .jai-hero.is-done .jai-hero__scan { opacity: 0; }
.jai-hero.is-done .jai-hero__sil { animation: none; opacity: 0; transition: opacity .4s ease; }
.jai-hero__loader-label { position: absolute; left: calc((var(--l) + var(--w) / 2) * 100%); top: calc((var(--t) + var(--h)) * 100%); transform: translate(-50%, 1.6vw);
  display: flex; gap: .6em; align-items: baseline; white-space: nowrap; font: 600 12px/1 "Gilroy", sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #17151C; }
.jai-hero__loader-pct { min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.jai-hero__loader-text { opacity: .45; }
.jai-hero.is-done .jai-hero__loader-label { opacity: 0; transition: opacity .3s ease; }
@media (min-width: 1440px) { .jai-hero__loader-label { transform: translate(-50%, 23px); } }
@media (max-width: 991px) { .jai-hero__loader-label { font-size: 2.4vw; } }
@keyframes jai-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .jai-hero__sil { animation: none; } .jai-hero__loader, .jai-hero__canvas { transition-duration: .01s; } }
