/*
 * Hoja de solicitud de la ficha (lib/nueva/pages/ficha/solicitud_sheet.dart):
 * adoptar y ofrecer hogar temporal en dos pasos, y su resultado.
 *
 * Diseño: la propuesta aprobada de tres tableros. Las piezas comunes de una
 * hoja (panel, título, botones, aviso legal) son las de base.css; aquí va
 * solo lo propio. Solo variables: los valores viven en tokens.css.
 *
 * Esta hoja llega después del primer pintado (la solicitud está cerrada al
 * cargar). La regla que mantiene oculto lo que lleva `hidden` está en
 * ficha.css, que sí llega antes.
 *
 * El estado lo dice `data-nw-paso` en la hoja: intro, hogar, contacto o
 * enviada (lo cambia solicitud.js).
 */

/* ── Encabezado según el paso ────────────────────────────────────────── */
/* En los dos pasos: foto chica, título compacto y la organización debajo. */
.nw-solicitud .nw-solicitud__foto {
  width: 44px;
  height: 44px;
  border-radius: var(--nw-r-md);
}
.nw-solicitud[data-nw-paso='hogar'] .nw-sheet__titles,
.nw-solicitud[data-nw-paso='contacto'] .nw-sheet__titles {
  gap: 1px;
}
.nw-solicitud[data-nw-paso='hogar'] .nw-sheet__title,
.nw-solicitud[data-nw-paso='contacto'] .nw-sheet__title {
  font-size: 15px;
  letter-spacing: -0.2px;
  line-height: 1.25;
}
.nw-solicitud[data-nw-paso='hogar'] .nw-sheet__text,
.nw-solicitud[data-nw-paso='contacto'] .nw-sheet__text {
  font-size: var(--v5-text-label);
  font-weight: 500;
  line-height: 1.3;
}
/* En el resultado: el visto bueno y el título, al centro. */
.nw-solicitud[data-nw-paso='enviada'] .nw-sheet__head {
  justify-content: center;
  padding-right: 0;
  text-align: center;
}
.nw-solicitud[data-nw-paso='enviada'] .nw-sheet__title {
  font-size: 19px;
  letter-spacing: -0.4px;
  line-height: 1.2;
}
.nw-solicitud[data-nw-paso='enviada'] .nw-sheet__title:focus-visible {
  outline: none;
}
.nw-solicitud__ok {
  flex: none;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin-top: 10px;
  border-radius: var(--nw-r-round);
  background: var(--v5-success-soft);
  color: var(--v5-tint-game-ink);
  font-size: 22px;
}

