/**
 * ===================================================================
 * global.css
 * Variables de tema, tipografía base, Header, Navegación y Footer.
 * ===================================================================
 */

:root {
  --radius: 14px;
  --radius-sm: 9px;
  --verde: #2e8b57;
  --amarilla: #e0a800;
  --roja: #c0392b;
  --purpura: #8e44ad;
}

html[data-theme="dark"] {
  --bg: #0b1b29;
  --bg-elev: #112436;
  --bg-elev-2: #16304a;
  --bg-elev-3: #1c3a57;
  --line: rgba(237, 242, 246, 0.1);
  --text-hi: #edf2f6;
  --text-mid: #9fb2c2;
  --text-low: #64798c;
  --brand: #689ae4;
  --brand-dim: rgba(221, 227, 238, 0.16);
  --gold: #f2b705;
  --gold-dim: rgba(242, 183, 5, 0.14);
  --data-line: #5fd3c4;
  --verde: #4caf7d;
  --amarilla: #e8b13f;
  --naranja: #f39c12;
  --roja: #e05a4e;
  --purpura: #9b59b6;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
  --bg: #f4f6f9;
  --bg-elev: #ffffff;
  --bg-elev-2: #edf1f6;
  --bg-elev-3: #e3e9f0;
  --line: rgba(11, 37, 69, 0.11);
  --text-hi: #0b2545;
  --text-mid: #48607a;
  --text-low: #8398ac;
  --brand: #14356b;
  --brand-dim: rgba(20, 53, 107, 0.08);
  --gold: #c88f00;
  --gold-dim: rgba(200, 143, 0, 0.12);
  --data-line: #137a6b;
  --verde: #2e8b57;
  --amarilla: #c88f00;
  --naranja: #d35400;
  --roja: #c0392b;
  --purpura: #8e44ad;
  --shadow: 0 20px 50px rgba(15, 40, 70, 0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-hi);
  font-family: "IBM Plex Sans", sans-serif;
  transition: background 0.25s ease, color 0.25s ease;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }

/* ================= HEADER Y LOGOS ================= */
header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  gap: 20px;
  flex-wrap: wrap;
}

.logos-container {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  flex-wrap: wrap;
}

.instituciones-wrap { display: flex; align-items: center; gap: 25px; flex-wrap: wrap; }
.brand-group { display: flex; align-items: center; gap: 14px; }
.brand-text { font-size: 15px; line-height: 1.25; color: var(--text-hi); }
.main-sep { width: 1px; height: 70px; background: var(--line); }
.observatorio-wrap { display: flex; align-items: center; gap: 16px; }

.real-logo { object-fit: contain; display: block; }
.unam-logo { height: 100px; width: auto; }
.ii-logo { height: 50px; width: auto; }
.obs-logo { height: 95px; width: auto; }

.obs-text-block { display: flex; flex-direction: column; align-items: stretch; justify-content: center; }
.obs-t1 { font-size: 15px; font-weight: 600; color: var(--brand); letter-spacing: 0.05em; line-height: 1; font-family: "Fraunces", serif; }
.obs-t2 { font-size: 38px; font-weight: 800; color: var(--brand); line-height: 0.9; letter-spacing: -0.02em; margin-top: 2px; font-family: "Fraunces", serif; }
.obs-t3 { font-size: 38px; font-weight: 700; color: var(--brand); text-align: center; line-height: 1; margin-top: 4px; }
.obs-line { height: 2px; background: var(--gold); width: 100%; margin: 6px 0 4px; }
.obs-t4 { font-size: 20px; font-weight: 600; color: var(--brand); text-align: center; letter-spacing: 0.03em; }

/* Controles (Tema y Menú Móvil) */
.header-controls { display: flex; align-items: center; gap: 12px; }
.theme-toggle, .menu-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.theme-toggle:hover { color: var(--text-hi); border-color: var(--brand); transform: translateY(-2px); }
.menu-toggle { display: none; }

/* ================= NAVEGACIÓN ================= */
nav#mainnav {
  background: var(--brand);
  border-bottom: 2px solid var(--line);
}
html[data-theme="light"] nav#mainnav { background: var(--text-hi); }

