/* ==========================================================================
   Variables y Estilos Globales
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  --metro-blue: #005a9c;
  --metro-dark: #0a2540;
  --metro-sky: #0099e6;
  --metro-orange: #f37021;
  --metro-light: #f4f8fc;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  max-width: 100%;
}

body, .font-body {
  font-family: var(--font-body) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading) !important;
  letter-spacing: -0.015em;
}

.header-scrolled {
  box-shadow: 0 4px 20px -2px rgba(10, 37, 64, 0.12) !important;
}

/* Fondo Hero degradado con la foto de tu fachada */
.hero-section {
  background: linear-gradient(135deg, rgba(10, 37, 64, 0.94) 0%, rgba(0, 90, 156, 0.88) 100%), 
              url('../img/fachada.webp');
  background-size: cover;
  background-position: center;
}

/* Sombra suave para tarjetas */
.card-feature {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.card-feature:hover {
  box-shadow: 0 16px 32px -8px rgba(0, 90, 156, 0.15);
}

/* Barra blanca superior no fija al deslizar en ninguna página */
#main-header {
  position: relative !important;
  top: auto !important;
}

/* Suavizado de transiciones */
a, button, input, select, textarea {
  transition: all 0.2s ease-in-out;
}

/* ==========================================================================
   Acordeón de Preguntas Frecuentes (FAQ)
   ========================================================================== */
.faq-item {
  transition: all 0.3s ease;
  cursor: pointer;
}

.faq-answer {
  max-height: 0;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              padding-bottom 0.25s ease,
              opacity 0.3s ease;
  opacity: 0;
}

.faq-item.active .faq-answer {
  max-height: 420px;
  padding-bottom: 1.15rem !important;
  pointer-events: auto;
  user-select: text;
  opacity: 1;
}

.faq-item.active .faq-chevron {
  transform: rotate(180deg);
  color: var(--metro-blue);
}

/* Gradiente azul a naranja para títulos destacados */
.text-gradient-blue-orange {
  background: linear-gradient(135deg, #005a9c 0%, #f37021 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

/* Transición suave para cambio de imágenes en el visor */
#facility-img {
  transition: opacity 0.25s ease-in-out;
}

/* ==========================================================================
   Animaciones Suaves y Scroll Reveal (Modern & Medical Grade)
   ========================================================================== */

/* Clases base para revelación al scroll */
.reveal-item {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1), 
              transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal-item.reveal-left {
  transform: translateX(-22px);
}

.reveal-item.reveal-right {
  transform: translateX(22px);
}

.reveal-item.reveal-scale {
  transform: scale(0.96);
}

/* Estado revelado al entrar en viewport */
.reveal-item.is-revealed {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Micro-interacción: Elevación y sombra al pasar el cursor (Hover) */
.card-hover-effect {
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease, 
              border-color 0.3s ease;
}

.card-hover-effect:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 32px -8px rgba(0, 90, 156, 0.15);
  border-color: rgba(0, 153, 230, 0.35) !important;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s ease,
              border-color 0.3s ease;
}

/* Efecto zoom suave en imágenes dentro de tarjetas */
.card-hover-effect .overflow-hidden img,
.img-zoom-hover {
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card-hover-effect:hover .overflow-hidden img,
.card-hover-effect:hover .img-zoom-hover {
  transform: scale(1.05);
}

/* Efecto de elevación en botones principales */
.btn-hover-lift {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
              background-color 0.2s ease;
}

.btn-hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(243, 112, 33, 0.35);
}

/* Pulso suave y elegante en el botón de WhatsApp flotante */
@keyframes pulse-whatsapp-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55), 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(37, 211, 102, 0), 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0), 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  }
}

