/* ============================================================
   STREAMIII — ANIMATIONS
   Canvas hero, keyframes, transitions
   ============================================================ */

/* ── KEYFRAMES ─────────────────────────────────────────────── */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

@keyframes pulse-ring {
  0%   { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

@keyframes glow-flicker {
  0%, 100% { opacity: 1; }
  92%       { opacity: 1; }
  93%       { opacity: 0.6; }
  94%       { opacity: 1; }
  96%       { opacity: 0.7; }
  97%       { opacity: 1; }
}

@keyframes slide-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scanline {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes neon-pulse {
  0%, 100% { box-shadow: 0 0 8px var(--clr-cyan-glow), 0 0 20px rgba(0,219,233,0.15); }
  50%       { box-shadow: 0 0 16px var(--clr-cyan-glow), 0 0 40px rgba(0,219,233,0.25); }
}

@keyframes border-flow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ── HERO GLOBE ────────────────────────────────────────────── */
.hero-globe {
  position: sticky;
  top: var(--topbar-h);
  width: 100%;
  height: calc(100vh - var(--topbar-h));
  min-height: 560px;
  overflow: hidden;
  margin: calc(-1 * var(--space-6));
  margin-bottom: 0;
  background: var(--clr-bg);
  z-index: 1;
}

/* Globe : plein écran derrière tout */
.hero-globe__right {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
}

/* ── LEFT PANEL ─────────────────────────────────────────────── */
.hero-globe__left {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: clamp(40vw, 50vw, 60vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-8) var(--space-7);
  z-index: 2;
  background: none;
  /* Le conteneur lui-même ne capte pas les clics → globe cliquable dessous */
  pointer-events: none;
}

/* Seuls les éléments interactifs captent les clics */
.hero-globe__left > * {
  pointer-events: auto;
}

/* Texte d'accueil — transition fade-out */
.hero-welcome {
  animation: slide-in-up 0.7s var(--ease) 0.1s both;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.hero-welcome.hidden {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  position: absolute;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--clr-cyan);
  margin-bottom: var(--space-4);
}
.hero-tag::before {
  content: '';
  width: 20px; height: 1px;
  background: var(--clr-cyan);
  box-shadow: 0 0 6px var(--clr-cyan-glow);
}

.hero-title-main {
  font-size: clamp(2rem, 3.2vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--clr-text);
  margin-bottom: var(--space-4);
}

.hero-sub {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  line-height: 1.6;
  max-width: 320px;
}

/* ── FLOATING PLAYER ────────────────────────────────────────── */
@keyframes player-in {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@keyframes player-change {
  0%   { opacity: 1; transform: scale(1); }
  40%  { opacity: 0; transform: scale(0.96); }
  60%  { opacity: 0; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}

.hero-player {
  animation: player-in 0.55s var(--ease) both;
}
.hero-player.changing {
  animation: player-change 0.6s var(--ease) both;
}

.floating-player {
  background: rgba(12, 13, 28, 0.85);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 0.5px solid rgba(0, 219, 233, 0.18);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.6),
    0 0 0 0.5px rgba(0,219,233,0.08) inset,
    0 0 40px rgba(0,219,233,0.04);
  max-width: 70vw;
  width: 100%;
}

/* Barre de progression auto-cycle */
.player-progress-bar {
  height: 2px;
  background: rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}
.player-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--clr-cyan), var(--clr-violet));
  box-shadow: 0 0 8px var(--clr-cyan-glow);
  width: 0%;
  transition: width linear;
}

/* Thumbnail zone */
.fp-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #000;
}
.fp-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 8s ease, opacity 0.4s ease;
  transform: scale(1.04);
}
.fp-thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0.1) 0%,
    rgba(0,0,0,0.6) 80%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}
.fp-play-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(0,219,233,0.15);
  border: 1.5px solid rgba(0,219,233,0.4);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 28px;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}
.fp-play-btn:hover {
  background: rgba(0,219,233,0.3);
  border-color: var(--clr-cyan);
  box-shadow: 0 0 20px var(--clr-cyan-glow);
  transform: scale(1.08);
}
.fp-thumb-badges {
  position: absolute;
  top: var(--space-3); left: var(--space-3);
  display: flex; gap: var(--space-2);
}