.nav-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-link {
  padding: 16px 34px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  position: relative;
  transition: all 0.3s ease;
}
.nav-link:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.15);
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.08); border-radius: 8px 8px 0 0; }
.nav-link.active {
  color: #fff;
  border-bottom-color: var(--gold);
  background: linear-gradient(to top, var(--gold-dim), transparent);
  border-radius: 8px 8px 0 0;
}

/* ================= CONTENEDOR PRINCIPAL ================= */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: 60vh;
}
.page-head { padding: 38px 0 26px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 8px;
}
.page-title {
  font-family: "Fraunces", serif;
  font-size: clamp(26px, 3.4vw, 38px);
  font-weight: 600;
  color: var(--text-hi);
  margin-bottom: 10px;
  margin-top: 0;
}
.page-lede {
  font-size: 15px;
  color: var(--text-mid);
  max-width: 640px;
  line-height: 1.6;
  margin-top: 0;
}

/* ================= FOOTER MEJORADO ================= */
.site-footer {
  background: var(--bg-elev-2);
  border-top: 1px solid var(--line);
  padding: 50px 24px 20px;
  margin-top: 60px;
}
.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--line);
}
.footer-brand { display: flex; align-items: center; gap: 16px; }
.footer-logo { height: 60px; width: auto; object-fit: contain; }
.footer-brand-text strong { color: var(--text-hi); font-size: 16.5px; font-family: "Fraunces", serif; line-height: 1.2; }
.footer-brand-text span { color: var(--brand); font-size: 12.5px; font-weight: 700; letter-spacing: 0.05em; }

.footer-info p { color: var(--text-mid); font-size: 14px; line-height: 1.7; margin: 0; }
.footer-info strong { color: var(--text-hi); font-size: 15px; }

.footer-social p { color: var(--text-hi); font-size: 14px; font-weight: 600; margin: 0 0 14px 0; }
.social-icons { display: flex; gap: 14px; }
.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-elev);
  color: var(--text-hi);
  border: 1px solid var(--line);
  transition: all 0.3s ease;
}
.social-icons a:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transform: translateY(-4px);
  box-shadow: 0 10px 20px var(--brand-dim);
}

.footer-bottom {
  max-width: 1400px;
  margin: 0 auto;
  padding-top: 24px;
  text-align: center;
  color: var(--text-low);
  font-size: 12.5px;
}

/* ================= MEDIA QUERIES GLOBALES ================= */
@media (max-width: 1250px) {
  .logos-container { flex-direction: column; align-items: center; gap: 20px; text-align: center; }
  .main-sep { display: none; }
  .obs-t3 { text-align: center; }
}

@media (max-width: 850px) {
  .header-top { flex-direction: column; padding: 20px; position: relative; }
  .header-controls { position: absolute; top: 20px; right: 20px; }
  .menu-toggle { display: flex; color: var(--text-hi); }
  .nav-inner { display: none; flex-direction: column; align-items: stretch; padding: 10px; }
  .nav-inner.open { display: flex; }
  .nav-link { text-align: center; border-radius: 8px; border: none; }
  .nav-link.active { border-left: 4px solid var(--gold); background: rgba(255, 255, 255, 0.1); }
  
  header { position: relative !important; }
  
  .footer-content { grid-template-columns: 1fr; text-align: center; gap: 30px; }
  .footer-brand { flex-direction: column; justify-content: center; }
  .social-icons { justify-content: center; flex-wrap: wrap; }
  .footer-bottom { font-size: 13px; line-height: 1.6; padding: 24px 20px 0; }
  .footer-bottom p { margin: 0; }
}

@media (max-width: 600px) {
  .instituciones-wrap { flex-direction: column; align-items: center; gap: 16px; }
  .observatorio-wrap { flex-direction: column; align-items: center; }
  .obs-t2 { font-size: 26px; text-align: center; }
  .unam-logo { height: 75px; }
  .ii-logo { height: 45px; }
  .obs-logo { height: 75px; }
  .brand-text { display: none; }
}