/* AIFER · diálogo de proyecto (embudo) y pie. */

/* ───────── Pie ───────── */
.banda.pie {
  padding-block: var(--s-8) var(--s-6);
  border-top: 1px solid var(--linea-oscura);
}
.pie [hidden] { display: none !important; }
.pie__rejilla {
  display: grid;
  gap: var(--s-7) var(--s-6);
}
@media (min-width: 23rem) and (max-width: 47.99rem) {
  .pie__rejilla { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-6) var(--s-5); }
  .pie__marca { grid-column: 1 / -1; }
}
@media (min-width: 48rem) {
  .pie__rejilla { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); }
}
.pie__logo { display: inline-block; border-radius: var(--r-campo); }
.pie__logo img { width: 10.5rem; height: auto; }
.pie__eslogan {
  margin-top: var(--s-5);
  font-family: var(--f-display);
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.4rem);
  font-weight: 800;
  line-height: 1;
}
.pie__descripcion {
  margin-top: var(--s-3);
  max-width: 30em;
  font-size: var(--t-small);
  color: var(--gris-oscuro);
}
.pie__subtitulo {
  font-family: var(--f-texto);
  font-size: var(--t-small);
  font-weight: 650;
  color: var(--gris-oscuro);
  margin-bottom: var(--s-2);
}
.pie__lista { list-style: none; padding: 0; margin: 0; }
.pie__enlace {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  min-height: 2.75rem;
  padding-block: 0.35rem;
  line-height: 1.3;
  color: var(--blanco);
  text-decoration: none;
}
.pie__enlace:hover { text-decoration: underline; text-decoration-color: var(--menta); }
.pie__enlace--accion { color: var(--lima); font-weight: 650; }
.pie__valor { color: var(--gris-oscuro); }
.pie__enlace:hover .pie__valor { color: var(--blanco); }
.pie__pendiente {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding-block: 0.35rem;
  line-height: 1.3;
  color: var(--gris-oscuro);
  font-style: italic;
}
.pie__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-6);
  margin-top: var(--s-7);
  padding-top: var(--s-4);
  border-top: 1px solid var(--linea-oscura);
  font-size: var(--t-small);
  color: var(--gris-oscuro);
}
.pie__legales { display: flex; flex-wrap: wrap; gap: 0 var(--s-5); list-style: none; padding: 0; margin: 0; }
.pie__legales .pie__enlace { color: var(--gris-oscuro); }
.pie__legales .pie__enlace:hover { color: var(--blanco); }
.pie__cookies { flex-basis: 100%; margin-top: 0; }
@media (min-width: 64rem) {
  .pie__cookies { flex-basis: auto; margin-left: auto; }
}

/* ───────── Diálogo de proyecto ───────── */
body.proyecto-abierto { overflow: hidden; padding-right: var(--barra-scroll, 0px); }

.proyecto {
  --p-borde: #73827d;            /* borde de campo sobre papel: 4:1 */
  --avance: 0.2;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--papel);
  color: var(--grafito);
  overflow: hidden;
}
.proyecto [hidden] { display: none !important; }
.proyecto::backdrop { background: rgba(0, 0, 0, .72); }
.proyecto :focus-visible { outline-color: var(--pino); }
.proyecto__cabecera :focus-visible { outline-color: var(--menta); }

@media (min-width: 48rem) and (min-height: 34rem) {
  .proyecto {
    width: min(100% - 4rem, 50rem);
    height: min(100% - 4rem, 46rem);
    margin: auto;
    border-radius: var(--r-panel);
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .45);
  }
}

.proyecto__panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Cabecera negra con el trazo como barra de avance */
.proyecto__cabecera {
  flex: none;
  padding: var(--s-3) var(--gutter) var(--s-4);
  padding-top: max(var(--s-3), env(safe-area-inset-top));
  background: var(--noche);
  color: var(--blanco);
}
.proyecto__fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}
.proyecto__titulo {
  font-family: var(--f-display);
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.9rem);
  font-weight: 800;
  line-height: 1;
}
.proyecto__cerrar {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--blanco);
  cursor: pointer;
}
.proyecto__cerrar:hover { background: var(--noche-2); color: var(--lima); }
.proyecto__progreso {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-top: var(--s-3);
}
.proyecto__barra {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--linea-oscura);
}
/* El degradado se descubre al avanzar: empieza en lima y termina en cian */
.proyecto__relleno {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: calc(var(--avance) * 100%);
  border-radius: var(--r-pill);
  background: var(--trazo);
  background-size: calc(100% / var(--avance)) 100%;
  transition: width .45s var(--ease), background-size .45s var(--ease);
}
.proyecto__relleno::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blanco);
  box-shadow: 0 0 0 3px var(--noche);
  transform: translateY(-50%);
}
.proyecto__contador {
  flex: none;
  min-width: 6.5em;
  text-align: right;
  font-size: var(--t-micro);
  font-variant-numeric: tabular-nums;
  color: var(--gris-oscuro);
}

