/* Smooth scrolling + base */
:root {
  --ease-luxe: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-luxe-out: cubic-bezier(0.23, 1, 0.32, 1);
  --dur-luxe: 400ms;
  --dur-luxe-slow: 480ms;
  --accent-gradient: linear-gradient(135deg, #ff5e14 0%, #ff8a3d 45%, #ffc078 100%);
  --header-bg: linear-gradient(180deg, rgba(28, 52, 82, 0.96) 0%, rgba(16, 38, 66, 0.92) 100%);
  --header-bg-scrolled: linear-gradient(180deg, rgba(22, 44, 72, 0.82) 0%, rgba(12, 28, 52, 0.78) 100%);
  --scroll-padding-top: 5.5rem;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--scroll-padding-top);
  font-size: 16px;
}

body {
  overflow-x: hidden;
}

body.bg-slate-50 {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 48%, #f1f5f9 100%) !important;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-guide-dash,
  .hero-guide-dash-v {
    animation: none !important;
  }

  .hero-pauta.is-current .hero-pauta-line {
    animation: none !important;
    transform: scaleX(1);
    opacity: 0.75;
  }

  .logo-preload {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

/* Custom scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #ff5e14 #0a1d37;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #e8ecf1;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff5e14, #c74712);
  border-radius: 999px;
  border: 2px solid #e8ecf1;
}

::-webkit-scrollbar-thumb:hover {
  background: #ff9900;
}

/* Logo: sin fondo opaco (requiere PNG con canal alfa en assets/logo.png) */
.site-logo {
  background: transparent !important;
  background-color: transparent;
  box-shadow: none;
}

/* Preloader */
.preloader {
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.preloader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.logo-preload {
  animation: logo-pulse 1.5s ease-in-out infinite;
}

/* Logo del loader: más compacto que el header */
#preloader .logo-preload {
  height: 2.125rem;
  width: auto;
  max-width: min(82vw, 150px);
  object-fit: contain;
}

@media (min-width: 640px) {
  #preloader .logo-preload {
    height: 2.375rem;
    max-width: 165px;
  }
}

@media (min-width: 768px) {
  #preloader .logo-preload {
    height: 2.5rem;
    max-width: 175px;
  }
}

@keyframes logo-pulse {
  0%,
  100% {
    opacity: 0.82;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

.preloader-bar {
  animation: bar-slide 1.1s ease-in-out infinite;
}

@keyframes bar-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(200%);
  }
}

/* Glassmorphism */
.glass-panel {
  background: rgba(10, 29, 55, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.form-glass-light {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

footer .glass-panel,
.bg-white .glass-panel {
  background: rgba(255, 255, 255, 0.12);
}

/* Header: vidrio + gradiente sutil (opacidad alta al inicio) */
#site-header.header-sticky {
  background: var(--header-bg) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: rgba(255, 255, 255, 0.14);
  transition:
    background var(--dur-luxe) var(--ease-luxe),
    box-shadow var(--dur-luxe) var(--ease-luxe),
    border-color var(--dur-luxe) var(--ease-luxe),
    backdrop-filter var(--dur-luxe) var(--ease-luxe);
}

/* Header shrink: barra más compacta, fondo más translúcido (sensación “ligera”) */
.header-sticky.is-scrolled {
  padding-top: 0;
  padding-bottom: 0;
  background: var(--header-bg-scrolled) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.header-stacked .header-sticky.is-scrolled {
  opacity: 0.98;
}

#site-header .header-inner-compact {
  transition: padding var(--dur-luxe) var(--ease-luxe), gap var(--dur-luxe) var(--ease-luxe);
}

.header-sticky.is-scrolled .header-inner-compact {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

@media (min-width: 1024px) {
  .header-sticky.is-scrolled .header-inner-compact {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

/* Logo: escala suave al hacer scroll */
#site-header .header-logo {
  transition:
    transform var(--dur-luxe) var(--ease-luxe),
    max-height var(--dur-luxe) var(--ease-luxe),
    height var(--dur-luxe) var(--ease-luxe);
  transform-origin: left center;
}

.header-sticky.is-scrolled .header-logo {
  transform: scale(0.92);
}

@media (max-width: 1023px) {
  .header-sticky.is-scrolled .header-logo {
    transform: scale(0.9);
  }
}

/* Títulos de sección principal: acento en gradiente (index) */
#features h2,
#servicios h2,
#testimonios h2,
#cursos h2 {
  position: relative;
}

#features h2::after,
#servicios h2::after,
#testimonios h2::after,
#cursos h2::after {
  content: '';
  display: block;
  width: 3.25rem;
  height: 3px;
  margin-top: 0.65rem;
  border-radius: 999px;
  background: var(--accent-gradient);
  opacity: 0.85;
}

#features h2.text-center::after,
#servicios h2.text-center::after,
#testimonios h2.text-center::after {
  margin-left: auto;
  margin-right: auto;
}

#cursos h2::after {
  margin-left: 0;
}

