/* =====================================================================
   generacion2038 · estilos · mobile-first
   Identidad Colegio Institución Teresiana + gancho generacional 2038.
   Firma: el "horizonte 2026→2038" (hero) y la barra de progreso como el
   mismo camino. Tipografía system-ui (0 latencia en móvil = menos fricción).
   ===================================================================== */

:root {
  --navy: #1B2A5E;
  --navy-700: #16224d;
  --red: #CE4638;
  --yellow: #E8B32C;
  --ink: #23282F;
  --muted: #6B7280;
  --bg: #FFFFFF;
  --tint: #ECEFF6;
  --tint-line: #d9dfec;

  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 640px;
  --touch: 48px;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;

  --shadow: 0 1px 2px rgba(27, 42, 94, 0.06), 0 6px 20px rgba(27, 42, 94, 0.06);
  --focus: 0 0 0 3px rgba(27, 42, 94, 0.28);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Barra de progreso (firma: camino hacia 2038) ---------- */
.progress {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--tint-line);
}
.progress__track {
  height: 4px;
  background: var(--tint);
  position: relative;
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--navy), var(--red));
  transition: width .35s ease;
}
.progress__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .01em;
}
.progress__meta strong { color: var(--navy); font-weight: 700; }

/* ---------- Contenedor ---------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px 140px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 32px 0 8px;
}
.hero__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.hero__brand img { width: 26px; height: 26px; display: block; }
.hero__title {
  margin: 18px 0 2px;
  font-size: clamp(2.1rem, 9vw, 3rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: var(--navy);
}
.hero__title span { color: var(--red); }
.hero__lead {
  margin: 10px 0 0;
  font-size: 1.05rem;
  color: var(--ink);
  max-width: 34ch;
}

/* Horizonte 2026 -> 2038 (el elemento firma) */
.horizon {
  margin: 26px 0 4px;
  --p: 0; /* progreso decorativo del hero, se setea en JS opcionalmente */
}
.horizon__line {
  position: relative;
  height: 2px;
  background: var(--tint-line);
  margin: 0 6px;
}
.horizon__line::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 60%;
  background: linear-gradient(90deg, var(--navy), var(--yellow));
}
.horizon__dot {
  position: absolute;
  right: -1px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--yellow);
  transform: translate(50%, -50%);
  box-shadow: 0 0 0 4px rgba(232, 179, 44, 0.22);
}
.horizon__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.horizon__labels b { display: block; color: var(--navy); font-size: 14px; }
.horizon__labels span:last-child { text-align: right; }

/* ---------- Intro ---------- */
.intro {
  margin: 22px 0 8px;
  padding: 18px 18px;
  background: var(--tint);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--ink);
}
.intro strong { color: var(--navy); }

/* ---------- Secciones ---------- */
.section { margin-top: 34px; }
.section__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--navy);
  margin-bottom: 6px;
}
.section__idx {
  font-size: 13px;
  font-weight: 800;
  color: var(--red);
  letter-spacing: .04em;
}
.section__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
}

/* ---------- Preguntas ---------- */
.q {
  margin-top: 16px;
  padding: 18px 16px;
  background: #fff;
  border: 1px solid var(--tint-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.q.is-error { border-color: var(--red); }
.q__label {
  display: block;
  font-weight: 600;
  font-size: 1.03rem;
  color: var(--ink);
  margin-bottom: 2px;
}
.q__req { color: var(--red); margin-left: 2px; }
.q__hint {
  font-size: 13.5px;
  color: var(--muted);
  margin: 2px 0 12px;
}
.q__error {
  display: none;
  font-size: 13.5px;
  color: var(--red);
  font-weight: 600;
  margin-top: 10px;
}
.q.is-error .q__error { display: block; }

/* ---------- Opción única / múltiple: lista de pills ---------- */
.opts { display: grid; gap: 8px; margin-top: 12px; }
.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--touch);
  padding: 10px 14px;
  border: 1.5px solid var(--tint-line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--navy); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt__mark {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: border-color .15s;
}
.opt[data-multi] .opt__mark { border-radius: 6px; }
.opt__mark::after {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--navy);
  transform: scale(0);
  transition: transform .15s;
}
.opt[data-multi] .opt__mark::after { border-radius: 2px; }
.opt__text { font-size: 1rem; }
.opt input:checked ~ .opt__mark { border-color: var(--navy); }
.opt input:checked ~ .opt__mark::after { transform: scale(1); }
.opt:has(input:checked) {
  border-color: var(--navy);
  background: var(--tint);
}
.opt:has(input:focus-visible) { box-shadow: var(--focus); }
.opt.is-disabled { opacity: .5; cursor: not-allowed; }

/* Sub-input "Otro" */
.opt-other-field {
  margin-top: -2px;
  display: none;
}
.opt-other-field.is-open { display: block; }

