/* ========== 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) !important;
  color: var(--text-dark);
}

/* 👇 FIX MÓVIL: en celular Wix usa su propio viewport (más angosto que la
   pantalla real), así que 100vw / 100dvh NO coinciden con lo que se ve.
   El JS mide el área visible real y la publica en estas variables:
   --app-w / --app-h (tamaño) y --app-x / --app-y (posición).
   Mientras el JS no corre, se usan 100vw / 100dvh como respaldo. */

/* ========== 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. Solución: position: absolute +
   tamaño en unidades de viewport (vw / dvh). */
/* 👇 FIX: Wix inserta esta capa automáticamente y nos robaba los
   clics/hover. pointer-events:none deja pasar el mouse a través. */
[data-testid="colorUnderlay"] {
  pointer-events: none !important;
}

#bgGrid {
  position: absolute !important;
  top: calc(var(--app-y, 0px) + var(--gap) * 2) !important;
  left: calc(var(--app-x, 0px) + var(--gap) * 2) !important;
  width: calc(var(--app-w, 100vw) - var(--gap) * 4) !important;
  height: calc(var(--app-h, 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: var(--app-y, 0px) !important;
  left: var(--app-x, 0px) !important;
  width: var(--app-w, 100vw) !important;
  height: var(--app-h, 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. */
@media (max-width: 768px) {
  :root {
    --gap: 6px;
  }

  #stage {
    padding: 22px;
    overflow-y: auto;
  }

  /* Tarjeta más compacta y un poco más opaca para que el texto se lea
     bien sobre los vídeos y colores de fondo. */
  .card {
    padding: 26px 22px 22px;
    border-radius: 18px;
    max-width: 360px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow:
      0 4px 18px rgba(0, 0, 0, 0.08),
      0 18px 50px rgba(0, 0, 0, 0.14);
  }

  .card .logo {
    width: 118px;
    margin-bottom: 14px;
  }

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

  .card h1 {
    font-size: 26px;
    line-height: 1.05;
    letter-spacing: -0.4px;
    margin-bottom: 12px;
  }

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

  .card .cta {
    font-size: 10px;
    letter-spacing: 1px;
    padding: 8px 2px;
    gap: 8px;
    text-align: left;
  }

  .card .cta .icon {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  /* El texto extra ya no reserva espacio vacío: se despliega al tocar. */
  .card .cta-detail {
    min-height: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.4s ease, margin-top 0.4s ease;
  }

  .card .cta-detail.show {
    max-height: 120px;
    margin-top: 6px;
  }

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

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

  .card {
    padding: 22px 16px 18px;
  }

  .card .logo {
    width: 106px;
  }

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

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

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

/* ========== RESPONSIVE — MÓVIL EN HORIZONTAL (bajo, ancho) ========== */
@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;
  }
}
