/* ===== RESET ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* ── Brand Tokens ── */
  --bg: #faf8f5;
  --card: #ede9e2;
  --fg: #1a1208;
  --muted: #5a4d3e;
  --border: #d4c9b8;
  --accent: #a0845c;
  --primary: #6b5340;
  --pf: #faf8f5;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Work Sans', system-ui, sans-serif;

  /* ── Aliases de Compatibilidad ── */
  --bg-primary: #faf8f5;
  --bg-secondary: #ede9e2;
  --bg-tertiary: #e0dbd2;
  --text-primary: #1a1208;
  --text-secondary: #5a4d3e;
  --accent-muted: rgba(107, 83, 64, 0.08);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --navbar-height: 70px;
  --radius: 8px;
}

body {
  font-family: 'Inter', var(--sans), sans-serif;
  background-color: var(--bg-primary);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ===== CLASES DE UTILIDAD DE VISIBILIDAD ===== */
.desktop-only {
  display: block !important;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  /* Ajuste para elementos flex/inline-block que usen la utilidad */
  span.mobile-only,
  a.mobile-only {
    display: inline-block !important;
  }
}

/* ===== NAVBAR ===== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10%;
  height: 76px;
  /* Aumentado de 70px a 76px para que el logo y los enlaces respiren mejor */
  position: sticky;
  top: 0;
  background: rgba(250, 248, 245, 0.85);
  z-index: 1000;
  transition: var(--transition);
  border-bottom: 1px solid rgba(212, 201, 184, 0.4);
  touch-action: manipulation;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.navbar.scrolled {
  background: rgba(250, 248, 245, 0.96);
  border-bottom-color: var(--border);
  box-shadow: 0 2px 12px rgba(26, 18, 8, 0.03);
}

/* Enlace Home Dedicado */
.nav-home-link {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.03em;
  transition: var(--transition);
  opacity: 0.9;
}

.nav-home-link:hover {
  color: var(--accent);
  opacity: 1;
}

/* Contenedor del menú en Escritorio */
.nav-links {
  display: flex;
  gap: 44px;
  /* El secreto: espacio generoso e intencional entre las secciones */
  align-items: center;
}

nav a {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  opacity: 0.65;
  transition: var(--transition);
  position: relative;
  padding-bottom: 3px;
}

nav a:hover,
.nav-links a.active {
  opacity: 1;
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* Botón "Servicios" destacado en la Navbar de escritorio */
@media (min-width: 769px) {
  .nav-links a[href="index.html"] {
    background-color: var(--primary) !important;
    color: var(--pf) !important;
    padding: 8px 18px !important;
    border-radius: var(--radius) !important;
    font-weight: 500;
    opacity: 1 !important;
    text-decoration: none;
    transition: opacity var(--transition) !important;
  }

  .nav-links a[href="index.html"]:hover {
    opacity: 0.9 !important;
  }

  /* Desactiva la línea inferior animada solo para este botón-tarjeta */
  .nav-links a[href="index.html"]::after {
    display: none !important;
  }
}

/* ===== LOGO ===== */
.logo {
  filter: invert(1) brightness(0);
  position: relative;
  width: 160px;
  height: 60px;
  cursor: pointer;
  flex-shrink: 0;
}

.logo img {
  position: absolute;
  left: 0;
  transition: var(--transition);
}

.logo-full {
  height: 60px;
  top: 0;
  opacity: 1;
}

.logo-icon {
  height: 40px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
}

.navbar.scrolled .logo-full {
  opacity: 0;
  transform: translateY(-4px) scale(0.95);
}

.navbar.scrolled .logo-icon {
  opacity: 1;
}

/* ===== HERO & ENLACES ===== */
.hero {
  min-height: calc(100vh - var(--navbar-height));
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 0 10%;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.02);
  pointer-events: none;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 16px;
  max-width: 750px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.hero p {
  max-width: 500px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Contenedor global de Datos/Metas del Hero en Escritorio */
.hero-meta {
  display: flex;
  gap: 40px;
  margin-top: 24px;
}

.hero-meta-item {
  font-size: 2.5rem;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}

.hero-meta-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Contenedor de los accesos rápidos en Móvil (Fútbol / Secciones) */
.hero-mobile-nav.mobile-only {
  display: flex;
  flex-direction: row;
  /* Corrección: Uno al lado del otro */
  flex-wrap: wrap;
  /* Corrección: Salto de línea limpio si falta espacio */
  gap: 10px;
  /* Corrección: Separación uniforme */
  align-items: center;
  justify-content: flex-start;
  /* Corrección: Alineados a la izquierda */
  width: 100%;
  margin-top: 24px;
}

/* Los botones individuales de secciones */
.hero-mobile-nav.mobile-only a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  /* Corrección: Ancho adaptado estricto al texto */
  padding: 10px 18px;
  /* Corrección: Relleno balanceado */
  background-color: var(--primary);
  color: var(--pf);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: opacity var(--transition), transform var(--transition);
}

.hero-mobile-nav.mobile-only a:active,
.hero-mobile-nav.mobile-only a:hover {
  opacity: 0.9;
  transform: translateX(2px);
}

/* Bloque Navegación Nativa Alternativa */
.mobile-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* ===== BOTONES ===== */
.btn,
.btn-outline,
.btn-mobile-nav {
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  transition: var(--transition);
  display: inline-block;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  text-align: center;
}

.btn {
  background: var(--primary);
  color: var(--pf);
}

.btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.btn-outline {
  border: 1px solid var(--border);
  color: var(--text-primary);
  background: transparent;
}

.btn-outline:hover {
  border-color: var(--primary);
  background: var(--accent-muted);
}

.btn-mobile-nav {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 12px;
}

.btn-mobile-nav:active {
  background: var(--bg-tertiary);
}

/* ===== SISTEMA DE NAVEGACIÓN POR SECCIONES ===== */
section:not(.hero) {
  display: none;
  padding: 60px 10%;
  min-height: calc(100vh - var(--navbar-height));
}

section.active-section {
  display: block;
  animation: fadeInSection 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInSection {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-subtitle {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 0.9rem;
}

/* ===== SECCIÓN: SOBRE MÍ ===== */
#about {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#about p {
  max-width: 640px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.8;
}

/* ===== TARJETAS & GRIDS (PROYECTOS/ARTÍCULOS) ===== */
.project-card,
.article-card {
  background: var(--bg-secondary);
  padding: 28px;
  border-radius: var(--radius);
  transition: var(--transition);
  border: 1px solid transparent;
}

.project-card:hover,
.article-card:hover {
  background: var(--bg-tertiary);
  transform: translateY(-3px);
  border-color: var(--border);
}

.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 32px;
}

@media (min-width: 768px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== CONTROLES Y TABLAS DE DATOS ===== */
.controls {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
  margin: 32px 0 24px;
  flex-wrap: wrap;
}

.controls select {
  padding: 9px 14px;
  background: var(--bg-secondary);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a4d3e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.data-card {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.data-card ul {
  list-style: none;
}

.data-card li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.data-card li:last-child {
  border-bottom: none;
}

.data-card li span:last-child {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ===== FIXTURES MUNDIAL ===== */
.fixture-stage {
  margin-bottom: 48px;
}

.stage-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.match-card {
  background: var(--bg-secondary);
  padding: 20px 24px;
  border-radius: var(--radius);
  transition: var(--transition);
  border: 1px solid transparent;
  margin-bottom: 12px;
}

.match-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.match-teams {
  font-weight: 600;
}

/* ===== CAMISETAS / JERSEYS ===== */
.jersey-container {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  scrollbar-width: thin;
}

.jersey-card {
  flex: 0 0 auto;
  width: 220px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid transparent;
  transition: var(--transition);
}

.jersey-card:hover {
  background: var(--bg-tertiary);
  border-color: var(--border);
}

.jersey-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 12px;
}

/* ===== FOOTER REFORMADO ===== */
.footer-contacto {
  background-color: var(--bg-secondary);
  color: var(--fg);
  padding: 48px 10%;
  text-align: center;
  border-top: 1px solid var(--border);
}

.contacto-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0;
}

.btn-contacto,
.btn-cv {
  text-decoration: none;
  color: var(--fg);
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  transition: var(--transition);
  font-size: 0.85rem;
}

.btn-contacto:hover {
  background-color: var(--bg-tertiary);
  border-color: rgba(255, 255, 255, 0.35);
}

.btn-cv {
  background-color: #1a6ef5;
  border-color: #1a6ef5;
  font-weight: 600;
}

.btn-cv:hover {
  background-color: #1558cc;
  border-color: #1558cc;
}

.footer-contacto .copyright,
.footer-contacto>p:last-of-type,
.footer-contacto>p:nth-last-of-type(2) {
  font-size: 0.78rem;
  color: #666;
  margin-top: 6px;
}

/* ===== FADE IN ANIMATION ===== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================
   MEDIA QUERY: DISPOSITIVOS MÓVILES (<= 768px)
========================================== */
@media (max-width: 768px) {
  :root {
    --navbar-height: 64px;
  }

  section:not(.hero) {
    padding: 48px 6%;
  }

  .navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10%;
    height: var(--navbar-height);
    top: 0;
    position: sticky;
  }

  .hero {
    padding: 0 6%;
    text-align: left;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero .btn-row {
    justify-content: center;
  }

  /* Corrección: Grid de 2 columnas para mitigar los saltos de línea caóticos en móvil */
  .hero-meta {
    display: grid !important;
    grid-template-columns: max-content 1fr;
    gap: 16px 20px;
    align-items: center;
    text-align: left;
    width: 100%;
    margin-top: 32px;
  }

  .hero-meta-item {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 0;
  }

  .hero-meta-label {
    font-size: 12px;
    line-height: 1.3;
    margin-top: 0;
    margin-bottom: 0;
  }

  /* Menú desplegable hamburguesa por defecto */
  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    background: rgba(15, 15, 15, 0.97);
    backdrop-filter: blur(12px);
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    z-index: 999;
  }

  /* Enlaces individuales del menú */
  .nav-links a {
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    /* Un toque sutil de tracking para darle un aire más elegante */
    opacity: 0.6;
    /* Atenuación por defecto para no saturar la vista */
    transition: opacity var(--transition), color var(--transition);
    position: relative;
    padding: 6px 0;
  }

  .nav-links a:last-child {
    border-bottom: none;
  }

  /* Estados activos y hover */
  .nav-links a:hover,
  .nav-links a.active {
    opacity: 1;
    color: var(--fg);
  }

  /* Línea sutil de sección activa ajustada al nuevo espaciado */
  .nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
  }

  .nav-links.show {
    display: flex !important;
    flex-direction: column;
  }

  .nav-toggle {
    display: block;
  }

  .logo {
    width: 130px;
    height: 50px;
  }

  .logo-full {
    height: 50px;
  }

  .logo-icon {
    height: 35px;
  }

  .match-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .contacto-links {
    flex-direction: column;
    align-items: stretch;
  }

  /* Corrección: Forzar comportamiento horizontal fluido para los accesos del hero */
  .hero-mobile-nav.mobile-only {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    max-width: 100% !important;
    justify-content: flex-start !important;
    margin-top: 32px;
  }
}

/* ==========================================
   ENLACE DE REGRESO A SERVICIOS / IDIOMAS
========================================== */
.nav-home-link {
  color: var(--fg) !important;
  text-decoration: none;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.9rem;
  margin-right: 16px;
  display: inline-flex;
  align-items: center;
  transition: color var(--transition);
}

.nav-home-link:hover {
  color: var(--accent) !important;
}