/* Site splash / loading screen */
body.splash-active {
  overflow: hidden;
  height: 100vh;
}

.site-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.site-splash.phase-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-backdrop {
  position: absolute;
  inset: 0;
  background: linear-gradient(165deg, var(--cream) 0%, #efe8dc 45%, #e8f0e4 100%);
}

.splash-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: 100%;
}

.splash-scene {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ── Boy walk (right → left) ── */
.splash-boy-wrap {
  position: absolute;
  bottom: 28%;
  left: 0;
  width: 100%;
  height: 200px;
  pointer-events: none;
}

.splash-boy-wrap .splash-boy {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 140px;
  height: 185px;
  opacity: 0;
  transform: translateX(calc(100vw + 80px));
  will-change: transform;
}

.site-splash.is-active .splash-boy {
  opacity: 1;
  animation: splash-boy-walk 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Boy enters from right, walks to left */
@keyframes splash-boy-walk {
  0% {
    transform: translateX(calc(100vw + 80px));
  }
  100% {
    transform: translateX(6vw);
  }
}

.splash-boy-svg {
  width: 100%;
  height: auto;
  display: block;
  animation: splash-boy-bob 0.45s ease-in-out infinite;
}

@keyframes splash-boy-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.splash-leg-l {
  transform-origin: 51px 98px;
  animation: splash-leg-swing 0.45s ease-in-out infinite;
}

.splash-leg-r {
  transform-origin: 69px 98px;
  animation: splash-leg-swing 0.45s ease-in-out infinite reverse;
}

@keyframes splash-leg-swing {
  0%, 100% { transform: rotate(-14deg); }
  50% { transform: rotate(18deg); }
}

.splash-arm-front {
  transform-origin: 78px 72px;
  animation: splash-arm-swing 0.45s ease-in-out infinite reverse;
}

.splash-arm-back {
  transform-origin: 42px 72px;
  animation: splash-arm-swing 0.45s ease-in-out infinite;
}

@keyframes splash-arm-swing {
  0%, 100% { transform: rotate(8deg); }
  50% { transform: rotate(-12deg); }
}

.splash-boy-shadow {
  animation: splash-shadow-pulse 0.45s ease-in-out infinite;
}

@keyframes splash-shadow-pulse {
  0%, 100% { transform: scaleX(1); opacity: 0.15; }
  50% { transform: scaleX(0.85); opacity: 0.1; }
}

/* ── Speech bubble ── */
.splash-bubble {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) scale(0.85);
  margin-bottom: 12px;
  z-index: 2;
  min-width: 240px;
  max-width: min(320px, 88vw);
  padding: 14px 18px;
  background: var(--white);
  border: 2px solid var(--gold);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(26, 45, 77, 0.12);
  text-align: center;
  opacity: 0;
  visibility: hidden;
}

.splash-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border: 10px solid transparent;
  border-top-color: var(--gold);
}

.splash-bubble p {
  font-size: 14px;
  line-height: 1.45;
  color: var(--navy);
  font-weight: 500;
}

.splash-bubble strong {
  color: var(--dark-green);
  font-weight: 700;
}

.splash-bubble-cta {
  margin-top: 6px;
  font-size: 13px !important;
  color: var(--gold) !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em;
}

.site-splash.phase-talk .splash-boy-svg,
.site-splash.phase-talk .splash-leg-l,
.site-splash.phase-talk .splash-leg-r,
.site-splash.phase-talk .splash-arm-front,
.site-splash.phase-talk .splash-arm-back,
.site-splash.phase-talk .splash-boy-shadow {
  animation-play-state: paused;
}

.site-splash.phase-talk .splash-bubble {
  visibility: visible;
  animation: splash-bubble-in 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

@keyframes splash-bubble-in {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.75) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1) translateY(0);
  }
}

/* ── Logo slide (right → left) ── */
.splash-logo-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  overflow: hidden;
  height: clamp(140px, 34vh, 260px);
  opacity: 0;
  visibility: hidden;
}

.site-splash.phase-logo .splash-logo-track {
  visibility: visible;
  opacity: 1;
}

.splash-logo-img {
  position: absolute;
  top: 50%;
  left: 50%;
  height: 100%;
  width: auto;
  max-width: min(92vw, 680px);
  object-fit: contain;
  transform: translate(115vw, -50%);
}

.site-splash.phase-logo .splash-logo-img {
  animation: splash-logo-slide 1.6s cubic-bezier(0.25, 0.1, 0.2, 1) forwards;
}

@keyframes splash-logo-slide {
  0% {
    transform: translate(115vw, -50%);
  }
  100% {
    transform: translate(-50%, -50%);
  }
}

/* Hide boy when logo shows */
.site-splash.phase-logo .splash-boy-wrap {
  animation: splash-boy-fade 0.35s ease forwards;
}

@keyframes splash-boy-fade {
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .site-splash.is-active .splash-boy,
  .site-splash.phase-logo .splash-logo-img {
    animation: none !important;
  }

  .site-splash.is-active .splash-boy {
    opacity: 1;
    transform: translateX(6vw);
  }

  .site-splash.phase-talk .splash-bubble,
  .site-splash.phase-logo .splash-logo-track {
    visibility: visible;
    opacity: 1;
    animation: none !important;
  }

  .site-splash.phase-logo .splash-logo-img {
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 600px) {
  .splash-boy-wrap {
    bottom: 22%;
  }

  .site-splash.is-active .splash-boy {
    animation-duration: 1.35s;
  }

  @keyframes splash-boy-walk {
    100% {
      transform: translateX(4vw);
    }
  }

  .splash-boy-wrap .splash-boy {
    width: 115px;
    height: 152px;
  }

  .splash-logo-track {
    height: clamp(110px, 28vh, 180px);
  }

  .splash-bubble {
    min-width: 200px;
    padding: 12px 14px;
  }

  .splash-bubble p {
    font-size: 13px;
  }
}
