/* ==========================
   UNAM – Estilos globales
   Reutiliza este archivo en TODAS las páginas
   ========================== */

/* Variables de color */
:root {
  --azul-unam: #0033A0;
  --dorado-unam: #B38E5D;
  --gris-fondo: #f5f5f5;
}

/* Base */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
body {
  font-family: 'Roboto', sans-serif;
  margin: 0;
  background-color: #fff;
  color: #333;
}
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

/* ======= HEADER ======= */
header {
  color: #fff;
  text-align: center;
  padding: 1rem 0;
  position: relative;
  overflow: hidden;
  background-color: var(--azul-unam);

  /* Estampado UNAM con tinte azul */
  background-image:
    linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.1)),
    url("../images/unam.png");
  background-repeat: repeat;
  background-size: 120px auto;
  background-position: center;
  background-blend-mode: overlay;
}
header img {
  width: 260px;
  height: auto;
}

/* ======= NAV ======= */
nav {
  background-color: var(--dorado-unam);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.5rem;
}
nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 400;
}
nav a:hover { text-decoration: underline; }

/* ======= HERO ======= */
.hero {
  padding: 3rem 1rem;
  text-align: center;
  background-color: var(--gris-fondo);
}
.hero h1 { color: var(--azul-unam); }

/* ======= FRASE INSTITUCIONAL ======= */
.frase {
  position: relative;
  overflow: hidden;
  color: #fff;
  text-align: center;
  padding: 2rem 1rem;
  font-style: italic;
  background-color: var(--azul-unam);

  /* Estampado UNAM con mismo tinte que header */
  background-image:
    linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.1)),
    url("../images/unam.png");
  background-repeat: repeat;
  background-size: 120px auto;
  background-position: center;
  background-blend-mode: overlay;
}

/* ======= FOOTER ======= */
footer {
  background-color: #222;
  color: #eee;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
}
footer img {
  width: 80px;
  height: auto;
  margin-top: 1rem;
}
footer a {
  color: var(--dorado-unam);
  text-decoration: none;
}

/* Redes sociales en footer */
.socials {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  align-items: center;
}
.socials a {
  display: inline-block;
  width: 48px;
  height: 48px;
}
.socials img {
  max-width: 100%;
  max-height: 100%;
}

/* ======= RESPONSIVE ======= */
@media (max-width: 480px) {
  header img { width: 200px; }
  .socials a { width: 40px; height: 40px; }
}
header img,
footer img {
  display: block;
  margin: 0 auto;
}

/* Roboto local (WOFF2) */
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/roboto/roboto-300.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/roboto/roboto-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/roboto/roboto-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

html, body { font-family: 'Roboto', Arial, sans-serif; }


/* ======= Separadores más compactos en NAV ======= */
nav {
  background-color: var(--dorado-unam);
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0; /* elimina separación extra */
  padding: 0.5rem;
}

nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 400;
  padding: 0 0.25rem; /* espaciado compacto entre enlaces */
}

/* Separador | entre enlaces */
nav a:not(:last-child)::after {
  content: "|";
  color: #fff;
  margin-left: 0.25rem; /* espacio mínimo */
  font-weight: 300;
  opacity: 0.9;
}

/* Hover mantiene el blanco */
nav a:hover,
nav a:hover::after {
  color: #fff;
  opacity: 1;
}

/* === Mantener el formato original del nav pero con <ul><li> === */

/* El contenedor sigue igual, sólo aseguramos z-index para el dropdown */
#main-nav { position: relative; z-index: 2000; }

/* Poner la lista principal en fila, como antes estaban los <a> */
#main-nav .nav-list {
  list-style: none;
  margin: 0;
  padding: 0.05rem;                 /* igual que tu styles.css */
  display: flex;                   /* fila */
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;                          /* sin espacio extra entre items */
  background-color: var(--dorado-unam); /* mismo dorado del nav */
}

/* Cada item puede albergar submenú */
#main-nav .nav-list > li {
  position: relative;              /* para que sus submenús se posicionen */
}

/* Enlaces de primer nivel: mismos estilos que tu nav original */
#main-nav .nav-list > li > a {
  color: #fff;                     /* texto blanco */
  text-decoration: none;
  font-weight: 400;
  padding: 0 0.25rem;              /* espaciado compacto */
}

/* Separador "|" entre enlaces del primer nivel (como en styles.css) */
#main-nav .nav-list > li:not(:last-child) > a::after {
  content: "|";
  color: #fff;
  margin-left: 0.25rem;
  font-weight: 300;
  opacity: 0.9;
}

/* Hover del primer nivel: mantiene blanco y subraya como el original */
#main-nav .nav-list > li > a:hover {
  text-decoration: underline;
  color: #fff;
}

/* ===== Dropdown (sin alterar el formato del nivel superior) ===== */

#main-nav .submenu {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  position: absolute;
  display: none;                   /* oculto por defecto */
  min-width: 260px;
  top: 100%;                       /* cuelga bajo el padre */
  left: 0;
  background: var(--dorado-unam);  /* coherente con el nav */
  border: 2px solid var(--azul-unam);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.24);
  z-index: 3000;
}

/* Mostrar el nivel-1 al pasar por el padre */
#main-nav .has-submenu:hover > .submenu.level-1,
#main-nav .has-submenu:focus-within > .submenu.level-1 {
  display: block;
}

/* Nivel-2 a la derecha del item activo del nivel-1 */
#main-nav .submenu.level-1 li.has-submenu { position: relative; }
#main-nav .submenu.level-1 li.has-submenu > .submenu.level-2 {
  top: 0;
  left: 100%;
}
#main-nav .submenu.level-1 li.has-submenu:hover > .submenu.level-2,
#main-nav .submenu.level-1 li.has-submenu:focus-within > .submenu.level-2 {
  display: block;
}

/* Enlaces dentro de submenús (blancos; hover azul) */
#main-nav .submenu a {
  display: block;
  padding: 0.55rem 0.75rem;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
  transition: background-color .2s ease, color .2s ease;
}
#main-nav .submenu a:hover,
#main-nav .submenu a:focus {
  background: var(--azul-unam);
  color: #fff;
  outline: none;
}

/* Indicadores sutiles (no afectan separadores del top) */
#main-nav .nav-list > .has-submenu > a::after {
  content: " ▾";  /* flecha hacia abajo junto al separador */
  opacity: 0.9;
}
#main-nav .submenu .has-submenu > a::after {
  content: " ▸";  /* flecha a la derecha en submenú */
  float: right;
  opacity: 0.9;
}

/* Importante: sin separadores "|" dentro de submenús */
#main-nav .submenu a::after { content: none !important; }
