/* Variables CSS para colores, sombras y radios */
:root{
  --bg: #f4f4f4;
  --surface: #ffffff;
  --text: #333333;
  --muted: #666a73;
  --primary: #0056b3; /* azul corporativo */
  --primary-700: #00408a;
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --shadow-hover: 0 12px 30px rgba(0,0,0,.12);
  --radius: 14px;
  
  /* Colores de redes sociales */
  --facebook: #1877F2;
  --instagram: #E4405F;
  --twitter: #000000;
  --linkedin: #0A66C2;
}

/* Aplica box-sizing a todos los elementos para un layout predecible */
*{ box-sizing: border-box; }
/* Asegura que la página ocupe el 100% de la altura del viewport y scroll suave */
html, body{ 
  height: 100%; 
  scroll-behavior: smooth;
}

/* Compensación para el sticky header en anclas */
:target {
  scroll-margin-top: 85px;
}
#ultimas {
  scroll-margin-top: 85px;
}
/* Estilos base del documento: tipografía, color y fondo */
body{
  margin: 0;
  font-family: 'Roboto', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

/* Utilidades */
/* Contenedor centrado con ancho máximo fluido */
.container{
  width: min(1140px, 92vw);
  margin: 0 auto;
}

/* Estilos base para botones redondeados */
.btn{
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 0;
  padding: .75rem 1.5rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .25s ease;
}
/* Variante primaria del botón */
.btn-primary{
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover{ 
  background: var(--primary-700);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,86,179,0.25);
}

/* Header sticky */
/* Encabezado fijo con fondo translúcido y blur */
.site-header{
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,.95);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid #eaeaea;
  box-shadow: var(--shadow);
  transition: all .3s ease;
}
/* Distribución interna del header */
.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
/* Estilos de la marca (logo + texto) */
.brand{
  display: flex;
  align-items: center;
  text-decoration: none;
}
/* Dimensiones del logotipo */
.brand__logo{
  height: 48px; width: auto; object-fit: contain;
}

/* Navegación */
.site-nav{
  display: flex;
  align-items: center;
}
/* Lista de enlaces en línea */
.nav-list{
  display: flex; 
  align-items: center; 
  gap: 1.5rem;
  list-style: none; 
  margin: 0; 
  padding: 0;
}
/* Enlaces del menú con indicador animado */
.nav-list a{
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  padding: .5rem 0;
  position: relative;
  transition: color .25s ease;
}
.nav-list a:hover{
  color: var(--primary);
}
/* Subrayado animado en hover */
.nav-list a::after{
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .3s ease-out;
}
.nav-list a:hover::after{
  transform: scaleX(1);
  transform-origin: left;
}

/* Botones del header */
.nav-toggle,
.search-toggle{
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 1.25rem;
  padding: .5rem;
  cursor: pointer;
  border-radius: 8px;
  color: var(--text);
  transition: all .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-toggle:hover{
  background: rgba(0,0,0,.05);
  color: var(--primary);
}
/* Oculta el botón hamburguesa en escritorio */
.nav-toggle{ display: none; }

/* Barra de búsqueda (simulada) */
.search-bar{
  background: var(--surface);
  border-top: 1px solid #eee;
  overflow: hidden;
  transition: all .3s ease;
}
.search-inner{
  display: flex; gap: .75rem;
  padding: 1rem 0;
}
.search-bar input{
  flex: 1;
  padding: .75rem 1.25rem;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  outline: none;
  font-size: 1rem;
}
.search-bar input:focus{ border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,86,179,0.1); }

/* Hero destacada */
.hero{
  position: relative;
  min-height: 60vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: opacity 1.5s ease-in-out;
}
.hero.fade-out {
  opacity: 0;
}
.hero__image{
  position: absolute; inset: 0;
  background: url('https://images.unsplash.com/photo-1504384308090-c894fdcc538d?q=80&w=1920&q=95&auto=format&fit=crop') center/cover no-repeat;
  transform: scale(1.02);
  transition: background-image 1.5s ease-in-out;
  image-rendering: -webkit-optimize-contrast;
}
.hero__overlay{
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.4), rgba(0,0,0,.8));
}
.hero__content{
  position: relative;
  color: #fff;
  text-align: left;
  padding: 4rem 0;
  transition: transform 1.5s ease-in-out, opacity 1.5s ease-in-out;
}
.hero.fade-out .hero__content {
  transform: translateY(20px);
  opacity: 0;
}
.hero__title{
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin: 0 0 1rem;
  line-height: 1.1;
  font-weight: 700;
}
.hero__excerpt{
  max-width: 55ch;
  margin: 0 0 2rem;
  font-size: 1.15rem;
  color: rgba(255,255,255,0.9);
}

