/* The village square in the hero (js/village/). Loads after handmade.css. Tokens only. */

/* the paper fibres belonged to the cut-paper street; a lit 3D scene wants a clean lens */
.hero::after { display: none; }

.village { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.1s var(--ease-out); pointer-events: none; }
.hero.is-live .village { opacity: 1; }
.rm .village { transition: none; }

/* no WebGL: a still of the same square */
.hero.no-gl { background: var(--night) url("../assets/village.webp") center top / cover no-repeat; }
/* phones get the tall still; anything squarer crops the wide one from the top, so the sky stays behind the title */
@media (max-aspect-ratio: 3/5) { .hero.no-gl { background-image: url("../assets/village-tall.webp"); } }
.hero.no-gl .village { display: none; }

/* the strip of snow a finger can scoop. Touches that start here roll a snowball; anywhere else the page scrolls. */
.village-ground {
  position: absolute; left: 0; right: 0; bottom: 0; top: 70%; z-index: 3; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
}
.hero.can-roll, .hero.can-roll .village-ground { cursor: grab; }
.hero.is-rolling, .hero.is-rolling .village-ground { cursor: grabbing; }
.hero.can-poke, .hero.can-poke .village-ground { cursor: pointer; }

/* keyboard way in: a focus ring on the snow, nothing to read */
.village-ball {
  position: absolute; z-index: 4; left: 50%; bottom: 9%; width: 56px; height: 56px; translate: -50% 50%;
  padding: 0; border: 0; border-radius: 50%; background: none; opacity: 0; pointer-events: none;
}
/* a night-blue ring with a snow ring inside it: 3:1 or better on lit snow and on shadow */
.village-ball:focus-visible { opacity: 1; outline: 4px solid var(--night); outline-offset: 0; box-shadow: inset 0 0 0 3px var(--snow), 0 0 0 7px var(--snow); }

.hero-edge { position: absolute; left: 0; right: 0; bottom: -1px; z-index: 3; width: 100%; height: 26px; pointer-events: none; fill: var(--paper); }

/* a snowball thrown back at the lens: it lands, slides and melts */
.village-splat {
  position: absolute; z-index: 4; width: 26vmin; aspect-ratio: 1; translate: -50% -50%; pointer-events: none;
  background: radial-gradient(closest-side, var(--snow) 0 38%, color-mix(in oklab, var(--snow), transparent 45%) 60%, transparent 100%);
  border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%;
  animation: splat 2.6s var(--ease-out) forwards;
}
.village-splat::before, .village-splat::after {
  content: ""; position: absolute; left: 30%; top: 55%; width: 16%; height: 60%; border-radius: 50%;
  background: linear-gradient(color-mix(in oklab, var(--snow), transparent 30%), transparent);
}
.village-splat::after { left: 58%; top: 50%; width: 11%; height: 44%; }
@keyframes splat {
  0% { scale: .2; opacity: 0; }
  7% { scale: 1.08; opacity: .96; }
  14% { scale: 1; }
  60% { opacity: .8; }
  100% { scale: 1.04; opacity: 0; translate: -50% -30%; }
}
