/* Minimal, reversible overrides for navbar transparency behavior.
   Purpose: Transparent at top (.navbar-dark-mode); semi-transparent when scrolled (.navbar-light-mode).
   Notes:
   - Do not remove/rename existing classes. We only override backgrounds based on existing JS-toggled classes.
   - If JS is disabled, the default Bootstrap .bg-white will apply; our rules only take effect with .navbar-*-mode classes.
*/

/* Smooth background transition */
.navbar {
  transition: background-color 200ms ease, backdrop-filter 200ms ease, box-shadow 200ms ease;
}

/* Top of page: make navbar fully transparent when in dark mode (initial state) */
.navbar.navbar-dark-mode {
  background-color: transparent !important; /* override .bg-white without touching the class */
  backdrop-filter: none;
  box-shadow: none;
}

/* On scroll: semi-transparent background for readability when in light mode */
.navbar.navbar-light-mode {
  background-color: rgba(255, 255, 255, 0.85) !important;
  /* Subtle blur for glass effect on supported browsers; degrades gracefully */
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  /* Light shadow to separate from content */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Optional: when content behind is very light (e.g., partners), keep it opaque enough */
.navbar.navbar-light-on-partners.navbar-light-mode {
  background-color: rgba(255, 255, 255, 0.92) !important;
}

/* Servicios: CTA y comportamiento móvil (mínimo y reversible) */
#carouselServices .interior-container.is-open .overlay-text { opacity: 1; }
#carouselServices .interior-container.is-open .imagen-interior { opacity: 0; }

/* Botón dentro del overlay (visible en todos los tamaños) */
#carouselServices .overlay-text .mas-info-btn {
  margin-top: 0.75rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.95rem;
  line-height: 1.2;
  border-radius: 999px;
  border-width: 1px;
}
#carouselServices .overlay-text .mas-info-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Enlace sutil de escritorio: esquina inferior derecha, oculto en móvil */
#carouselServices .mas-info-desk {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  background: rgba(255,255,255,0.85);
  color: #000;
  padding: 6px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  font-size: 0.9rem;
  line-height: 1.2;
  opacity: 0;
  transition: opacity .2s ease;
}
#carouselServices .interior-container:hover .mas-info-desk,
#carouselServices .interior-container:focus-within .mas-info-desk { opacity: 1; }
#carouselServices .mas-info-desk:focus-visible { outline: 2px solid #0d6efd; outline-offset: 2px; }

@media (max-width: 767.98px){
  #carouselServices .mas-info-desk { display: none !important; }
}

/* --- Sección de Videos (overrides mínimos y reversibles) --- */
#videos .video-js { border-radius: 8px; }
#videos .list-group-item { padding: 0; }
#videos .video-select { padding: 0.75rem 1rem; text-decoration: none; color: inherit; display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; }
#videos .video-select[aria-pressed="true"] { background-color: #eef4ff; font-weight: 600; }
#videos .video-select:focus-visible { outline: 2px solid #0d6efd; outline-offset: 2px; border-radius: 6px; }
#videos .video-thumb { width: 72px; height: 40px; object-fit: cover; border-radius: 4px; background: #e9ecef; display: block; }
#videos .video-title { display: block; font-size: 0.95rem; line-height: 1.2; }

/* Imágenes y videos fluidos (guideline) */
img, video { max-width: 100%; height: auto; }


/* Especialidades y contenido principal: justificar texto en los párrafos, sin afectar títulos */
#especialidades p,
#main-content p {
  text-align: justify !important;
}

@media (min-width: 768px) {
  #videos .list-group-item + .list-group-item { border-top: 1px solid rgba(0,0,0,0.075); }
}


/* Servicios: asegurar visibilidad del CTA dentro del overlay en móvil (mínimo y reversible) */
#carouselServices .overlay-text {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* mostrar el inicio del texto */
  overflow-y: auto; /* permite hacer scroll del contenido largo */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* suaviza el scroll en iOS */
}

@media (max-width: 767.98px) {
  #carouselServices .overlay-text {
    /* Ocupa el 90% de la pantalla en móviles, manteniendo scroll interno */
    width: 80vw;
    max-width: 90vw;
    height: 36vh;
    max-height: 90vh;
    padding-bottom: 16px; /* margen para que el sticky no tape contenido */
  }
  #carouselServices .overlay-text .mas-info-btn {
    position: sticky; /* el CTA permanece visible al hacer scroll */
    bottom: 0;
    align-self: center;
    background-color: rgba(0, 0, 0, 0.15); /* leve fondo para legibilidad sobre imagen */
    backdrop-filter: saturate(180%) blur(4px); /* mejora legibilidad; degrada bien */
  }
}

/* --- Navbar móvil elegante (overrides mínimos y reversibles) ---
   Objetivo: al abrir el botón .navbar-toggler (<=991.98px), mostrar un panel vertical limpio
   sin alterar la funcionalidad de Bootstrap ni los hooks existentes. */
