/* ========== RESET & VARIABLES ========== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --green: #74c278;
  --green-dark: #45b76c;
  --coral: #f27363;
  --orange: #f89b39;
  --purple: #912791;
  --yellow: #e6c131;
  --text-dark: #383838;
  --text-muted: #888;
  --card-bg: rgba(255, 255, 255, 0.96);
  --bg-bone: #e9e4dd;
  --gap: 12px;
  --radius: 13px;
  --font-title: 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  /* ── AJUSTA LA VELOCIDAD DE LAS TRANSICIONES DE CELDAS ── */
  --transition-push: 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* 👇 FIX: !important para ganarle a los estilos propios de Wix que
   podrían estar pisando esto (Wix inyecta su propio CSS en html/body). */
html,
body {
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;
  font-family: var(--font-body);
  background: var(--bg-bone);
  color: var(--text-dark);
}

/* ========== BACKGROUND GRID ==========
   👇 FIX: Wix envuelve el contenido inyectado en contenedores propios
   que suelen tener transform/filter/will-change aplicado. Eso hace que
   "position: fixed" deje de calcularse respecto a la pantalla y pase a
   calcularse respecto a ese contenedor (que puede tener tamaño 0 o
   estar recortado) — el fondo queda "enterrado" en vez de cubrir todo.

   Solución: usar position: absolute + tamaño en unidades de viewport
   (vw / dvh), que SIEMPRE se calculan contra la pantalla real sin
   importar qué ancestro tenga transform. Y top/left:0 con !important
   para anclarlo arriba a la izquierda pase lo que pase. */
/* 👇 FIX: Wix inserta esta capa automáticamente en el DOM de toda página,
   DESPUÉS de que tu código carga. Nos tapaba el fondo y nos robaba los
   clics/hover. pointer-events:none deja pasar el mouse "a través" de
   ella, y con eso alcanza (no hace falta z-index para el tapado visual,
   porque colorUnderlay pinta detrás del contenido normal de la página,
   pero SÍ hacía falta esto para que no bloquee el cursor). */
[data-testid="colorUnderlay"] {
  pointer-events: none !important;
}

#bgGrid {
  position: absolute !important;
  top: calc(var(--gap) * 2) !important;
  left: calc(var(--gap) * 2) !important;
  width: calc(100vw - var(--gap) * 4) !important;
  height: calc(100dvh - var(--gap) * 4) !important;
  box-sizing: border-box;
  z-index: 100002 !important;
}

.cell {
  position: absolute;
  border-radius: var(--radius);
  overflow: hidden;
  box-sizing: border-box;
  transition:
    left var(--transition-push),
    top var(--transition-push),
    width var(--transition-push),
    height var(--transition-push),
    box-shadow 0.8s ease,
    filter 0.8s ease;
  will-change: auto;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.045);
}

.cell.active {
  z-index: 5;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
  filter: brightness(1.05);
  will-change: transform;
}

.cell video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  /* ── AJUSTA LA VELOCIDAD DEL FUNDIDO DE VÍDEOS ── */
  transition: opacity 0.3s ease;
}

.cell.video {
  box-shadow: 0 5px 18px rgba(20, 28, 24, 0.16);
}

/* ========== CENTER CARD ==========
   👇 FIX: mismo criterio que #bgGrid, absolute + vw/dvh en vez de fixed + inset */
#stage {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100dvh !important;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100003 !important;
  pointer-events: none;
  padding: 20px;
  box-sizing: border-box;
}

.card {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(3.4);
  -webkit-backdrop-filter: blur(16px) saturate(3.4);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 20px;
  padding: 56px 40px 48px;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.06),
    0 20px 60px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(30px);
  animation: cardIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s forwards;
}

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card .logo {
  width: 180px;
  height: auto;
  margin-bottom: 20px;
}

.card .subtitle {
  font-weight: 400;
  font-size: 13px;
  color: var(--text-dark);
  letter-spacing: 0.3px;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.6s forwards;
}

