/* --------------------------------------------------------------------------
   1. VARIABLES NATIVAS DE BOOTSTRAP 5 (PALETA TÉCNICA INDUSTRIAL)
   -------------------------------------------------------------------------- */
:root {
  /* Tipografía industrial y legible */
  --bs-body-font-family: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  /* Colores Principales (Agua, Infraestructura y Diagnóstico) */
  --bs-primary: #30638D;             /* Azul Marino Técnico / Profundo */
  --bs-primary-rgb: 48, 99, 141;
  --bs-secondary: #6C757D;           /* Gris Industrial */
  --bs-secondary-rgb: 108, 117, 125;
  --bs-info: #0284C7;                /* Azul Hidráulico */
  --bs-info-rgb: 2, 132, 199;
  --bs-success: #448344;             /* Verde Operativo */
  --bs-success-rgb: 68, 131, 68;

  /* Texto y Fondos Neutros */
  --bs-body-color: #0F172A;          /* Slate Oscuro */
  --bs-secondary-color: #475569;     /* Gris Técnico Metadatos */
  --bs-body-bg: #F8FAFC;             /* Gris Hidráulico Ultra Claro */
  --bs-border-color: #E2E8F0;        /* Límite Limpio */

  /* Radios Limpios */
  --bs-border-radius-sm: 0.25rem;
  --bs-border-radius: 0.375rem;
  --bs-border-radius-lg: 0.5rem;

  /* Sombras Precisas */
  --bs-box-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --bs-box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --bs-box-shadow-lg: 0 12px 20px -4px rgba(15, 23, 42, 0.12);
}

/* --------------------------------------------------------------------------
   2. RESET Y TIPOGRAFÍA
   -------------------------------------------------------------------------- */
body {
  color: var(--bs-body-color);
  font-family: var(--bs-body-font-family);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--bs-primary);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   3. UTILIDADES
   -------------------------------------------------------------------------- */
.text-primary-dark {
  color: var(--bs-primary);
}

.bg-primary {
  background-color: var(--bs-primary) !important;
}

.text-label-uppercase {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bs-success);
}

/* --------------------------------------------------------------------------
   6. BOTONES PERSONALIZADOS
   -------------------------------------------------------------------------- */
.btn-primary {
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
  color: #fff;
  font-weight: 600;
  border-radius: var(--bs-border-radius);
  padding: 0.6rem 1.2rem;
  transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out, filter 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  color: #fff;
  filter: brightness(0.85);
  box-shadow: 0 4px 8px rgba(var(--bs-primary-rgb), 0.25);
}

.btn-outline-primary {
  color: var(--bs-primary);
  border-color: var(--bs-primary);
  border-width: 2px;
  font-weight: 700;
  text-transform: uppercase;
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
  color: #fff;
  background-color: var(--bs-primary);
  border-color: var(--bs-primary);
}

/* --------------------------------------------------------------------------
   7. TARJETAS (ESTRUCTURA UNIFICADA SIN INVALIDAR BOOTSTRAP)
   -------------------------------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg, 0.5rem);
  background-color: #ffffff;
  box-shadow: var(--bs-box-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--bs-box-shadow-lg);
}

.card-body,
.card.p-4,
.card.p-4.p-xl-5 {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card h3, .card .h3,
.card h4, .card .h4,
.card h5, .card .h5 {
  font-family: inherit;
  color: var(--bs-primary);
  margin-bottom: 0.75rem;
}

.card p {
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--bs-secondary-color);
  margin-bottom: 1.25rem;
}

.card .mt-auto,
.card .border-top {
  margin-top: auto !important;
}

/* --------------------------------------------------------------------------
   8. IMÁGENES EN ARTÍCULO COMPLETO (PRODUCTO TÉCNICO)
   -------------------------------------------------------------------------- */

/* 8.1 Imagen General de Artículo Completo (Máximo 4/12 columnas) */
.com-content-article .item-image,
.com-content-article .com-content-article__image,
.com-content-article .item-image-fulltext {
  float: left;
  max-width: calc(100% * 4 / 12);
  width: auto;
  margin-right: 1.5rem;
  margin-bottom: 1rem;
  margin-top: 0.25rem;
}

.com-content-article .item-image img,
.com-content-article .com-content-article__image img,
.com-content-article .item-image-fulltext img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: var(--bs-border-radius-sm, 0.25rem);
}

/* 8.2 Imagen de Introducción (Tamaño Fijo Controlado) */
.com-content-article .item-image-intro {
  float: left;
  width: 240px;
  height: 240px;
  max-width: calc(100% * 4 / 12);
  margin-right: 1.5rem;
  margin-bottom: 1rem;
  margin-top: 0.25rem;
}

.com-content-article .item-image-intro img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #ffffff;
  padding: 0.25rem;
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-sm, 0.25rem);
  box-shadow: var(--bs-box-shadow-sm);
}

/* Bloque adyacente limitado a la altura exacta de la imagen de intro (240px) */
.intro-side-block {
  max-height: 240px;
  overflow: hidden;
  margin-bottom: 1rem;
}

