/* Apex design system — estilos base + tokens custom (feature 008).
 * Complementa Tailwind CDN. Ver specs/008-ui-frontend/design-tokens.md.
 */

:root {
  --apex-purple: #6d28d9;
  --apex-amber: #fbbf24;
  --apex-cyan: #06b6d4;
  --bg-base: #fafaf9;
  --bg-card: #ffffff;
  --text-strong: #1e293b;
  --text-muted: #64748b;
  --border-soft: #e2e8f0;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --league-bronce: #b45309;
  --league-plata: #94a3b8;
  --league-oro: #eab308;
  --league-diamante: #38bdf8;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-base);
  color: var(--text-strong);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Focus ring siempre visible (accesibilidad WCAG AA). Nunca outline:none sin
   reemplazo. Se usa :focus-visible para no molestar en clicks de mouse. */
:focus-visible {
  outline: 2px solid var(--apex-purple);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link: oculto hasta foco por teclado. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--apex-purple);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

/* Botón base reutilizable (microinteracciones de design-tokens). */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    transform 150ms ease-out,
    filter 150ms ease-out,
    background-color 150ms ease-out;
  user-select: none;
}
.btn:active {
  transform: scale(0.95);
}
.btn-primary {
  background: var(--apex-purple);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  transform: scale(1.03);
  filter: brightness(1.1);
}
.btn-secondary {
  background: #fff;
  color: var(--text-strong);
  border-color: var(--border-soft);
}
.btn-secondary:hover:not(:disabled) {
  background: #f8fafc;
}
.btn-danger {
  background: var(--error);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  background: #f1f5f9;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Card. */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(109, 40, 217, 0.06);
}

/* Input. */
.input {
  width: 100%;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px; /* 16px evita zoom en iOS */
  background: #fff;
  color: var(--text-strong);
}
.input:focus {
  border-color: var(--apex-purple);
  outline: 2px solid rgba(109, 40, 217, 0.25);
  outline-offset: 0;
}

/* Pill / chip de filtro. */
.chip {
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--apex-purple);
  color: #fff;
  border-color: var(--apex-purple);
}

/* Badges de liga (gradientes). */
.league-bronce {
  background: linear-gradient(135deg, #b45309, #92400e);
  color: #fff;
}
.league-plata {
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  color: #1e293b;
}
.league-oro {
  background: linear-gradient(135deg, #facc15, #eab308);
  color: #1e293b;
}
.league-diamante {
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  color: #0c4a6e;
}

/* Avatar de iniciales. */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  color: #fff;
  font-weight: 700;
}

/* Scroll horizontal con snap (catálogo destacado mobile). */
.h-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.h-scroll > * {
  scroll-snap-align: start;
  flex: 0 0 auto;
}

/* Sólo lectores de pantalla. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