@media (max-width: 991.98px) {
  /* Asegura que el panel se posicione relativo al contenedor del navbar */
  .navbar > .container { position: relative; }

  /* Panel colapsable: fondo sutil y elevación */
  .navbar .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    padding: 12px 16px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  }
  /* Mantener visibilidad durante la animación de Bootstrap */
  .navbar .navbar-collapse.collapsing,
  .navbar .navbar-collapse.show {
    display: block !important;
  }

  /* Disposición vertical elegante */
  .navbar .navbar-nav {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px;
    text-align: left;
  }
  .navbar .nav-item { padding: 0 !important; }
  .navbar .nav-link {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    color: inherit;
  }
  .navbar .nav-link:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
  }

  /* Dropdowns dentro del colapso: que fluyan en la columna */
  .navbar .dropdown-menu {
    position: static !important;
    float: none;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 4px 0 8px 0;
  }
  .navbar .dropdown-item {
    border-radius: 6px;
    padding: 10px 14px;
  }
}

/* Minimal, reversible overrides for navbar transparency behavior.
   Purpose: Transparent at top (.navbar-dark-mode); semi-transparent when scrolled (.navbar-light-mode).
   Notes:
   - Do not remove/rename existing classes. We only override backgrounds based on existing JS-toggled classes.
   - If JS is disabled, the default Bootstrap .bg-white will apply; our rules only take effect with .navbar-*-mode classes.
*/

/* Smooth background transition */
.navbar {
  transition: background-color 200ms ease, backdrop-filter 200ms ease, box-shadow 200ms ease;
}

/* Top of page: make navbar fully transparent when in dark mode (initial state) */
.navbar.navbar-dark-mode {
  background-color: transparent !important; /* override .bg-white without touching the class */
  backdrop-filter: none;
  box-shadow: none;
}

/* On scroll: semi-transparent background for readability when in light mode */
.navbar.navbar-light-mode {
  background-color: rgba(255, 255, 255, 0.85) !important;
  /* Subtle blur for glass effect on supported browsers; degrades gracefully */
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  /* Light shadow to separate from content */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Optional: when content behind is very light (e.g., partners), keep it opaque enough */
.navbar.navbar-light-on-partners.navbar-light-mode {
  background-color: rgba(255, 255, 255, 0.92) !important;
}

/* Servicios: CTA y comportamiento móvil (mínimo y reversible) */
#carouselServices .interior-container.is-open .overlay-text { opacity: 1; }
#carouselServices .interior-container.is-open .imagen-interior { opacity: 0; }

/* Botón dentro del overlay (visible en todos los tamaños) */
#carouselServices .overlay-text .mas-info-btn {
  margin-top: 0.75rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.95rem;
  line-height: 1.2;
  border-radius: 999px;
  border-width: 1px;
}
#carouselServices .overlay-text .mas-info-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Enlace sutil de escritorio: esquina inferior derecha, oculto en móvil */
#carouselServices .mas-info-desk {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  background: rgba(255,255,255,0.85);
  color: #000;
  padding: 6px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  font-size: 0.9rem;
  line-height: 1.2;
  opacity: 0;
  transition: opacity .2s ease;
}
#carouselServices .interior-container:hover .mas-info-desk,
#carouselServices .interior-container:focus-within .mas-info-desk { opacity: 1; }
#carouselServices .mas-info-desk:focus-visible { outline: 2px solid #0d6efd; outline-offset: 2px; }

@media (max-width: 767.98px){
  #carouselServices .mas-info-desk { display: none !important; }
}

/* --- Sección de Videos (overrides mínimos y reversibles) --- */
#videos .video-js { border-radius: 8px; }
#videos .list-group-item { padding: 0; }
#videos .video-select { padding: 0.75rem 1rem; text-decoration: none; color: inherit; display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: center; }
#videos .video-select[aria-pressed="true"] { background-color: #eef4ff; font-weight: 600; }
#videos .video-select:focus-visible { outline: 2px solid #0d6efd; outline-offset: 2px; border-radius: 6px; }
#videos .video-thumb { width: 72px; height: 40px; object-fit: cover; border-radius: 4px; background: #e9ecef; display: block; }
#videos .video-title { display: block; font-size: 0.95rem; line-height: 1.2; }

/* Imágenes y videos fluidos (guideline) */
img, video { max-width: 100%; height: auto; }

@media (min-width: 768px) {
  #videos .list-group-item + .list-group-item { border-top: 1px solid rgba(0,0,0,0.075); }
}


/* Servicios: asegurar visibilidad del CTA dentro del overlay en móvil (mínimo y reversible) */
#carouselServices .overlay-text {
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* mostrar el inicio del texto */
  overflow-y: auto; /* permite hacer scroll del contenido largo */
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch; /* suaviza el scroll en iOS */
}