/* En móviles (≤ 575.98px), como la imagen deja de flotar, liberamos la altura máxima */
@media (max-width: 575.98px) {
  .intro-side-block {
    max-height: none !important;
  }
}

/* Unificación Responsive para Móviles (≤ 575.98px) */
@media (max-width: 575.98px) {
  .com-content-article .item-image,
  .com-content-article .com-content-article__image,
  .com-content-article .item-image-fulltext,
  .com-content-article .item-image-intro {
    float: none;
    width: 100% !important;
    max-width: 100% !important;
    margin-right: 0;
    margin-bottom: 1.25rem;
  }

  .com-content-article .item-image-intro {
    height: auto !important;
  }

  .com-content-article .item-image-intro img {
    height: auto;
    max-height: 260px;
  }
}

/* --------------------------------------------------------------------------
   9. NOTICIAS – ESTILO PERIÓDICO
   -------------------------------------------------------------------------- */
.noticias-estilo-periodico .mod-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.noticias-estilo-periodico .mod-list > li {
  display: grid;
  grid-template-columns: 170px 1fr;
  grid-template-areas:
    "imagen titulo"
    "imagen texto"
    "imagen leer";
  column-gap: 1.25rem;
  row-gap: .45rem;
  align-items: start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--bs-border-color);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  will-change: transform;
}

.noticias-estilo-periodico .mod-list > li:last-child {
  border-bottom: none;
}

.noticias-estilo-periodico .mod-list > li:hover {
  transform: translateX(4px);
}

.noticias-estilo-periodico .newsflash-image {
  grid-area: imagen;
  margin: 0;
  overflow: hidden;
  border-radius: var(--bs-border-radius);
  background: var(--bs-tertiary-bg, #f5f5f5);
  box-shadow: var(--bs-box-shadow-sm);
}

.noticias-estilo-periodico .newsflash-image img {
  display: block;
  width: 170px;
  height: 120px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.noticias-estilo-periodico li:hover .newsflash-image img {
  transform: scale(1.06);
}

.noticias-estilo-periodico .newsflash-title {
  grid-area: titulo;
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.3;
  font-weight: 700;
}

.noticias-estilo-periodico .newsflash-title a {
  color: var(--bs-body-color);
  text-decoration: none;
  transition: color 0.25s;
}

.noticias-estilo-periodico .newsflash-title a:hover {
  color: var(--bs-primary);
}

.noticias-estilo-periodico .mod-list > li > p:not(.readmore) {
  grid-area: texto;
  margin: 0;
  color: var(--bs-secondary-color);
  font-size: .92rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.noticias-estilo-periodico .readmore {
  grid-area: leer;
  margin-top: .35rem;
}

.noticias-estilo-periodico .readmore .btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--bs-primary);
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: color 0.2s ease;
}

.noticias-estilo-periodico .readmore .btn:hover,
.noticias-estilo-periodico .readmore .btn:focus-visible {
  text-decoration: underline;
  color: var(--bs-primary);
}

/* --------------------------------------------------------------------------
   10. RESPONSIVE
   -------------------------------------------------------------------------- */

/* Tablets y pantallas medianas (≤991.98px) */
@media (max-width: 991.98px) {
  .form-sidebar-box iframe {
    min-height: 450px;
  }

  .navbar-toggler {
    border: 2px solid var(--bs-primary);
    background-color: transparent;
    padding: 0.4rem 0.6rem;
    border-radius: var(--bs-border-radius);
    transition: background-color 0.2s ease-in-out;
  }
  
  .navbar-toggler:hover,
  .navbar-toggler:focus {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    box-shadow: none;
  }
  
  .navbar-toggler .icon-menu {
    color: var(--bs-primary);
    font-size: 1.25rem;
  }
}

/* Móviles (≤768px) */
@media (max-width: 768px) {
  .noticias-estilo-periodico .mod-list > li {
    grid-template-columns: 1fr;
    grid-template-areas:
      "imagen"
      "titulo"
      "texto"
      "leer";
    row-gap: .8rem;
  }

  .noticias-estilo-periodico .newsflash-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .banner-hero {
    min-height: 450px;
  }
  
  .banner-main-logo {
    max-height: 120px;
  }
}

/* --------------------------------------------------------------------------
   11. ACCESIBILIDAD
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bs-primary);
  color: #fff;
  padding: 0.5rem 1rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 9999;
  border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
  transition: top 0.2s ease-in-out;
}

.skip-link:focus-visible {
  top: 0;
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .skip-link {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   12. ESTILOS DE IMPRESIÓN
   -------------------------------------------------------------------------- */
@media print {
  .navbar,
  .navbar-toggler,
  .skip-link,
  .form-sidebar-box,
  .btn,
  footer {
    display: none !important;
  }

  .banner-hero {
    min-height: auto !important;
    background: transparent !important;
    color: #000 !important;
  }

  .banner-glass-card {
    background: #fff !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    border: 1px solid #000 !important;
    color: #000 !important;
  }

  .noticias-estilo-periodico .mod-list > li {
    break-inside: avoid;
    page-break-inside: avoid;
    border-bottom: 1px solid #666;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }

  a {
    text-decoration: underline !important;
    color: #000 !important;
  }

  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
}