/* Cuerpo con scroll y barra de navegación fija */
.proyecto__form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.proyecto__cuerpo {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-6) var(--gutter) var(--s-7);
}
@media (min-width: 48rem) {
  .proyecto__cuerpo { padding: var(--s-7) var(--s-7) var(--s-7); }
}
.proyecto__pie {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--gutter);
  padding-bottom: max(var(--s-3), env(safe-area-inset-bottom));
  border-top: 1px solid var(--linea-clara);
  background: var(--papel);
}
@media (min-width: 48rem) {
  .proyecto__pie { padding-inline: var(--s-7); }
}
.proyecto__continuar { margin-left: auto; min-width: 9.5rem; }

/* Botones dentro del diálogo (fondo claro) */
.proyecto .boton--principal { background: var(--noche); color: var(--blanco); }
.proyecto .boton--principal:hover { background: var(--grafito); }
.proyecto .boton--secundario { color: var(--grafito); }

/* Pasos */
fieldset.paso, fieldset.campo { margin-inline: 0; padding: 0; border: 0; min-width: 0; }
fieldset.paso { margin: 0; }
.paso__leyenda { padding: 0; width: 100%; }
.paso__titulo {
  font-family: var(--f-display);
  font-size: clamp(2.1rem, 1.6rem + 2.2vw, 3.2rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.paso__titulo:focus { outline: none; }
.paso__ayuda { margin-top: var(--s-3); color: var(--grafito-suave); }

/* Fichas: casillas y opciones reales con forma de píldora */
.fichas {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
@media (min-width: 40rem) {
  .fichas--dos { grid-template-columns: 1fr 1fr; }
  .fichas--dos .ficha--ancha { grid-column: 1 / -1; }
}
.fichas--linea { display: flex; flex-wrap: wrap; margin-top: var(--s-2); }
.fichas--linea .ficha { flex: 1 1 12rem; }
.ficha {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: 3.5rem;
  padding: 0.8rem 1.5rem 0.8rem 1.15rem;
  border: 1.5px solid var(--p-borde);
  border-radius: var(--r-pill);
  background: var(--papel);
  cursor: pointer;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.ficha:hover { border-color: var(--grafito); background: #fff; }
.ficha input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0;
  border: 2px solid currentColor;
  background: transparent;
  cursor: pointer;
}
.ficha input[type="checkbox"] { border-radius: 5px; }
.ficha input[type="radio"] { border-radius: 50%; }
.ficha input::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  background: var(--lima);
  transform: scale(0);
  transition: transform .15s var(--ease);
}
.ficha input[type="radio"]::before { border-radius: 50%; }
.ficha input[type="checkbox"]::before {
  width: 0.8rem;
  clip-path: polygon(14% 44%, 0 62%, 40% 100%, 100% 22%, 84% 6%, 39% 66%);
}
.ficha input:checked { border-color: var(--lima); }
.ficha input:checked::before { transform: scale(1); }
.ficha:has(input:checked) { background: var(--noche); border-color: var(--noche); color: var(--blanco); }
.ficha:has(input:focus-visible) { outline: 3px solid var(--pino); outline-offset: 3px; }
@supports selector(:has(*)) {
  .ficha input:focus-visible { outline: none; }
}
.ficha__texto { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.ficha__nombre { font-weight: 650; line-height: 1.25; }
.ficha__pista { font-size: var(--t-small); line-height: 1.35; color: var(--grafito-suave); }
.ficha:has(input:checked) .ficha__pista { color: var(--gris-oscuro); }
.ficha:has(input[aria-invalid="true"]) { border-color: var(--error); }

/* Campos de texto */
.campo { margin-top: var(--s-5); }
.campo__etiqueta {
  display: block;
  padding: 0;
  margin-bottom: var(--s-2);
  font-weight: 650;
}
.campo__opcional { font-weight: 400; color: var(--grafito-suave); }
.campo__pista {
  margin: calc(var(--s-2) * -1) 0 var(--s-2);
  font-size: var(--t-small);
  color: var(--grafito-suave);
}
.campo__control {
  display: block;
  width: 100%;
  min-height: 3.25rem;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--p-borde);
  border-radius: var(--r-campo);
  background: #fff;
  font-size: 1.0625rem;
  line-height: 1.45;
}
.campo__control--area { min-height: 8.5rem; resize: vertical; }
.campo__control:hover { border-color: var(--grafito); }
.campo__control:focus-visible { outline: 3px solid var(--pino); outline-offset: 1px; border-color: var(--grafito); }
.campo__control[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.campo__error {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin-top: var(--s-3);
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--error);
}
.campo__error::before {
  content: "!";
  flex: none;
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.1rem;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1;
}

/* Resumen: el mensaje tal cual llegará, unido por el trazo */
.resumen {
  position: relative;
  margin-top: var(--s-5);
  padding: var(--s-5) var(--s-5) var(--s-5) calc(var(--s-5) + 0.5rem);
  border-radius: var(--r-panel);
  background: var(--niebla);
}
.resumen::before {
  content: "";
  position: absolute;
  left: var(--s-4);
  top: var(--s-5);
  bottom: var(--s-5);
  width: 4px;
  border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--lima), var(--menta) 50%, var(--cian));
}
.resumen__texto {
  padding-left: var(--s-3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--t-small);
  line-height: 1.5;
}
@media (min-width: 48rem) {
  .resumen__texto { font-size: var(--t-base); line-height: 1.55; }
}
@media (max-width: 47.99rem) {
  .resumen { padding: var(--s-4) var(--s-4) var(--s-4) calc(var(--s-4) + 0.5rem); }
  .resumen::before { left: var(--s-3); top: var(--s-4); bottom: var(--s-4); }
}
.envio {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.envio__boton { flex: 1 1 14rem; }
.envio__avisos { margin-top: var(--s-4); display: grid; gap: var(--s-2); }
.envio__aviso {
  margin: 0;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-panel);
  background: #fff2c4;
  color: #4d3800;
  font-size: var(--t-small);
  font-weight: 600;
}
.envio__privacidad {
  margin-top: var(--s-5);
  max-width: 60ch;
  font-size: var(--t-small);
  color: var(--grafito-suave);
}

/* Estado final */
.final__trazo {
  display: block;
  width: 5rem;
  height: 4px;
  margin-bottom: var(--s-5);
  border-radius: var(--r-pill);
  background: var(--trazo);
}
.final__texto { margin-top: var(--s-4); max-width: 60ch; font-size: var(--t-lead); line-height: 1.5; }
.final__acciones { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }
.final__acciones .boton { flex: 0 1 auto; }
.final__estado { margin-top: var(--s-3); min-height: 1.6em; font-weight: 600; color: var(--pino); }
.final__volver {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-top: var(--s-4);
  padding: 0;
  border: 0;
  background: none;
  color: var(--pino);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

/* Movimiento: solo al abrir, cerrar y cambiar de paso */
@keyframes proyecto-entra { from { opacity: 0; transform: translateY(1.5rem); } }
@keyframes proyecto-sale { to { opacity: 0; transform: translateY(1rem); } }
@keyframes proyecto-fondo-entra { from { opacity: 0; } }
@keyframes proyecto-fondo-sale { to { opacity: 0; } }
@keyframes paso-adelante { from { opacity: 0; transform: translateX(2rem); } }
@keyframes paso-atras { from { opacity: 0; transform: translateX(-2rem); } }
.proyecto[open] { animation: proyecto-entra .32s cubic-bezier(.2, .7, .2, 1); }
.proyecto[open]::backdrop { animation: proyecto-fondo-entra .32s ease; }
.proyecto.is-cerrando { animation: proyecto-sale .2s ease-in forwards; }
.proyecto.is-cerrando::backdrop { animation: proyecto-fondo-sale .2s ease-in forwards; }
.paso.entra-adelante { animation: paso-adelante .3s var(--ease); }
.paso.entra-atras { animation: paso-atras .3s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  .proyecto[open], .proyecto.is-cerrando, .paso.entra-adelante, .paso.entra-atras,
  .proyecto[open]::backdrop, .proyecto.is-cerrando::backdrop { animation: none; }
  .proyecto__relleno, .ficha, .ficha input::before { transition: none; }
}
