/* ==========================================================
   Avalis Seguros — cotizador por pasos integrado en contacto.html (#cotizar), v8 (2 dic 2026).
   Una pregunta por pantalla dentro de una tarjeta; el primer paso es elegir qué cotizar.
   Depende de los tokens de styles.css (colores, --f, --fd, --e-out). Respaldo v7 (diálogo): scratchpad/qa/ct.
   ========================================================== */

.qf {
  --qf-ease: var(--e-out, cubic-bezier(.23, 1, .32, 1));
  --qf-line: rgba(41, 53, 26, .16);
  --qf-pad: clamp(18px, 4.6vw, 40px);
  position: relative; display: flex; flex-direction: column;
  min-height: 560px; border-radius: var(--r-xl, 32px);
  background: var(--crema, #fffcf5); color: var(--tinta, #1c2412); font-family: var(--f);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .6) inset, 0 28px 56px -28px rgba(10, 14, 6, .55);
  scroll-margin-top: calc(var(--nav-h, 76px) + 16px);
  container-type: inline-size;
}
@media (min-width: 1040px) { .qf { min-height: 640px; } }

.qf__form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.qf__form[hidden], .qf__done[hidden] { display: none; }

/* Encabezado: seguro elegido y paso */
.qf__head { flex: none; padding: var(--qf-pad) var(--qf-pad) 0; }
.qf__who { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 14px; }
main #qf-title {
  margin: 0; min-width: 0; font-family: var(--f) !important; font-stretch: normal !important; font-weight: 650 !important;
  font-size: 1rem !important; text-transform: none; letter-spacing: -.01em !important; line-height: 1.25 !important;
  color: var(--bosque, #29351a); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qf__count { flex: none; margin: 0; font-size: .88rem; color: var(--tinta-2, #4f5544); font-variant-numeric: tabular-nums; }
.qf__bar { display: block; height: 4px; background: rgba(41, 53, 26, .1); border-radius: 4px; overflow: hidden; }
.qf__bar i { display: block; height: 100%; background: var(--g-ocre, #dca15d); border-radius: 4px; transform-origin: 0 50%; transform: scaleX(0); transition: transform 420ms var(--qf-ease); }

/* Escenario del paso */
.qf__stage { flex: 1; padding: clamp(22px, 4cqi, 30px) var(--qf-pad) 22px; }
.qf__stage > .qf__hint a { color: var(--bosque, #29351a); font-weight: 600; }
.qf__step.is-in-next { animation: qf-next 300ms var(--qf-ease) both; }
.qf__step.is-in-prev { animation: qf-prev 300ms var(--qf-ease) both; }
@keyframes qf-next { from { opacity: 0; transform: translateX(20px); } }
@keyframes qf-prev { from { opacity: 0; transform: translateX(-20px); } }

.qf__title {
  margin: 0; font-family: var(--fd); font-stretch: 112%; font-weight: 800; text-transform: uppercase;
  font-size: clamp(1.45rem, 1.1rem + 1.5vw, 2.05rem); line-height: 1; letter-spacing: -.01em;
  color: var(--bosque, #29351a); text-wrap: balance;
}
.qf__title:focus { outline: none; }
.qf__hint { margin: 10px 0 0; font-size: 1rem; line-height: 1.45; color: var(--tinta-2, #4f5544); max-width: 42ch; }

.qf__control { margin-top: 24px; }

/* Opciones grandes */
.qf__opts { display: grid; gap: 10px; }
@container (min-width: 460px) { .qf__opts.is-many { grid-template-columns: 1fr 1fr; } }
.qf__opt {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 14px 18px; text-align: left;
  border: 0; border-radius: 16px; cursor: pointer; font: 500 1.03rem/1.3 var(--f); color: var(--tinta, #1c2412);
  background: #fff; box-shadow: inset 0 0 0 1.5px var(--qf-line);
  transition: box-shadow 200ms var(--qf-ease), background-color 200ms var(--qf-ease), transform 140ms var(--qf-ease);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .qf__opt:hover { box-shadow: inset 0 0 0 1.5px var(--olivo, #626b3a); } }
.qf__opt:active { transform: scale(.985); }
.qf__opt:focus-visible { outline: 2px solid var(--olivo, #626b3a); outline-offset: 3px; }
.qf__opt[aria-checked="true"] { background: var(--olivo-20, #e9ebdc); box-shadow: inset 0 0 0 2px var(--bosque, #29351a); }
.qf__mark {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px rgba(41, 53, 26, .3); color: var(--crema, #fffcf5);
  transition: background-color 200ms var(--qf-ease), box-shadow 200ms var(--qf-ease);
}
.qf__opts[role="group"] .qf__mark { border-radius: 7px; }
.qf__mark svg { width: 15px; height: 15px; transform: scale(.4); opacity: 0; transition: transform 240ms var(--qf-ease), opacity 160ms var(--qf-ease); }
.qf__opt[aria-checked="true"] .qf__mark { background: var(--bosque, #29351a); box-shadow: none; }
.qf__opt[aria-checked="true"] .qf__mark svg { transform: none; opacity: 1; }

/* Primer paso: qué cotizar (mosaico con el objeto de cada seguro) */
.qf__opts.qf__opts--pick { grid-template-columns: 1fr 1fr; gap: 10px; }
@container (min-width: 520px) { .qf__opts.qf__opts--pick { grid-template-columns: repeat(3, minmax(0, 1fr)); } .qf__opt--pick .qf__thumb { aspect-ratio: 2 / 1; } .qf__opt--pick .qf__optlabel { min-height: 42px; padding-bottom: 8px; } }
.qf__opt--pick { flex-direction: column; align-items: stretch; gap: 0; min-height: 0; padding: 6px 6px 0; border-radius: 18px; }
.qf__thumb { display: block; aspect-ratio: 16 / 10; border-radius: 13px; overflow: hidden; background: #efe5cf; }
.qf__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 560ms var(--ease-enter, var(--qf-ease)); }
.qf__thumb--q { display: grid; place-items: center; background: var(--g-bosque6, #29351a); color: var(--ocre-claro, #dca15d); }
.qf__thumb--q svg { width: 34px; height: 34px; }
.qf__opt--pick .qf__optlabel { display: flex; align-items: center; min-height: 48px; padding: 8px 8px 10px; font-weight: 600; font-size: .98rem; line-height: 1.2; color: var(--bosque, #29351a); }
.qf__opt--pick .qf__mark { position: absolute; top: 14px; right: 14px; background: var(--crema, #fffcf5); box-shadow: inset 0 0 0 1.5px rgba(41, 53, 26, .25); }
.qf__opt--pick:not([aria-checked="true"]) .qf__mark { opacity: 0; transition: opacity 200ms var(--qf-ease); }
@media (hover: hover) { .qf__opt--pick:hover .qf__thumb img { transform: scale(1.05); } }
/* En dos columnas, "Otra cosa" ocupa la fila completa y queda en horizontal */
@container (max-width: 519px) {
  .qf__opt--pick:last-child { grid-column: 1 / -1; flex-direction: row; align-items: center; padding: 6px; }
  .qf__opt--pick:last-child .qf__thumb { flex: none; width: 76px; aspect-ratio: 1; }
  .qf__opt--pick:last-child .qf__optlabel { padding: 0 44px 0 14px; }
  .qf__opt--pick:last-child .qf__mark { top: 50%; margin-top: -12px; }
}

/* Campos de texto */
.qf__inputwrap { display: grid; gap: 8px; }
.qf__label { font-size: .88rem; font-weight: 600; color: var(--bosque, #29351a); }
.qf__field {
  width: 100%; min-height: 58px; padding: 16px 18px; border: 0; border-radius: 16px; background: #fff;
  font: 400 1.125rem/1.4 var(--f); color: var(--tinta, #1c2412); box-shadow: inset 0 0 0 1.5px var(--qf-line);
  -webkit-appearance: none; appearance: none; resize: vertical; transition: box-shadow 200ms var(--qf-ease);
}
textarea.qf__field { min-height: 120px; }
.qf__field::placeholder { color: rgba(79, 85, 68, .55); }
.qf__field:focus { outline: none; box-shadow: inset 0 0 0 2px var(--bosque, #29351a), 0 0 0 4px rgba(98, 107, 58, .16); }
.qf__control.has-error .qf__field, .qf__control.has-error .qf__opt { box-shadow: inset 0 0 0 2px #b3261e; }

.qf__err { margin: 10px 0 0; font-size: .92rem; color: #b3261e; }
.qf__err:empty { display: none; }
.is-shake { animation: qf-shake 320ms var(--qf-ease); }
@keyframes qf-shake { 25%, 75% { transform: translateX(-4px); } 50% { transform: translateX(4px); } }

/* Resumen y consentimiento */
.qf__summary { margin: 22px 0 0; padding: 4px 18px; background: #fff; border-radius: 16px; box-shadow: inset 0 0 0 1.5px rgba(41, 53, 26, .1); }
.qf__sumrow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 11px 0; }
.qf__sumrow + .qf__sumrow { box-shadow: 0 -1px 0 rgba(41, 53, 26, .08); }
.qf__sumrow dt { grid-column: 1; font-size: .82rem; color: var(--tinta-2, #4f5544); }
.qf__sumrow dd { grid-column: 1; margin: 0; font-size: 1rem; font-weight: 500; word-break: break-word; }
.qf__edit { grid-column: 2; grid-row: 1 / span 2; align-self: center; min-height: 44px; border: 0; background: none; padding: 0 4px; cursor: pointer; font: 600 .88rem var(--f); color: var(--ocre-txt, #9b5419); text-decoration: underline; text-underline-offset: 3px; }

.qf__consent { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: .95rem; line-height: 1.45; color: var(--tinta, #1c2412); position: relative; }
.qf__consent input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.qf__box { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 7px; display: grid; place-items: center; background: #fff; color: var(--crema, #fffcf5); box-shadow: inset 0 0 0 1.5px rgba(41, 53, 26, .3); transition: background-color 200ms var(--qf-ease), box-shadow 200ms var(--qf-ease); }
.qf__box svg { width: 15px; height: 15px; transform: scale(.4); opacity: 0; transition: transform 240ms var(--qf-ease), opacity 160ms var(--qf-ease); }
.qf__consent.is-on .qf__box { background: var(--bosque, #29351a); box-shadow: none; }
.qf__consent.is-on .qf__box svg { transform: none; opacity: 1; }
.qf__consent input:focus-visible + .qf__box { outline: 2px solid var(--olivo, #626b3a); outline-offset: 3px; }
.qf__consent.has-error .qf__box { box-shadow: inset 0 0 0 2px #b3261e; }
.qf__consent a { color: var(--bosque, #29351a); font-weight: 600; }
.qf__alt { margin: 18px 0 0; font-size: .92rem; color: var(--tinta-2, #4f5544); }
.qf__alt a { color: var(--bosque, #29351a); font-weight: 600; }

/* Pie: Atrás / Continuar */
.qf__foot {
  flex: none; display: flex; gap: 12px; align-items: center;
  padding: 16px var(--qf-pad) var(--qf-pad); border-top: 1px solid rgba(41, 53, 26, .1);
}
.qf__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 26px;
  border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  font-family: var(--fd); font-stretch: 110%; font-weight: 750; text-transform: uppercase; font-size: .9rem; letter-spacing: .02em;
  transition: transform 140ms var(--qf-ease), background-color 200ms var(--qf-ease), filter 200ms var(--qf-ease);
  -webkit-tap-highlight-color: transparent;
}
.qf__btn:active { transform: scale(.97); }
.qf__btn:focus-visible { outline: 2px solid var(--bosque, #29351a); outline-offset: 3px; }
.qf__btn[hidden] { display: none; }
.qf__btn--go { flex: 1; background: var(--g-ocre, #dca15d); color: var(--bosque, #29351a); }
@media (hover: hover) { .qf__btn--go:hover { background: var(--g-ocre-hover, #e2a964); } }
.qf__btn--go:disabled { opacity: .7; cursor: progress; }
.qf__btn--ghost { background: transparent; color: var(--bosque, #29351a); padding: 0 18px; box-shadow: inset 0 0 0 1.5px var(--qf-line); }
@media (hover: hover) { .qf__btn--ghost:hover { background: var(--arena, #f6f1e6); } }
@container (min-width: 520px) { .qf__btn--go { flex: none; min-width: 210px; margin-left: auto; } }
.qf__btn svg { width: 20px; height: 20px; }

/* Confirmación */
.qf__done {
  flex: 1; padding: 48px var(--qf-pad);
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; text-align: center;
}
.qf__done h3 { margin: 8px 0 0; font-family: var(--fd); font-stretch: 112%; font-weight: 800; text-transform: uppercase; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); line-height: 1; letter-spacing: -.01em; color: var(--bosque, #29351a); text-wrap: balance; }
.qf__done h3:focus { outline: none; }
.qf__done p { margin: 0; color: var(--tinta-2, #4f5544); max-width: 34ch; font-size: 1.05rem; }
.qf__doneactions { display: grid; gap: 8px; width: min(340px, 100%); margin-top: 18px; }
.qf__check svg { width: 72px; height: 72px; fill: none; stroke: var(--olivo, #626b3a); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.qf__check circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: qf-draw 600ms var(--qf-ease) forwards; }
.qf__check path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: qf-draw 420ms var(--qf-ease) 380ms forwards; }
@keyframes qf-draw { to { stroke-dashoffset: 0; } }

.qf__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .qf__step.is-in-next, .qf__step.is-in-prev, .is-shake { animation: none; }
  .qf__bar i, .qf__mark svg, .qf__box svg, .qf__thumb img { transition: none; }
  .qf__check circle, .qf__check path { animation: none; stroke-dashoffset: 0; }
}
.qf__doneactions .qf__btn { width: 100%; margin-left: 0; }