@media (max-width: 767.98px) {
  #carouselServices .overlay-text {
    /* Ocupa el 90% de la pantalla en móviles, manteniendo scroll interno */
    width: 80vw;
    max-width: 90vw;
    height: 36vh;
    max-height: 90vh;
    padding-bottom: 16px; /* margen para que el sticky no tape contenido */
  }
  #carouselServices .overlay-text .mas-info-btn {
    position: sticky; /* el CTA permanece visible al hacer scroll */
    bottom: 0;
    align-self: center;
    background-color: rgba(0, 0, 0, 0.15); /* leve fondo para legibilidad sobre imagen */
    backdrop-filter: saturate(180%) blur(4px); /* mejora legibilidad; degrada bien */
  }
}

/* --- Navbar móvil elegante (overrides mínimos y reversibles) ---
   Objetivo: al abrir el botón .navbar-toggler (<=991.98px), mostrar un panel vertical limpio
   sin alterar la funcionalidad de Bootstrap ni los hooks existentes. */
@media (max-width: 991.98px) {
  /* Asegura que el panel se posicione relativo al contenedor del navbar */
  .navbar > .container { position: relative; }

  /* Panel colapsable: fondo sutil y elevación */
  .navbar .navbar-collapse {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    padding: 12px 16px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  }
  /* Mantener visibilidad durante la animación de Bootstrap */
  .navbar .navbar-collapse.collapsing,
  .navbar .navbar-collapse.show {
    display: block !important;
  }

  /* Disposición vertical elegante */
  .navbar .navbar-nav {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px;
    text-align: left;
  }
  .navbar .nav-item { padding: 0 !important; }
  .navbar .nav-link {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    color: inherit;
  }
  .navbar .nav-link:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
  }

  /* Dropdowns dentro del colapso: que fluyan en la columna */
  .navbar .dropdown-menu {
    position: static !important;
    float: none;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 4px 0 8px 0;
  }
  .navbar .dropdown-item {
    border-radius: 6px;
    padding: 10px 14px;
  }
}

/* A11y: enlace "Saltar al contenido" visible al enfocar */
.visually-hidden-focusable {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.visually-hidden-focusable:focus, .visually-hidden-focusable:active {
  position: static !important;
  width: auto; height: auto;
  margin: 0; overflow: visible; clip: auto;
  padding: 8px 12px;
  background: #0d6efd; color: #fff;
  border-radius: 6px;
  z-index: 10000;
}

/* Reduced motion helper */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}


/* --- Nosotros: diseño diferenciado para Misión/Visión y separación de Modelo/Valores --- */
/* Mobile-first; no dependencias nuevas; reversible. */
#mision-vision-valores .mv-split {
  margin-bottom: 0.5rem;
}
#mision-vision-valores .feature-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
#mision-vision-valores .feature-panel .pill-accent {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #4F5941; /* color existente en el proyecto */
}

@media (min-width: 768px) {
  #mision-vision-valores .mv-split { margin-bottom: 1rem; }
}

/* Card alignment tweaks for the new 3-column rows in this section */
#mision-vision-valores .service-card { height: 100%; }
#mision-vision-valores .service-card .service-icon { font-size: 1.6rem; color: #4F5941; }
#mision-vision-valores .service-card .service-title { margin-top: .5rem; margin-bottom: .5rem; font-weight: 600; }

/* --- Especialidades: asegurar fondo visible del submenú sobre el hero (mínimo y reversible) --- */
/* Objetivo: cuando el usuario abre "Especialidades" en páginas con clase .navbar-especialidades,
   el submenú tenga fondo blanco semitransparente para no perderse con el hero. */
.navbar-especialidades .dropdown-menu {
  background-color: rgba(255, 255, 255, 0.95) !important; /* fondo claro y legible */
  color: #2B3526;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 1050; /* por encima del hero si fuese necesario */
}
.navbar-especialidades .dropdown-item { color: #2B3526; }
.navbar-especialidades .dropdown-item:hover { background-color: rgba(0,0,0,0.04); color: #000; }

/* Mejora progresiva: si el navegador soporta :has(), aplicar un fondo semitransparente al navbar
   mientras el dropdown está abierto en modo oscuro (p. ej., en home al inicio) */
@supports selector(:has(*)) {
  .navbar.navbar-dark-mode:has(.dropdown-menu.show) {
    background-color: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  }
}

/* Nosotros: valores 2x2 y numeralia */
#mision-vision-valores .valores-grid .service-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem;
}
#numeralia .stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}
#numeralia .stat-value {
  font-size: clamp(1.5rem, 4.5vw, 2.25rem);
  font-weight: 700;
  color: #4F5941;
  line-height: 1.1;
}
#numeralia .stat-label {
  margin-top: .25rem;
  color: #475569;
  font-size: .95rem;
}
#quienes-somos-hoy .rounded-3 { background: linear-gradient(180deg, #f8fafc, #ffffff); }
#nuestro-enfoque .content-readable { max-width: 70ch; }
@media (min-width: 768px) {
  #nuestro-enfoque .content-readable { font-size: 1.05rem; }
}


