/* =========================================================
   Hablemos
   Mismas unidades que fresca.css: 1u = 1px del mockup
   (desktop: 1279px · mobile: 630px)
   ========================================================= */

/* El fondo violeta con la trama sigue por detrás del footer: una sola pieza de pantalla */
.hero--hb { height: calc(720 * var(--u)); margin-bottom: calc(-125 * var(--u)); text-align: left; }
.footer { z-index: 3; }
body:has(.hero--hb) .footer { background: transparent; }
/* el fondo de la página también es violeta: si por redondeo de píxeles (pantallas retina / Mac) queda una rendija bajo el footer, no se ve blanca */
html:has(.hero--hb), body:has(.hero--hb) { background: #8237ea; }

.hb { position: absolute; inset: 0; z-index: 3; }
.hb-title {
  position: absolute; left: calc(67 * var(--u)); top: calc(168 * var(--u));
  font-weight: 800; font-size: calc(50.5 * var(--u)); line-height: 1.15; letter-spacing: -.01em;
}
.hb-sub {
  position: absolute; left: calc(67 * var(--u)); top: calc(253 * var(--u)); margin: 0;
  font-size: calc(17 * var(--u)); line-height: calc(30 * var(--u));
}

/* ---------- Recuadro blanco con el formulario ---------- */
.hb-card {
  position: absolute; left: calc(696 * var(--u)); top: calc(156 * var(--u));
  width: calc(473 * var(--u)); height: calc(390 * var(--u));
  background: #fff; color: #000; border-radius: calc(27 * var(--u));
  padding: calc(30 * var(--u));
  box-shadow: 0 calc(18 * var(--u)) calc(50 * var(--u)) rgba(40, 0, 100, .18);
}
.hb-form { height: 100%; display: grid; grid-template-rows: auto auto auto 1fr auto; row-gap: calc(12 * var(--u)); position: relative; }
.hb-row { display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(12 * var(--u)); }
.hb-field { display: flex; min-width: 0; }
.hb-field label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* solo para lectores de pantalla */
.hb-field input, .hb-field textarea {
  width: 100%; font: inherit; font-size: max(14px, calc(14 * var(--u))); color: #000;
  background: #f4f0fd; border: 2px solid transparent; border-radius: calc(10 * var(--u));
  padding: 0 calc(14 * var(--u)); height: calc(40 * var(--u)); min-height: 40px;
  transition: border-color .25s, background-color .25s, box-shadow .25s;
}
.hb-field textarea { resize: none; height: 100%; min-height: 80px; padding: calc(12 * var(--u)) calc(14 * var(--u)); line-height: 1.5; }
.hb-field--msg { min-height: 0; }
.hb-field input::placeholder, .hb-field textarea::placeholder { color: #8a7fa3; opacity: 1; }
.hb-field input:hover, .hb-field textarea:hover { background: #ede6fb; }
.hb-field input:focus, .hb-field textarea:focus { outline: none; background: #fff; border-color: var(--purple); box-shadow: 0 0 0 4px rgba(140, 49, 242, .15); }
.hb-field input.is-invalid, .hb-field textarea.is-invalid { border-color: #e5322d; background: #fff6f6; }
.hb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.hb-send {
  height: calc(42 * var(--u)); min-height: 42px; border: 0; border-radius: calc(10 * var(--u));
  background: var(--purple); color: #fff; font: inherit; font-weight: 600; font-size: max(14px, calc(15 * var(--u)));
  letter-spacing: .02em; cursor: pointer; transition: background-color .3s, transform .3s var(--ease);
}
.hb-send:hover { background: #000; }
.hb-send:active { transform: scale(.98); }
.hb-send[disabled] { opacity: .6; cursor: progress; }
.hb-status { position: absolute; left: 0; right: 0; bottom: calc(-4 * var(--u)); transform: translateY(100%); margin: 0; text-align: center; font-size: max(12px, calc(12.5 * var(--u))); line-height: 1.3; color: #fff; }
.hb-status:empty { display: none; }
.hb-status.is-ok { font-weight: 700; }
.hb-status.is-err { color: #ffd7d4; font-weight: 600; }

/* =========================================================
   MOBILE
   ========================================================= */
@media (max-width: 760px) {
  /* en mobile el recuadro fluye (su alto depende del formulario) y la pantalla crece para alojarlo */
  .hero--hb { height: auto; min-height: calc(1120 * var(--u)); margin-bottom: 0; } /* el footer va debajo del recuadro, sin solaparse */
  .hb { position: relative; inset: auto; min-height: calc(1120 * var(--u)); padding: calc(344 * var(--u)) 0 40px; box-sizing: border-box; }
  .hb-title { left: calc(68 * var(--u)); top: calc(205 * var(--u)); font-size: max(28px, calc(44 * var(--u))); }
  .hb-sub { left: calc(68 * var(--u)); top: calc(268 * var(--u)); font-size: max(13px, calc(14.6 * var(--u))); line-height: calc(40 * var(--u)); }
  .hb-card {
    position: relative; left: auto; top: auto; height: auto;
    width: max(calc(414 * var(--u)), min(88vw, 360px)); margin: 0 auto;
    border-radius: calc(29 * var(--u)); padding: 22px 20px;
  }
  .hb-form { height: auto; grid-template-rows: none; row-gap: 10px; }
  .hb-row { grid-template-columns: 1fr; row-gap: 10px; }
  .hb-field input, .hb-field textarea { font-size: 16px; height: 44px; border-radius: 10px; } /* 16px evita el zoom automático en iPhone */
  .hb-field textarea { height: 120px; }
  .hb-send { height: 46px; border-radius: 10px; font-size: 15px; }
  .hb-status { position: static; transform: none; margin-top: 4px; color: #4a2a8a; }
  .hb-status.is-ok { color: #1c8a4a; }
  .hb-status.is-err { color: #e5322d; }
}

/* Desktop: trama sin recorte en el borde superior (la sección es más alta que la trama estándar) */
@media (min-width: 761px) {
  .hero--hb .hero__bg { background-image: url("../assets/trama-hablemos.svg"); background-size: 100% auto; background-position: center top; }
}

/* Captcha (Turnstile en modo "solo si hace falta"): invisible salvo que pida una verificación */
.hb-captcha { position: absolute; left: 0; right: 0; top: calc(100% + 34 * var(--u)); display: flex; justify-content: center; }
.hb-captcha:empty { display: none; }
@media (max-width: 760px) { .hb-captcha { position: static; margin-top: 6px; } }
