/* ============================================================
   SOFTREK — DESIGN SYSTEM
   ============================================================
   Variables, reset, tipografía base y utilidades compartidas
   ============================================================ */

/* ============================================================
   FONT FACE — Averta (la fuente de la marca)
   ============================================================
   3 pesos × 2 estilos = 6 archivos locales en assets/fonts/.
   Mapeo de fallback (font-matching del browser):
     200/300        → Averta Light
     400/500        → Averta Regular
     600/700/800    → Averta Semibold
   font-display: swap evita FOIT (Flash of Invisible Text).
   ============================================================ */

@font-face {
  font-family: 'Averta';
  src: url('../assets/fonts/Averta-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Averta';
  src: url('../assets/fonts/Averta-LightItalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Averta';
  src: url('../assets/fonts/Averta-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Averta';
  src: url('../assets/fonts/Averta-RegularItalic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Averta';
  src: url('../assets/fonts/Averta-Semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Averta';
  src: url('../assets/fonts/Averta-SemiboldItalic.woff2') format('woff2');
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --max-width: 1280px;
  --side-padding: clamp(20px, 4vw, 56px);
  --bg: #f5f3ee;
  --ink: #0a0a1a;
  --muted: rgba(10, 10, 26, 0.55);
  --hairline: rgba(10, 10, 26, 0.12);
  --violet: #6300FF;
  --footer-bg: #06061a;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Averta', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  font-weight: 400;
}

/* Animaciones de entrada
   Al entrar al viewport, los elementos con [data-animate] o [data-animate-stagger]
   reciben la clase .is-visible (lo hace shared.js) y hacen fade-in + translateY.
   Stagger: cada hijo se desfasa 0.08s (hasta 8 hijos). */
[data-animate] {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}
[data-animate-stagger] > * {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
[data-animate-stagger].is-visible > * {
  opacity: 1;
  transform: translateY(0);
}
[data-animate-stagger].is-visible > *:nth-child(1) { transition-delay: 0s; }
[data-animate-stagger].is-visible > *:nth-child(2) { transition-delay: 0.08s; }
[data-animate-stagger].is-visible > *:nth-child(3) { transition-delay: 0.16s; }
[data-animate-stagger].is-visible > *:nth-child(4) { transition-delay: 0.24s; }
[data-animate-stagger].is-visible > *:nth-child(5) { transition-delay: 0.32s; }
[data-animate-stagger].is-visible > *:nth-child(6) { transition-delay: 0.40s; }
[data-animate-stagger].is-visible > *:nth-child(7) { transition-delay: 0.48s; }
[data-animate-stagger].is-visible > *:nth-child(8) { transition-delay: 0.56s; }

@media (prefers-reduced-motion: reduce) {
  [data-animate],
  [data-animate-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ============================================================
   NAV — Header glass premium + posicionamiento blindado
   ============================================================ */

nav.nav {
  position: fixed !important;
  top: 24px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  z-index: 9000 !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  transition:
    top 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.55s cubic-bezier(0.22, 1, 0.36, 1),
    background-color 0.45s ease,
    border-color 0.45s ease,
    box-shadow 0.45s ease,
    backdrop-filter 0.45s ease,
    -webkit-backdrop-filter 0.45s ease;
}

nav.nav:not(.is-bar) {
  background: rgba(255, 255, 255, 0.48);
  box-shadow:
    0 8px 32px rgba(10, 10, 26, 0.06),
    0 2px 6px rgba(10, 10, 26, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 14px 28px;
  border-radius: 999px;
  width: calc(100% - var(--side-padding) * 2);
  max-width: calc(var(--max-width) - var(--side-padding) * 2);
}

/* Bar mode — edge-to-edge transparente sobre hero oscuro */
nav.nav.is-bar {
  top: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 22px var(--side-padding);
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
nav.nav.is-bar .logo,
nav.nav.is-bar .nav-links a,
nav.nav.is-bar .nav-icons svg,
nav.nav.is-bar .menu-toggle { color: #ffffff; }
nav.nav.is-bar .nav-links a { opacity: 0.9; }
nav.nav.is-bar .nav-links a:hover,
nav.nav.is-bar .nav-links a.active { opacity: 1; }
nav.nav.is-bar .nav-links a.active::after { background: #ffffff; }

.logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  line-height: 0;
}
.logo img {
  height: 24px;
  width: auto;
  display: block;
  /* SVG es blanco; sobre fondos claros (nav glass) lo oscurecemos */
  filter: brightness(0);
  transition: filter 0.45s ease;
}
nav.nav.is-bar .logo img {
  /* Sobre hero oscuro el SVG queda en su color original (blanco) */
  filter: none;
}
.nav-links { display: flex; gap: 38px; list-style: none; }
.nav-links a {
  color: var(--ink); text-decoration: none;
  font-size: 14px; font-weight: 400; font-style: normal; opacity: 0.85;
  transition: color 0.45s ease, opacity 0.2s ease;
}
.nav-links a:hover { opacity: 1; }
.nav-links a.active { opacity: 1; }
.nav-links a.active::after {
  content: ''; display: block; width: 100%; height: 2px;
  background: var(--violet); margin-top: 6px; border-radius: 2px;
  transition: background 0.45s ease;
}
.nav-icons {
  display: flex; gap: 16px; align-items: center;
}
.nav-icons svg {
  width: 20px; height: 20px;
  color: var(--ink); opacity: 0.7;
  cursor: pointer; transition: color 0.45s ease, opacity 0.2s ease;
}
.nav-icons svg:hover { opacity: 1; }
/* Link wrapper alrededor del ícono de contacto: hereda color y sin underline */
.nav-icon-link {
  display: inline-flex; align-items: center;
  color: inherit; text-decoration: none;
}


/* ============================================================
   MOBILE MENU — Hamburguesa + Drawer premium
   ============================================================ */

.menu-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1010;
  position: relative;
  color: var(--ink);
}
.menu-toggle-lines {
  width: 22px;
  height: 16px;
  position: relative;
}
.menu-toggle-lines span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              top 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.2s ease;
}
.menu-toggle-lines span:nth-child(1) { top: 0; }
.menu-toggle-lines span:nth-child(2) { top: 7px; }
.menu-toggle-lines span:nth-child(3) { top: 14px; }
.menu-toggle.is-open .menu-toggle-lines span:nth-child(1) { top: 7px; transform: rotate(45deg); }
.menu-toggle.is-open .menu-toggle-lines span:nth-child(2) { opacity: 0; }
.menu-toggle.is-open .menu-toggle-lines span:nth-child(3) { top: 7px; transform: rotate(-45deg); }

.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 360px;
  height: 100vh;
  background: rgba(245, 243, 238, 0.85);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-left: 1px solid rgba(10, 10, 26, 0.08);
  z-index: 9005;
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 100px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  box-shadow: -20px 0 60px rgba(10, 10, 26, 0.15);
}
.mobile-menu.is-open { transform: translateX(0); }

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 26, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9004;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.mobile-menu-overlay.is-open { opacity: 1; pointer-events: auto; }

.mobile-menu-links {
  list-style: none; display: flex; flex-direction: column; gap: 4px; padding: 0; margin: 0;
}
.mobile-menu-links li {
  opacity: 0; transform: translateX(20px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-menu.is-open .mobile-menu-links li { opacity: 1; transform: translateX(0); }
.mobile-menu.is-open .mobile-menu-links li:nth-child(1) { transition-delay: 0.10s; }
.mobile-menu.is-open .mobile-menu-links li:nth-child(2) { transition-delay: 0.15s; }
.mobile-menu.is-open .mobile-menu-links li:nth-child(3) { transition-delay: 0.20s; }
.mobile-menu.is-open .mobile-menu-links li:nth-child(4) { transition-delay: 0.25s; }
.mobile-menu.is-open .mobile-menu-links li:nth-child(5) { transition-delay: 0.30s; }
.mobile-menu.is-open .mobile-menu-links li:nth-child(6) { transition-delay: 0.35s; }

.mobile-menu-links a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid rgba(10, 10, 26, 0.08);
  color: var(--ink); text-decoration: none;
  font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
  transition: color 0.2s ease, padding-left 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-menu-links a:hover { color: var(--violet); padding-left: 8px; }
.mobile-menu-links a::after {
  content: '→';
  color: rgba(10, 10, 26, 0.3);
  font-weight: 400;
  transition: color 0.2s ease, transform 0.3s ease;
}
.mobile-menu-links a:hover::after { color: var(--violet); transform: translateX(4px); }

.mobile-menu-footer {
  margin-top: auto; padding-top: 32px;
  border-top: 1px solid rgba(10, 10, 26, 0.08);
  display: flex; flex-direction: column; gap: 12px;
}
.mobile-menu-footer-label {
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: rgba(10, 10, 26, 0.55);
  margin-bottom: 4px;
}
.mobile-menu-footer a {
  color: var(--ink); text-decoration: none;
  font-size: 15px; font-weight: 600;
  transition: color 0.2s ease;
}
.mobile-menu-footer a:hover { color: var(--violet); }

body.menu-open { overflow: hidden; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-icons { display: none; }
  .menu-toggle { display: inline-flex; }
}


/* ============================================================
   CUSTOM CURSOR — Bolita violeta con glow + detección dark/light
   ============================================================ */

@media (hover: hover) and (pointer: fine) {
  body, body * { cursor: none !important; }
}

.custom-cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--violet);
  pointer-events: none;
  /* Z-index máximo para quedar por encima del widget de Chatwoot (que usa z muy altos) */
  z-index: 2147483646;
  transform: translate(-50%, -50%);
  opacity: 0.12;
  filter: blur(8px);
  transition:
    width 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease,
    background 0.4s ease;
  animation: cursor-glow-pulse 2s ease-in-out infinite;
  will-change: transform;
}

.custom-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--violet);
  pointer-events: none;
  /* Z-index máximo para quedar por encima del widget de Chatwoot */
  z-index: 2147483647;
  transform: translate(-50%, -50%);
  transition:
    width 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.4s ease,
    opacity 0.25s ease;
  will-change: transform;
}

.custom-cursor.on-dark { background: #ffffff; }
.custom-cursor-glow.on-dark { background: #ffffff; opacity: 0.10; }

@keyframes cursor-glow-pulse {
  0%, 100% { opacity: 0.12; filter: blur(8px); }
  50% { opacity: 0.20; filter: blur(10px); }
}

.custom-cursor.is-hover {
  width: 32px; height: 32px;
  background: transparent;
  border: 2px solid var(--violet);
}
.custom-cursor.is-hover.on-dark {
  background: transparent;
  border-color: #ffffff;
}

/* Sobre el botón blanco del CTA "Envíanos un mensaje" en las páginas de producto:
   el ring blanco se pierde sobre fondo blanco, así que volvemos al violeta de marca */
body:has(.interest-section .btn-primary:hover) .custom-cursor.is-hover {
  background: transparent;
  border-color: var(--violet);
}
body:has(.interest-section .btn-primary:hover) .custom-cursor-glow.is-hover {
  background: var(--violet);
}
.custom-cursor-glow.is-hover {
  width: 40px; height: 40px;
  opacity: 0.20;
}

.custom-cursor.is-click { width: 10px; height: 10px; }
.custom-cursor.is-text {
  width: 2px; height: 24px;
  border-radius: 2px;
}

.custom-cursor.is-hidden, .custom-cursor-glow.is-hidden { opacity: 0; }

@media (hover: none), (pointer: coarse) {
  .custom-cursor, .custom-cursor-glow { display: none !important; }
  body, body * { cursor: auto !important; }
}

@media (prefers-reduced-motion: reduce) {
  .custom-cursor-glow { animation: none; }
}


/* ============================================================
   IMAGE PLACEHOLDER — Para imágenes que aún no se han subido
   ============================================================ */

.img-placeholder {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 240px;
  background:
    radial-gradient(ellipse at center, rgba(99, 0, 255, 0.04) 0%, transparent 70%),
    var(--bg);
  border: 1.5px dashed rgba(10, 10, 26, 0.18);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: rgba(10, 10, 26, 0.45);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 24px;
  text-align: center;
  overflow: hidden;
}
.img-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(255, 106, 31, 0.06) 0%, transparent 60%);
  pointer-events: none;
}
.img-placeholder-icon {
  width: 32px; height: 32px;
  color: rgba(10, 10, 26, 0.35);
  position: relative;
  z-index: 1;
}
.img-placeholder-name {
  position: relative;
  z-index: 1;
  font-family: 'Averta', monospace;
  word-break: break-all;
  max-width: 100%;
}

[data-cursor-mode="dark"] .img-placeholder,
.footer .img-placeholder {
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.04) 0%, transparent 70%),
    rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.55);
}
[data-cursor-mode="dark"] .img-placeholder-icon,
.footer .img-placeholder-icon {
  color: rgba(255, 255, 255, 0.4);
}

img.failed-load { display: none; }


/* ============================================================
   TIPOGRAFÍA EDITORIAL — Regla universal
   ============================================================
   Titulares editoriales: regular base (400) + italic semibold (600)
   El italic siempre es MÁS pesado que el base.
   ============================================================ */

.hero-title, .product-title, .service-title, .project-title,
.package-name, .packages-title, .contact-title, .page-title,
.services-title {
  font-weight: 400;
  font-style: normal;
}

.hero-title .italic, .product-title .italic, .service-title .italic,
.project-title .italic, .package-name .italic, .packages-title .italic,
.contact-title .italic, .page-title .italic, .services-title .italic {
  font-style: italic;
  font-weight: 600;
}
.hero-title .strong, .product-title .strong, .service-title .strong,
.project-title .strong {
  font-weight: 400;
  font-style: normal;
}

/* ============================================================
   UTILIDADES GLOBALES
   ============================================================ */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--side-padding);
}

.eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(10, 10, 26, 0.55);
  position: relative;
  padding-top: 12px;
  margin-bottom: 18px;
}
.eyebrow::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 40px; height: 2px;
  background: var(--violet);
  box-shadow: 0 0 12px rgba(99, 0, 255, 0.3);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(10, 10, 26, 0.15);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 28px;
  border: 1px solid rgba(10, 10, 26, 0.12);
  border-radius: 999px;
  background: transparent;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.btn-ghost:hover {
  background: var(--ink);
  color: #fff;
  transform: translateY(-2px);
}


/* ============================================================
   CHATWOOT WIDGET — override del bubble flotante para usar el
   violeta de marca, mantener posición fija y permitir que el
   cursor custom pase por encima.
   ============================================================ */

.woot-widget-bubble,
.woot-widget-bubble.woot-elements--right,
.woot-widget-bubble.woot--bubble-holder {
  background: var(--violet) !important;
  position: fixed !important;
  bottom: 24px !important;
  right: 24px !important;
  z-index: 2147483640 !important;
}

.woot-widget-bubble:hover,
.woot-widget-bubble.woot-elements--right:hover {
  background: #4d00cc !important;  /* violeta un poco más oscuro */
  transform: scale(1.05);
}

/* Notification dot (badge de mensaje no leído) — mantén el rojo de Chatwoot */
.woot-widget-bubble .woot-widget--unread-count {
  /* default rojo, sin override */
}

/* Algunos themes de Chatwoot usan estos selectores adicionales */
.woot--bubble-holder { z-index: 2147483640 !important; }