/* Info zone */
.fp-info {
  padding: var(--space-4) var(--space-4) var(--space-3);
}
.fp-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--clr-text);
  margin-bottom: var(--space-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.fp-creator {
  font-size: 0.75rem;
  color: var(--clr-text-muted);
  display: flex; align-items: center; gap: 6px;
}
.fp-viewers {
  font-size: 0.72rem;
  color: var(--clr-cyan);
  display: flex; align-items: center; gap: 3px;
}
.fp-viewers .material-symbols-outlined { font-size: 13px; }

/* Footer zone */
.fp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 0.5px solid rgba(255,255,255,0.05);
}
.fp-node-label {
  font-size: 0.62rem;
  color: var(--clr-text-dim);
  font-family: monospace;
  letter-spacing: 0.06em;
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */

/* 900–1200px : contenu aligné en bas */
@media (min-width: 900px) and (max-width: 1200px) {
  .hero-globe__left {
    justify-content: flex-end;
    padding-bottom: var(--space-7);
  }
}

/* < 900px : layout mobile — globe plein écran, player en bas bord à bord */
@media (max-width: 900px) {
  .hero-globe {
    height: calc(100svh - var(--topbar-h) + 80px);
    min-height: 520px;
    -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
    mask-image:         linear-gradient(to bottom, black 70%, transparent 100%);
    margin-left:  calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    margin-top:   calc(-1 * var(--space-4));
    margin-bottom: -60px;
    width: calc(100% + 2 * var(--space-4));
  }

  .hero-globe__left {
    left: 32px;
    right: 0;
    top: auto;
    bottom: 150px;
    justify-content: flex-end;
    align-items: stretch;
    padding: 0;
  }

  .floating-player {
    max-width: 100%;
    width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  #hero-welcome {
    padding: var(--space-5) var(--space-4) var(--space-4);
  }

  #hero-player {
    margin: auto;
    width: 90%;
  }
}

/* < 600px : player pleine largeur, visible en entier,
   fondu flou vers la section suivante via un pseudo-élément */
@media (max-width: 700px) {
  .hero-globe {
    height: auto;
    min-height: 0;
    -webkit-mask-image: none;
    mask-image: none;
    margin-bottom: 0;
    padding-bottom: 0;
    overflow: visible; /* laisse le player sortir */
  }

  /* Globe limité à la hauteur de l'écran */
  .hero-globe__right {
    height: calc(100svh - var(--topbar-h));
    position: relative;
  }

  /* Player sort du hero et chevauche la section suivante */
  .hero-globe__left {
    top: auto; left: auto; bottom: 150px; right: auto;
    width: 100%;
    padding: 0;
    margin-top: -120px; /* remonte sur le globe */
    z-index: 10;
  }

  #hero-player {
    position: relative;
    z-index: 10;
    /* Fondu flou en bas : le player disparaît progressivement */
    -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
    mask-image:         linear-gradient(to bottom, black 55%, transparent 100%);
    margin-bottom: -80px; /* chevauchement avec la section chips */
  }

  .floating-player {
    max-width: 100%;
    width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  #hero-welcome {
    padding: var(--space-4) var(--space-4) var(--space-3);
  }

  .hero-title-main { font-size: 1.7rem; }
}

/* ── NAV ANIMATIONS ────────────────────────────────────────── */
.nav-item {
  animation: slide-in-right 0.3s var(--ease) both;
}

/* Stagger nav items */
.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.10s; }
.nav-item:nth-child(3) { animation-delay: 0.15s; }
.nav-item:nth-child(4) { animation-delay: 0.20s; }
.nav-item:nth-child(5) { animation-delay: 0.25s; }
.nav-item:nth-child(6) { animation-delay: 0.30s; }

/* ── CARD STAGGER ──────────────────────────────────────────── */
.stream-card {
  animation: slide-in-up 0.4s var(--ease) both;
}
.stream-card:nth-child(1)  { animation-delay: 0.05s; }
.stream-card:nth-child(2)  { animation-delay: 0.09s; }
.stream-card:nth-child(3)  { animation-delay: 0.13s; }
.stream-card:nth-child(4)  { animation-delay: 0.17s; }
.stream-card:nth-child(5)  { animation-delay: 0.21s; }
.stream-card:nth-child(6)  { animation-delay: 0.25s; }
.stream-card:nth-child(7)  { animation-delay: 0.29s; }
.stream-card:nth-child(8)  { animation-delay: 0.33s; }

/* ── GLOW NEON ─────────────────────────────────────────────── */
.neon-pulse {
  animation: neon-pulse 3s ease-in-out infinite;
}

.text-glow-cyan {
  color: var(--clr-cyan);
  text-shadow: 0 0 10px var(--clr-cyan-glow), 0 0 30px rgba(0,219,233,0.2);
  animation: glow-flicker 8s ease-in-out infinite;
}

/* ── METRIC CARDS ENTRANCE ─────────────────────────────────── */
.metric-card {
  animation: slide-in-up 0.5s var(--ease) both;
}
.metric-card:nth-child(1) { animation-delay: 0.1s; }
.metric-card:nth-child(2) { animation-delay: 0.17s; }
.metric-card:nth-child(3) { animation-delay: 0.24s; }

/* ── ADMIN SCANLINE (subtil) ───────────────────────────────── */
.scanline-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 219, 233, 0.008) 2px,
    rgba(0, 219, 233, 0.008) 4px
  );
}

/* ── LIVE PULSE BADGE ──────────────────────────────────────── */
.live-pulse-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px;
}
.live-pulse-ring::before,
.live-pulse-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--clr-error);
  animation: pulse-ring 2s ease-out infinite;
}
.live-pulse-ring::after {
  animation-delay: 0.6s;
}

/* ── PAGE TRANSITIONS ──────────────────────────────────────── */
.page-inner {
  animation: fade-in 0.35s var(--ease) both;
}