/* ── Avance ──────────────────────────────────────────────────────────── */
.nw-solicitud__progreso {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nw-solicitud__paso-texto {
  flex: none;
  color: var(--v5-primary-deep);
  font-size: var(--v5-text-overline);
  font-weight: 700;
  letter-spacing: 0.6px;
  line-height: 1.3;
  text-transform: uppercase;
}
.nw-solicitud__barra {
  flex: 1 1 auto;
  display: flex;
  gap: 4px;
}
.nw-solicitud__tramo {
  flex: 1 1 0;
  height: 5px;
  border-radius: var(--v5-r-pill);
  background: var(--v5-border);
}
.nw-solicitud__tramo.is-on {
  background: var(--v5-primary);
}

/* ── Pasos ───────────────────────────────────────────────────────────── */
.nw-solicitud__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  margin: 0;
}
.nw-solicitud__titulo {
  margin-top: 2px;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.4px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
/* El título recibe el foco al llegar al paso solo para que se lea. */
.nw-solicitud__titulo:focus-visible {
  outline: none;
}
.nw-solicitud__bloque,
.nw-solicitud__fechas {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Preguntas de tocar ──────────────────────────────────────────────── */
.nw-solicitud__pregunta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.nw-solicitud__rotulo {
  color: var(--v5-text-muted);
  font-size: var(--v5-text-label);
  font-weight: 700;
  line-height: 1.35;
}
/* «Restricciones»: nombra las dos preguntas que siguen. */
.nw-solicitud__rotulo--grupo {
  margin-top: 4px;
  color: var(--v5-primary-deep);
  font-size: var(--v5-text-overline);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.nw-solicitud__ayuda {
  margin-top: -4px;
  color: var(--v5-text-muted);
  font-size: var(--v5-text-label);
  font-weight: 400;
  line-height: 1.4;
}
.nw-solicitud__opciones {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* El botón de radio existe para el teclado y el lector de pantalla; lo que
   se ve y se toca es su etiqueta. */
.nw-solicitud__radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  opacity: 0;
}
.nw-solicitud__opcion {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--v5-border);
  border-radius: var(--v5-r3);
  background: var(--v5-surface);
  color: var(--v5-ink);
  font-size: var(--v5-text-body);
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nw-solicitud__opcion .nw-i {
  flex: none;
  width: 18px;
  color: var(--v5-primary-deep);
  font-size: 15px;
  text-align: center;
}
.nw-solicitud__radio:checked + .nw-solicitud__opcion {
  border-color: var(--v5-primary);
  background: var(--v5-primary-soft);
}
.nw-solicitud__radio:focus-visible + .nw-solicitud__opcion {
  outline: 3px solid var(--v5-primary);
  outline-offset: 2px;
}
.nw-solicitud__opciones[aria-invalid='true'] .nw-solicitud__opcion {
  border-color: var(--v5-error);
}
/* Sí o No, y las opciones cortas: pastillas lado a lado. */
.nw-solicitud__opciones--pastillas {
  flex-direction: row;
  flex-wrap: wrap;
}
.nw-solicitud__opciones--pastillas .nw-solicitud__opcion {
  flex: 1 1 40%;
  justify-content: center;
  min-height: var(--nw-touch);
  padding: 8px 12px;
  border-radius: var(--v5-r-pill);
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
}
.nw-solicitud__opciones--pastillas
  .nw-solicitud__radio:checked
  + .nw-solicitud__opcion {
  color: var(--v5-primary-deep);
}

/* ── Cuestionario propio de la organización ─────────────────────────── */
/* Las preguntas las escribe cada organización: el texto puede ser largo y
   sin espacios (un enlace), así que se corta donde haga falta. */
.nw-solicitud__cq {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.nw-solicitud__cq .nw-solicitud__rotulo {
  color: var(--v5-ink);
  font-size: var(--v5-text-body);
  overflow-wrap: anywhere;
}
.nw-solicitud__cq .nw-solicitud__opcion {
  overflow-wrap: anywhere;
}
.nw-solicitud__obligatoria {
  color: var(--v5-error);
}
/* Las casillas (selección múltiple y «Sí, acepto») se ven como casillas:
   un cuadro que se llena con el ✓ (el símbolo `check` del registro). */
.nw-solicitud__radio[type='checkbox'] + .nw-solicitud__opcion::before {
  content: '';
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: 2px solid var(--v5-border-strong);
  border-radius: 6px;
  background: var(--v5-surface);
  color: var(--v5-surface);
  font-family: 'Material Symbols Rounded';
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  font-variation-settings: 'FILL' 0, 'wght' 600, 'GRAD' 0, 'opsz' 20;
}
.nw-solicitud__radio[type='checkbox']:checked + .nw-solicitud__opcion::before {
  content: '\e668';
  border-color: var(--v5-primary);
  background: var(--v5-primary);
}
.nw-solicitud__cq-intro {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: var(--nw-r-md);
  background: var(--v5-primary-soft);
}
.nw-solicitud__cq-titulo {
  margin: 0;
  color: var(--v5-ink);
  font-size: var(--v5-text-label);
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.nw-solicitud__cq-intro .nw-solicitud__ayuda {
  margin: 0;
}
.nw-solicitud__area {
  min-height: 44px;
  resize: vertical;
  font-family: inherit;
}

/* ── Campos ──────────────────────────────────────────────────────────── */
.nw-solicitud__campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
/* La caja es el campo: etiqueta arriba y lo escrito debajo, como el diseño. */
.nw-solicitud__caja {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 12px 7px;
  border: 1.5px solid var(--v5-border);
  border-radius: var(--nw-r-md);
  background: var(--v5-surface);
}
.nw-solicitud__caja:focus-within {
  border-color: var(--v5-primary);
  box-shadow: var(--nw-focus-ring);
}
.nw-solicitud__caja.is-invalid {
  border-color: var(--v5-error);
}
.nw-solicitud__etiqueta {
  color: var(--v5-primary-deep);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.3;
  text-transform: uppercase;
}
/* 16 px: con menos, iOS acerca la página al enfocar. El foco lo marca la
   caja; el contorno queda transparente, no quitado, para que el modo de
   alto contraste lo pinte. */
.nw-solicitud__input {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--v5-ink);
  font-size: var(--v5-text-body-large);
  font-weight: 500;
  line-height: 1.4;
  appearance: none;
}
.nw-solicitud__input:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}
.nw-solicitud__input::placeholder {
  color: var(--v5-text-light);
  font-weight: 400;
  opacity: 1;
}
/* Correo y edad comparten fila cuando caben; las dos fechas, siempre. */
.nw-solicitud__dos {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}
.nw-solicitud__dos--fechas {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 360px) {
  .nw-solicitud__dos {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }
  .nw-solicitud__dos--fechas {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* El rojo de texto es la tinta, que sí da contraste; el de estado queda
   para el borde. */
.nw-solicitud__error {
  color: var(--v5-tint-law-ink);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
}

/* ── Sin cuenta, y el atajo de Google y Apple ────────────────────────── */
/* Lo primero del paso: se postula sin cuenta. Igual que el aviso de
   /adoptar (`explorar.css`). */
.nw-solicitud__sin-cuenta {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: var(--v5-text-muted);
  font-size: var(--v5-text-body);
  font-weight: 400;
  line-height: 1.45;
}
.nw-solicitud__sin-cuenta > .nw-i {
  flex: none;
  margin-top: 1px;
  color: var(--v5-teal-action);
  font-size: 18px;
}
.nw-solicitud__sin-cuenta strong {
  color: var(--v5-ink);
  font-weight: 700;
}
/* El atajo es secundario: texto chico y dos botones parejos, bajo el
   botón principal en peso. */
.nw-solicitud__cuenta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nw-solicitud__cuenta-texto {
  margin: 0;
  color: var(--v5-text-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
}
.nw-solicitud__cuenta-botones {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.nw-solicitud__atajo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: var(--nw-touch);
  padding: 0 12px;
  border: 1.5px solid var(--v5-border);
  border-radius: var(--v5-r3);
  background: var(--v5-surface);
  color: var(--v5-ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}
.nw-solicitud__atajo[hidden] {
  display: none;
}
.nw-solicitud__atajo .nw-i {
  font-size: 16px;
}
.nw-solicitud__atajo:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--nw-focus-ring);
}
.nw-solicitud__atajo[aria-busy='true'] {
  opacity: 0.6;
  cursor: progress;
}

/* ── Red social: la red y el usuario en una fila ─────────────────────── */
/* Siempre en dos columnas; la de la red nunca angosta más que «Instagram»
   con su flecha (a 320 px se cortaba). Va después de `.nw-solicitud__dos`
   para ganarle también en teléfonos chicos. */
.nw-solicitud__dos--red {
  grid-template-columns: minmax(128px, 1fr) minmax(0, 1.5fr);
}
.nw-solicitud__caja--elegir {
  position: relative;
}
.nw-solicitud__select {
  padding-right: 22px;
  cursor: pointer;
  appearance: none;
}
.nw-solicitud__flecha {
  position: absolute;
  right: 8px;
  bottom: 8px;
  color: var(--v5-text-muted);
  font-size: 20px;
  pointer-events: none;
}
.nw-solicitud__legal {
  text-align: left;
}

/* ── Acciones ────────────────────────────────────────────────────────── */
/* Los botones de la hoja son enlaces en base.css; estos son <button>. */
.nw-solicitud__boton {
  width: 100%;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
.nw-solicitud__atras {
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}
/* Mientras se consulta o se envía: no se puede tocar de nuevo. */
.nw-solicitud .nw-sheet__cta[aria-busy='true'] {
  gap: 10px;
  opacity: 0.75;
  cursor: progress;
  pointer-events: none;
}
.nw-solicitud .nw-sheet__cta[aria-busy='true']::after {
  content: '';
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--nw-r-round);
  animation: nw-solicitud-gira 0.7s linear infinite;
}
@keyframes nw-solicitud-gira {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .nw-solicitud .nw-sheet__cta[aria-busy='true']::after {
    animation: none;
  }
}

/* ── Cuando el envío falla ───────────────────────────────────────────── */
.nw-solicitud__fallo {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: var(--v5-r3);
  background: var(--v5-dupla-soft);
}
.nw-solicitud__fallo:focus-visible {
  outline: none;
}
.nw-solicitud__fallo-texto {
  color: var(--v5-tint-law-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

/* ── Resultado ───────────────────────────────────────────────────────── */
.nw-solicitud__texto {
  color: var(--v5-text-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
}
.nw-solicitud__seguir {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--v5-border);
  border-radius: var(--v5-r3);
  background: var(--v5-bg);
}
.nw-solicitud__seguir-titulo {
  font-size: var(--v5-text-body);
  font-weight: 700;
  line-height: 1.3;
}
.nw-solicitud__seguir-texto {
  color: var(--v5-text-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}
.nw-solicitud__seguir-boton {
  min-height: 48px;
  margin-top: 4px;
}
/* «Siguiendo»: lo marca cuenta.js cuando la persona ya lo sigue. */
.nw-solicitud__seguir-boton[aria-pressed='true'],
.nw-solicitud__seguir-boton[aria-pressed='true']:hover {
  background: var(--v5-primary-soft);
  color: var(--v5-primary-deep);
  box-shadow: none;
}

@media (hover: hover) {
  .nw-solicitud__opcion:hover {
    border-color: var(--v5-border-strong);
  }
  .nw-solicitud__radio:checked + .nw-solicitud__opcion:hover {
    border-color: var(--v5-primary);
  }
}

/* ── Escritorio ──────────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .nw-solicitud__input {
    font-size: 15px;
  }
  .nw-solicitud__opcion {
    min-height: var(--nw-touch);
  }
}
