/* ============================================================
   Conexión Cristiana — sistema de diseño del funnel
   Mobile-first: la base es 320px. Se enriquece en 481 / 769 / 1025.
   Sin dependencias externas: cada clase usada en los templates
   tiene su regla aquí (ver TestNoUndefinedTemplateClasses).
   ============================================================ */

:root {
  /* Superficies */
  --bg: #0b0c12;
  --surface: #151720;
  --surface-2: #1e2029;
  --border: rgba(243, 237, 224, 0.1);
  --border-strong: rgba(243, 237, 224, 0.26);

  /* Texto */
  --fg: #f3ede0;
  --muted: #9a917e;

  /* Acento (uso máximo: progreso + CTA principal) */
  --accent: #d4af37;
  --accent-2: #c9a030;
  --accent-ink: #0b0c12;

  /* Semánticos */
  --wa: #25d366;
  --danger: #f08a8a;
  --danger-bg: rgba(240, 138, 138, 0.1);

  /* Tipografía: Manrope en todo el funnel. Manrope no tiene cursiva, así
     que el contraste de los títulos viene del peso (700/800), nunca de
     font-style: una cursiva sintética se ve deformada. */
  --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --t-question: clamp(1.5rem, 6.2vw, 2.125rem);
  --t-brand: clamp(1.0625rem, 4.4vw, 1.375rem);
  --t-option: 1rem;
  --t-body: 0.9375rem;
  --t-eyebrow: 0.6875rem;
  --t-cta: 0.875rem;

  /* Espacio y forma */
  --gap: 0.625rem;
  --pad: 1.25rem;
  --r-sm: 0.625rem;
  --r: 0.875rem;
  --r-lg: 1.25rem;
  --r-pill: 999px;

  /* Áreas seguras (notch / barra inferior iOS) */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

svg {
  display: block;
  flex: none;
}

/* Accesibilidad: solo para lectores de pantalla. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Un solo estilo de foco, visible sobre fondo oscuro. */
:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ---------- Estructura de página ---------- */

.funnel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(1rem + var(--safe-t)) calc(0.75rem + var(--safe-r))
    calc(0.75rem + var(--safe-b)) calc(0.75rem + var(--safe-l));
}

.brand {
  margin: 0;
  text-align: center;
  font-family: var(--font);
  font-size: var(--t-brand);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--fg);
}

/* Sin cursiva en Manrope: el énfasis de la marca es de peso y color. */
.brand em {
  font-style: normal;
  font-weight: 800;
  color: var(--accent);
}

.legal {
  margin: 0;
  padding-bottom: 0.25rem;
  text-align: center;
  font-size: 0.6875rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.card {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

/* Variante con cabecera tipo conversación (página del grupo). */
.card--chat {
  flex: 0 0 auto;
  max-width: 32.5rem;
  margin-inline: auto;
  overflow: hidden;
}

/* ---------- Paso del cuestionario ---------- */

.step,
.step__form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.step__form {
  margin: 0;
  padding: var(--pad);
  gap: 1.5rem;
}

.step__head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) 0;
  padding: var(--pad) var(--pad) 0.75rem;
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.step__nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step__eyebrow {
  margin: 0;
  font-size: var(--t-eyebrow);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.step__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.step__question {
  display: block;
  margin: 0;
  padding: 0;
  max-width: 24ch;
  font-family: var(--font);
  font-size: var(--t-question);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--fg);
}

.step__hint {
  margin: -0.5rem 0 0;
  max-width: 42ch;
  font-size: var(--t-body);
  color: var(--muted);
}

.step__guide {
  margin: -0.25rem 0 0;
  max-width: 46ch;
  padding: 0.75rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--fg);
  background: rgba(243, 237, 224, 0.04);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
}

.step__wa {
  display: flex;
  /* Mobile-first: em 320px o texto quebra em 2-3 linhas; o ícone
     alinha ao topo em vez de flutuar no meio do bloco. */
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.22);
  border-radius: var(--r-sm);
}

