/* ==========================================================================
   Trailwords — Animated Sasquatch Intro Splash Overlay
   Shaggier Sasquatch artwork + weathered wood tagline + rotating C-spinner
   on #121715 dark-forest background.
   - Entrance/Idle: playful mascot bounce/rumble shake, wobbling wood sign,
     spinning wood C-spinner, and animated rotating trail loading lines
   - Exit ("Screen Chomp"): mascot zooms forward while giant jagged dark
     jaws snap shut from top and bottom before parting to reveal Home
   - First visit today: holds >= 1.3s + full chomp exit
   - Repeat visits today (.is-snappy-visit): snappier ~0.5s animated version
   - prefers-reduced-motion: reduce: skips all motion with simple instant fade
   ========================================================================== */

html.has-gq-splash,
html.has-gq-splash body {
  overflow: hidden;
}

.gq-splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    max(12px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  isolation: isolate;
}

.gq-splash-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: #121715;
  transition: opacity 80ms linear;
}

.gq-splash-stage {
  position: relative;
  z-index: 1;
  width: min(96vw, 740px, calc((90dvh - 54px) * 1.6));
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.5vh, 14px);
  will-change: transform, opacity;
  animation: gq-stage-pop 320ms cubic-bezier(0.22, 1.28, 0.36, 1) both;
}

/* Rustic Weathered Wood Trail-Sign Tagline */
.gq-splash-tagline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 7px 18px;
  border-radius: 5px;
  background-color: #6E4F34;
  background-image:
    linear-gradient(180deg, rgba(255, 232, 198, 0.14) 0%, rgba(18, 10, 4, 0.34) 100%),
    url('../assets/wood-slat.jpg');
  background-size: 100% 100%, 360px auto;
  background-position: 0 0, 42% 30%;
  border: 1.5px solid #2A1B0F;
  border-bottom: 3px solid #130C07;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 206, 0.28),
    0 4px 12px rgba(0, 0, 0, 0.45);
  color: #F5F1E8;
  font-family: 'Anton', 'Oswald', 'Impact', 'Overpass', sans-serif;
  font-size: clamp(0.86rem, 2.3vw, 1.18rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(15, 9, 4, 0.78);
  flex-shrink: 0;
  will-change: transform;
  animation: gq-signpost-wobble 1.15s ease-in-out infinite;
}

.gq-splash-tagline-nail {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #1F140B;
  box-shadow: 0 1px 0 rgba(255, 236, 206, 0.25);
  flex-shrink: 0;
}

/* Shaggier Sasquatch Artwork Wrapper (Exact 1200:750 Aspect Ratio) */
.gq-splash-art-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 750;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gq-splash-art {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform-origin: 50% 58%;
  will-change: transform;
  animation: gq-mascot-rumble 520ms cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
}

/* ==========================================================================
   WOOD-GRAIN SPINNER & ANIMATED ROTATING TRAIL STATUS
   Anchored cleanly inside the monster's dark chest cavity (bottom-center)
   ========================================================================== */

.gq-splash-loader {
  position: absolute;
  left: 50%;
  bottom: 1.8%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(3px, 0.8vw, 6px);
  width: min(86%, 320px);
  text-align: center;
  pointer-events: auto;
}

.gq-wood-spinner-wrap {
  width: clamp(38px, 7.6vw, 60px);
  height: clamp(38px, 7.6vw, 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.72));
}

.gq-wood-spinner {
  width: 100%;
  height: 100%;
  display: block;
  will-change: transform;
  animation: gq-wood-spin 0.95s linear infinite;
}

.gq-splash.is-error .gq-wood-spinner,
.gq-splash.is-error .gq-splash-art {
  animation: none;
}

.gq-splash.is-error .gq-wood-spinner {
  opacity: 0.45;
}

