/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* GENERAL */
body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0d1f44, #0a3d62);
  color: #ffffff;
  padding: 0;
}

/* Oculta el contenido principal mientras el loader está activo */
#main-content {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease;
}

/* Lo muestra una vez que termina el loader */
body.loaded #main-content {
  opacity: 1;
  visibility: visible;
}


/* === LOADER DE ENTRADA === */
#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 1s ease, visibility 1s ease;
}

#loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-logo {
  width: 120px;
  animation: pulse 2s infinite ease-in-out;
  filter: drop-shadow(0 0 10px #00bfff);
}

/* Efecto de latido/pulso */
@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.85; }
  100% { transform: scale(1); opacity: 1; }
}


h1, #searchBar {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Al mostrar */
body.loaded h1,
body.loaded #searchBar {
  opacity: 1;
  transform: translateY(0);
}


/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #03112a;
  backdrop-filter: blur(10px);
  padding: 15px 30px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-logo img {
  height: 90px;
  filter: drop-shadow(0 0 6px #00b4d8);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-logo h1 {
  font-size: 1.6em;
  color: #aadfff;
  font-weight: 600;
  text-shadow: 0 0 5px rgba(0, 180, 255, 0.3);
}


.nav-links {
  list-style: none;
  display: flex;
  gap: 25px;
}

.nav-links li a {
  text-decoration: none;
  color: #aadfff;
  font-weight: 500;
  transition: all 0.3s ease;
}

.nav-links li a:hover {
  color: #00b4d8;
  text-shadow: 0 0 6px #00b4d8;
}

/* TITULO Y BUSCADOR */
h1 {
  text-align: center;
  font-size: 2.5em;
  margin: 40px 0 20px;
}

#searchBar {
  display: block;
  margin: 0 auto 40px auto;
  padding: 15px;
  width: 80%;
  max-width: 500px;
  border-radius: 30px;
  border: none;
  font-size: 16px;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

#searchBar:focus {
  outline: none;
  box-shadow: 0 0 20px #00b4d8;
}

/* GRID TARJETAS */
.grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, auto);
  gap: 25px;
  padding: 0 80px 60px;
}

.card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 15px;
  padding: 20px;
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease, border 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  backdrop-filter: blur(10px);

  /* estado inicial para animación */
  opacity: 0;
  transform: translateY(20px) scale(1);
}

.card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(0, 200, 255, 0.15), transparent);
  transform: rotate(45deg);
  z-index: 0;
}

.card.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.card:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 12px 30px rgba(0, 200, 255, 0.4);
  border: 1px solid rgba(0, 200, 255, 0.3);
}


.card h2 {
  color: #ffffff;
  font-size: 1.3em;
  margin-bottom: 15px;
  z-index: 1;
  position: relative;
}

.card ul {
  list-style: none;
  z-index: 1;
  position: relative;
}

.card ul li {
  margin-bottom: 10px;
}

.card ul li a {
  text-decoration: none;
  color: #aadfff;
  font-size: 0.95em;
  transition: color 0.2s ease;
}

.card ul li a:hover {
  color: #00b4d8;
  text-decoration: underline;
}



/* FOOTER */
.footer {
  background: #03112a;
  padding: 40px 30px;
  color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-content {
  max-width: 1200px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-info {
  max-width: 500px;
  line-height: 1.6;
}

.footer-info h3 {
  margin-bottom: 15px;
  color: #00b4d8;
}

.footer-logo img {
  height: 150px;
  filter: drop-shadow(0 0 6px #00b4d8);
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav-links {
    flex-direction: column;
    gap: 10px;
  }

  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .grid-container {
    grid-template-columns: 1fr;
  }

  #searchBar {
    width: 90%;
  }

  .nav-logo img {
    height: 40px;
  }

  .footer-logo img {
    height: 60px;
  }
}

/* === ANIMACIÓN DETALLADA DE APARICIÓN DEL NAV === */
.navbar {
  transition: transform 0.4s ease-in-out, background-color 0.3s ease;
  will-change: transform;
}

.navbar.hide-nav {
  transform: translateY(-100%);
}

/* Ocultar contenido del navbar inicialmente (cuando reaparece) */
.navbar-content-hidden .nav-logo,
.navbar-content-hidden .nav-links li {
  opacity: 0;
  transform: translateY(-15px);
  transition: all 0.6s ease;
}

/* Mostrar contenido con animación */
.navbar-content-visible .nav-logo,
.navbar-content-visible .nav-links li {
  opacity: 1;
  transform: translateY(0);
}

/* Retrasos para animación escalonada de los links */
.nav-links li:nth-child(1) { transition-delay: 0.05s; }
.nav-links li:nth-child(2) { transition-delay: 0.15s; }
.nav-links li:nth-child(3) { transition-delay: 0.2s; }
.nav-links li:nth-child(4) { transition-delay: 0.25s; }
.nav-links li:nth-child(5) { transition-delay: 0.3s; }