/* --- Novedades: Reforma a la Ley Aduanera (overrides mínimos y reversibles) --- */
#main-content h2.h3 { margin-top: 1.5rem; }
#main-content h3.h5 { margin-top: 1rem; }
#main-content ul { padding-left: 1.25rem; }
#main-content li { margin: 0.25rem 0; }
.article-header .badge-soft { border: 1px solid rgba(13,110,253,0.2); }
.footnotes { padding-left: 1.25rem; }
.footnotes li { margin-bottom: 0.5rem; }

/* Hero de artículo en Novedades */
.article-hero { min-height: 220px; background-size: cover; background-position: center; background-repeat: no-repeat; }
.article-hero .hero-overlay { min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.55) 100%); }
@media (min-width: 768px){ .article-hero, .article-hero .hero-overlay { min-height: 280px; } }
@media (min-width: 1024px){ .article-hero, .article-hero .hero-overlay { min-height: 320px; } }

/* Fix hero stacking and attachment (blog entry behavior) */
.navbar.fixed-top { z-index: 1080; } /* ensure navbar is above hero/header */
.article-hero { background-attachment: scroll; } /* avoid perceived fixed background */
.article-header { position: relative; z-index: 1; }


/* Polyfill: Bootstrap 5.3 text-bg-*-subtle badges (for projects using <=5.2)
   Purpose: ensure subtle background badges are visible without upgrading Bootstrap.
   Scope: minimal and reversible; limited to .badge to avoid side effects. */
.badge.text-bg-primary-subtle { color: #084298; background-color: #cfe2ff; }
.badge.text-bg-secondary-subtle { color: #41464b; background-color: #e2e3e5; }


/* --- Navbar link color overrides (minimal, reversible) ---
   Ensure white links at top (dark mode) and dark links on scroll (light mode).
   We avoid touching vendor; relies on existing JS toggling .navbar-dark-mode/.navbar-light-mode.
*/
.navbar.navbar-dark-mode .nav-link { color: #ffffff !important; }
.navbar.navbar-dark-mode .nav-link:hover,
.navbar.navbar-dark-mode .nav-link:focus { color: #f1f1f1 !important; }


/* --- Novedades: Reforma a la Ley Aduanera (títulos/subtítulos en verde) ---
   Contexto: Solicitud para igualar estilo de títulos con otras páginas (.text-about-us).
   Alcance: Solo afecta al contenido del artículo de esta vista usando .novedad-aduanera.
   Reversible: eliminar este bloque.
*/
.novedad-aduanera h2.h3,
.novedad-aduanera h3.h5,
.novedad-aduanera p.fw-semibold {
  color: #4F5941; /* mismo tono que .text-about-us en web/css/styles.css */
}

.novedad-aduanera strong {
  color: #4F5941; /* mismo tono que subtítulos en novedades */
}



/* --- Descarga de PDF: estilos mínimos y reversibles ---
   Alcance: bloque de descarga en la página de la reforma (card, icono, botones).
   Degradación: si no carga este CSS, los elementos siguen siendo usables con estilos Bootstrap.
*/

/* Novedades: tarjetas de descarga de PDF más compactas y centradas */
.download-asset {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.download-asset .card-body {
  justify-content: center;
}

/* Centrar botón de descarga dentro de la tarjeta */
.download-asset .flex-fill {
  text-align: center;
}

.download-asset .icon-ring {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: #f1f3f5;
  display: grid;
  place-items: center;
  color: #dc3545; /* color típico de PDF/icono */
  font-size: 1.5rem;
}
/* Alinear con el verde de marca en el CTA principal solo dentro del artículo */
.novedad-aduanera .btn-success {
  background-color: #4F5941;
  border-color: #4F5941;
}
.novedad-aduanera .btn-success:hover,
.novedad-aduanera .btn-success:focus {
  background-color: #3d4533;
  border-color: #3d4533;
}
/* Mejorar foco visible sin !important */
.download-asset a.btn:focus-visible {
  outline: 3px solid rgba(13,110,253,0.35);
  outline-offset: 2px;
}


/* Utility: opt-out of animations for specific elements (minimal, reversible) */
.no-animate,
.no-animate * {
  animation: none !important;
  transition: none !important;
}
.no-animate,
.no-animate.animatable,
.no-animate.animated {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

/* Inicio: Home -> Videos: subtítulo Radar Informativo en verde (mínimo y reversible) */
#videos h2.h3 { color: #4F5941; }
/* Fin override */