/* Tarjetas de servicio: base 3D + acento inferior en gradiente */
.service-card.tilt-card {
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
  backface-visibility: hidden;
  transition:
    box-shadow var(--dur-luxe-slow) var(--ease-luxe-out),
    border-color var(--dur-luxe) var(--ease-luxe),
    transform 0s;
  border-color: rgba(148, 163, 184, 0.35);
}

.service-card.tilt-card::before {
  content: '';
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--dur-luxe) var(--ease-luxe);
  pointer-events: none;
  z-index: 2;
}

.service-card.tilt-card:hover::before {
  opacity: 0.85;
}

.service-card.tilt-card:hover {
  box-shadow:
    0 22px 48px rgba(10, 29, 55, 0.1),
    0 0 0 1px rgba(255, 94, 20, 0.16);
  border-color: rgba(255, 138, 61, 0.32);
}

/* Button underline animation (menú principal y footer) */
.btn-underline {
  position: relative;
  overflow: hidden;
}

.btn-underline::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #ff9900);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s ease;
}

.btn-underline:hover::after,
.btn-underline:focus-visible::after {
  transform: scaleX(1);
}

/* Nav links: no double underline on rounded buttons — subtler */
.nav-link.btn-underline::after {
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
}

.footer-link.btn-underline::after {
  bottom: -1px;
}

/* Search panel expand */
.search-wrap.open .search-panel {
  max-width: min(70vw, 420px);
  opacity: 1;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

@media (max-width: 1023px) {
  .search-wrap.open .search-panel {
    max-width: min(85vw, 360px);
  }
}

/* Resultados del buscador global */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 220;
  width: min(100vw - 1.5rem, 420px);
  max-height: min(70vh, 380px);
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 29, 55, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.search-results[hidden] {
  display: none !important;
}

.search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.search-result-item {
  display: block;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.92);
  transition: background 0.15s ease;
}

.search-result-item:hover,
.search-result-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.search-result-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #f6b07a;
  line-height: 1.35;
}

.search-result-snippet {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.65);
}

.search-results-empty {
  margin: 0;
}

/* Megamenu glass */
#megamenu.glass-panel {
  background: rgba(10, 29, 55, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Hero: guías con líneas finas (pautas visuales) */
.hero-slide-guides {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  opacity: 0.9;
}

.hero-guides-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-guide-dash,
.hero-guide-dash-v {
  animation: hero-guide-march 20s linear infinite;
}

.hero-guide-dash--slow {
  animation-duration: 28s;
  animation-direction: reverse;
}

.hero-guide-dash--rev {
  animation-duration: 24s;
  animation-direction: reverse;
}

.hero-guide-dash-v--mid {
  animation-duration: 22s;
}

.hero-guide-dash-v--slow {
  animation-duration: 32s;
  animation-direction: reverse;
}

@keyframes hero-guide-march {
  to {
    stroke-dashoffset: -360;
  }
}

/* Pautas de tiempo (progreso por slide) */
.hero-pautas-wrap {
  opacity: 0.95;
}

.hero-pauta {
  position: relative;
  width: min(5.5rem, 24vw);
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.hero-pauta-line {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 94, 20, 0.35), rgba(255, 180, 100, 0.95), rgba(255, 153, 0, 0.85));
}

.hero-pauta.is-past .hero-pauta-line {
  animation: none;
  transform: scaleX(1);
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.42);
}

.hero-pauta.is-future .hero-pauta-line {
  animation: none;
  transform: scaleX(0);
  opacity: 1;
}

.hero-pauta.is-current .hero-pauta-line {
  animation: hero-pauta-progress var(--hero-slide-duration, 7s) linear forwards;
}

@keyframes hero-pauta-progress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* Hero slides stack */
.hero-slide {
  opacity: 0;
  transition: opacity 0.65s ease;
  z-index: 0;
}

.hero-slide.is-active {
  opacity: 1;
  z-index: 1;
}

/* Mismo tratamiento visual: slider hero y franjas parallax (filtro + velo navy) */
.hero-slide .hero-bg,
.parallax-strip > .parallax-bg {
  filter: brightness(0.62) contrast(1.02) saturate(0.92);
}

.hero-slide .hero-overlay,
.parallax-strip > .parallax-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-color: rgba(10, 29, 55, 0.78);
  pointer-events: none;
}

/* Parallax: fondos movidos por JS (sin transition en transform) */
.hero-slider .hero-bg.parallax-bg,
.parallax-strip .parallax-bg {
  will-change: transform;
  backface-visibility: hidden;
  transform-origin: center center;
}

/* Megamenú: puente de hover */
#megamenu {
  position: absolute;
}

/* Puente invisible en el hueco bajo el botón (26px = 8px originales + 18px adicionales) */
#megamenu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -26px;
  height: 26px;
}

/* Hero layered entrance */
.hero-slide.is-active .hero-layer {
  animation: layer-in 0.7s ease forwards;
}

.hero-slide.is-active .hero-layer:nth-child(1) {
  animation-delay: 0.05s;
}

.hero-slide.is-active .hero-layer:nth-child(2) {
  animation-delay: 0.22s;
}

@keyframes layer-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Float card subtle */
.float-card {
  animation: float-y 5s ease-in-out infinite;
}