.whatsapp-pulse-btn {
  animation: pulse-whatsapp-glow 2.4s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.whatsapp-pulse-btn:hover {
  animation: none;
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 28px -4px rgba(37, 211, 102, 0.45);
}

/* Entrada Hero secuencial al cargar */
@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-fade-1 {
  animation: heroFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.hero-fade-2 {
  animation: heroFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.25s both;
}

.hero-fade-3 {
  animation: heroFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}

.hero-fade-4 {
  animation: heroFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.55s both;
}

.hero-fade-5 {
  animation: heroFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
}

/* ==========================================================================
   Animaciones de Aparición Elegante para Páginas de Especialidades y Servicios
   ========================================================================== */
@keyframes subpageFadeUp {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.subpage-anim-1 {
  animation: subpageFadeUp 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
  will-change: opacity, transform;
}

.subpage-anim-2 {
  animation: subpageFadeUp 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
  will-change: opacity, transform;
}

.subpage-anim-3 {
  animation: subpageFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.32s both;
  will-change: opacity, transform;
}

.subpage-anim-4 {
  animation: subpageFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.46s both;
  will-change: opacity, transform;
}

/* Animación suave para menús desplegables de navegación */
@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-dropdown-panel {
  animation: dropdownSlideIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.nav-dropdown-open > .nav-dropdown-panel {
  display: block !important;
}

.nav-dropdown-open > a,
.nav-dropdown-open > button {
  color: var(--metro-blue) !important;
}

.nav-dropdown-open > a .fa-chevron-down,
.nav-dropdown-open > button .fa-chevron-down {
  transform: rotate(180deg);
  color: var(--metro-blue);
}

/* ==========================================================================
   Animación de Aparición Elegante: Barra Superior Azul y Barra Blanca
   ========================================================================== */
@keyframes topbarSlideDown {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes navLogoEnter {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes navItemEnter {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes navCtaEnter {
  from {
    opacity: 0;
    transform: translateX(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.topbar-entrance {
  animation: topbarSlideDown 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (max-width: 767px) {
  .topbar-entrance {
    display: none !important;
  }
}

#main-header nav a[href*="#nosotros"],
#mobile-menu a[href*="#nosotros"] {
  display: none !important;
}

#main-header > div > a:first-child {
  animation: navLogoEnter 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

#main-header nav > *:nth-child(1) {
  animation: navItemEnter 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.14s both;
}
#main-header nav > *:nth-child(2) {
  animation: navItemEnter 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.19s both;
}
#main-header nav > *:nth-child(3) {
  animation: navItemEnter 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.24s both;
}
#main-header nav > *:nth-child(4) {
  animation: navItemEnter 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.29s both;
}
#main-header nav > *:nth-child(5) {
  animation: navItemEnter 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.34s both;
}

#main-header > div > div.hidden.lg\:flex {
  animation: navCtaEnter 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.32s both;
}

@keyframes navCtaGreenWave {
  0% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3), 0 0 0 0 rgba(37, 211, 102, 0.65);
  }
  70% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3), 0 0 0 12px rgba(37, 211, 102, 0);
  }
  100% {
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3), 0 0 0 0 rgba(37, 211, 102, 0);
  }
}

#main-header > div > div.hidden.lg\:flex > a {
  animation: navCtaGreenWave 2.2s cubic-bezier(0.22, 1, 0.36, 1) 1s infinite;
}

#main-header > div > div.hidden.lg\:flex > a:hover {
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.48);
}

/* Accesibilidad: Respeto a usuarios con preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal-item,
  .subpage-anim-1,
  .subpage-anim-2,
  .subpage-anim-3,
  .subpage-anim-4 {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  .whatsapp-pulse-btn {
    animation: none !important;
  }
}

/* ==========================================================================
   SLIDER PREMIUM DE ESPECIALIDADES (3 TARJETAS SIMÉTRICAS)
   ========================================================================== */
