/* "Chanuka Ready" interactive hero - v4.
 * Every neon piece (arc, trolley, menorah, dreidels, doughnuts, coins, bottle, crown) is the Week 1 advert artwork's
 * own light, stored on black and ADDED onto the clean PSD brick wall (mix-blend-mode), so tubes and glow are the
 * artwork's. The lettering is a normal cut-out on top. When everything is in place the scene is the artwork.
 * Scroll: the hero pins, the trolley rolls in, the items drop into it. Markup: hero-chanuka.html (build.php). */

.kk-cr {
	--sw: max(300px, min(100vw, 1240px, max(540px, (100vh - 330px) * 1.68)));
	--sw: max(300px, min(100vw, 1240px, max(540px, (100svh - 330px) * 1.68)));
	--track: 130vh;                                          /* how much scrolling the roll-in / drop-in takes */
	position: relative; background: #050b24; color: #fff;
	font-family: Poppins, system-ui, -apple-system, "Segoe UI", sans-serif;
	-webkit-tap-highlight-color: transparent;
}
.kk-cr *, .kk-cr *::before, .kk-cr *::after { box-sizing: border-box; }
.kk-cr img { max-width: none; border: 0; border-radius: 0; box-shadow: none; -webkit-user-drag: none; user-select: none; }
.kk-cr__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* scroll mode (set by the script): the hero sticks while the page scrolls through --track */
.kk-cr__pin { position: relative; overflow: hidden; isolation: isolate; background: #050b24; }
.kk-cr--scroll::after { content: ""; display: block; height: var(--track); }      /* the scroll length (a block, not padding: sticky needs the room inside the content box) */
.kk-cr--scroll .kk-cr__pin { position: -webkit-sticky; position: sticky; top: 0; }
.kk-cr--scroll.is-auto::after { height: 0; }

/* ---------- wall + stage ---------- */
.kk-cr__wallzone { position: relative; z-index: 1; overflow: hidden; cursor: crosshair; font-size: calc(var(--sw) / 100); padding-bottom: 9em; }   /* 1em = 1% of the stage width; 9em more floor below */
.kk-cr__wallzone::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5em; pointer-events: none; z-index: 6; background: linear-gradient(to bottom, rgba(5, 11, 36, 0), #050b24); }
.kk-cr__stage { position: relative; width: var(--sw); aspect-ratio: 2000 / 1206; margin: calc(var(--sw) * -0.02) 0 0 calc((100% - var(--sw)) / 2); }
.kk-cr__stage picture { display: contents; }
/* The clean brick wall + wet floor, placed as in the PSD (126.1% of the stage, centred). It grows to cover any
   screen width while its glowing floor line stays under the trolley wheels (94.29% down the 60.3em-high stage). */
.kk-cr__wall {
	--ww: max(126.138em, 100vw);
	position: absolute; display: block; width: var(--ww); height: calc(var(--ww) * .56273);
	left: calc(50em - var(--ww) / 2); top: calc(56.854em - var(--ww) * .44859);
}

/* light that follows the pointer / finger across the bricks */
.kk-cr__spot { position: absolute; left: 50%; top: 38%; width: 0; height: 0; pointer-events: none; mix-blend-mode: color-dodge; will-change: transform; opacity: 0; transition: opacity .6s; }
.kk-cr.has-ptr .kk-cr__spot { opacity: 1; }
.kk-cr__spot i { position: absolute; left: -24em; top: -24em; width: 48em; height: 48em; border-radius: 50%; background: radial-gradient(closest-side, rgba(150, 200, 255, .36), rgba(80, 120, 255, .14) 45%, transparent 72%); }

/* paint splats left by a tap on the wall */
.kk-cr__splats { position: absolute; inset: 0; pointer-events: none; }
.kk-cr__splat { position: absolute; width: var(--sz, 90px); height: var(--sz, 90px); margin: calc(var(--sz, 90px) / -2) 0 0 calc(var(--sz, 90px) / -2); transform: rotate(var(--rot, 0deg)); opacity: .9; filter: drop-shadow(0 0 10px currentColor); animation: kk-cr-splat .28s cubic-bezier(.2, 1.5, .4, 1) both; transition: opacity .9s; }
.kk-cr__splat svg { display: block; width: 100%; height: 100%; overflow: visible; }
.kk-cr__splat.out { opacity: 0; }
@keyframes kk-cr-splat { from { transform: rotate(var(--rot, 0deg)) scale(.2); opacity: 0; } }

/* ---------- artwork layers ---------- */
.kk-cr__art { position: absolute; inset: 0; }
.kk-cr .el { position: absolute; display: block; }
.kk-cr .el img { display: block; width: 100%; height: 100%; }
.kk-cr .lt { mix-blend-mode: screen; mix-blend-mode: plus-lighter; }      /* light: added onto the wall */
.kk-cr .it__par, .kk-cr .it__bob, .kk-cr .it__act { position: relative; width: 100%; height: 100%; }
.kk-cr .it[data-act] { cursor: pointer; }
.kk-cr .it__par { transform: translate(calc(var(--px, 0) * var(--d, 0) * .1em), calc(var(--py, 0) * var(--d, 0) * .06em)); }
.kk-cr .it__bob { --by: -.5em; --br: 2.2deg; animation: kk-cr-bob var(--t, 5s) ease-in-out var(--dl, 0s) infinite alternate; }
.kk-cr .it[data-mode="basket"] .it__bob { --by: -.12em; --br: .6deg; transform-origin: 50% 90%; }
@keyframes kk-cr-bob { from { transform: translateY(0) rotate(0deg); } to { transform: translateY(var(--by)) rotate(var(--br)); } }
.kk-cr .it[data-mode="basket"] .it__act { transform-origin: 50% 85%; }
.kk-cr__trolley { transform-origin: 50% 92%; will-change: transform, opacity; }
.kk-cr .drop { will-change: transform, opacity; }

/* candle flames: a lit flame is the artwork itself; an unlit one is the same light dimmed */
.kk-cr .fl { position: absolute; width: 3.2em; height: 3.6em; margin: -1.9em 0 0 -1.6em; border-radius: 50%; cursor: pointer; }
.kk-cr .fl::before { content: ""; position: absolute; left: 14%; right: 14%; top: 6%; bottom: 22%; border-radius: 50%; background: radial-gradient(closest-side, #58586a 55%, rgba(88, 88, 106, 0)); mix-blend-mode: multiply; opacity: 0; transition: opacity .35s; }
.kk-cr .fl:not(.lit)::before { opacity: 1; }

/* lettering */
.kk-cr__lettering { pointer-events: none; transform-origin: 50% 55%; }
.kk-cr__shine { position: absolute; inset: 0; -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; background: linear-gradient(105deg, rgba(255, 255, 255, 0) 42%, rgba(255, 255, 255, .85) 50%, rgba(255, 255, 255, 0) 58%) no-repeat; background-size: 300% 100%; background-position: 150% 0; opacity: 0; }
.kk-cr__lhit { position: absolute; left: 5%; right: 5%; top: 30%; bottom: 30%; pointer-events: auto; cursor: pointer; transform: rotate(-5deg); }
@keyframes kk-cr-shine { 0% { opacity: 1; background-position: 150% 0; } 100% { opacity: 1; background-position: -50% 0; } }
.kk-cr.is-shine .kk-cr__shine { animation: kk-cr-shine 1s ease-in-out both; }

/* particles */
.kk-cr__fx { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.kk-cr__fxg * { fill: none; stroke-width: 2.6; stroke-linecap: round; }

/* ---------- power-on (on load): wall brightens, the arc flickers on, the lettering lands ---------- */
.kk-cr--js .kk-cr__wall { filter: brightness(.38) saturate(.75); transition: filter 1.4s ease-out; }
.kk-cr--js.is-power .kk-cr__wall { filter: none; }
.kk-cr--js .seq:not(.on) { opacity: .05; }
.kk-cr--js .seq.on { animation: kk-cr-flick .7s linear both; }
@keyframes kk-cr-flick { 0% { opacity: .05; } 8% { opacity: 1; } 14% { opacity: .2; } 22% { opacity: 1; } 30% { opacity: .4; } 40%, 100% { opacity: 1; } }
.kk-cr--js .kk-cr__lettering { opacity: 0; }
.kk-cr--js .kk-cr__letterglow { opacity: 0; transition: opacity .7s .3s; }
.kk-cr--js.is-head .kk-cr__lettering { opacity: 1; animation: kk-cr-slam .55s cubic-bezier(.2, 1.35, .4, 1) both; }
.kk-cr--js.is-head .kk-cr__letterglow { opacity: 1; }
@keyframes kk-cr-slam { from { opacity: 0; transform: scale(1.45) rotate(2.5deg); } 55% { opacity: 1; } to { opacity: 1; transform: none; } }
/* until the script takes over the trolley and the items, keep them out of sight (it shows them, or the fail-safe does) */
.kk-cr--js:not(.is-live) .kk-cr__trolley, .kk-cr--js:not(.is-live) .kk-cr__haze, .kk-cr--js:not(.is-live) .drop { opacity: 0; }

/* ---------- floor band with the copy ---------- */
.kk-cr__floor {
	position: relative; z-index: 3; text-align: center; margin-top: calc(var(--sw) * -0.085);   /* the copy sits on the real floor */
	padding: 0 20px clamp(26px, 4vw, 44px);
	background: linear-gradient(to bottom, rgba(5, 11, 36, 0), rgba(5, 11, 36, 0) calc(var(--sw) * .05), #050b24 calc(var(--sw) * .1));
}
.kk-cr__copy { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.kk-cr__tag { margin: 0; max-width: 30em; font-size: clamp(15px, 1.7vw, 19px); font-weight: 500; line-height: 1.4; color: #e6efff; text-shadow: 0 1px 10px rgba(0, 10, 60, .9); }
.kk-cr__cta, .kk-cr__cta:visited {
	display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 13px 28px; border-radius: 999px;
	background: linear-gradient(#ffe14a, #ffb400); color: #1a0f4a; text-decoration: none;
	font-size: clamp(16px, 1.6vw, 18px); font-weight: 700; letter-spacing: .01em;
	box-shadow: 0 0 0 2px rgba(255, 255, 255, .85) inset, 0 0 18px rgba(255, 180, 0, .75), 0 0 46px rgba(255, 150, 0, .45);
	transition: transform .18s, box-shadow .18s;
}
.kk-cr__cta:hover, .kk-cr__cta:focus-visible { color: #1a0f4a; transform: translateY(-2px) scale(1.03); box-shadow: 0 0 0 2px #fff inset, 0 0 26px rgba(255, 200, 40, .95), 0 0 70px rgba(255, 150, 0, .6); }
.kk-cr__cta:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.kk-cr__cta svg { transition: transform .18s; }
.kk-cr__cta:hover svg { transform: translateX(4px); }
.kk-cr__cta--soon, .kk-cr__cta--soon:hover { background: rgba(8, 16, 60, .55); color: #ffd84a; cursor: default; transform: none; box-shadow: 0 0 0 2px #ffc61a inset, 0 0 16px rgba(255, 180, 0, .45); }
.kk-cr.is-party .kk-cr__cta { animation: kk-cr-cta 1.2s ease-in-out 3; }
@keyframes kk-cr-cta { 50% { transform: scale(1.07); box-shadow: 0 0 0 2px #fff inset, 0 0 34px rgba(255, 210, 60, 1), 0 0 90px rgba(255, 160, 0, .75); } }
.kk-cr__hint { margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: #8fc8ff; opacity: .85; }
.kk-cr.is-cue .kk-cr__hint-t::after { content: " \2193"; display: inline-block; margin-left: .4em; animation: kk-cr-cue 1.1s ease-in-out infinite; }
@keyframes kk-cr-cue { 50% { transform: translateY(5px); } }
.kk-cr--js .kk-cr__copy > * { opacity: 0; transform: translateY(10px); transition: opacity .5s, transform .5s; }
.kk-cr--js.is-copy .kk-cr__copy > * { opacity: 1; transform: none; }
.kk-cr--js.is-copy .kk-cr__copy > .kk-cr__cta { transition-delay: .12s; }
.kk-cr--js.is-copy .kk-cr__copy > .kk-cr__hint { opacity: .85; transition-delay: .5s; }

/* script never arrived: show everything lit and in place */
.kk-cr--failsafe .seq, .kk-cr--failsafe .kk-cr__lettering, .kk-cr--failsafe .kk-cr__letterglow, .kk-cr--failsafe .kk-cr__trolley, .kk-cr--failsafe .kk-cr__haze, .kk-cr--failsafe .drop { opacity: 1 !important; }
.kk-cr--failsafe .kk-cr__wall { filter: none !important; }
.kk-cr--failsafe .kk-cr__copy > * { opacity: 1 !important; transform: none !important; }

/* off-screen: stop every loop */
.kk-cr.is-paused *, .kk-cr.is-paused *::before, .kk-cr.is-paused *::after { animation-play-state: paused !important; }

@media (max-width: 640px) {
	.kk-cr { --sw: 104vw; --track: 110vh; }
	/* phones: the pinned hero is shorter than the screen, so hold it a little below the top instead of leaving all the dark below */
	.kk-cr--scroll .kk-cr__pin { top: calc((100vh - var(--pin-h, 100vh)) * .26); top: calc((100svh - var(--pin-h, 100svh)) * .26); }
	.kk-cr--scroll .kk-cr__pin::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 22px; z-index: 5; pointer-events: none; background: linear-gradient(#050b24, rgba(5, 11, 36, 0)); }
	.kk-cr .it[data-mode]::after { content: ""; position: absolute; inset: -1.6em; }   /* bigger tap targets */
	.kk-cr__cta { width: min(100%, 340px); justify-content: center; }
	.kk-cr__hint { font-size: 12px; }
	.kk-cr .fl { width: 4.4em; height: 4.8em; margin: -2.6em 0 0 -2.2em; }
}

@media (prefers-reduced-motion: reduce) {
	.kk-cr *, .kk-cr *::before, .kk-cr *::after { animation: none !important; transition: none !important; }
	.kk-cr--js .seq:not(.on), .kk-cr--js .kk-cr__lettering, .kk-cr--js .kk-cr__letterglow { opacity: 1; }
	.kk-cr--js:not(.is-live) .kk-cr__trolley, .kk-cr--js:not(.is-live) .kk-cr__haze, .kk-cr--js:not(.is-live) .drop { opacity: 1; }
	.kk-cr--js .kk-cr__wall { filter: none; }
	.kk-cr--js .kk-cr__copy > * { opacity: 1; transform: none; }
	.kk-cr--js .kk-cr__copy > .kk-cr__hint { opacity: .85; }
	.kk-cr .it__par { transform: none; }
}
