/* ==============================
   Variables globales
============================== */
:root {
  --bg-main: #1a1a1a;
  --bg-card: #222;
  --bg-dark: #111;
  --primary: #6ec1e4;
  --primary-hover: #57a7d9;
  --accent: #10b981;
  --accent-dark: #059669;
  --text-main: #f4f4f4;
  --text-muted: #aaa;
}

/* ==============================
   Estilos generales
============================== */
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
}

/* ==============================
   Header / Navbar
============================== */
header {
  position: fixed;
  width: 100%;
  top: 0;
  background-color: rgba(34,34,34,0.9);
  backdrop-filter: blur(10px);
  padding: 15px 0;
  z-index: 1000;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: auto;
  padding: 0 20px;
}

.logo {
  font-size: 28px;
  font-weight: bold;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 20px;
}

.nav-links a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: bold;
  position: relative;
}

/* línea animada */
.nav-links a::after {
  content: "";
  position: absolute;
  width: 0%;
  height: 2px;
  bottom: -5px;
  left: 0;
  background: var(--primary);
  transition: 0.3s;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a.active-link {
  color: var(--primary);
}

/* Biblioteca destacada */
.nav-links a[data-section="biblioteca"] {
  color: var(--accent);
}

/* ==============================
   Secciones
============================== */
.section {
  display: none;
  padding: 110px 20px 80px;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid #2a2a2a;
  animation: fadeIn 0.4s ease-in-out;
}

.section.active {
  display: block;
}

h2 {
  text-align: center;
  margin-bottom: 30px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==============================
   Inicio / Hero
============================== */
.hero-text {
  text-align: center;
}

.hero-text h2 {
  font-size: 2.5rem;
}

.hero-text p {
  font-size: 1.2rem;
}

/* Aviso destacado */
.aviso-destacado {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  padding: 20px;
  border-radius: 15px;
  margin: 25px auto;
  max-width: 400px;
  color: white;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

/* ==============================
   Avisos
============================== */
.avisos-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.aviso-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 15px;
  width: 280px;
  border-left: 5px solid var(--primary);
  transition: 0.3s;
}

.aviso-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.fecha {
  display: block;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==============================
   Botones
============================== */
.btn {
  padding: 12px 25px;
  border: none;
  border-radius: 30px;
  background: var(--primary);
  color: #1a1a1a;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

.btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

/* ==============================
   Artículos
============================== */
.articles {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.article-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 15px;
  width: 300px;
  text-align: center;
  transition: 0.3s;
}

.article-card:hover {
  transform: translateY(-5px);
}

.article-card img {
  width: 100%;
  border-radius: 10px;
}

/* ==============================
   Biblioteca
============================== */
.biblioteca-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.libro-card {
  background: var(--bg-card);
  padding: 20px;
  border-radius: 15px;
  width: 260px;
  text-align: center;
  transition: 0.3s;
}

.libro-card:hover {
  transform: scale(1.05);
}

/* Buscador */
#buscador-libros {
  width: 100%;
  max-width: 400px;
  padding: 12px;
  margin: 20px auto;
  border-radius: 25px;
  border: none;
  background: #333;
  color: var(--text-main);
  display: block;
  text-align: center;
}

/* ==============================
   Frase ajedrez
============================== */
.frase-ajedrez {
  font-style: italic;
  font-size: 1.2rem;
  margin: 20px 0;
  color: var(--primary);
}

/* ==============================
   Logo
============================== */
.logo-img {
  width: 280px;
}

/* ==============================
   Footer
============================== */
footer {
  text-align: center;
  padding: 20px;
  background-color: var(--bg-dark);
  margin-top: 50px;
}

/* ==============================
   NAVBAR MOBILE FIX FINAL PRO
============================== */
@media (max-width: 600px) {

  /* Header más compacto */
  header {
    padding: 6px 0;
  }

  .navbar {
    flex-direction: column;
    gap: 2px;
  }

  /* Logo del navbar */
  .logo {
    font-size: 18px;
  }

  /* Menú más compacto */
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 0;
    padding: 0;
  }

  .nav-links a {
    font-size: 11px;
    padding: 2px 4px;
  }

  /* Ajuste de espacio superior (CLAVE) */
  .section {
    padding: 75px 15px 60px;
  }

  /* Logo principal (inicio) */
  .logo-img {
    width: 150px;
    margin-top: 5px;
  }

}

/* ==============================
   Misión y Visión
============================== */

.intro-nosotros {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 30px auto;
  font-size: 1.1rem;
  color: #ccc;
}

.mision-vision-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.mv-card {
  background: #222;
  padding: 25px;
  border-radius: 15px;
  width: 320px;
  text-align: center;
  border: 1px solid #333;
  transition: transform 0.3s, box-shadow 0.3s;
}

.mv-card h3 {
  color: #10b981;
  margin-bottom: 10px;
  font-size: 1.4rem;
}

.mv-card p {
  font-size: 1rem;
  color: #ccc;
}

.mv-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}