.spec-slider-viewport {
  overflow: hidden;
  padding: 1.25rem 0.5rem 1.75rem;
  margin: -1.25rem -0.5rem -1.75rem;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.spec-slider-viewport.is-dragging,
.spec-slider-viewport.is-dragging a,
.spec-slider-viewport.is-dragging * {
  cursor: grabbing !important;
}

.spec-slider-viewport img,
.spec-slider-viewport a {
  -webkit-user-drag: none;
  user-select: none;
}

.spec-slider-track {
  display: flex;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.spec-slider-track.is-dragging {
  transition: none !important;
}

.spec-slide-item {
  flex: 0 0 100%;
  max-width: 100%;
  padding: 0 0.85rem;
  display: flex;
}

@media (min-width: 768px) {
  .spec-slide-item {
    flex: 0 0 50%;
    max-width: 50%;
  }
}

@media (min-width: 1024px) {
  .spec-slide-item {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
}

.spec-card-sym {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  border-radius: 30px;
  padding: 1.25rem 1.25rem 1.75rem;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 14px 35px -10px rgba(12, 32, 59, 0.07), 0 4px 14px -4px rgba(29, 99, 184, 0.04);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.35s ease;
}

.spec-card-sym:hover {
  transform: translateY(-8px);
  border-color: rgba(43, 147, 213, 0.45);
  box-shadow: 0 24px 48px -12px rgba(29, 99, 184, 0.16), 0 8px 20px -6px rgba(43, 147, 213, 0.1);
}

.spec-nav-btn {
  box-shadow: 0 10px 30px rgba(43, 147, 213, 0.22), 0 0 0 6px rgba(240, 249, 255, 0.85);
}

.spec-nav-btn:hover {
  box-shadow: 0 14px 34px rgba(29, 99, 184, 0.36), 0 0 0 8px rgba(224, 242, 254, 0.95);
}

.spec-dot {
  height: 10px;
  width: 10px;
  border-radius: 9999px;
  background-color: #cbd5e1;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}

.spec-dot.active {
  width: 32px;
  background-color: #2b93d5;
}

/* ==========================================================================
   SLIDER EDITORIAL DE SERVICIOS HOSPITALARIOS (DISEÑO DISTINTIVO Y SIMÉTRICO)
   ========================================================================== */
.srv-card-sym {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: #ffffff;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: 0 14px 35px -10px rgba(12, 32, 59, 0.07), 0 4px 14px -4px rgba(12, 32, 59, 0.04);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.35s ease;
}

.srv-card-sym:hover {
  transform: translateY(-8px);
  border-color: rgba(29, 99, 184, 0.38);
  box-shadow: 0 26px 52px -12px rgba(12, 32, 59, 0.15), 0 10px 24px -8px rgba(29, 99, 184, 0.12);
}

.srv-card-sym.is-active-unit {
  border-color: rgba(43, 147, 213, 0.55);
  box-shadow: 0 20px 44px -12px rgba(29, 99, 184, 0.16), 0 0 0 2px rgba(43, 147, 213, 0.18);
}

.srv-quick-tab {
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.srv-quick-tab.active {
  background: linear-gradient(135deg, #0c203b 0%, #1d63b8 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 8px 20px -4px rgba(29, 99, 184, 0.35);
}

.srv-dot {
  height: 8px;
  width: 14px;
  border-radius: 9999px;
  background-color: #cbd5e1;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}

.srv-dot.active {
  width: 38px;
  background: linear-gradient(90deg, #1d63b8 0%, #f07e13 100%);
}

/* ==========================================================================
   Menú Móvil Ejecutivo Ultra-Fluido (GPU Acelerado 60/120 FPS)
   ========================================================================== */
@keyframes mobileMenuSlideDown {
  from {
    opacity: 0;
    transform: translate3d(0, -10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes mobileMenuSlideUp {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  to {
    opacity: 0;
    transform: translate3d(0, -10px, 0);
  }
}

#mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 37, 64, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  will-change: opacity;
}

#mobile-menu-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

#mobile-menu-btn,
#mobile-menu-btn:focus,
#mobile-menu-btn:focus-visible,
#mobile-menu-btn:active,
#mobile-menu button,
#mobile-menu a {
  outline: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

#mobile-menu-btn {
  border-radius: 0.75rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

#mobile-menu-btn:active {
  background-color: rgba(29, 99, 184, 0.08);
}

@media (min-width: 768px) {
  #mobile-menu-btn,
  #mobile-menu-backdrop {
    display: none !important;
  }
}

#mobile-menu.metro-mobile-drawer {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 60;
  background: #ffffff;
  border-bottom: 1px solid rgba(226, 232, 240, 0.95);
  border-bottom-left-radius: 1.25rem;
  border-bottom-right-radius: 1.25rem;
  box-shadow: 0 20px 45px -10px rgba(10, 37, 64, 0.22);
  max-height: calc(100vh - 76px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translate3d(0, 0, 0);
  will-change: transform, opacity;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  animation: mobileMenuSlideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

#mobile-menu.metro-mobile-drawer.is-closing {
  animation: mobileMenuSlideUp 0.18s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
  pointer-events: none;
}

.mob-menu-item-anim {
  opacity: 1;
}

.mob-acc-panel.is-open .mob-acc-inner a {
  opacity: 1;
}

.mob-acc-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
  opacity: 0;
}

.mob-acc-panel.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.mob-acc-inner {
  overflow: hidden;
}

.mob-acc-trigger.is-open {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1d63b8;
}

.mob-acc-trigger.is-open .mob-acc-chevron {
  transform: rotate(180deg);
  color: #1d63b8;
}

/* ==========================================================================
   En teléfonos: Ocultar el botón flotante de WhatsApp y ajustar botón Subir
   ========================================================================== */
@media (max-width: 767px) {
  /* Barra superior blanca fijada (sticky) exclusivamente en teléfonos */
  #main-header {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 50 !important;
    background-color: #ffffff !important;
    box-shadow: 0 4px 18px -4px rgba(10, 37, 64, 0.1) !important;
  }

  a.whatsapp-pulse-btn,
  a.whatsapp-pulse,
  a.fixed[href*="wa.me"],
  a[aria-label="Contactar por WhatsApp"],
  a[aria-label="WhatsApp"].fixed {
    display: none !important;
  }

  #back-to-top {
    width: 2.35rem !important;
    height: 2.35rem !important;
    font-size: 0.8rem !important;
    bottom: 1.1rem !important;
    right: 1rem !important;
  }

  /* Reducir espacio vacío entre la barra blanca (#main-header) y el cuadro de Atención Médica (#inicio / Hero) en teléfonos */
  #inicio,
  #main-header + section {
    padding-top: 1.5rem !important;
    padding-bottom: 2.75rem !important;
    min-height: auto !important;
  }

  /* Reducir espacio en blanco entre la foto de la clínica (#nosotros) y #especialidades en teléfonos */
  #nosotros {
    padding-bottom: 2rem !important;
  }

  #especialidades {
    padding-top: 2.25rem !important;
    padding-bottom: 2.25rem !important;
  }

  #servicios {
    padding-top: 2.25rem !important;
  }

  /* Cuadrícula simétrica de 2 columnas para los botones de servicios en teléfonos */
  #srv-quick-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.6rem !important;
  }

  #srv-quick-tabs .srv-quick-tab {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 0.65rem 0.5rem !important;
  }

  #srv-quick-tabs .srv-quick-tab:last-child {
    grid-column: span 2 / span 2 !important;
  }

  /* Evitar que el breadcrumb flotante se desborde en teléfonos angostos (320px - 360px) */
  .subpage-anim-2 {
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Flechas laterales del carrusel de especialidades más discretas en teléfonos para no tapar el texto */
  #spec-prev-btn,
  #spec-next-btn {
    width: 2.35rem !important;
    height: 2.35rem !important;
  }
}