.step__wa-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--fg);
}

.step__wa-text strong {
  font-weight: 700;
  color: var(--wa);
}

.step__region {
  margin: -0.5rem 0 0;
  font-size: var(--t-eyebrow);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.step__foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: auto calc(var(--pad) * -1) calc(var(--pad) * -1);
  padding: 1rem var(--pad) calc(var(--pad) + var(--safe-b));
  background: linear-gradient(to top, var(--surface) 62%, rgba(21, 23, 32, 0));
}

/* Con JS los pasos de opción avanzan al elegir: el botón es el
   fallback sin JS, así que solo se oculta cuando JS está activo. */
.js .step__foot--auto {
  display: none;
}

/* ---------- Progreso ---------- */

.progress {
  height: 4px;
  background: rgba(243, 237, 224, 0.07);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress__fill {
  display: block;
  height: 100%;
  min-width: 4px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: var(--r-pill);
  transition: width 0.45s ease-out;
}

/* ---------- Botones e iconos ---------- */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-left: -0.75rem;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.icon-btn--placeholder {
  display: none;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
}

.icon--lg {
  width: 1.75rem;
  height: 1.75rem;
}

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  min-height: 3.375rem;
  padding: 0.875rem 1.25rem;
  font-family: inherit;
  font-size: var(--t-cta);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  border-radius: var(--r);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.2s ease;
}

.cta:active {
  transform: translateY(2px);
}

.cta--muted {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
}

.cta--ghost {
  min-height: 2.75rem;
  color: var(--muted);
  background: transparent;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: var(--t-body);
}

/* ---------- Opciones ---------- */

.options {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  border: 0;
}