@keyframes float-y {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* Feature / service icon transition */
.feature-icon i,
.service-icon-badge {
  transition: transform 0.35s ease, color 0.35s ease;
}

.service-card:hover .service-icon-badge {
  color: #ff9900;
  transform: translateY(-5px);
}

/* Gadget redes: retráctil (solo pestaña visible al colapsar) + paleta brand navy / orange */
/* El hijo es más ancho que el contenedor: hay que alinearlo al borde derecho; si no, overflow recorta la IZQUIERDA y solo se ve el panel claro (bug “pestaña blanca”). */
.social-gadget {
  position: fixed;
  right: 0;
  top: 50%;
  /* Por encima del gadget WhatsApp (230) para que la pestaña reciba clics en la esquina */
  z-index: 240;
  /* +220px hacia arriba respecto al centro vertical */
  transform: translateY(calc(-50% - 220px));
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: stretch;
  overflow: hidden;
  width: 2.75rem;
  max-width: calc(100vw - 0.5rem);
  border-radius: 0.75rem 0 0 0.75rem;
  box-shadow: -4px 6px 28px rgba(10, 29, 55, 0.28);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: width;
}

.social-gadget.is-open {
  width: min(17.25rem, calc(100vw - 0.5rem));
}

/* Cerrado: el panel no participa en el layout (evita capas invisibles que roban el clic al botón) */
.social-gadget:not(.is-open) .social-panel {
  display: none !important;
}

.social-gadget.is-open .social-panel {
  display: flex !important;
}

.social-gadget-inner {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 0 0 auto;
  width: max-content;
  min-height: 0;
  min-width: min-content;
}

.social-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.125rem;
  min-width: 13.25rem;
  padding: 0.75rem 0.5rem 0.75rem 0.875rem;
  background: linear-gradient(165deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px solid rgba(10, 29, 55, 0.1);
  border-right: none;
  border-radius: 0.75rem 0 0 0.75rem;
}

.social-panel-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: #0a1d37;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background-color 0.22s ease, color 0.22s ease;
}

.social-panel-link:hover {
  background: rgba(255, 94, 20, 0.1);
  color: #0a1d37;
}

.social-panel-link:focus-visible {
  outline: 2px solid #ff5e14;
  outline-offset: 2px;
}

.social-panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 9999px;
  background: linear-gradient(145deg, #0a1d37, #152a45);
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(10, 29, 55, 0.35);
}

.social-panel-text {
  letter-spacing: 0.01em;
}

.social-tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 2.75rem;
  min-height: 9.5rem;
  flex-shrink: 0;
  padding: 0.5rem 0.25rem;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  color: #fff;
  background: linear-gradient(180deg, #0a1d37 0%, #132a47 100%);
  border-radius: 0 0.65rem 0.65rem 0;
  box-shadow: inset 3px 0 0 #ff5e14;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.social-tab:hover {
  background: linear-gradient(180deg, #132a47 0%, #1a3554 100%);
  box-shadow: inset 3px 0 0 #ff9900;
}

.social-tab:focus-visible {
  outline: 2px solid #ff9900;
  outline-offset: 2px;
}

.social-tab-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-orientation: mixed;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  user-select: none;
  color: rgba(255, 255, 255, 0.95);
}

.social-tab-chevron {
  color: #ff9900;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-gadget.is-open .social-tab-chevron {
  transform: rotate(180deg);
}

@media (max-width: 639px) {
  .social-gadget.is-open {
    width: min(16.5rem, calc(100vw - 1rem));
  }

  .social-panel {
    min-width: 12rem;
    padding: 0.5rem 0.35rem 0.5rem 0.65rem;
  }
}

/* Bloque fijo inferior: botón scroll encima del gadget WhatsApp */
.floating-actions {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 230;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 0.75rem;
  pointer-events: none;
}

.floating-actions .wa-gadget {
  pointer-events: auto;
}

#wa-gadget .wa-gadget-logo {
  height: 2rem;
  width: auto;
  max-height: 2.25rem;
  max-width: 9rem;
  object-fit: contain;
  object-position: left center;
}

@media (min-width: 640px) {
  #wa-gadget .wa-gadget-logo {
    height: 2.25rem;
    max-height: 2.5rem;
  }
}

/* WA chat bubbles */
.wa-bubble {
  max-width: 85%;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  word-break: break-word;
}

.wa-bubble--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid #e2e2e2;
  color: #111;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
}

.wa-bubble--user {
  align-self: flex-end;
  background: #dcf8c6;
  color: #111;
  margin-left: auto;
}

#wa-messages {
  display: flex;
  flex-direction: column;
}

/* Scroll up visible */
.scroll-up-btn.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Footer smallest text baseline */
.footer-site {
  font-size: 13px;
}

.copyright-text {
  font-size: 11px;
}

.footer-menu-title {
  color: #ff5e14;
}

/* Blog — patrón sutil en hero */
.blog-hero-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* Touch targets min 44px where needed */
#menu-toggle,
#search-toggle,
.hero-dot {
  min-width: 44px;
  min-height: 44px;
}