.gq-splash-loading-title {
  font-family: 'Anton', 'Oswald', 'Impact', 'Arial Narrow', 'Overpass', sans-serif;
  font-size: clamp(0.92rem, 2.5vw, 1.42rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #F3EFE3;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  animation: gq-title-pulse 1.1s ease-in-out infinite;
}

.gq-splash-status {
  font-family: var(--font-sans, 'Overpass', sans-serif);
  font-size: clamp(0.7rem, 1.7vw, 0.86rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #D8CCBA;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  min-height: 1.25em;
}

.gq-splash-status.is-line-swap {
  animation: gq-status-swap 240ms cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

.gq-splash-retry {
  margin-top: 6px;
}

/* ==========================================================================
   FULL-SCREEN CARTOON BITE EXIT TRANSITION ("SCREEN CHOMP")
   ========================================================================== */

.gq-bite-curtain {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  will-change: opacity, transform;
}

.gq-bite-jaw {
  position: absolute;
  left: -4vw;
  width: 108vw;
  height: 62vh;
  height: 62dvh;
  display: flex;
  flex-direction: column;
  will-change: transform, opacity;
}

.gq-bite-jaw--top {
  top: 0;
  transform: translate3d(0, -112%, 0);
}

.gq-bite-jaw--bottom {
  bottom: 0;
  transform: translate3d(0, 112%, 0);
}

.gq-bite-fill {
  flex: 1 1 auto;
  background-color: #090D0B;
}

.gq-bite-teeth {
  width: 100%;
  height: clamp(64px, 14vh, 130px);
  display: block;
  flex-shrink: 0;
}

.gq-bite-jaw--top .gq-bite-teeth {
  margin-top: -2px;
}

.gq-bite-jaw--bottom .gq-bite-teeth {
  margin-bottom: -2px;
}

.gq-bite-crunch {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.4) rotate(-8deg);
  opacity: 0;
  font-family: 'Bangers', 'Anton', 'Impact', sans-serif;
  font-size: clamp(2.6rem, 11vw, 5.4rem);
  letter-spacing: 0.08em;
  color: #F4BC3E;
  text-shadow:
    0 4px 0 #140D08,
    0 0 22px rgba(238, 120, 46, 0.55);
  pointer-events: none;
  will-change: transform, opacity;
}

/* Phase 1: Mascot zooms/lunges forward & giant jagged jaws chomp INWARD to pitch-black */
.gq-splash.is-chomping .gq-splash-stage {
  animation: gq-stage-lunge 245ms cubic-bezier(0.32, 0, 0.2, 1) forwards;
}

.gq-splash.is-chomping .gq-bite-curtain {
  opacity: 1;
}

.gq-splash.is-chomping .gq-bite-jaw--top {
  animation: gq-jaw-slam-top 245ms cubic-bezier(0.55, 0.04, 0.25, 1) forwards;
}

.gq-splash.is-chomping .gq-bite-jaw--bottom {
  animation: gq-jaw-slam-bottom 245ms cubic-bezier(0.55, 0.04, 0.25, 1) forwards;
}

.gq-splash.is-chomping .gq-bite-crunch {
  animation: gq-crunch-flash 300ms cubic-bezier(0.22, 1.3, 0.36, 1) 120ms forwards;
}

/* Phase 2: Splash scene vanishes behind pitch-black bite, then jaws part smoothly */
.gq-splash.is-swallowed .gq-splash-backdrop,
.gq-splash.is-swallowed .gq-splash-stage {
  opacity: 0;
  visibility: hidden;
}

.gq-splash.is-swallowed .gq-bite-jaw--top {
  animation: gq-jaw-unveil-top 275ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.gq-splash.is-swallowed .gq-bite-jaw--bottom {
  animation: gq-jaw-unveil-bottom 275ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.gq-splash.is-swallowed .gq-bite-curtain {
  animation: gq-curtain-dissolve 285ms ease-out forwards;
}

/* ==========================================================================
   SNAPPY REPEAT-VISIT TIMING (~0.5s total with active bounce + fast chomp)
   ========================================================================== */

.gq-splash.is-snappy-visit .gq-splash-stage {
  animation-duration: 180ms;
}

.gq-splash.is-snappy-visit .gq-splash-art {
  animation-duration: 380ms;
}

.gq-splash.is-snappy-visit.is-chomping .gq-splash-stage {
  animation-duration: 145ms;
}

.gq-splash.is-snappy-visit.is-chomping .gq-bite-jaw--top,
.gq-splash.is-snappy-visit.is-chomping .gq-bite-jaw--bottom {
  animation-duration: 145ms;
}

.gq-splash.is-snappy-visit.is-chomping .gq-bite-crunch {
  animation-duration: 180ms;
  animation-delay: 65ms;
}

.gq-splash.is-snappy-visit.is-swallowed .gq-bite-jaw--top,
.gq-splash.is-snappy-visit.is-swallowed .gq-bite-jaw--bottom {
  animation-duration: 155ms;
}

.gq-splash.is-snappy-visit.is-swallowed .gq-bite-curtain {
  animation-duration: 160ms;
}

/* ==========================================================================
   REDUCED-MOTION INSTANT FADE
   ========================================================================== */

.gq-splash.is-reduced-motion .gq-splash-stage,
.gq-splash.is-reduced-motion .gq-splash-tagline,
.gq-splash.is-reduced-motion .gq-splash-art,
.gq-splash.is-reduced-motion .gq-splash-loading-title,
.gq-splash.is-reduced-motion .gq-wood-spinner {
  animation: none !important;
}

.gq-splash.is-reduced-exit {
  opacity: 0;
  transition: opacity 120ms linear;
  pointer-events: none;
}

/* ==========================================================================
   RESPONSIVE TUNING FOR PORTRAIT MOBILE & SHORT LANDSCAPE
   ========================================================================== */

@media (max-width: 540px) {
  .gq-splash-stage {
    width: 100vw;
    max-width: 100vw;
    gap: 10px;
  }

  .gq-splash-tagline {
    padding: 6px 14px;
    font-size: 0.84rem;
    letter-spacing: 0.1em;
  }

  .gq-splash-loader {
    bottom: -24px;
    gap: 4px;
  }

  .gq-wood-spinner-wrap {
    width: 36px;
    height: 36px;
  }

  .gq-splash-loading-title {
    font-size: 0.92rem;
  }

  .gq-splash-status {
    font-size: 0.74rem;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .gq-splash-stage {
    width: min(88vw, calc((88dvh - 44px) * 1.6));
    gap: 6px;
  }

  .gq-splash-tagline {
    padding: 4px 12px;
    font-size: 0.76rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gq-splash-stage,
  .gq-splash-tagline,
  .gq-splash-art,
  .gq-splash-loading-title,
  .gq-splash-status,
  .gq-wood-spinner,
  .gq-bite-jaw,
  .gq-bite-crunch {
    animation: none !important;
  }
}

/* ==========================================================================
   KEYFRAMES
   ========================================================================== */

@keyframes gq-stage-pop {
  0% {
    opacity: 0;
    transform: scale(0.88) translate3d(0, 16px, 0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translate3d(0, 0, 0);
  }
}

@keyframes gq-signpost-wobble {
  0%, 100% {
    transform: rotate(-1.7deg);
  }
  50% {
    transform: rotate(-0.6deg);
  }
}

/* Energetic playful bounce & comic rumble shake on the shaggier Sasquatch */
@keyframes gq-mascot-rumble {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1, 1) rotate(0deg);
  }
  22% {
    transform: translate3d(-2px, -7px, 0) scale(1.028, 1.034) rotate(-0.9deg);
  }
  42% {
    transform: translate3d(2.5px, -3px, 0) scale(1.036, 1.018) rotate(1.1deg);
  }
  56% {
    transform: translate3d(-2px, 5px, 0) scale(1.016, 0.972) rotate(-0.7deg);
  }
  72% {
    transform: translate3d(1.5px, -2px, 0) scale(1.012, 1.01) rotate(0.5deg);
  }
}

@keyframes gq-title-pulse {
  0%, 100% {
    opacity: 0.92;
  }
  50% {
    opacity: 1;
  }
}

@keyframes gq-status-swap {
  0% {
    opacity: 0;
    transform: translate3d(0, 5px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes gq-wood-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes gq-stage-lunge {
  0% {
    transform: scale(1) translate3d(0, 0, 0);
  }
  30% {
    transform: scale(0.94) translate3d(0, 7px, 0);
  }
  100% {
    transform: scale(1.38) translate3d(0, -12px, 0);
  }
}

@keyframes gq-jaw-slam-top {
  0% {
    transform: translate3d(0, -112%, 0);
  }
  82% {
    transform: translate3d(0, 5%, 0);
  }
  100% {
    transform: translate3d(0, 2%, 0);
  }
}

@keyframes gq-jaw-slam-bottom {
  0% {
    transform: translate3d(0, 112%, 0);
  }
  82% {
    transform: translate3d(0, -5%, 0);
  }
  100% {
    transform: translate3d(0, -2%, 0);
  }
}

@keyframes gq-crunch-flash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45) rotate(-10deg);
  }
  42% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.14) rotate(-4deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.34) rotate(2deg);
  }
}

@keyframes gq-jaw-unveil-top {
  0% {
    transform: translate3d(0, 2%, 0);
  }
  100% {
    transform: translate3d(0, -114%, 0);
  }
}

@keyframes gq-jaw-unveil-bottom {
  0% {
    transform: translate3d(0, -2%, 0);
  }
  100% {
    transform: translate3d(0, 114%, 0);
  }
}

@keyframes gq-curtain-dissolve {
  0%, 40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
