/* ==========================================================================
   EsportsHub — Animations & Intro
   ========================================================================== */

/* ------------------------------- Intro overlay ---------------------------- */

#intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(circle at 50% 40%, rgba(29,185,84,0.16), transparent 55%),
    linear-gradient(180deg, #05080a 0%, #081a10 60%, #05080a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: opacity .8s var(--ease), visibility .8s var(--ease);
}
#intro.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.intro-active { overflow: hidden; height: 100vh; }

.intro-beam {
  position: absolute;
  top: -20%;
  width: 240px;
  height: 160%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transform: rotate(18deg);
  animation: beamSweep 3.2s ease-in-out infinite;
}
.intro-beam.b2 { animation-delay: 1.1s; opacity: .6; }

.intro-pitch-lines {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(0deg, rgba(29,185,84,0.05) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, rgba(29,185,84,0.05) 0 1px, transparent 1px 64px);
  mask-image: radial-gradient(circle at 50% 50%, black, transparent 75%);
}

.intro-ball-wrap {
  margin-bottom: 34px;
  animation: introBounce 1.1s cubic-bezier(.5,0,.5,1) infinite;
}
.intro-ball-spin {
  width: 92px;
  height: 92px;
  animation: introSpin 1.6s linear infinite;
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.55));
}
.intro-ball-spin svg { display: block; width: 100%; height: 100%; }

.intro-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.1rem, 9vw, 4.6rem);
  letter-spacing: 0.06em;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 92vw;
  overflow: hidden;
}
.intro-title span {
  display: inline-block;
  opacity: 0;
  transform: translateY(110%);
  animation: introLetterUp .7s var(--ease) forwards;
}
.intro-title .hub { color: var(--gold); margin-left: 12px; }

.intro-tag {
  margin-top: 14px;
  font-size: 0.95rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-faint);
  opacity: 0;
  text-align: center;
  max-width: 88vw;
  animation: introFadeUp .8s var(--ease) forwards;
  animation-delay: 1.15s;
}

@media (max-width: 480px) {
  .intro-tag { letter-spacing: 0.14em; font-size: 0.8rem; }
}

.intro-bar {
  margin-top: 42px;
  width: 220px;
  height: 3px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  opacity: 0;
  animation: introFadeUp .6s var(--ease) forwards;
  animation-delay: 1.3s;
}
.intro-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pitch-light), var(--gold));
  animation: introLoad 1.7s var(--ease) forwards;
  animation-delay: 1.35s;
}

.intro-skip {
  position: absolute;
  bottom: 28px; right: 28px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  animation: introFadeUp .6s var(--ease) forwards;
  animation-delay: 1s;
  transition: color .2s ease, border-color .2s ease;
}
.intro-skip:hover { color: var(--text); border-color: var(--pitch-light); }

@keyframes introBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-26px); }
}
@keyframes introSpin { to { transform: rotate(360deg); } }
@keyframes introLetterUp {
  to { opacity: 1; transform: translateY(0); }
}
@keyframes introFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes introLoad {
  from { width: 0%; }
  to { width: 100%; }
}
@keyframes beamSweep {
  0%, 100% { transform: translateX(-40vw) rotate(18deg); opacity: 0; }
  50% { transform: translateX(40vw) rotate(18deg); opacity: 1; }
}

/* --------------------------------- Global --------------------------------- */

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.4); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes scrollDot {
  0% { opacity: 1; top: 6px; }
  70% { opacity: 0; top: 20px; }
  100% { opacity: 0; top: 20px; }
}
@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-22px) rotate(8deg); }
}
@keyframes driftUp {
  0% { transform: translateY(0); opacity: 0; }
  10% { opacity: .8; }
  90% { opacity: .3; }
  100% { transform: translateY(-120vh); opacity: 0; }
}
@keyframes swayGrass {
  0%, 100% { transform: skewX(0deg); }
  50% { transform: skewX(1.2deg); }
}

/* Hero elements using the keyframes */
.floating-ball { animation: floatY 6s ease-in-out infinite; }
.pitch-floor { animation: swayGrass 8s ease-in-out infinite; }

.light-particles span { animation: driftUp linear infinite; }

/* Fade-in utility for content that mounts via JS */
.fade-in { animation: introFadeUp .6s var(--ease) forwards; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
