/* Tipografía general y reseteo */
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #111;
  background-color: #fff;
}

/* Contenedor principal */
.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Header / Logo */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: #fff;
  border-bottom: 1px solid #ddd;
}

header .logo img {
  height: 60px;
}

/* Imagen destacada */
.hero {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  display: block;
}

/* -------- MENÚ MULTINIVEL FUNCIONAL -------- */

nav {
  position: relative;
  z-index: 100;
}

nav ul {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  background-color: #fff;
}

nav ul li {
  position: relative;
}

nav ul li a {
  display: block;
  padding: 1rem;
  text-decoration: none;
  color: #000;
  font-weight: 500;
  white-space: nowrap;
}

nav ul li:hover > a {
  background-color: #f2f2f2;
}

/* SUBMENÚS NIVEL 2 */
nav ul ul {
  position: absolute;
  top: 100%;
  left: 0;
  display: none;
  flex-direction: column;
  background-color: #fff;
  border: 1px solid #ddd;
  min-width: 220px;
  z-index: 200;
}

nav ul li:hover > ul {
  display: flex;
}

/* SUBMENÚS NIVEL 3 CON AJUSTE DINÁMICO IZQUIERDA */
nav ul ul ul {
  top: 0;
  left: 100%;
  margin-left: 1px;
  border-left: none;
}

nav ul li:hover > ul ul {
  left: 100%;
  right: auto;
}

@media screen and (min-width: 1025px) {
  nav ul li:hover > ul ul {
    transform: translateX(0);
  }

  nav ul li:hover > ul ul.right-edge {
    left: auto;
    right: 100%;
    transform: translateX(0);
  }
}


/* Corregimos desbordamiento */
header,
body {
  overflow: visible !important;
}

/* MOBILE */
@media (max-width: 1024px) {
  nav ul {
    flex-direction: column;
  }

  nav ul ul,
  nav ul ul ul {
    position: static;
    display: none;
    border: none;
  }

  nav ul li:hover > ul {
    display: block;
  }

  nav ul li a {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
  }

  header .logo {
    margin-bottom: 1rem;
  }
}


/* Footer */
footer {
  text-align: center;
  padding: 2rem 1rem;
  color: #666;
  font-size: 0.9rem;
  border-top: 1px solid #ddd;
  margin-top: 4rem;
}

/* Títulos */
h1, h2 {
  color: #003366;
}

.articulos-subcategoria {
  margin-top: 3rem;
  padding: 0 1rem;
}

.grid-articulos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.articulo-box {
  background-color: #f9f9f9;
  border-left: 4px solid #003366;
  padding: 1rem;
  border-radius: 6px;
  transition: background-color 0.3s;
}

.articulo-box:hover {
  background-color: #eef3f7;
}

.articulo-box a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.articulo-box h3 {
  margin-top: 0;
  color: #003366;
}

.articulo-box p {
  color: #555;
  font-size: 0.95rem;
}
/* Corrige el desbordamiento hacia la derecha en submenús de 3er nivel */
nav ul ul ul.right-edge {
  left: auto;
  right: 100%;
}

/* Tarjetas visuales para artículos relacionados */
.articulos-relacionados {
  margin-top: 3rem;
  padding: 0 1rem;
}

.grid-relacionados {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.tarjeta-articulo {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.tarjeta-articulo:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.tarjeta-articulo img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.tarjeta-articulo .contenido {
  padding: 1rem;
}

.tarjeta-articulo .contenido h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #003366;
}

.tarjeta-articulo .contenido p {
  margin: 0;
  font-size: 0.9rem;
  color: #555;
}