/* ---------- Matriz P4 (tarjetas + control segmentado) ---------- */
.matrix { display: grid; gap: 14px; margin-top: 14px; }
.mrow {
  padding: 14px 14px 12px;
  border: 1.5px solid var(--tint-line);
  border-radius: var(--radius-sm);
  background: #fff;
}
.mrow.is-error { border-color: var(--red); }
.mrow__theme {
  font-weight: 600;
  font-size: .98rem;
  margin-bottom: 10px;
}
.seg {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.seg__opt {
  position: relative;
  display: block;
  text-align: center;
  cursor: pointer;
}
.seg__opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--touch);
  padding: 6px 2px;
  border: 1.5px solid var(--tint-line);
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 1.1;
  color: var(--muted);
  transition: all .15s;
}
.seg__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tint-line);
  transition: background .15s, transform .15s;
}
.seg__opt input:checked ~ .seg__box {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
  font-weight: 600;
}
.seg__opt input:checked ~ .seg__box .seg__dot { background: var(--yellow); transform: scale(1.3); }
.seg__opt input:focus-visible ~ .seg__box { box-shadow: var(--focus); }

/* ---------- Campos de texto ---------- */
.field {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--tint-line);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--ink);
  background: #fff;
  resize: vertical;
}
.field:focus-visible { outline: none; border-color: var(--navy); box-shadow: var(--focus); }
textarea.field { min-height: 92px; }

/* Honeypot: nunca visible para humanos */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---------- Botón de envío (fijo abajo en móvil) ---------- */
.submitbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 32%);
  pointer-events: none;
}
.submitbar__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  pointer-events: auto;
}
.btn {
  width: 100%;
  min-height: 54px;
  border: none;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(27, 42, 94, 0.24);
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--navy-700); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus), 0 8px 24px rgba(27,42,94,.24); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn--ghost {
  background: #fff;
  color: var(--navy);
  border: 1.5px solid var(--navy);
  box-shadow: none;
}
.btn--ghost:hover { background: var(--tint); }

/* mensaje de error global de envío */
.sendmsg {
  display: none;
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
}
.sendmsg.is-show { display: block; }
.sendmsg--error { background: #fbe9e7; color: #9a2d22; }
.sendmsg--warn  { background: #fdf5e2; color: #8a6410; }

/* ---------- Pantalla de gracias ---------- */
.thanks { display: none; padding: 48px 0 24px; text-align: center; }
.thanks.is-show { display: block; }
.thanks__mark {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--tint);
  display: grid; place-items: center;
}
.thanks__mark svg { width: 32px; height: 32px; }
.thanks__title { color: var(--navy); font-size: 1.6rem; margin: 0 0 8px; font-weight: 800; }
.thanks__body { color: var(--ink); max-width: 40ch; margin: 0 auto; }

/* Contador "Ya somos N de TOTAL familias" */
.counter { margin: 26px auto 0; max-width: 340px; }
.counter__label { margin: 0 0 9px; font-size: .98rem; font-weight: 600; color: var(--navy); }
.counter__track { height: 10px; background: var(--tint); border-radius: 999px; overflow: hidden; }
.counter__fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--navy), var(--yellow));
  border-radius: 999px;
  transition: width .6s ease;
}

/* Botón de compartir por WhatsApp */
.wa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 26px; min-height: 54px; padding: 0 24px;
  background: var(--navy); color: #fff; text-decoration: none;
  border-radius: var(--radius); font-weight: 700; font-size: 1.03rem;
  box-shadow: 0 8px 24px rgba(27, 42, 94, .24);
  transition: background .15s, transform .05s;
}
.wa-btn:hover { background: var(--navy-700); }
.wa-btn:active { transform: translateY(1px); }
.wa-btn:focus-visible { outline: none; box-shadow: var(--focus), 0 8px 24px rgba(27,42,94,.24); }

/* ---------- Banner de reingreso ---------- */
.reentry {
  display: none;
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1.5px solid var(--yellow);
  background: #fdf5e2;
  border-radius: var(--radius);
  font-size: 14.5px;
}
.reentry.is-show { display: block; }
.reentry__actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.reentry .btn { width: auto; min-height: 42px; font-size: .95rem; padding: 0 16px; }

/* ---------- utilidades ---------- */
.hidden { display: none !important; }

/* ---------- desktop tweaks ---------- */
@media (min-width: 680px) {
  body { font-size: 17px; }
  .submitbar { position: static; padding: 24px 0 0; background: none; }
  .submitbar__inner { pointer-events: auto; }
  .btn { max-width: 320px; }
  .wrap { padding-bottom: 48px; }
  .seg__box { font-size: 12.5px; }
}

/* ---------- accesibilidad: movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
