/* ============================================
   VANTCALL — CLS Fixes (Cumulative Layout Shift)
   Aplica estos estilos DESPUÉS de bundle.css
   ============================================ */

/* 1. FUENTES: Prevenir salto de texto (FOUT) */
@font-face {
  font-family: 'Cabinet Grotesk';
  font-display: swap;
  src: local('Cabinet Grotesk');
}

@font-face {
  font-family: 'Satoshi';
  font-display: swap;
  src: local('Satoshi');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-display: swap;
  src: local('JetBrains Mono');
}

/* Fallback fonts con métricas similares para reducir el salto */
:root {
  --font-display-fallback: 'Arial Black', 'Helvetica Neue', sans-serif;
  --font-body-fallback: 'Segoe UI', 'Roboto', sans-serif;
  --font-mono-fallback: 'Consolas', 'Monaco', monospace;
}

body {
  font-family: var(--font-body), var(--font-body-fallback);
}

h1, h2, h3, h4, h5, h6, .valorant-hero h1, .content h1, .content h2 {
  font-family: var(--font-display), var(--font-display-fallback);
}

code, pre, .nav-number, .mobile-nav-number {
  font-family: var(--font-mono), var(--font-mono-fallback);
}

/* 2. IMÁGENES: Reservar espacio para evitar saltos */
.valorant-hero {
  min-height: 75vh;
  position: relative;
}

.valorant-hero .hero-media {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('./assets/hero-arena.webp');
  background-size: cover;
  background-position: center;
  z-index: -1;
}

.logo img, .footer-logo img {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.ranking-team-logo {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--color-surface-offset);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ranking-team-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vp-emblem {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.rank-emblem {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-emblem svg {
  width: 100%;
  height: 100%;
}

/* 3. CONTENIDO DINÁMICO: Reservar altura mínima */
.skeleton-list {
  min-height: 120px;
}

.skeleton-row {
  height: 72px;
  margin-bottom: var(--space-3);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

[data-async] {
  min-height: 200px;
  position: relative;
}

[data-async="home-stats"] {
  min-height: 100px;
}

[data-async="home-tournaments"] {
  min-height: 300px;
}

.stats-strip {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.t-card {
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.ranking-row {
  min-height: 72px;
  display: flex;
  align-items: center;
}

.match-card {
  min-height: 80px;
  display: flex;
  align-items: center;
}

/* 4. ELEMENTOS ABSOLUTOS: Prevenir movimiento */
.valorant-hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 900px;
  height: 900px;
  max-width: 100vw;
  max-height: 100vh;
  background: radial-gradient(circle, var(--color-primary-glow) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}

/* 5. MEJORAS ADICIONALES */
html {
  font-display: swap;
}

.main {
  min-height: 60vh;
  transition: opacity 0.2s ease-in-out;
}

.loading-placeholder {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.header-admin[hidden] {
  display: none !important;
}

#auth-link {
  min-width: 80px;
  text-align: center;
}

/* 6. MEDIA QUERIES para móvil */
@media (max-width: 768px) {
  .valorant-hero {
    min-height: 60vh;
    padding: var(--space-16) var(--space-4) var(--space-12);
  }

  .valorant-hero h1 {
    font-size: clamp(2.5rem, 1rem + 8vw, 4rem);
  }

  .ranking-team-logo {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }

  .vp-emblem {
    width: 48px;
    height: 48px;
  }
}

/* 7. UTILIDADES para futuros elementos */
.img-placeholder {
  background: var(--color-surface-offset);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
}

.aspect-square { aspect-ratio: 1 / 1; }
.aspect-video { aspect-ratio: 16 / 9; }
.aspect-photo { aspect-ratio: 4 / 3; }

/* 8. HERO más grande en escritorio */
@media (min-width: 769px) {
  .valorant-hero h1 {
    font-size: clamp(4rem, 1rem + 12vw, 12rem);
  }
}
