/* KUNG FU FUNGI - HOME ONLY: the showstopper (Nate 2026-11-26: "all out ... make people aware this is a
   different brand"). Loaded on Home only - the Shop and product pages never load this file.
   On HOME ONLY ambient loops are allowed (turning sun rays, drifting spores, film grain, poster flicker).
   Rules that stay:
     - people who turned motion off get a still page (bottom of this file + js/home.js does nothing)
     - every loop pauses when the hero is off screen or the tab is hidden (.is-paused, set by js/home.js)
   Colors come from tokens.css. */

/* the rays poke out past the screen edge - clip sideways only, so the poster can still break out below */
.hero { overflow-x: clip; }

/* ---------- red-sun rays (behind the sun behind the poster) ---------- */
.hero__rays {
  position: absolute; z-index: -2; pointer-events: none;
  width: 190%; aspect-ratio: 1; left: -64%; top: -36%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(217, 120, 39, 0.55) 0deg 7deg, transparent 7deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 30%, rgba(0, 0, 0, 0.6) 48%, transparent 70%);
  mask-image: radial-gradient(circle, #000 30%, rgba(0, 0, 0, 0.6) 48%, transparent 70%);
}

/* ---------- film grain over the whole hero ---------- */
.hero__grain { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero__grain {
  opacity: 0.11; mix-blend-mode: screen;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 0.9  0 0 0 0 0.7  0 0 0 1.4 -0.4'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* ---------- the spore canvas (drawn by js/home.js) ---------- */
.hero__spores { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }


/* ---------- the spore burst on "Enter the shop" (canvas laid over the page for half a second) ---------- */
.burst-layer { position: fixed; inset: 0; z-index: 60; width: 100vw; height: 100vh; pointer-events: none; }

@media (prefers-reduced-motion: no-preference) {

  /* ambient loops - Home only */
  .home-fx .hero__rays { animation: home-spin 70s linear infinite; }
  .home-fx .hero__grain { animation: home-grain 0.5s steps(5) infinite; }
  .home-fx .hero__poster img { animation: home-gate 9s steps(1, jump-none) 3s infinite; }

  /* paused: hero off screen or tab hidden (js/home.js) */
  .hero.is-paused .hero__rays,
  .hero.is-paused .hero__grain,
  .hero.is-paused .hero__poster img { animation-play-state: paused; }

  /* projector start-up: the poster flickers on like an old print hitting the lamp (once per page load) */
  .home-fx.home-boot .hero__poster picture { animation: home-projector 1.1s steps(1, jump-none) 0.4s both; }

  /* section titles punch in like title cards (once, as they scroll in) */
  .home-fx .title[data-punch] { opacity: 0; }
  .home-fx .title[data-punch].is-punched { animation: home-titlecard 0.6s cubic-bezier(0.2, 1.3, 0.35, 1) both; }

}

@keyframes home-spin { to { rotate: 360deg; } }
@keyframes home-grain {
  0% { background-position: 0 0; } 20% { background-position: -47px 31px; } 40% { background-position: 63px -18px; }
  60% { background-position: -22px -71px; } 80% { background-position: 39px 55px; } 100% { background-position: 0 0; }
}
/* a few frames of gate flicker every 9 seconds - the rest of the time, nothing */
@keyframes home-gate {
  0%, 3.2%, 100% { filter: none; translate: 0 0; }
  0.6% { filter: brightness(1.18) sepia(0.3); translate: 0 -2px; }
  1.4% { filter: brightness(0.86) sepia(0.2); translate: 1px 1px; }
  2.2% { filter: brightness(1.1) sepia(0.25); translate: 0 0; }
}
@keyframes home-projector {
  0% { opacity: 0; filter: brightness(3) sepia(1); }
  10% { opacity: 1; filter: brightness(2.2) sepia(0.8); }
  18% { opacity: 0.2; }
  26% { opacity: 1; filter: brightness(1.5) sepia(0.5); }
  38% { opacity: 0.55; filter: brightness(0.8); }
  50% { opacity: 1; filter: brightness(1.3) sepia(0.3); }
  70% { filter: brightness(0.95); }
  100% { opacity: 1; filter: none; }
}
@keyframes home-titlecard {
  0% { opacity: 0; scale: 1.9; filter: blur(6px); letter-spacing: 0.2em; }
  55% { opacity: 1; scale: 0.94; filter: blur(0); letter-spacing: 0.005em; }
  75% { scale: 1.04; }
  100% { opacity: 1; scale: 1; filter: none; }
}

@media (max-width: 760px) {
  .hero__rays { width: 150%; left: -25%; top: -25%; }
}

/* ---------- people who turned off motion: a still page (the rays and grain just sit there) ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero__spores, .burst-layer { display: none; }
  .hero__rays, .hero__grain, .hero__poster img, .hero__poster picture { animation: none !important; }
}

/* ======================================================================
   TONIGHT'S FEATURE: Kung Fu Fungi '96 in an arcade cabinet (Nate 2026-11-26)
   The screen plays a silent loop (js/home.js loads it near the screen). Click = the full film (js/theater.js).
   ====================================================================== */
.feature {
  background-color: var(--c-navy); color: var(--c-cream);
  border-block: 4px solid var(--c-ink); padding: var(--s-5) 0 var(--s-6);
  background-image: radial-gradient(circle, rgba(242, 222, 180, 0.09) 1.6px, transparent 2px); background-size: 11px 11px;
}
.feature__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: var(--s-5); align-items: center; }
.feature__credit { font: 700 1rem/1.2 var(--f-second); text-transform: uppercase; letter-spacing: 0.2em; color: var(--c-yellow); margin-bottom: var(--s-1); }
.feature .lead { margin-bottom: 0; }

/* the cabinet: a purple box with side stripes in the brand colors */
.cab {
  position: relative; padding: 0 1.4rem 1.2rem;
  background: linear-gradient(90deg, var(--c-yellow) 0 0.6rem, var(--c-red) 0.6rem 1.1rem, var(--c-purple) 1.1rem calc(100% - 1.1rem), var(--c-red) calc(100% - 1.1rem) calc(100% - 0.6rem), var(--c-yellow) calc(100% - 0.6rem));
  border: var(--line); box-shadow: 14px 14px 0 var(--c-red); transform: rotate(-1deg);
}
/* the lit marquee sign on top */
.cab__marquee {
  margin: 0 -1.4rem 1rem; padding: 0.8rem 1rem 0.7rem; text-align: center;
  background: radial-gradient(ellipse at 50% 50%, var(--c-red) 0 55%, #8f1a12);
  border-bottom: var(--line);
  font: 400 clamp(1.9rem, 4.2vw, 3.2rem)/1 var(--f-display); text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--c-yellow); text-shadow: 3px 3px 0 var(--c-ink), 0 0 18px rgba(245, 185, 33, 0.65);
}
.cab__year { color: var(--c-cream); }
/* the black bezel and the curved old-TV screen */
.cab__bezel { background: var(--c-ink); padding: 1rem; border-radius: 0.6rem; border: 3px solid #000; }
/* the link = the glass + a strip under it for INSERT COIN / PRESS START (so they never cover the footage) */
.cab__screen { position: relative; display: block; padding-bottom: 3.2rem; color: var(--c-cream); text-decoration: none; }
.cab__glass {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 1.6rem / 1.2rem; background: #000; box-shadow: inset 0 0 0 2px #2a2a2a;
}
.cab__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* scan lines + the curved-glass shading + a soft glare */
.cab__scan {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 120% 90% at 30% 15%, rgba(255, 255, 255, 0.12), transparent 40%),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
}
.cab__coin, .cab__start {
  position: absolute; left: 50%; bottom: 0.3rem; translate: -50% 0; white-space: nowrap;
  font: 400 clamp(1.1rem, 2.4vw, 1.7rem)/1 var(--f-display); text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--c-yellow); text-shadow: 3px 3px 0 var(--c-ink), 0 0 12px rgba(245, 185, 33, 0.8);
}
.cab__start { opacity: 0; background: var(--c-yellow); color: var(--c-ink); text-shadow: none; padding: 0.55rem 0.9rem 0.45rem; border: var(--line); box-shadow: 5px 5px 0 var(--c-red); }
.cab__screen:hover .cab__coin, .cab__screen:focus-visible .cab__coin { opacity: 0; animation: none; }
.cab__screen:hover .cab__start, .cab__screen:focus-visible .cab__start { opacity: 1; }
.cab__screen:focus-visible { outline: 4px solid var(--c-yellow); outline-offset: 4px; }
/* the control deck: joystick, three buttons, coin slot */
.cab__deck { display: flex; align-items: center; gap: 0.9rem; margin-top: 1rem; padding: 0.7rem 1rem; background: var(--c-ink); border-radius: 0.4rem; }
.cab__stick { position: relative; width: 2.2rem; height: 2.2rem; }
.cab__stick::before { content: ""; position: absolute; left: 50%; bottom: 0; width: 0.5rem; height: 1.6rem; translate: -50% 0; background: #555; border-radius: 0.2rem; }
.cab__stick::after { content: ""; position: absolute; left: 50%; top: -0.4rem; width: 1.5rem; height: 1.5rem; translate: -50% 0; border-radius: 50%; background: var(--c-red); border: 2px solid #000; }
.cab__btn { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid #000; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.35); }
.cab__btn--red { background: var(--c-red); margin-left: auto; }
.cab__btn--yellow { background: var(--c-yellow); }
.cab__btn--teal { background: var(--c-teal); }
.cab__slot { margin-left: 0.8rem; padding: 0.25rem 0.5rem; border: 2px solid var(--c-yellow); color: var(--c-yellow); font: 700 1rem/1 var(--f-second); }

@media (prefers-reduced-motion: no-preference) {
  .home-fx .cab__coin { animation: home-blink 1.1s steps(1, jump-none) infinite; }
  .cab.is-paused .cab__coin { animation-play-state: paused; }
}
@keyframes home-blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }

@media (max-width: 760px) {
  .feature__grid { grid-template-columns: 1fr; }
  .cab { transform: none; padding: 0 0.9rem 0.9rem; box-shadow: 8px 8px 0 var(--c-red); }
  .cab__marquee { margin: 0 -0.9rem 0.8rem; }
  .cab__bezel { padding: 0.6rem; }
}

/* ======================================================================
   TRICH LURKING (Nate 2026-11-26): while you scroll Home, the Mold Emperor (drawn in code, img/trich-lurk.svg)
   peeks in from a screen edge, then a Ninja streak kicks him out. Only lurking or losing. Never blocks a click.
   js/home.js decides when (3 times a visit at most) and adds the classes. Motion-off visitors never see it.
   ====================================================================== */
/* v2 (Nate: "trich did not appear"): bigger, higher up and further on screen so he can't be missed */
.lurk { position: fixed; z-index: 40; bottom: 10vh; width: clamp(200px, 24vw, 360px); pointer-events: none; --dir: -1; }
.lurk--left { left: 0; }
.lurk--right { right: 0; --dir: 1; }
.lurk__body { display: block; translate: calc(var(--dir) * 110%) 0; }
.lurk__body img { display: block; width: 100%; height: auto; }
.lurk--right .lurk__body img { scale: -1 1; }            /* always reaches toward the middle of the page */
.lurk__streak {
  position: fixed; left: 0; right: 0; bottom: calc(10vh + clamp(100px, 12vw, 180px)); height: 6.5rem; opacity: 0; transform: skewX(-24deg);
  background: linear-gradient(90deg, transparent, var(--c-magenta) 30%, var(--c-purple) 62%, var(--c-yellow) 62% 72%, var(--c-purple) 72% 90%, var(--c-cream));
  -webkit-mask-image: repeating-linear-gradient(180deg, #000 0 24px, transparent 24px 30px);
  mask-image: repeating-linear-gradient(180deg, #000 0 24px, transparent 24px 30px);
}
.lurk--left .lurk__streak { transform: skewX(24deg) scaleX(-1); }   /* bright end leads toward him */
/* THE NINJA (Nate 2026-11-26: "show our hero flying and kicking the bastard"): flies in on the streak, his foot
   lands on Trich at the hit, then he back-flips away. --tw = Trich's width (same as .lurk). */
.lurk { --tw: clamp(200px, 24vw, 360px); }
.lurk__ninja {
  position: fixed; bottom: calc(10vh + var(--tw) * 0.52); width: clamp(190px, 21vw, 320px); opacity: 0;
  translate: calc(var(--dir) * -120vw) 0;
}
.lurk--right .lurk__ninja { right: 0; }
.lurk--left .lurk__ninja { left: 0; }
.lurk__ninja img { display: block; width: 100%; height: auto; }
.lurk--left .lurk__ninja img { scale: -1 1; }                 /* always kicks toward Trich */
.lurk__pow {
  position: absolute; left: 50%; top: 20%; translate: -50% 0; opacity: 0; white-space: nowrap;
  font: 400 clamp(1.8rem, 3.5vw, 2.8rem)/1 var(--f-display); text-transform: uppercase; color: var(--c-yellow);
  text-shadow: 3px 3px 0 var(--c-red), 6px 6px 0 var(--c-ink); -webkit-text-stroke: 1.5px var(--c-ink);
}

@media (prefers-reduced-motion: no-preference) {
  /* peeks in, leans, glares */
  .lurk.is-in .lurk__body { animation: lurk-peek 3s cubic-bezier(0.25, 0.8, 0.3, 1) both; }
  .lurk.is-in .lurk__body img { filter: drop-shadow(0 0 14px rgba(101, 184, 62, 0.75)); }   /* sickly green glow */
  /* the Ninja streak comes from the far side and knocks him off the screen, spinning */
  /* slowed down (Nate 2026-11-26: "almost too fast to see"): the streak takes 0.7 s to reach him, a short
     hit-stop flash when it lands, then he spins away over about a second */
  .lurk.is-out .lurk__body { animation: lurk-kicked 2s linear both; }
  .lurk.is-out .lurk__streak { animation: lurk-streak 1s cubic-bezier(0.4, 0, 0.6, 1) both; }
  .lurk.is-out .lurk__pow { animation: lurk-pow 1.2s 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
  .lurk.is-out .lurk__ninja { animation: lurk-ninja 2s linear both; }
}
/* 0-35%: flies in (lands his foot on Trich at 35% = the hit) - 35-45%: hit-stop - 45-100%: back-flips up and away */
@keyframes lurk-ninja {
  0% { opacity: 1; translate: calc(var(--dir) * -120vw) 0; rotate: 0deg; animation-timing-function: cubic-bezier(0.3, 0, 0.6, 1); }
  35% { opacity: 1; translate: calc(var(--dir) * var(--tw) * -0.3) 0; rotate: calc(var(--dir) * -4deg); }
  38% { translate: calc(var(--dir) * var(--tw) * -0.27) 0; rotate: calc(var(--dir) * -2deg); }
  41% { translate: calc(var(--dir) * var(--tw) * -0.3) 0; rotate: calc(var(--dir) * -4deg); }
  45% { opacity: 1; translate: calc(var(--dir) * var(--tw) * -0.36) 0; rotate: 0deg; animation-timing-function: cubic-bezier(0.3, 0.6, 0.6, 1); }
  70% { opacity: 1; translate: calc(var(--dir) * -35vw) -22vh; rotate: calc(var(--dir) * -300deg); }
  100% { opacity: 0; translate: calc(var(--dir) * -70vw) 12vh; rotate: calc(var(--dir) * -360deg); }
}
@keyframes lurk-peek {
  0% { translate: calc(var(--dir) * 110%) 0; rotate: 0deg; }
  30% { translate: calc(var(--dir) * 22%) 0; rotate: calc(var(--dir) * 6deg); }
  50% { translate: calc(var(--dir) * 28%) 0; rotate: calc(var(--dir) * 2deg); }
  75% { translate: calc(var(--dir) * 20%) 0; rotate: calc(var(--dir) * 7deg); }
  100% { translate: calc(var(--dir) * 25%) 0; rotate: calc(var(--dir) * 5deg); }
}
@keyframes lurk-kicked {
  0%, 33% { translate: calc(var(--dir) * 25%) 0; rotate: calc(var(--dir) * 5deg); filter: none; animation-timing-function: steps(1, jump-none); }
  35% { translate: calc(var(--dir) * 19%) 0; rotate: calc(var(--dir) * -4deg); filter: brightness(2.4) saturate(0.3); }
  38% { translate: calc(var(--dir) * 30%) 0; rotate: calc(var(--dir) * 10deg); filter: brightness(1.6); }
  41% { translate: calc(var(--dir) * 21%) 0; rotate: calc(var(--dir) * -2deg); filter: brightness(2.4) saturate(0.3); }
  45% { translate: calc(var(--dir) * 30%) -2vh; rotate: calc(var(--dir) * 20deg); filter: none; animation-timing-function: cubic-bezier(0.4, 0, 0.8, 0.6); }
  100% { translate: calc(var(--dir) * 190%) -70vh; rotate: calc(var(--dir) * 600deg); filter: none; }
}
/* comes in from the far side and stops on him (the hit), then fades */
@keyframes lurk-streak {
  0% { opacity: 1; translate: calc(var(--dir) * -110vw) 0; }
  70% { opacity: 1; translate: calc(var(--dir) * -12vw) 0; }
  100% { opacity: 0; translate: calc(var(--dir) * -6vw) 0; }
}
@keyframes lurk-pow {
  0% { opacity: 0; scale: 0.2; rotate: -12deg; }
  20% { opacity: 1; scale: 1; rotate: -6deg; }
  75% { opacity: 1; }
  100% { opacity: 0; scale: 1.2; rotate: -6deg; }
}
@media (prefers-reduced-motion: reduce) {
  .lurk { display: none; }
}

/* "Play the game" button under the '96 cabinet text -> game.html (Nate 2026-11-28) */
.feature__play { margin-top: var(--s-3); }
