/* The creatures on the GoreBoy page (assets/goreboy/creatures/). Decorative layers: none of
   them take pointer events, so nothing here can sit in the way of a link or a tap. */

/* The Watcher: its own small canvas, moved by transform */
.gb-watcher {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 45;
  pointer-events: none;
  will-change: transform;
}
.gb-watcher.gb-faded {
  opacity: 0;
  transition: opacity 0.45s ease-out;
}

/* Flight: up only while blood or pieces are in the air */
.gb-fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 44;
  pointer-events: none;
}

/* Landed pieces, pinned to the page. Clipped at the sides: a splat by the edge never
   widens the page */
.gb-gibs,
.gb-splats {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 0;
  overflow-x: clip;
  pointer-events: none;
}
.gb-gibs {
  z-index: 2;
}
/* Splats lie on the floor: under the content, so text stays on top */
.gb-splats {
  z-index: -1;
}
.gb-gib,
.gb-splat {
  position: absolute;
  display: block;
  background-repeat: no-repeat;
}
.gb-gib {
  background-position: var(--s);
}
/* A piece lands glossy and cools to its settled bake (the game's ~0.7 s settle) */
.gb-gib::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: inherit;
  background-size: inherit;
  background-repeat: no-repeat;
  background-position: var(--f);
  animation: gb-cool 0.7s ease-in forwards;
}
@keyframes gb-cool {
  to {
    opacity: 0;
  }
}
.gb-gone {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}
.gb-fadein {
  animation: gb-fadein 0.6s ease-out both;
}
.gb-fadein::after {
  display: none;
}
@keyframes gb-fadein {
  from {
    opacity: 0;
  }
}

/* The paddle answering a kill */
.bubble.gb-says {
  transform-origin: 22px 100%;
  animation: gb-says 0.36s cubic-bezier(0.3, 1.6, 0.5, 1);
}
@keyframes gb-says {
  0% {
    transform: scale(0.6);
  }
  100% {
    transform: scale(1);
  }
}

/* …and, with the hero out of view, peeking up from the bottom to say it */
.gb-peek {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: 0;
  z-index: 46;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
  transform: translateY(calc(100% + 4px));
  transition: transform 0.4s cubic-bezier(0.3, 1.3, 0.5, 1);
}
.gb-peek.gb-up {
  transform: translateY(18px);
}
.gb-peek img {
  width: 128px;
  image-rendering: pixelated;
  filter: drop-shadow(0 -4px 14px rgba(0, 0, 0, 0.6));
}
.gb-peek .bubble {
  align-self: flex-end;
  margin-right: 6px;
}
.gb-peek.gb-still {
  transform: translateY(18px);
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
.gb-peek.gb-still.gb-up {
  opacity: 1;
}

/* Sound for the creatures: off and on, remembered */
.gb-mute {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 46;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule, rgba(227, 218, 201, 0.12));
  border-radius: 50%;
  background: rgba(12, 7, 8, 0.86);
  color: #9a8f86;
  cursor: pointer;
}
.gb-mute:hover {
  color: var(--bone, #e3dac9);
}
.gb-mute svg {
  width: 20px;
  height: 20px;
}
.gb-mute .gb-sound-off,
.gb-mute[aria-pressed="true"] .gb-sound-on {
  display: none;
}
.gb-mute[aria-pressed="true"] .gb-sound-off {
  display: inline;
}

/* Goredo: his canvas rides the footer's top rule */
[data-goredo-floor] {
  position: relative;
  overflow-x: clip;
}
.gb-goredo {
  position: absolute;
  left: 0;
  z-index: 3;
  pointer-events: none;
}
.bubble.gb-goredo-says {
  position: absolute;
  bottom: calc(100% + 18px);
  margin: 0;
  z-index: 4;
  width: max-content;
  max-width: min(300px, calc(100vw - 32px));
  pointer-events: none;
  font-size: 15px;
  line-height: 1.35;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-out, visibility 0s linear 0.2s;
}
.bubble.gb-goredo-says.gb-on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.2s ease-out;
}
/* The tail points back at him: from the bubble's near side, at his face */
.bubble.gb-goredo-says::after {
  left: -9px;
  top: calc(50% - 7px);
  bottom: auto;
  transform: rotate(135deg);
}
.bubble.gb-goredo-says.gb-says-left::after {
  left: auto;
  right: -9px;
  transform: rotate(-45deg);
}
.bubble.gb-goredo-says small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: #9a8f86;
}
/* A footer link he's inhaling stretches toward his mouth (transform set live) */
.gb-link {
  display: inline-block;
}
.gb-link.gb-snap {
  transition: transform 0.42s cubic-bezier(0.3, 1.9, 0.5, 1);
}

/* …and on the screen's bottom edge while the footer's out of view */
.gb-goredo-edge {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 45;
  pointer-events: none;
}
.gb-goredo-edge.gb-still {
  transition: opacity 0.3s ease-out;
}
