/* Encuesta del landing — sección fija justo debajo del hero (no flotante).
   Personaje a la izquierda que reacciona a cada respuesta y, a la derecha,
   la tarjeta con la pregunta y sus opciones. Ver assets/js/encuesta-landing.js. */

.af-enc-section {
  background: #F5F2EA;
  padding: 44px 20px 12px;
  font-family: 'Sora', system-ui, sans-serif;
}

.af-enc-inner {
  max-width: 940px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

/* ── Personaje + nota ─────────────────────────────────────── */
.af-enc-companion {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.af-enc-face {
  position: relative;
  width: 100%;
  max-width: 330px;
  aspect-ratio: 841 / 706;
  transform-origin: 50% 100%;
  animation: af-enc-breathe 4.6s ease-in-out infinite; /* respira suavemente mientras está en pantalla */
}
/* El personaje son dos capas con la misma imagen (la pone encuesta-landing.js en --af-cara): el cuerpo y,
   solo en la pose de bienvenida ("tiene-mano"), la mano con guante, que saluda girando sobre la muñeca. */
.af-enc-base,
.af-enc-mano {
  position: absolute;
  inset: 0;
  background: var(--af-cara) no-repeat center bottom / contain;
}
.af-enc-mano { display: none; transform-origin: 23.1% 58.7%; }
.af-enc-face.tiene-mano .af-enc-base { clip-path: polygon(evenodd, 0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, 13.08% 33.49%, 30.77% 33.49%, 30.77% 57.34%, 27.69% 58.26%, 22.31% 58.72%, 18.46% 55.96%, 13.08% 47.71%, 13.08% 33.49%, 0% 0%); }
.af-enc-face.tiene-mano .af-enc-mano { display: block; clip-path: polygon(13.46% 33.94%, 30.38% 33.94%, 30.38% 57.80%, 28.46% 60.55%, 21.54% 60.55%, 17.69% 56.88%, 13.46% 48.17%); }
/* Saludo con la mano (pose de bienvenida): solo gira la mano */
.af-enc-face.is-hello.tiene-mano .af-enc-mano { animation: af-enc-wave 1.8s ease-in-out 1; }
/* Saludo en las demás poses: el cuerpo se menea un poco (usa la propiedad "rotate", que se combina con el balanceo) */
.af-enc-face.is-hello:not(.tiene-mano) {
  animation: af-enc-breathe 4.6s ease-in-out infinite, af-enc-hello 1.9s ease-in-out 1;
}

.af-enc-note {
  position: relative;
  align-self: stretch;
  margin: 0 8px 14px;
  min-height: 66px;
  box-sizing: border-box;
  padding: 11px 14px;
  background: #eef8f1;
  border: 1px solid #b9ddc5;
  border-radius: 14px;
  color: #315a44;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 7px 16px rgba(20, 74, 55, .10);
}

.af-enc-note::after {
  content: '';
  position: absolute;
  bottom: -7px;
  left: 56px;
  width: 12px;
  height: 12px;
  background: #eef8f1;
  border-right: 1px solid #b9ddc5;
  border-bottom: 1px solid #b9ddc5;
  transform: rotate(45deg);
}

.af-enc-note strong,
.af-enc-note span {
  display: block;
  position: relative;
  z-index: 1;
}

.af-enc-note strong {
  margin-bottom: 2px;
  color: #174a37;
  font-size: 12.5px;
  font-weight: 700;
}

.af-enc-companion.is-reacting .af-enc-face {
  animation: af-enc-react .42s ease-out;
}

@keyframes af-enc-breathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.012); }
}
@keyframes af-enc-wave {
  0% { transform: rotate(0deg); }
  12% { transform: rotate(-17deg); }
  28% { transform: rotate(15deg); }
  44% { transform: rotate(-15deg); }
  60% { transform: rotate(13deg); }
  76% { transform: rotate(-9deg); }
  90% { transform: rotate(4deg); }
  100% { transform: rotate(0deg); }
}
@keyframes af-enc-hello {
  0% { rotate: 0deg; }
  14% { rotate: -4deg; }
  28% { rotate: 4deg; }
  42% { rotate: -3.5deg; }
  56% { rotate: 3deg; }
  72% { rotate: -1.5deg; }
  100% { rotate: 0deg; }
}

