/* ============================================================
   VECINDO — Ventana "Muy pronto" + preregistro (prelanzamiento)
   Solo se carga/activa cuando window.VECINDO_PRELAUNCH === true.
   Usa EXCLUSIVAMENTE tokens de vecindo.css (cero hex a mano).
   Escritorio: diálogo centrado. Celular (<560px): hoja inferior.
   ============================================================ */

/* Velo oscuro + centrado del diálogo */
.mp-velo {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--verdin) 55%, transparent);
  display: grid;
  place-items: center;
  padding: var(--e-4);
  z-index: 1000;
  animation: mp-aparece 0.2s ease-out;
}
.mp-velo[hidden] { display: none; }

.mp-dlg {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--superficie-alta);
  border-radius: var(--radio-tarjeta);
  padding: var(--e-8) var(--e-6) var(--e-6);
  box-shadow: var(--sombra-flotante);
  animation: mp-sube 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  text-align: center;   /* todo el diálogo centrado; el formulario re-alinea a la izquierda */
}

/* El contenido del formulario SÍ va alineado a la izquierda (etiquetas y campos). */
.mp-form { text-align: left; }

.mp-cerrar {
  position: absolute;
  top: var(--e-3);
  right: var(--e-3);
  width: 40px;
  height: 40px;
  border-radius: var(--radio-pildora);
  border: 0;
  background: transparent;
  color: var(--texto-suave);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.mp-cerrar:hover { background: var(--cal); }
.mp-cerrar svg { width: 20px; height: 20px; }

/* Edificio con ventanas que se encienden */
.mp-edif {
  width: 116px;
  margin: 0 auto var(--e-4);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mp-techo {
  width: 100%;
  height: 10px;
  background: var(--verdin);
  border-radius: 6px 6px 0 0;
}
.mp-fachada {
  width: 100%;
  background: var(--cal);
  border: 3px solid var(--verdin);
  border-top: 0;
  padding: var(--e-2) var(--e-2) var(--e-3);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.mp-v {
  aspect-ratio: 3 / 4;
  border-radius: 3px;
  background: var(--junta);
  transition: background 0.5s, box-shadow 0.5s;
}
.mp-v.on { background: var(--aviso); }
.mp-v.tuya {
  background: var(--accion);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accion) 30%, transparent);
}
.mp-puerta {
  width: 26px;
  height: 16px;
  background: var(--verdin);
  border-radius: 8px 8px 0 0;
  margin-top: -1px;
}
.mp-buganv { display: flex; gap: 4px; margin-top: -6px; }
.mp-buganv i {
  width: 10px;
  height: 10px;
  border-radius: var(--radio-pildora);
  background: var(--accion);
  opacity: 0.85;
}
.mp-buganv i:nth-child(2) { background: var(--jade); }

.mp-logo {
  display: block;
  height: 34px;
  width: auto;
  margin: 0 auto var(--e-4);
}
.mp-ceja {
  display: block;
  text-align: center;
  font-size: var(--t-xs);
  font-weight: var(--peso-semi);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--jade);
  margin-bottom: var(--e-1);
}
.mp-dlg h2 {
  font-family: var(--fuente-display);
  font-weight: var(--peso-extra);
  font-size: var(--t-xl);
  line-height: var(--interlinea-apretada);
  letter-spacing: -0.01em;
  text-align: center;
  /* landing.css pone h2 { max-width:18ch }: la caja quedaba angosta y pegada a la
     izquierda. Se quita el límite y se centra la caja para que el texto quede al medio. */
  max-width: none;
  margin: 0 auto var(--e-2);
  text-wrap: balance;
}
.mp-dlg h2 span { color: var(--accion); }
.mp-lead {
  text-align: center;
  color: var(--texto-suave);
  margin: 0 auto var(--e-5);
  max-width: 34ch;
  font-size: var(--t-sm);
}

/* Formulario */
.mp-form { display: flex; flex-direction: column; gap: var(--e-3); }
.mp-fila { display: grid; grid-template-columns: 1fr 88px; gap: var(--e-3); }
.mp-campo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--t-sm);
  font-weight: var(--peso-semi);
  color: var(--texto-suave);
  min-width: 0;
}
.mp-input {
  font-family: var(--fuente-cuerpo);
  font-size: var(--t-base);
  color: var(--texto);
  background: var(--fondo);
  border: var(--borde) solid var(--linea);
  border-radius: var(--radio-campo);
  padding: var(--e-3) var(--e-4);
  width: 100%;
}
.mp-input:focus-visible {
  outline: none;
  border-color: var(--jade);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--jade) 22%, transparent);
}
.mp-input[aria-invalid="true"] { border-color: var(--error); }
.mp-input.mp-inicial { text-align: center; text-transform: uppercase; }

/* Campo trampa (honeypot): fuera de pantalla, no visible, no tabulable */
.mp-trampa {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Casilla de aviso de privacidad */
.mp-acepto {
  display: flex;
  gap: var(--e-3);
  align-items: flex-start;
  font-size: var(--t-sm);
  color: var(--texto);
  cursor: pointer;
  margin-top: 2px;
}
.mp-acepto input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 2px solid var(--linea);
  border-radius: 7px;
  background: var(--superficie-alta);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.mp-acepto input:checked { background: var(--jade); border-color: var(--jade); }
.mp-acepto input:checked::after {
  content: "";
  width: 6px;
  height: 11px;
  border: solid var(--texto-inverso);
  border-width: 0 2.5px 2.5px 0;
  transform: translateY(-1px) rotate(45deg);
}
.mp-acepto input:focus-visible { outline: 2px solid var(--accion); outline-offset: 2px; }
.mp-acepto a { color: var(--jade); font-weight: var(--peso-semi); }

.mp-error {
  font-size: var(--t-sm);
  color: var(--error);
  min-height: 1.2em;
  margin: 0;
}
.mp-form .mp-enviar { width: 100%; margin-top: 2px; }
.mp-nota {
  text-align: center;
  font-size: var(--t-xs);
  color: var(--texto-suave);
  margin: 2px 0 0;
}

/* Paso de éxito */
.mp-exito { text-align: center; }
.mp-exito[hidden] { display: none; }
.mp-exito p {
  color: var(--texto-suave);
  margin: 0 auto var(--e-5);
  max-width: 32ch;
  font-size: var(--t-sm);
}
.mp-exito b { color: var(--texto); }
.mp-exito .mp-seguir { width: 100%; }

@keyframes mp-aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes mp-sube {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes mp-sheet { from { transform: translateY(100%); } to { transform: none; } }

/* Celular: hoja inferior */
@media (max-width: 560px) {
  .mp-velo { place-items: end stretch; padding: 0; }
  .mp-dlg {
    max-width: none;
    border-radius: var(--radio-tarjeta) var(--radio-tarjeta) 0 0;
    padding: var(--e-5) var(--e-4) calc(var(--e-5) + env(safe-area-inset-bottom, 0px));
    animation: mp-sheet 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 92vh;
    overflow: auto;
  }
  .mp-dlg::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    border-radius: var(--radio-pildora);
    background: var(--junta);
    margin: -8px auto var(--e-4);
  }
  .mp-edif { width: 96px; }
  .mp-logo { height: 30px; margin-bottom: var(--e-3); }
  .mp-dlg h2 { font-size: var(--t-lg); }
}

@media (prefers-reduced-motion: reduce) {
  .mp-velo, .mp-dlg, .mp-v { animation: none !important; transition: none !important; }
}
