/* ==========================================================================
   VIDRIERA CENTINELA — Estilos Personalizados
   Minimalismo arquitectónico + Glassmorphism + Transiciones suaves
   ========================================================================== */

/* Compensar la altura del header sticky al hacer scroll a un ancla */
section[id] {
  scroll-margin-top: 72px;
}

/* ==========================================================================
   1. EFECTO GLASSMORPHISM
   ========================================================================== */
.glass-hero {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
}

.glass-badge {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   2. SLIDESHOW DE BIENVENIDA (Hero Carousel)
   ========================================================================== */
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.1s ease-in-out, transform 6s ease-out;
  pointer-events: none;
}

.hero-slide.is-active {
  opacity: 1;
  transform: scale(1);
}

.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.4);
  transition: width 0.3s ease, background-color 0.3s ease;
  cursor: pointer;
}

.hero-dot.is-active {
  width: 28px;
  background: #38BDF8;
}

/* ==========================================================================
   3. CATÁLOGO DE PROYECTOS (Filtros y Tarjetas)
   ========================================================================== */
.filter-btn {
  padding: 0.55rem 1.15rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  background-color: #F8FAFC;
  border: 1px solid #E2E8F0;
  transition: all 0.22s ease;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: #0284C7;
  color: #0284C7;
}

.filter-btn.is-active {
  background-color: #0F172A;
  border-color: #0F172A;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.catalog-item {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Animación arquitectónica tipo cristal al cambiar de sección en el catálogo */
.catalog-section {
  transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease;
}

.catalog-section.is-leaving {
  opacity: 0;
  transform: scale(0.98) translateY(8px);
  filter: blur(6px);
  pointer-events: none;
}

.catalog-section.is-entering .catalog-item {
  opacity: 0;
  animation: glassCardReveal 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--stagger, 0ms);
}

@keyframes glassCardReveal {
  0% {
    opacity: 0;
    transform: translateY(24px) scale(0.94);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

/* Marca de agua sutil y difuminada del logo arriba de cada imagen del catálogo (solo en miniatura) */
.catalog-item .aspect-\[4\/3\] {
  position: relative;
}

.catalog-item .aspect-\[4\/3\]::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('../img/logo/logo-header.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 160px auto;
  opacity: 0.55;
  filter: blur(0.6px) drop-shadow(0 0 8px rgba(255, 255, 255, 0.92));
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.catalog-item:hover .aspect-\[4\/3\]::after {
  opacity: 0.35;
}

.catalog-item.is-hidden {
  display: none;
}

/* Overlay al hacer hover en cada tarjeta del catálogo */
.catalog-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.05) 0%,
    rgba(15, 23, 42, 0.45) 45%,
    rgba(15, 23, 42, 0.9) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.catalog-item:hover .catalog-overlay,
.catalog-item:focus-within .catalog-overlay {
  opacity: 1;
}

/* En pantallas táctiles (móviles), mantener visible el título inferior */
@media (hover: none) {
  .catalog-overlay {
    opacity: 1;
    background: linear-gradient(
      180deg,
      rgba(15, 23, 42, 0) 30%,
      rgba(15, 23, 42, 0.85) 100%
    );
  }
}

/* ==========================================================================
   4. LIGHTBOX MODAL (Entrada desde el fondo + Difuminado al cerrar)
   ========================================================================== */
#lightbox-modal {
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.36s ease, visibility 0.36s ease;
}

#lightbox-modal .lightbox-stage {
  opacity: 0;
  transform: scale(0.82) translateY(16px);
  filter: blur(6px);
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease,
    filter 0.4s ease;
}

#lightbox-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#lightbox-modal.is-open .lightbox-stage {
  opacity: 1;
  transform: scale(1) translateY(0);
  filter: blur(0);
}

#lightbox-modal.is-closing {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.34s ease, visibility 0.34s ease;
}

#lightbox-modal.is-closing .lightbox-stage {
  opacity: 0;
  transform: scale(0.93);
  filter: blur(12px);
  transition:
    transform 0.34s ease,
    opacity 0.32s ease,
    filter 0.34s ease;
}

/* Transición tipo carrusel lateral dentro del Lightbox */
.lightbox-media {
  will-change: transform, opacity;
}

.lightbox-media.slide-out-left {
  animation: lightboxSlideOutLeft 0.18s ease-in forwards;
}

