/* A little trouble before the homepage. All styles stay inside the intro. */
html.intro-pending,
html.intro-pending body {
  overflow: hidden;
  overscroll-behavior: none;
}

.gremlin-intro {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  isolation: isolate;
  background: #000;
  color: #e9ff61;
  opacity: 1;
  transition: opacity 650ms cubic-bezier(.4, 0, .2, 1);
  touch-action: manipulation;
}

.intro-pending .gremlin-intro { display: block; }
.gremlin-intro.is-leaving { opacity: 0; }

.intro-trigger {
  appearance: none;
  display: grid;
  place-items: center;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.intro-trigger:focus { outline: none; }
.intro-trigger:focus-visible .intro-eyes { filter: drop-shadow(0 0 12px #d9ff4433); }
.is-revealing .intro-trigger { cursor: default; }

.intro-eyes {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 94px;
  transform: translate(-50%, -50%) rotate(-4deg);
  filter: drop-shadow(0 0 10px #d9ff4422);
  transition: opacity 140ms ease, transform 240ms ease;
}

.intro-eyes svg { display: block; width: 100%; height: auto; overflow: visible; }
.intro-eye { transform-box: fill-box; transform-origin: center; animation: intro-blink 4.7s 1s infinite; }
.intro-eye-right { animation-delay: 1.04s; }
.is-revealing .intro-eyes { opacity: 0; transform: translate(-50%, -50%) scale(.75); }

@keyframes intro-blink {
  0%, 27%, 34%, 38%, 45%, 100% { transform: scaleY(1); }
  30%, 41% { transform: scaleY(.045); }
}

.intro-hint {
  position: absolute;
  bottom: max(10%, 36px);
  left: 0;
  width: 100%;
  color: #808274;
  font-family: var(--body), sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .13em;
  opacity: 0;
  animation: intro-hint-in 1s 1.8s both;
  transition: opacity 180ms ease;
}

.intro-hint-touch { display: none; }
.is-revealing .intro-hint { animation: none; opacity: 0; }
@keyframes intro-hint-in { from { opacity: 0; } to { opacity: 1; } }

.intro-reveal {
  display: grid;
  place-items: center;
  position: relative;
  width: min(72vw, 410px, 53svh);
  pointer-events: none;
  opacity: 0;
}

.is-revealing .intro-reveal { opacity: 1; }
.intro-gremlin { position: relative; z-index: 1; display: block; width: 100%; height: auto; opacity: 0; }
.is-revealing .intro-gremlin { animation: intro-creature-arrives 2150ms cubic-bezier(.2, .7, .25, 1) both; }

@keyframes intro-creature-arrives {
  0% { opacity: 0; filter: brightness(.15); transform: translateY(28px) rotate(-9deg) scale(.64); }
  24% { opacity: 1; filter: brightness(1); transform: translateY(-8px) rotate(3deg) scale(1.05); }
  42% { opacity: 1; filter: brightness(1); transform: translateY(0) rotate(-2deg) scale(1); }
  70% { opacity: 1; filter: brightness(1); transform: translateY(0) rotate(0) scale(1); }
  100% { opacity: 0; filter: brightness(1); transform: translateY(20px) rotate(4deg) scale(1.35); }
}

.intro-aura {
  position: absolute;
  width: 145%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(ellipse, #b7df241a 0, #b7df2409 37%, transparent 68%);
  opacity: 0;
}

.is-revealing .intro-aura { animation: intro-aura-in 1800ms ease both; }
@keyframes intro-aura-in { 0%, 100% { opacity: 0; transform: scale(.6); } 35%, 75% { opacity: 1; transform: scale(1); } }

.intro-whisper {
  position: absolute;
  top: calc(100% + 20px);
  width: 100%;
  color: #e9ff61;
  text-align: center;
  font-size: 12px;
  letter-spacing: .08em;
  opacity: 0;
}

.is-revealing .intro-whisper { animation: intro-whisper-in 1700ms ease both; }
@keyframes intro-whisper-in { 0%, 25%, 100% { opacity: 0; transform: translateY(5px); } 45%, 83% { opacity: 1; transform: translateY(0); } }

.intro-skip {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  right: 24px;
  padding: 10px 14px;
  border: 1px solid #e9ff61;
  background: #000;
  color: #e9ff61;
  font: inherit;
  font-size: 12px;
  opacity: 0;
  cursor: pointer;
  pointer-events: none;
}

.intro-skip:focus-visible { opacity: 1; pointer-events: auto; outline: 2px solid #e9ff61; outline-offset: 4px; }
.intro-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (pointer: coarse) {
  .intro-hint-desktop { display: none; }
  .intro-hint-touch { display: inline; }
}

@media (max-width: 600px) {
  .intro-eyes { width: 79px; }
  .intro-reveal { width: min(76vw, 48svh); }
}

@media (prefers-reduced-motion: reduce) {
  .gremlin-intro { transition: opacity 150ms linear !important; }
  .intro-eye { animation: none !important; }
  .intro-hint { animation: none !important; opacity: 1; }
  .is-revealing .intro-hint { opacity: 0; }
  .is-revealing .intro-gremlin { animation: none !important; opacity: 1; transform: none; }
  .is-revealing .intro-whisper { animation: none !important; opacity: 1; }
  .intro-aura { display: none; }
}