/* Secciones */
.section{
  padding: 5rem 0;
}
.section--alt{ background: #fff; }
.section__title{
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  margin: 0 0 2.5rem;
  position: relative;
  padding-bottom: .75rem;
}
.section__title::after{
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--primary);
  border-radius: 2px;
}

/* Contenedor Principal con Sidebar */
.content-wrapper {
  display: grid;
  grid-template-columns: 1fr 300px; /* Contenido principal y sidebar fijo en PC */
  gap: 3rem;
  align-items: start;
  margin-top: 2rem;
  margin-bottom: 5rem;
}

.main-content {
  padding: 0; /* Ajuste para el wrapper */
}

/* Sidebar de Publicidad */
.sidebar {
  background: var(--surface); /* Fondo blanco para un look limpio */
  padding: 1.5rem;
  border-radius: 15px; /* Esquinas redondeadas según pedido */
  box-shadow: 0 4px 15px rgba(0,0,0,0.05); /* Sombra tenue */
  border: 1px solid #f0f0f0; /* Borde sutil */
  position: sticky;
  top: 100px;
  max-width: 300px;
}

.sidebar__title {
  color: var(--primary); /* Título institucional */
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 0.75rem;
}

.ads-carousel {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5; /* Proporción para anuncios verticales */
  overflow: hidden;
  border-radius: 10px;
  background: #f9f9f9;
}

.ad-item {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s ease-in-out, visibility 1s ease-in-out; /* Fade elegante */
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-item.active {
  opacity: 1;
  visibility: visible;
}

.ad-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Recorte profesional */
  border-radius: 10px;
}

