:root {
  --splash-ivory: #fbf2ea;
  --splash-shadow: rgba(80, 44, 35, 0.2);
}

html.splash-pending,
html.splash-pending body {
  overflow: hidden;
  overscroll-behavior: none;
}

.site-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--splash-ivory);
  color: inherit;
  cursor: pointer;
  appearance: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 1;
  transition: opacity 380ms ease;
}

html:not(.splash-pending) .site-splash:not(.is-leaving) {
  display: none;
}

.site-splash.is-leaving {
  display: grid;
  pointer-events: none;
  opacity: 0;
}

.site-splash:focus-visible {
  outline: 3px solid rgba(176, 93, 79, 0.7);
  outline-offset: -5px;
}

.site-splash-poster {
  position: relative;
  display: block;
  width: min(100vw, calc(100dvh * 9 / 16), 430px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: var(--splash-ivory);
}

.site-splash-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.site-splash-emblem {
  position: absolute;
  left: 30.6%;
  top: 11.4%;
  width: 38.8%;
  aspect-ratio: 1.024 / 1;
  pointer-events: none;
  transform: translateZ(0);
}

.site-splash-layer {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform-origin: 50% 50%;
  will-change: opacity, transform, filter, clip-path;
}

.site-splash-halo {
  clip-path: circle(49% at 50% 50%);
  animation: splash-halo-breathe 4.6s cubic-bezier(0.22, 0.65, 0.32, 1) infinite;
}

.site-splash-heart {
  clip-path: circle(20% at 50% 55%);
  transform-origin: 50% 55%;
  animation: splash-heart-awaken 4.6s cubic-bezier(0.2, 0.78, 0.22, 1) infinite;
}

.site-splash-arrow {
  animation: splash-arrow-sheen 4.6s ease-in-out infinite;
}

.site-splash-sparkle {
  animation: splash-star-glint 4.6s ease-out infinite;
}

.site-splash-sparkle-top {
  clip-path: circle(7% at 50% 9%);
  animation-delay: 0.05s;
}

.site-splash-sparkle-right {
  clip-path: circle(7% at 91% 52%);
  animation-delay: 0.27s;
}

.site-splash-sparkle-bottom {
  clip-path: circle(7% at 50% 91%);
  animation-delay: 0.49s;
}

.site-splash-sparkle-left {
  clip-path: circle(7% at 9% 52%);
  animation-delay: 0.71s;
}

@keyframes splash-halo-breathe {
  0%, 4%, 100% {
    opacity: 0;
    transform: scale(0.975) rotate(-0.35deg);
    filter: brightness(1);
  }
  12% { opacity: 0.14; }
  30% {
    opacity: 0.46;
    transform: scale(1.028) rotate(0.35deg);
    filter: brightness(1.32) drop-shadow(0 0 12px rgba(231, 171, 93, 0.7));
  }
  48% {
    opacity: 0.18;
    transform: scale(1.008) rotate(0deg);
    filter: brightness(1.12) drop-shadow(0 0 5px rgba(240, 175, 146, 0.46));
  }
  61% {
    opacity: 0;
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes splash-heart-awaken {
  0%, 18%, 100% {
    opacity: 0;
    transform: scale(1);
    filter: brightness(1);
  }
  23% {
    opacity: 0.2;
    transform: scale(1.01);
  }
  29% {
    opacity: 0.82;
    transform: scale(1.075);
    filter: brightness(1.4) drop-shadow(0 0 14px rgba(245, 108, 144, 0.76));
  }
  36% {
    opacity: 0.28;
    transform: scale(0.995);
    filter: brightness(1.15);
  }
  43% {
    opacity: 0.52;
    transform: scale(1.035);
    filter: brightness(1.28) drop-shadow(0 0 8px rgba(245, 108, 144, 0.56));
  }
  52% {
    opacity: 0;
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes splash-arrow-sheen {
  0%, 16%, 100% {
    opacity: 0;
    clip-path: polygon(8% 80%, 12% 84%, 23% 73%, 19% 69%);
    filter: brightness(1);
  }
  21% { opacity: 0.14; }
  29% {
    opacity: 0.84;
    clip-path: polygon(39% 52%, 45% 58%, 55% 48%, 49% 42%);
    filter: brightness(1.85) drop-shadow(0 0 7px rgba(255, 226, 171, 0.95));
  }
  38% {
    opacity: 0.92;
    clip-path: polygon(75% 18%, 81% 24%, 91% 14%, 85% 8%);
    filter: brightness(2) drop-shadow(0 0 9px rgba(255, 229, 174, 0.96));
  }
  44% {
    opacity: 0;
    clip-path: polygon(84% 10%, 90% 16%, 98% 8%, 92% 2%);
    filter: brightness(1.2);
  }
}

@keyframes splash-star-glint {
  0%, 30%, 100% {
    opacity: 0;
    transform: scale(0.82);
    filter: brightness(1);
  }
  38% { opacity: 0.16; }
  43% {
    opacity: 0.92;
    transform: scale(1.2);
    filter: brightness(2) drop-shadow(0 0 8px rgba(255, 222, 157, 0.95));
  }
  49% {
    opacity: 0;
    transform: scale(1);
    filter: brightness(1);
  }
}

@media (min-width: 700px) {
  .site-splash {
    background: #2f292b;
  }

  .site-splash-poster {
    box-shadow: 0 24px 72px var(--splash-shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-splash-layer {
    animation: none !important;
    opacity: 0 !important;
  }

  .site-splash {
    transition-duration: 160ms;
  }
}