.card h1 {
  font-weight: 600;
  font-family: var(--font-title);
  font-size: 46px;
  line-height: 0.9;
  letter-spacing: -0.5px;
  margin-bottom: 20px;
  color: var(--text-dark);
  opacity: 0;
  animation: fadeUp 0.6s ease 0.75s forwards;
}

.card .description {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.65;
  color: #666;
  margin-bottom: 28px;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.9s forwards;
}

.card .cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dark);
  text-decoration: none;
  padding: 12px 4px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s ease, color 0.3s ease;
  opacity: 0;
  animation: fadeUp 0.6s ease 1.05s forwards;
}

.card .cta:hover {
  border-bottom-color: var(--orange);
}

.card .cta .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--orange);
  color: var(--orange);
  font-size: 14px;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.card .cta:hover .icon {
  background: var(--orange);
  color: #fff;
}

.card .cta.is-active {
  border-bottom-color: var(--coral);
}

.card .cta.is-active .icon {
  background: var(--coral);
  border-color: var(--coral);
}

.card .cta-detail {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 420px;
  min-height: 53px;
  margin: 10px auto 0;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease;
}

.card .cta-detail.show {
  opacity: 1;
  visibility: visible;
}

.card .coming-soon {
  margin-top: 32px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--text-muted);
  opacity: 0;
  animation: fadeUp 0.6s ease 1.2s forwards;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== RESPONSIVE — TABLET / MÓVIL GRANDE (≤768px) ==========
   Coincide con MOBILE_BREAKPOINT en el JS: por debajo de este ancho el
   script arma un grid de 4 columnas apiladas en vertical en vez del de
   10×5 pensado para pantallas anchas, así que acompañamos con un margen
   exterior más chico y una tarjeta que respire mejor en formato angosto. */
@media (max-width: 768px) {
  :root {
    --gap: 8px;
  }

  #stage {
    padding: 16px;
    /* Si el contenido de la tarjeta llega a ser más alto que la pantalla
       (fuente del sistema agrandada, teclado, etc.) permitimos scroll en
       vez de recortarlo. */
    overflow-y: auto;
  }

  .card {
    padding: 34px 24px 30px;
    border-radius: 18px;
    max-width: 400px;
  }

  .card .logo {
    width: 130px;
    margin-bottom: 16px;
  }

  .card .subtitle {
    font-size: 12px;
    margin-bottom: 12px;
  }

  .card h1 {
    font-size: 27px;
    line-height: 1.05;
    margin-bottom: 16px;
  }

  .card .description {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 22px;
  }

  .card .cta {
    font-size: 10.5px;
    padding: 10px 2px;
  }

  .card .cta .icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .card .coming-soon {
    margin-top: 24px;
    font-size: 11px;
    letter-spacing: 3px;
  }
}

/* ========== RESPONSIVE — MÓVIL CHICO (≤380px, p.ej. iPhone SE) ========== */
@media (max-width: 380px) {
  .card {
    padding: 28px 18px 24px;
  }

  .card .logo {
    width: 110px;
  }

  .card h1 {
    font-size: 23px;
  }

  .card .description {
    font-size: 12.5px;
  }

  .card .cta-detail {
    font-size: 11px;
    min-height: 0;
  }
}

/* ========== RESPONSIVE — MÓVIL EN HORIZONTAL (bajo, ancho) ==========
   En landscape la altura disponible es chica; achicamos verticalmente
   la tarjeta y dejamos que el fondo siga cubriendo todo el viewport. */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
  .card {
    padding: 20px 28px;
    max-width: 460px;
  }

  .card .logo {
    width: 100px;
    margin-bottom: 10px;
  }

  .card .subtitle {
    margin-bottom: 8px;
  }

  .card h1 {
    font-size: 22px;
    margin-bottom: 10px;
  }

  .card .description {
    margin-bottom: 14px;
    font-size: 12px;
  }

  .card .coming-soon {
    margin-top: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
