/* 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;
  }
}

/* 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;
}