.ad-item:hover img {
  filter: brightness(1.05);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

/* Adaptación Móvil */
@media (max-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .sidebar {
    display: none; /* Ocultar sidebar en tablets/móviles para no apretar el contenido */
  }
}

/* Grilla de noticias (ajuste para el nuevo ancho) */
.news-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

/* Tarjetas */
.card{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.card:hover{
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
}
.card__media{
  position: relative;
  height: 200px; /* Altura fija para PC */
  overflow: hidden;
}
.card__media img{
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%; 
  object-fit: cover; /* Recorte profesional sin deformar */
  transition: transform .5s ease;
}
.card:hover .card__media img{
  transform: scale(1.05);
}
.card__body{
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card__title{
  font-size: 1.25rem;
  margin: 0 0 .75rem;
  line-height: 1.3;
}
.card__title a{
  color: var(--text); text-decoration: none;
  transition: color .2s ease;
}
.card:hover .card__title a{ color: var(--primary); }
.card__excerpt{
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  flex: 1;
}
.card__more{
  font-weight: 700; 
  text-decoration: none;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.card__more::after{
  content: "→";
  transition: transform .2s ease;
}
.card:hover .card__more::after{
  transform: translateX(4px);
}

/* Footer */
.site-footer{
  color: #fff;
  background: #0b1a2a;
  padding: 5rem 0 0;
}
.footer-inner{
  display: flex;
  flex-direction: column;
  gap: 4rem;
}
.footer-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
}
.footer-col h3{ 
  margin: 0 0 1.5rem; 
  font-size: 1.2rem;
  position: relative;
  padding-bottom: .5rem;
}
.footer-col h3::after{
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background: var(--primary);
}

/* Listas en footer */
.contact-list, .footer-links{
  list-style: none; padding: 0; margin: 0;
}
.contact-list li, .footer-links li{
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  color: rgba(255,255,255,0.8);
}
.contact-list i{ color: var(--primary); width: 20px; }
.contact-list a, .footer-links a{
  color: inherit;
  text-decoration: none;
  transition: all .2s ease;
}
.contact-list a:hover, .footer-links a:hover{
  color: #fff;
  padding-left: 4px;
}

/* Redes Sociales */
.socials{ 
  display: flex; 
  gap: 1rem; 
  flex-wrap: wrap;
}
.social-icon{
  width: 42px; 
  height: 42px; 
  display: flex; 
  align-items: center; 
  justify-content: center;
  color: #fff; 
  background: rgba(255,255,255,.1);
  border-radius: 50%; 
  text-decoration: none;
  font-size: 1.1rem;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
}
.icon-circle{
  display: flex;
  justify-content: center;
  align-items: center;
}
.icon-circle i{
  color: #ffffff;
  font-size: 1.2rem;
}
.social-icon:hover{
  transform: translateY(-5px);
  color: #fff;
}
.social-icon.facebook:hover { background: var(--facebook); }
.social-icon.instagram:hover { background: var(--instagram); }
.social-icon.twitter:hover { background: var(--twitter); }
.social-icon.linkedin:hover { background: var(--linkedin); }

/* Copyright */
.footer-copy{
  border-top: 1px solid rgba(255,255,255,.1);
  text-align: center;
  padding: 2rem 0;
  font-size: .9rem;
  color: rgba(255,255,255,0.6);
}
.footer-copy p{ margin: 0; }

/* Responsive menú móvil */
@media (max-width: 992px){
  .nav-toggle{ display: flex; }
  
  .site-nav{
    position: fixed;
    top: 72px;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border-bottom: 1px solid #eee;
  }
  
  .site-nav.open{
    max-height: 400px;
    padding: 1.5rem 0;
  }
  
  .nav-list{
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
  }
  
  .nav-list a{
    font-size: 1.1rem;
  }
  
  .header-actions{ margin-left: 0; }
  
  .footer-grid{ text-align: center; }
  .footer-col h3::after{ left: 50%; transform: translateX(-50%); }
  .contact-list li{ justify-content: center; }
  .socials{ justify-content: center; }
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(12px); /* Fondo desenfocado para enfoque total */
  -webkit-backdrop-filter: blur(12px);
  display: grid;
  place-items: center;
  padding: 1.5rem;
  transition: opacity .3s ease;
}
.modal[hidden]{ display: none !important; }
body.modal-open{ overflow: hidden; }

.modal__dialog{
  width: min(1000px, 100%); /* Modal más ancho para sección institucional */
  background: var(--surface);
  border-radius: var(--radius);
  position: relative;
  padding: 4rem; /* Padding interno de 40px o más */
  animation: modalIn .4s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.modal__content p {
  margin-bottom: 1.75rem;
  text-align: justify; /* Alineación justificada */
  line-height: 1.7; /* Interlineado profesional */
}

/* Metadatos en el modal */
.modal__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}
.modal__category {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal__separator {
  color: #ddd;
}

@keyframes modalIn{
  from{ transform: scale(0.9) translateY(20px); opacity: 0; }
  to{ transform: scale(1) translateY(0); opacity: 1; }
}

.modal__close{
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  width: 40px; height: 40px;
  border: 0; background: #f3f4f6; cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s ease;
  z-index: 10;
  font-size: 1.5rem;
  color: var(--text);
}
.modal__close:hover{ 
  background: var(--primary); 
  color: #fff;
  transform: rotate(90deg); 
}

.modal__title{ 
  margin: 0 0 1rem; 
  font-size: clamp(1.75rem, 4vw, 2.5rem); 
  color: var(--text); 
  line-height: 1.2;
  font-weight: 800;
}
.modal__figure {
  margin: 0 0 2.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  justify-content: center; /* Centrado horizontal */
}
.modal__figure img{ 
  width: auto;
  max-width: 70%; /* No a pantalla completa, margen visual limpio */
  max-height: 400px; /* Límite elegante en PC */
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

@media (max-width: 768px) {
  .modal__figure img {
    max-width: 100%; /* En móviles ocupa el ancho disponible */
    max-height: 250px;
  }
}

.modal__text {
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.8; /* Interlineado editorial para que el texto respire */
  max-width: 750px; /* Ancho máximo para legibilidad óptima */
  margin: 0 auto;
  text-align: left;
}

.modal__text p {
  margin-bottom: 1.75rem; /* Espaciado generoso entre párrafos */
}

.modal__text strong {
  color: var(--text);
  font-weight: 700;
}

.modal__text a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
  font-weight: 600;
}
/* Error message */
.error-message {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid #fee2e2;
  color: #ef4444;
}
