/* ===================================================================
   HERO — secuencia turntable (180→90 frames) pintada en <canvas>,
   scrubbeada por el scroll nativo. Contenedor alto + capa sticky.
   =================================================================== */
.hero {
  position: relative;
  /* Alto del "riel" de scroll: cada 100vh extra = una porción de la vuelta.
     ~300vh da una vuelta completa cómoda sin sentirse eterno. */
  height: 320vh;
}
.hero__sticky {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  display: flex; align-items: flex-end;
}
/* Poster estático: primer paint inmediato (nunca canvas en blanco) y
   fallback en móvil / prefers-reduced-motion. */
.hero__poster,
.hero__canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center bottom; /* piso anclado abajo; recorta cielo por arriba */
  z-index: 0;
}
.hero__canvas { opacity: 0; transition: opacity 0.5s ease; }
.hero.is-canvas-ready .hero__canvas { opacity: 1; }
.hero.is-canvas-ready .hero__poster { opacity: 0; }
.hero__poster { transition: opacity 0.5s ease; }

/* Viñeta para que el texto sobre el atardecer sea legible */
.hero__scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to top, rgba(22, 7, 15, 0.92) 2%, rgba(22, 7, 15, 0.15) 42%, transparent 70%),
    linear-gradient(to right, rgba(22, 7, 15, 0.7) 0%, transparent 55%);
}

.hero__overlay { position: relative; z-index: 2; width: 100%; padding-bottom: var(--space-6); }
.hero__copy { max-width: 640px; }
.hero h1 {
  font-size: clamp(2.8rem, 8vw, 6rem);
  font-weight: 700; line-height: 0.92;
  text-shadow: 0 8px 40px rgba(22, 7, 15, 0.6);
  margin-bottom: var(--space-3);
}
.hero h1 .accent { color: var(--rose); }
.hero__lead {
  color: var(--text); font-size: clamp(1rem, 2.2vw, 1.22rem);
  max-width: 520px; margin-bottom: var(--space-3);
  text-shadow: 0 2px 20px rgba(22, 7, 15, 0.7);
}
.hero__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Indicador de carga discreto (no bloquea el scroll) */
.hero__loader {
  position: absolute; z-index: 3; top: var(--space-3); right: var(--space-3);
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-dim);
  transition: opacity 0.4s ease;
}
.hero__loader[hidden] { display: none; }
.hero__loader .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--rose);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero__loader .dot { animation: none; } }

.scroll-hint {
  position: absolute; z-index: 3; bottom: var(--space-3); left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim); font-size: 0.72rem;
  letter-spacing: 0.24em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.scroll-hint::after {
  content: ""; width: 1px; height: 34px;
  background: linear-gradient(to bottom, var(--rose-soft), transparent);
  animation: hintdrop 1.8s ease-in-out infinite;
}
@keyframes hintdrop { 0% { transform: scaleY(0.3); transform-origin: top; opacity: 0.4; } 50% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(0.3); transform-origin: bottom; opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .scroll-hint::after { animation: none; } }

/* Móvil / reduced-motion: el poster manda, sin secuencia por scroll */
.hero--static { height: auto; }
.hero--static .hero__sticky { position: relative; height: 88vh; height: 88dvh; }
.hero--static .scroll-hint { display: none; }

/* ===================================================================
   BIENVENIDA
   =================================================================== */
.welcome {
  position: relative; z-index: 1;
  padding: var(--space-6) 0 var(--space-5);
}
.welcome__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--space-5); align-items: center; }
.welcome h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.welcome p { color: var(--text-dim); font-size: 1.05rem; max-width: 52ch; }
.welcome__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.stat {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-3) var(--space-2);
  text-align: center; backdrop-filter: blur(6px);
}
.stat .value { font-family: var(--font-display); font-weight: 700; font-size: 2.4rem; color: var(--gold); line-height: 1; }
.stat .label { font-size: 0.74rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 6px; }

@media (max-width: 820px) {
  .welcome__grid { grid-template-columns: 1fr; gap: var(--space-3); }
}

/* ===================================================================
   PALMARÉS — resultados en competencia por sede
   =================================================================== */
.palmares { position: relative; z-index: 1; padding: var(--space-4) 0 var(--space-5); }
.palmares__head { max-width: 680px; margin-bottom: var(--space-4); }
.palmares__head h2 { font-size: clamp(2rem, 4.5vw, 3rem); }
.palmares__head p { color: var(--text-dim); }
.palmares__stats { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.palmares__stats .stat { flex: 1; min-width: 120px; }

/* Grupos: nacional vs internacional */
.palmares__group { margin-bottom: var(--space-4); }
.palmares__group-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-1) var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.palmares__group-head h3 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.35rem; margin: 0;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--rose-soft);
}
.palmares__group-head p { margin: 0; font-size: 0.9rem; color: var(--text-mute); }

.palmares__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: var(--space-3);
}

.trophy-card {
  display: flex; flex-direction: column;
  padding: var(--space-3);
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.24s ease, transform 0.24s ease, box-shadow 0.24s ease;
}
.trophy-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-warm);
}
.trophy-card__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2);
  padding-bottom: var(--space-2); margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.trophy-card__head h4 { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; margin: 0; }
.trophy-card__count {
  flex-shrink: 0; font-family: var(--font-display); font-weight: 700;
  font-size: 1.1rem; color: var(--gold);
  letter-spacing: 0.04em; text-align: right;
}

