/* formulario.css · el formulario de la V1, tal cual: mismas medidas, mismos
   pasos y mismos estados. Para la V3 cambian solo los colores, las tipografías,
   las esquinas (--radio) y la caja que lo contiene: su borde inferior es la
   línea de tu parte y se dibuja una vez al cargar. Usa las variables de sitio.css. */

.oculto {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.icono {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ——— Botones ——— */

.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 28px;
  font-family: var(--fuente-titulos);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--blanco);
  background: var(--boton);
  border: 1px solid var(--boton);
  border-radius: var(--radio);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 200ms, border-color 200ms, color 200ms, transform 200ms, opacity 200ms;
}

@media (min-width: 768px) {
  .boton { width: auto; }
}

.boton__flecha { width: 20px; height: 20px; transition: transform 250ms var(--salida); }
/* Al pasar por encima, el botón se invierte: blanco con borde negro */
.boton:hover { background: var(--boton-encima); border-color: var(--tinta); color: var(--tinta); }
.boton:hover .boton__flecha { transform: translateX(4px); }
.boton:active { background: var(--boton-pulsado); border-color: var(--tinta); color: var(--tinta); transform: scale(0.98); }
.boton:disabled, .boton[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.boton.is-cargando { pointer-events: none; }
.boton.is-cargando .boton__flecha { display: none; }

.boton__spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--blanco);
  border-radius: 50%;
  animation: girar 0.8s linear infinite;
}

.boton.is-cargando .boton__spinner { display: block; }

@keyframes girar { to { transform: rotate(360deg); } }

.boton--secundario { background: transparent; border-color: var(--tinta); color: var(--tinta); }
.boton--secundario:hover { background: var(--tinta); border-color: var(--tinta); color: var(--blanco); }
.boton--secundario:active { background: var(--tinta); border-color: var(--tinta); color: var(--blanco); }
.boton--pequeno { min-height: 44px; padding: 0 20px; font-size: 16px; }

/* ——— Caja ———
   Su borde inferior es la línea de tu parte: negra de lado a lado y, en
   rojo, el tramo que mide el porcentaje escrito en el formulario (--parte).
   Al cargar se dibuja una vez: primero la negra, después la roja. */

.formulario-caja {
  position: relative;
  max-width: 720px;
  margin-inline: auto;
  padding: 28px 24px 34px;
  background: var(--blanco);
  color: var(--tinta);
  font-family: var(--fuente-titulos);
  border-bottom: 6px solid transparent;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.55);
  scroll-margin-top: calc(var(--cabecera-alto) + 16px);
}

.formulario-caja::before,
.formulario-caja::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 6px;
  transform-origin: left;
}

.formulario-caja::before { background: var(--tinta); }

.formulario-caja::after {
  background: var(--rojo);
  transform: scaleX(var(--parte));
  transition: transform 700ms var(--salida);
}

@media (prefers-reduced-motion: no-preference) {
  .formulario-caja::before { animation: linea-dibuja 900ms var(--salida) 300ms backwards; }
  .formulario-caja::after { animation: linea-dibuja 800ms var(--salida) 900ms backwards; }
}

@keyframes linea-dibuja { from { transform: scaleX(0); } }

@media (min-width: 768px) {
  .formulario-caja { padding: 40px 40px 46px; }
}

.formulario-caja__titulo { font-size: clamp(1.625rem, 1.3rem + 1.2vw, 2rem); }

.formulario-caja__entradilla {
  margin: 10px 0 24px;
  font-family: var(--fuente-texto);
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--tinta);
}

/* ——— Campos ——— */

.campo { display: flex; flex-direction: column; gap: 8px; }
/* Campos que salen solo en algunos casos (renta antigua, 25 oct 2026): ocultos de verdad */
.campo[hidden] { display: none; }
.campo__etiqueta { font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--tinta); }
.campo__opcional { font-weight: 400; color: var(--gris-texto); }
.campo__marca {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px 3px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: 1px;
  color: var(--blanco);
  background: var(--tinta);
  border-radius: var(--radio);
}
.campo--precio .campo__input { border-width: 2px; border-color: var(--tinta); }
.campo--precio .campo__ayuda { color: var(--tinta); }
legend.campo__etiqueta { margin-bottom: 12px; }

.campo__input {
  width: 100%;
  height: 56px;
  padding: 0 16px;
  font-family: var(--fuente-titulos);
  font-size: 17px;
  color: var(--tinta);
  background: var(--blanco);
  border: 1px solid var(--gris-campo);
  border-radius: var(--radio);
  transition: border-color 150ms, box-shadow 150ms;
}

.campo__input:focus { outline: none; border-color: var(--tinta); box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.16); }
.campo__input:disabled { opacity: 0.55; background: var(--gris-fondo); cursor: not-allowed; }
.campo__input::placeholder { color: transparent; }
.campo__input--area { height: auto; min-height: 140px; padding: 14px 16px; line-height: 1.5; resize: vertical; }
.campo__ayuda { font-size: 14px; line-height: 1.5; color: var(--gris-texto); }

.campo__error { display: none; align-items: flex-start; gap: 6px; font-size: 14px; line-height: 1.45; font-weight: 500; color: var(--rojo); }
.campo__error .icono { width: 18px; height: 18px; margin-top: 2px; }
.campo.is-error .campo__error { display: flex; }
.campo.is-error .campo__input { border-color: var(--rojo); }

.campo__aviso {
  display: none;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--tinta);
  background: var(--gris-fondo);
  border-radius: var(--radio);
}