.option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 1rem 1.125rem;
  background: rgba(243, 237, 224, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

/* El input queda enfocable (no display:none) pero invisible. */
.option input,
.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.option__label {
  font-size: var(--t-option);
  font-weight: 500;
  line-height: 1.35;
  color: var(--fg);
}

.option__check {
  width: 1.125rem;
  height: 1.125rem;
  color: var(--fg);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.option:has(input:checked) {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.option:has(input:checked) .option__check {
  opacity: 1;
  transform: none;
}

.option:has(input:focus-visible) {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

/* Par de tarjetas grandes (hermana / hermano). */
.options--pair {
  gap: 0.75rem;
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-height: 5rem;
  padding: 1rem 1.125rem;
  font-family: inherit;
  text-align: left;
  color: var(--fg);
  background: rgba(243, 237, 224, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--r);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.choice__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--fg);
  background: rgba(243, 237, 224, 0.04);
  border-radius: var(--r-pill);
}

.choice__label {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---------- Campo de texto ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field__input {
  width: 100%;
  min-height: 3.5rem;
  padding: 1rem 1.125rem;
  font-family: inherit;
  /* 17px: evita el zoom automático de iOS al enfocar. */
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--fg);
  background: rgba(243, 237, 224, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--r);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.field__input::placeholder {
  color: #6b6555;
}

.field__input:focus {
  background: rgba(243, 237, 224, 0.05);
  border-color: var(--border-strong);
  outline: none;
}

.field__input:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

/* ---------- Avisos ---------- */

.alert {
  margin: 0;
  padding: 0.875rem 1rem;
  font-size: var(--t-body);
  font-weight: 500;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(240, 138, 138, 0.22);
  border-radius: var(--r-sm);
}

/* ---------- Cabecera tipo conversación ---------- */

.chat {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem var(--pad);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.chat__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: var(--wa);
  background: rgba(37, 211, 102, 0.12);
  border-radius: var(--r-pill);
}

.chat__meta {
  min-width: 0;
}

.chat__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--fg);
}

.chat__sub {
  margin: 0.125rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Bloque de contenido (grupo / gracias) ---------- */

.note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: var(--pad);
  text-align: center;
}

.note__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  color: var(--accent);
  background: rgba(212, 175, 55, 0.12);
  border-radius: var(--r-pill);
}

.note__title {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(1.375rem, 5.6vw, 1.75rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.note__text {
  margin: 0;
  max-width: 38ch;
  color: var(--muted);
}

.note__text strong {
  font-weight: 600;
  color: var(--fg);
}

/* Portada del e-book (popup de desbloqueo). Mobile-first: compacta en
   320px, con sombra para destacar sobre el fondo oscuro. */
.ebook-cover {
  width: clamp(120px, 38vw, 160px);
  height: auto;
  border-radius: var(--r-sm);
  box-shadow: 0 1rem 2rem -0.5rem rgba(0, 0, 0, 0.55);
}

/* Precio destacado del e-book (popup de desbloqueo). */
.price-tag {
  margin: 0;
  padding: 0.375rem 1.25rem;
  /* Mobile-first: escala suave de 320px até o teto de 1.5rem. */
  font-size: clamp(1.25rem, 6vw, 1.5rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--accent);
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--r-pill);
}

/* Llamada a la acción final del popup: separador + acento dorado. */
.note__text--cta {
  width: 100%;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.note__text--cta strong {
  color: var(--accent);
}

/* Aclaración secundaria (grupo gratis) bajo la CTA. */
.note__fine {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.note .cta {
  margin-top: 0.5rem;
}

/* ---------- Hoja / diálogo sin JS (:target) ---------- */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.sheet:target {
  display: flex;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 8, 0.72);
  backdrop-filter: blur(2px);
}

.sheet__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 27.5rem;
  /* Mobile-first: o popup nunca passa da tela; em 320px o conteúdo
     rola dentro do painel e os botões seguem alcançáveis. */
  max-height: calc(100vh - 2rem);
  max-height: calc(100svh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2rem var(--pad) calc(var(--pad) + var(--safe-b));
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  animation: sheet-in 0.24s ease-out;
}

.sheet__close {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--r-pill);
}

.sheet__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  margin-top: 0.25rem;
}

@keyframes sheet-in {
  from {
    transform: translateY(1.5rem);
    opacity: 0;
  }
}

/* ---------- Hover: solo en punteros reales ---------- */

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    color: var(--fg);
    background: rgba(243, 237, 224, 0.06);
  }

  .cta:hover {
    filter: brightness(1.07);
  }

  .cta--muted:hover,
  .cta--ghost:hover {
    color: var(--fg);
    filter: none;
  }

  .option:hover,
  .choice:hover {
    background: rgba(243, 237, 224, 0.05);
    border-color: var(--border-strong);
  }

  .sheet__close:hover {
    color: var(--fg);
    background: rgba(243, 237, 224, 0.06);
  }
}

/* ---------- Tablet (481px+) ---------- */

@media (min-width: 481px) {
  :root {
    --pad: 2rem;
  }

  .funnel {
    gap: 1.5rem;
    justify-content: center;
    padding-inline: 1.25rem;
  }

  .card {
    flex: 0 0 auto;
    max-width: 32.5rem;
    min-height: 30rem;
    margin-inline: auto;
    box-shadow: 0 1.875rem 3.75rem -0.75rem rgba(0, 0, 0, 0.55);
  }

  .options--pair {
    grid-template-columns: 1fr 1fr;
  }

  .choice {
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 8.25rem;
    padding: 1.25rem;
  }

  .sheet {
    align-items: center;
  }

  .sheet__panel {
    border-radius: var(--r-lg);
    padding-bottom: var(--pad);
  }
}

/* ---------- Desktop (769px+) ---------- */

@media (min-width: 769px) {
  .card {
    max-width: 34rem;
    min-height: 32.5rem;
  }

  .step__question {
    max-width: 26ch;
  }
}

/* ---------- Pantallas grandes (1025px+) ---------- */

@media (min-width: 1025px) {
  .funnel {
    gap: 2rem;
  }
}

/* ---------- Movimiento reducido ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