@keyframes af-enc-in {
  from { transform: translateY(14px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes af-enc-react {
  0% { transform: translateY(5px) scale(.97); opacity: .5; }
  65% { transform: translateY(-4px) scale(1.02); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Tarjeta de pregunta ──────────────────────────────────── */
#af-enc-card {
  background: #fff;
  border: 1px solid #e7eee7;
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(21, 51, 33, .12);
  padding: 30px 32px 26px;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  transition: height .26s ease;
}

.af-enc-step,
.af-enc-q,
#af-enc-body {
  transition: opacity .18s ease, transform .18s ease;
}
#af-enc-card.is-swapping .af-enc-step,
#af-enc-card.is-swapping .af-enc-q,
#af-enc-card.is-swapping #af-enc-body {
  opacity: 0;
  transform: translateY(6px);
}

.af-enc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.af-enc-atras {
  background: none;
  border: 0;
  padding: 4px 2px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #5f776a;
  cursor: pointer;
}
.af-enc-atras:hover { color: #174a37; text-decoration: underline; }
.af-enc-atras[hidden] { display: none; }

.af-enc-step {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #2B9D5B;
}

.af-enc-q {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  color: #16301f;
}

#af-enc-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.af-enc-opt {
  display: block;
  box-sizing: border-box;
  width: 100%;
  text-align: left;
  background: #fafcfa;
  border: 1.5px solid #dfe6df;
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.3;
  color: #26402f;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .15s;
}
.af-enc-opt:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary, #58B71B) 10%, #fff);
  border-color: var(--primary, #58B71B);
  transform: translateY(-1px);
}
.af-enc-opt.is-selected {
  background: color-mix(in srgb, var(--primary, #58B71B) 14%, #fff);
  border-color: var(--primary, #58B71B);
  color: #174a37;
}
.af-enc-opt:disabled { cursor: default; }
.af-enc-opt.is-selected:disabled {
  background: color-mix(in srgb, var(--primary, #58B71B) 14%, #fff);
  border-color: var(--primary, #58B71B);
  color: #174a37;
}
.af-enc-opt:disabled:not(.is-selected) { opacity: .55; }
.af-enc-opt:focus-visible { outline: 3px solid #9be07f; outline-offset: 2px; }
.af-enc-opt:last-child:nth-child(odd),
.af-enc-input,
.af-enc-cta,
.af-enc-sec,
.af-enc-sub,
.af-enc-cerrar { grid-column: 1 / -1; }

.af-enc-consent {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  padding: 14px 16px;
  background: #fafcfa;
  border: 1.5px solid #dfe6df;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #3f5a4a;
  cursor: pointer;
}
.af-enc-consent input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: #2B9D5B;
  cursor: pointer;
}
.af-enc-consent a { color: #2B9D5B; font-weight: 700; }
.af-enc-consent.is-error { border-color: #b3261e; background: #fdf4f3; }

.af-enc-sub {
  margin: -10px 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: #7a887f;
}

.af-enc-sec { text-align: center; color: #26402f; }

.af-enc-cta { text-align: center; font-weight: 700; background: #2B9D5B; border-color: #2B9D5B; color: #fff; }
.af-enc-cta:hover:not(:disabled) { background: #238a4f; border-color: #238a4f; }

.af-enc-cerrar {
  background: none;
  border: 0;
  padding: 6px;
  font-family: inherit;
  font-size: 12px;
  color: #7a887f;
  cursor: pointer;
  text-decoration: underline;
}

.af-enc-error {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: #b3261e;
}
.af-enc-error[hidden] { display: none; }

.af-enc-telrow {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}
.af-enc-telrow .af-enc-input { flex: 1 1 auto; width: auto; min-width: 0; }
.af-enc-pais {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 48%;
  box-sizing: border-box;
  border: 1.5px solid #dfe6df;
  border-radius: 14px;
  padding: 15px 30px 15px 14px;
  background-color: #fafcfa;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2326402f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 12px 8px;
  -webkit-appearance: none;
  appearance: none;
  font-size: 14px;
  font-family: inherit;
  color: #26402f;
  cursor: pointer;
  text-overflow: ellipsis;
}
.af-enc-pais:focus-visible { outline: 3px solid #9be07f; outline-offset: 2px; }

.af-enc-input {
  box-sizing: border-box;
  width: 100%;
  border: 1.5px solid #dfe6df;
  border-radius: 14px;
  padding: 15px 16px;
  font-size: 14px;
  font-family: inherit;
}

/* ── Pantalla de resultado: fortaleza, beneficios y cursos recomendados ── */
.af-enc-res { grid-column: 1 / -1; display: grid; gap: 14px; min-width: 0; }
#af-enc-q.is-result { font-size: clamp(22px, 3.2vw, 31px); font-weight: 800; line-height: 1.12; letter-spacing: -.03em; }
.af-enc-hl { color: #2B9D5B; background: linear-gradient(180deg, transparent 64%, #FFE3A3 64%); padding: 0 .06em; }
.af-enc-lead b { color: #16301f; font-weight: 700; }
.af-enc-lead { margin: 0; font-size: 14.5px; line-height: 1.55; color: #4a6154; }
.af-enc-promo {
  position: relative;
  padding: 20px 22px 18px;
  border-radius: 20px;
  background: #25573d; /* color plano */
  color: #fff;
}
.af-enc-promo-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 11px;
  border-radius: 999px;
  background: #FFC93C;
  color: #2B2208;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .12em;
}
.af-enc-promo-t {
  margin: 0;
  font-size: clamp(22px, 3.4vw, 31px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.03em;
  text-transform: uppercase;
}
.af-enc-promo-t mark { background: none; color: #FFD571; }
.af-enc-promo-s { margin: 10px 0 0; font-size: 13px; font-weight: 500; letter-spacing: .01em; color: rgba(255, 255, 255, .82); }
.af-enc-sel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 2px solid #58B71B;
  border-radius: 18px;
  background: #f2faec;
  box-shadow: 0 10px 26px rgba(43, 157, 91, .14);
}
.af-enc-sel .af-cb-th { flex: 0 0 76px; width: 76px; height: 76px; border-radius: 14px; }
.af-enc-sel-i { flex: 1; min-width: 0; display: grid; gap: 3px; }
.af-enc-sel-tag {
  justify-self: start;
  padding: 3px 10px;
  border-radius: 999px;
  background: #FFC93C;
  color: #2B2208;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.af-enc-sel-i b { font-size: 15px; line-height: 1.28; color: #16301f; }
.af-enc-sel-i small { font-size: 12.5px; color: #4f6b5a; }
.af-enc-ok { margin: 0; padding: 10px 14px; border-radius: 12px; background: #eef8f1; border: 1px solid #cfe8d7; font-size: 13px; font-weight: 600; color: #25573d; }
.af-enc-h { margin: 6px 0 -6px; font-size: 16px; font-weight: 700; letter-spacing: -.01em; color: #16301f; }
.af-enc-hint { margin: 0; font-size: 13px; line-height: 1.5; color: #647a6c; }
.af-enc-lista { display: grid; gap: 8px; }
.af-enc-lista .af-cb-cur { border: 1px solid #e4ece6; box-shadow: 0 4px 14px rgba(20, 60, 40, .06); padding: 9px; }
.af-enc-lista .af-cb-ct b { font-size: 13.5px; }
.af-enc-lista .af-cb-ct small { font-size: 12px; }
.af-enc-pie { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding-top: 10px; border-top: 1px solid #edf2ed; }
.af-enc-link {
  padding: 6px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #25573d;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.af-enc-link:hover { color: #2B9D5B; }
.af-enc-link:focus-visible { outline: 3px solid #9be07f; outline-offset: 2px; border-radius: 4px; }
.af-enc-res > .af-enc-link { justify-self: start; }
.af-enc-wait { display: flex; justify-content: center; gap: 8px; padding: 30px 0 34px; }
.af-enc-wait i { width: 10px; height: 10px; border-radius: 50%; background: #58B71B; animation: af-enc-dot 1s ease-in-out infinite; }
.af-enc-wait i:nth-child(2) { animation-delay: .15s; }
.af-enc-wait i:nth-child(3) { animation-delay: .3s; }
@keyframes af-enc-dot { 0%, 80%, 100% { transform: scale(.55); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* ── Celular: la pregunta va primero y el personaje debajo ── */
@media (max-width: 760px) {
  .af-enc-section { padding: 28px 16px 8px; }
  .af-enc-inner { grid-template-columns: 1fr; gap: 6px; }
  #af-enc-card { order: 1; padding: 18px 16px 16px; border-radius: 20px; }
  .af-enc-opt { padding: 13px 16px; font-size: 14px; }
  .af-enc-companion { order: 2; flex-direction: row-reverse; align-items: flex-end; gap: 4px; }
  .af-enc-face { flex: 0 0 120px; width: 120px; }
  .af-enc-note { flex: 1; align-self: center; margin: 0 0 14px; }
  .af-enc-note::after { bottom: auto; top: 18px; left: auto; right: auto; left: -7px; border: 0; border-left: 1px solid #b9ddc5; border-bottom: 1px solid #b9ddc5; transform: rotate(45deg); }
  .af-enc-q { font-size: 19px; margin-bottom: 14px; }
  #af-enc-body { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .af-enc-face,
  .af-enc-companion.is-reacting .af-enc-face,
  .af-enc-face.is-hello,
  .af-enc-face.is-hello .af-enc-mano,
  .af-enc-wait i { animation: none; }
}