.campo__aviso .icono { width: 18px; height: 18px; margin-top: 2px; }
.campo.is-aviso .campo__aviso { display: flex; }

.campo__archivo { width: 100%; font-size: 16px; }
.campo__archivo-boton { display: none; }

html.js .campo__archivo {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}

html.js .campo__archivo-boton { display: inline-flex; }

@media (min-width: 768px) {
  html.js .campo__archivo-boton { align-self: flex-start; }
}

html.js .campo__archivo:focus-visible + .campo__archivo-boton { outline: 2px solid var(--tinta); outline-offset: 2px; }
.campo.is-error .campo__archivo-boton { border-color: var(--rojo); }

.archivos { list-style: none; }
.archivos:empty { display: none; }
.archivos__item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gris-linea); font-size: 15px; }
.archivos__item:first-child { border-top: 1px solid var(--gris-linea); }
.archivos__nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tinta); }
.archivos__peso { flex: none; color: var(--gris-texto); }
.archivos__quitar { flex: none; min-height: 44px; padding: 0 4px; font-weight: 600; color: var(--tinta); text-decoration: underline; text-underline-offset: 3px; }
.archivos__quitar:hover { color: var(--rojo); }

.campo__select { position: relative; }
.campo__select .campo__input { padding-right: 48px; appearance: none; -webkit-appearance: none; }
.campo__select .icono { position: absolute; right: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--gris-texto); pointer-events: none; }

.campo__sufijo { position: relative; }
.campo__sufijo .campo__input { padding-right: 48px; }
.campo__sufijo > span { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 17px; color: var(--gris-texto); pointer-events: none; }

.campo__dos { display: grid; gap: 16px; }

@media (min-width: 768px) {
  .campo__dos { grid-template-columns: 1fr 1fr; }
}

/* ——— Casillas ——— */

.casilla { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 8px 0; cursor: pointer; }
.casilla__input { position: absolute; width: 1px; height: 1px; margin: -1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); }

.casilla__caja {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 4px;
  border: 1.5px solid var(--gris-campo);
  border-radius: var(--radio);
  background: var(--blanco);
  transition: border-color 150ms, background-color 150ms;
}

.casilla__caja svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--blanco);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 15;
  stroke-dashoffset: 15;
  transition: stroke-dashoffset 200ms var(--salida);
}

.casilla__input:checked + .casilla__caja { border-color: var(--tinta); background: var(--tinta); }
.casilla__input:checked + .casilla__caja svg { stroke-dashoffset: 0; }
.casilla__input:focus-visible + .casilla__caja { outline: 2px solid var(--tinta); outline-offset: 2px; }
.casilla__texto { font-size: 17px; line-height: 1.5; }
.casilla__texto a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.casilla__texto a:hover { color: var(--rojo); }
.campo.is-error .casilla__caja { border-color: var(--rojo); }
.casillas { display: flex; flex-direction: column; }

/* ——— Barra de progreso ——— */

.progreso { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; list-style: none; }
.progreso__paso { display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; }
.progreso__nombre { font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--gris-texto); }

@media (min-width: 768px) {
  .progreso__nombre { font-size: 14px; }
}

.progreso__paso.is-activo .progreso__nombre { color: var(--tinta); }
.progreso__barra { position: relative; display: block; height: 4px; border-radius: var(--radio); background: var(--gris-linea); overflow: hidden; }
.progreso__barra::after { content: ''; position: absolute; inset: 0; background: var(--tinta); transform: scaleX(0); transform-origin: left; transition: transform 250ms var(--salida); }
.progreso__paso.is-activo .progreso__barra::after, .progreso__paso.is-hecho .progreso__barra::after { transform: scaleX(1); }

@media (max-width: 599px) {
  .progreso { position: relative; padding-bottom: 28px; }
  .progreso__paso { justify-content: flex-start; }

  .progreso__paso:not(.is-activo) .progreso__nombre {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .progreso__paso.is-activo .progreso__nombre { position: absolute; left: 0; right: 0; top: 14px; font-size: 15px; }
}

/* ——— Pasos ——— */

.formulario__paso { margin-top: 32px; outline: none; }
html.js .formulario__paso:not(.is-actual) { display: none; }
.formulario__legend { margin-bottom: 20px; font-size: 1.25rem; font-weight: 600; }
html.js .formulario__legend { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.formulario__campos { display: grid; gap: 24px; }
.formulario__acciones { display: flex; flex-direction: column; gap: 12px; margin-top: 32px; }

@media (min-width: 768px) {
  .formulario__acciones { flex-direction: row-reverse; justify-content: space-between; }
}

.formulario__resultado { margin-top: 20px; padding: 14px 16px; font-weight: 600; color: var(--rojo); border: 1px solid var(--rojo); border-radius: var(--radio); }
.formulario__resultado:empty { display: none; }
.formulario__trampa { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
html:not(.js) [data-siguiente], html:not(.js) [data-atras], html:not(.js) .progreso { display: none; }

/* Al cambiar de paso, el paso nuevo entra con un fundido corto (en la V1 lo hacía GSAP) */
@media (prefers-reduced-motion: no-preference) {
  .formulario.is-movido .formulario__paso.is-actual { animation: paso-entra 200ms ease-out; }
}

@keyframes paso-entra { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 767px) {
  .formulario-caja { padding: 24px 16px 28px; }
  .formulario__paso { margin-top: 22px; }
  .formulario__campos { gap: 16px; }
  .campo { gap: 6px; }
  .campo:has(> .campo__dos) > legend.campo__etiqueta { font-size: 14px; color: var(--gris-texto); }
  .formulario__acciones { margin-top: 24px; }
}