.lightbox-media.slide-in-right {
  animation: lightboxSlideInRight 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.lightbox-media.slide-out-right {
  animation: lightboxSlideOutRight 0.18s ease-in forwards;
}

.lightbox-media.slide-in-left {
  animation: lightboxSlideInLeft 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes lightboxSlideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(-70px) scale(0.97);
  }
}

@keyframes lightboxSlideInRight {
  from {
    opacity: 0;
    transform: translateX(70px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes lightboxSlideOutRight {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(70px) scale(0.97);
  }
}

@keyframes lightboxSlideInLeft {
  from {
    opacity: 0;
    transform: translateX(-70px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ==========================================================================
   5. WIDGET DESPLEGABLE DE WHATSAPP (Solo Web / Desktop >= 768px)
   ========================================================================== */
.wa-widget {
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  transform-origin: bottom right;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.25s ease;
}

.wa-widget.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.wa-chat-bg {
  background-color: #ECE5DD;
  background-image: radial-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: 16px 16px;
}

/* ==========================================================================
   6. PANTALLA INTRO GIF (Pantalla Completa + Cortina hacia Arriba)
   ========================================================================== */
.intro-curtain {
  background: #ffffff;
  transform: translateY(0);
  transition: transform 0.85s cubic-bezier(0.77, 0, 0.175, 1);
  will-change: transform;
}

.intro-curtain.is-curtain-up {
  transform: translateY(-100%);
}

.intro-gif-enhance {
  image-rendering: high-quality;
  mix-blend-mode: multiply;
  filter: url(#gif-sharpen) brightness(1.09) contrast(1.12) saturate(1.06);
  -webkit-mask-image: radial-gradient(ellipse 94% 92% at 50% 50%, #000 84%, transparent 100%);
  mask-image: radial-gradient(ellipse 94% 92% at 50% 50%, #000 84%, transparent 100%);
}

/* ==========================================================================
   7. MODAL FLOTANTE SELECTOR DE TELÉFONO WHATSAPP
   ========================================================================== */
.wa-chooser-modal {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.wa-chooser-modal .wa-chooser-card {
  opacity: 0;
  transform: scale(0.9) translateY(14px);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}

.wa-chooser-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wa-chooser-modal.is-open .wa-chooser-card {
  opacity: 1;
  transform: scale(1) translateY(0);
}

/* ==========================================================================
   8. ANIMACIÓN DE LEVITACIÓN SUTIL PARA BOTÓN FLOTANTE DE WHATSAPP
   ========================================================================== */
a[aria-label="Chatear por WhatsApp con Vidriera Centinela"] {
  animation: waLevitate 4.8s ease-in-out infinite;
  will-change: transform, box-shadow;
}

a[aria-label="Chatear por WhatsApp con Vidriera Centinela"]:hover {
  animation-play-state: paused;
}

@keyframes waLevitate {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  25% {
    transform: translate3d(3px, -5px, 0) scale(1.03);
  }
  50% {
    transform: translate3d(0, -8px, 0) scale(0.98);
  }
  75% {
    transform: translate3d(-3px, -4px, 0) scale(1.04);
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* ==========================================================================
   9. TRANSICIÓN WIDESCREEN ENTRE SECCIONES (Izquierda -> 1.5s -> Derecha)
   ========================================================================== */
.page-transition-curtain {
  position: fixed;
  inset: 0;
  z-index: 95;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0F172A;
  transform: translateX(-100%);
  transition: transform 1.05s cubic-bezier(0.45, 0, 0.25, 1);
  will-change: transform;
  pointer-events: none;
}

html.is-trans-holding .page-transition-curtain,
.page-transition-curtain.is-instant {
  transform: translateX(0);
  transition: none !important;
  pointer-events: auto;
}

.page-transition-curtain.is-center {
  transform: translateX(0);
  transition: transform 1.05s cubic-bezier(0.45, 0, 0.25, 1);
  pointer-events: auto;
}

.page-transition-curtain.is-exit-right {
  transform: translateX(100%);
  transition: transform 1.05s cubic-bezier(0.45, 0, 0.25, 1);
  pointer-events: none;
}

.page-transition-bg {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  object-fit: cover;
  filter: blur(1.5px) brightness(0.95);
}

.page-transition-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.48) 0%,
    rgba(248, 250, 252, 0.32) 48%,
    rgba(15, 23, 42, 0.25) 100%
  );
}

.page-transition-logo {
  position: relative;
  z-index: 2;
  width: min(90vw, 780px);
  max-height: 46vh;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 32px rgba(15, 23, 42, 0.32));
}
