/* ===== Visual FX layer — aurora bg, 3D tilt, live ticker, view-transitions =====
   Loaded after styles.css. Everything here is additive/overridable and safe
   to remove without breaking the base layout. */

/* ---------- Hero: animated aurora canvas + neon breathing border ---------- */
@property --hue {
  syntax: '<number>';
  inherits: false;
  initial-value: 200;
}

.hero.hero-banner {
  isolation: isolate;
  --hue: 200;
  animation: hero-hue-cycle 14s linear infinite;
  box-shadow:
    0 0 0 1px hsl(var(--hue) 90% 65% / 0.28),
    0 24px 70px -24px hsl(var(--hue) 90% 55% / 0.35);
  transition: box-shadow 0.4s ease;
}

@keyframes hero-hue-cycle {
  to { --hue: 560; }
}

html.light .hero.hero-banner {
  box-shadow:
    0 0 0 1px hsl(var(--hue) 80% 55% / 0.18),
    0 16px 40px -20px hsl(var(--hue) 80% 50% / 0.2);
}

.hero-aurora {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.85;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Sit above the bg image (::before) but below the darkening gradient (::after)
   so the dark vignette still reads on top of the glow, and below text (z-index:1). */
.hero.hero-banner > .hero-aurora {
  position: absolute;
  inset: 0;
  z-index: 0;
}

html.light .hero-aurora { opacity: 0.4; mix-blend-mode: multiply; }

/* One-time light sweep across the hero on load */
.hero.hero-banner > .hero-sweep {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(100deg,
    transparent 30%,
    rgba(255, 255, 255, 0.10) 47%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(255, 255, 255, 0.10) 53%,
    transparent 70%);
  transform: translateX(-130%);
  animation: hero-sweep 2.2s cubic-bezier(0.4, 0, 0.2, 1) 0.35s 1 both;
}

@keyframes hero-sweep {
  to { transform: translateX(130%); }
}

/* ---------- Live activity ticker (dynamic section) ---------- */
.live-ticker {
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(88, 166, 255, 0.07), rgba(163, 113, 247, 0.07));
  padding: 0.55rem 0;
  max-width: var(--max-width);
  margin: 0 auto 1.5rem;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
  position: relative;
  z-index: 1;
}

.live-ticker-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hot);
  background: var(--bg);
  padding-right: 0.6rem;
  z-index: 2;
}
.live-ticker-live-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hot);
  box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.6);
  animation: eyebrow-ping 1.8s ease-out infinite;
}

.live-ticker-track {
  display: flex;
  gap: 2.5rem;
  white-space: nowrap;
  width: max-content;
  animation: ticker-scroll 34s linear infinite;
  padding-left: 5.5rem;
}

.live-ticker:hover .live-ticker-track { animation-play-state: paused; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.ticker-item a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.ticker-item a:hover { color: var(--text); text-decoration: none; }
.ticker-item strong { color: var(--text); font-weight: 700; }

.ticker-tag {
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.ticker-tag--hot { background: rgba(255, 107, 107, 0.15); color: var(--hot); }
.ticker-tag--star { background: rgba(240, 192, 0, 0.15); color: var(--star); }
.ticker-tag--new { background: rgba(63, 185, 80, 0.15); color: var(--success); }
.ticker-tag--plays { background: rgba(88, 166, 255, 0.12); color: var(--accent); }

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .live-ticker-track { animation-duration: 22s; }
  .live-ticker-live-dot { display: none; }
  .live-ticker-track { padding-left: 0; }
}

/* ---------- Pointer-driven 3D tilt + glare on cards ---------- */
@media (hover: hover) and (pointer: fine) {
  .game-card, .hero-card, .category-card {
    will-change: transform;
  }
  .game-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    border-radius: inherit;
    opacity: 0;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.16), transparent 55%);
    transition: opacity 0.3s ease;
  }
  .game-card.tilt-active::before { opacity: 1; }

  .hero-carousel .hero-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.20), transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .hero-carousel .hero-card.tilt-active::before { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hero.hero-banner { animation: none !important; }
  .hero.hero-banner > .hero-sweep { display: none !important; }
  .live-ticker-track { animation: none !important; overflow-x: auto; }
}

/* ---------- View Transitions (filtering / layout switches) ---------- */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Slightly punchier card hover glow to match the tilt effect ---------- */
.game-card:hover {
  box-shadow: var(--shadow), 0 14px 34px -12px rgba(88, 166, 255, 0.28);
}
html.light .game-card:hover {
  box-shadow: var(--shadow), 0 12px 28px -14px rgba(37, 99, 235, 0.22);
}