.podium { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.podium li { display: flex; align-items: center; gap: 12px; font-size: 0.98rem; color: var(--text); }

.medal {
  flex-shrink: 0; min-width: 42px; height: 30px; padding: 0 9px;
  display: inline-grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem;
  border-radius: 8px; color: #2a0a12;
}
.medal--1 { background: linear-gradient(135deg, var(--gold), #ffe6a8); box-shadow: 0 4px 16px -6px rgba(255, 206, 122, 0.7); }
.medal--2 { background: linear-gradient(135deg, var(--silver), #f2f4fa); }
.medal--3 { background: linear-gradient(135deg, var(--ember), #ffbf94); }
.medal--x { background: transparent; color: var(--text-mute); border: 1px solid var(--border); }

.trophy-card__note { margin: var(--space-2) 0 0; font-size: 0.85rem; color: var(--text-dim); font-style: italic; }

/* Tarjeta destacada: la competencia más reciente */
.trophy-card--recent {
  position: relative;
  border-color: var(--border-strong);
  background: linear-gradient(160deg, rgba(255, 77, 109, 0.14), var(--glass) 55%);
}
.trophy-card__tag {
  position: absolute; top: calc(-1 * var(--space-2)); right: var(--space-3);
  font-family: var(--font-body); font-weight: 600;
  font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px; color: var(--bg);
  background: linear-gradient(135deg, var(--rose), var(--ember));
  box-shadow: 0 6px 18px -8px rgba(255, 77, 109, 0.8);
}
.mex-rank {
  display: flex; align-items: center; gap: 14px;
  margin: var(--space-1) 0 var(--space-3);
}
.mex-rank__pos {
  font-family: var(--font-display); font-weight: 700; line-height: 0.9;
  font-size: 3.4rem; color: var(--gold);
}
.mex-rank__label {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.15rem; line-height: 1.05; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.trophy-card__strengths { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--space-2); }
.trophy-card__strengths .chip {
  font-size: 0.74rem; font-weight: 600; color: var(--rose-soft);
  padding: 5px 11px; border-radius: 999px;
  background: rgba(255, 77, 109, 0.1); border: 1px solid var(--border);
}

@media (max-width: 560px) {
  .palmares__stats .stat .value { font-size: 1.8rem; }
}

/* ===================================================================
   BIBLIOTECA — categorías → niveles
   =================================================================== */
.library { position: relative; z-index: 1; padding: var(--space-4) 0 var(--space-6); }
.library__head { max-width: 640px; margin-bottom: var(--space-5); }
.library__head h2 { font-size: clamp(2rem, 4.5vw, 3rem); }
.library__head p { color: var(--text-dim); }

.category { margin-bottom: var(--space-5); }
.category__head {
  display: flex; align-items: center; gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.category__icon {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(255, 77, 109, 0.12); border: 1px solid var(--border);
  color: var(--rose-soft);
}
.category__icon svg { width: 24px; height: 24px; }
.category__title { font-size: 1.5rem; margin: 0; }
.category__count { margin-left: auto; font-size: 0.78rem; color: var(--text-mute); letter-spacing: 0.08em; text-transform: uppercase; }

.levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: var(--space-3);
}

/* Tarjeta de nivel */
.level-card {
  position: relative; display: flex; flex-direction: column;
  min-height: 200px; padding: var(--space-3);
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  text-decoration: none; color: var(--text);
  transition: border-color 0.24s ease, transform 0.24s ease, box-shadow 0.24s ease, background 0.24s ease;
}
.level-card__badge {
  align-self: flex-start;
  font-family: var(--font-body); font-weight: 600;
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border);
}
.level-card__badge--basico { color: var(--gold); border-color: rgba(255, 206, 122, 0.4); }
.level-card__badge--intermedio { color: var(--ember); }
.level-card__badge--avanzado { color: var(--rose-soft); }
.level-card__title { font-size: 1.55rem; margin: var(--space-3) 0 6px; }
.level-card__blurb { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 var(--space-2); }
.level-card__meta { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.level-card__sessions { font-size: 0.82rem; color: var(--text-dim); }
.level-card__go {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: 0.88rem; color: var(--rose);
  transition: gap 0.2s ease;
}
.level-card__go svg { width: 16px; height: 16px; }

/* Estado disponible */
.level-card--live { cursor: pointer; }
.level-card--live::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  padding: 1px; pointer-events: none; opacity: 0;
  background: linear-gradient(130deg, var(--rose), var(--ember));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  transition: opacity 0.24s ease;
}
.level-card--live:hover {
  transform: translateY(-5px);
  background: var(--glass-2);
  box-shadow: var(--shadow-warm);
}
.level-card--live:hover::before { opacity: 1; }
.level-card--live:hover .level-card__go { gap: 12px; }

/* Estado próximamente: menor contraste, sin sombra, cursor default */
.level-card--soon {
  opacity: 0.62;
  border-style: dashed;
  cursor: default;
}
.level-card--soon .level-card__title { color: var(--text-dim); }
.level-card--soon .level-card__go { color: var(--text-mute); }

/* Placeholder de categoría futura (una sola tarjeta genérica al final) */
.level-card--future {
  align-items: center; justify-content: center; text-align: center;
  border-style: dashed; opacity: 0.7;
  grid-column: 1 / -1;
  min-height: 150px;
}
.level-card--future .plus {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: var(--space-2);
  border: 1px solid var(--border); color: var(--rose-soft);
}
.level-card--future h3 { font-size: 1.2rem; margin: 0 0 4px; }
.level-card--future p { color: var(--text-mute); font-size: 0.85rem; margin: 0; }

@media (max-width: 560px) {
  .hero__actions { flex-direction: column; align-items: stretch; }
  .welcome__stats { grid-template-columns: repeat(3, 1fr); }
  .stat .value { font-size: 1.8rem; }
}
