/* brief-web. Idea: el progreso es una línea de tiempo de edición de video (el oficio del cliente):
   cada sección es un clip, su ancho es su número de preguntas y la barra inferior muestra cuánto
   está respondido. El amarillo de seguridad de obra marca dónde estás y qué hacer. */

/* Archivo (SIL Open Font License), subconjunto latino, servido desde aquí: sin peticiones a terceros. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("/archivo.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --concreto: #e6e9ec;
  --papel: #ffffff;
  --tinta: #1b2430;
  --tinta-suave: #4f5b69;
  --borde: #87919d;
  --borde-suave: #d3d8de;
  --senal: #f2b705;
  --senal-palida: #fff6d1;
  --error: #b42318;
  --fuente: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --ancho: 46rem;
}

*, *::before, *::after { box-sizing: border-box; }

/* Al desplazarse hasta un campo enfocado, deja sitio para la línea de tiempo fija y la etiqueta. */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 6rem; }

body {
  margin: 0;
  background: var(--concreto);
  color: var(--tinta);
  font-family: var(--fuente);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-stretch: 100%;
}

[hidden] { display: none !important; }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible {
  outline: 2px solid var(--tinta);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--senal);
}

/* --- Barra superior ------------------------------------------------------------------------ */

.barra {
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 1.25rem 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.marca {
  font-weight: 800;
  font-stretch: 125%;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

.idiomas { display: flex; border: 1px solid var(--borde); border-radius: 3px; overflow: hidden; }

.idiomas button {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.375rem 0.75rem;
  border: 0;
  background: transparent;
  color: var(--tinta);
  cursor: pointer;
}

.idiomas button[aria-pressed="true"] { background: var(--tinta); color: var(--papel); }

/* --- Cabecera --------------------------------------------------------------------------------- */

main { max-width: var(--ancho); margin: 0 auto; padding: 0 1rem 4rem; }

.cabecera { padding: 2.5rem 0 1.75rem; }

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.04;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.015em;
  max-width: 14em;
  text-wrap: balance;
}

.intro { margin: 1.25rem 0 0; max-width: 38em; color: var(--tinta-suave); }

/* --- Línea de tiempo ---------------------------------------------------------------------------- */

.linea {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--concreto);
  padding: 0.875rem 0 0.5rem;
}

.pista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 3px;
}

.pista li { display: flex; flex: 1 1 0; min-width: 3.5rem; }

.clip {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 2.5rem;
  padding: 0 0.375rem 0.375rem;
  border: 1px solid var(--borde);
  border-radius: 2px;
  background: var(--papel);
  color: var(--tinta);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  font-stretch: 70%;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.clip:hover { border-color: var(--tinta); }

.clip[aria-current="step"] { background: var(--senal); border-color: var(--tinta); }

.clip[data-error="true"] { border-color: var(--error); border-width: 2px; }

.clip-nombre { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.clip-relleno {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 5px;
  width: calc(var(--lleno, 0) * 100%);
  background: var(--tinta);
  transition: width 200ms ease-out;
}

/* El cabezal de reproducción: se mueve al clip de la sección actual. */
.cabezal {
  position: absolute;
  top: 0.25rem;
  left: 0;
  width: 2px;
  height: calc(2.5rem + 1.125rem);
  background: var(--tinta);
  transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
  pointer-events: none;
}

.cabezal::before {
  content: "";
  position: absolute;
  top: 0;
  left: -5px;
  border: 6px solid transparent;
  border-top: 8px solid var(--tinta);
}

.posicion { margin: 0.25rem 0 1rem; font-size: 0.9375rem; color: var(--tinta-suave); }

/* --- Hoja del formulario -------------------------------------------------------------------------- */

.hoja {
  background: var(--papel);
  border: 1px solid var(--borde-suave);
  border-radius: 4px;
  padding: 2rem 2.25rem 1.5rem;
  scroll-margin-top: 5.5rem;
}

.seccion h2 {
  margin: 0 0 1.75rem;
  font-size: 1.75rem;
  line-height: 1.15;
  font-weight: 750;
  font-stretch: 112%;
  outline: none;
}

.ayuda-seccion {
  margin: -1rem 0 1.75rem;
  padding: 0.75rem 1rem;
  background: var(--senal-palida);
  border-left: 4px solid var(--senal);
}

.pregunta { margin: 0 0 1.75rem; padding: 0; border: 0; min-width: 0; }

.pregunta > label,
.pregunta > legend {
  display: block;
  padding: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.35;
}

.req { color: var(--error); }

.ayuda { margin: -0.25rem 0 0.625rem; font-size: 0.9375rem; color: var(--tinta-suave); }

input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="date"], textarea {
  display: block;
  width: 100%;
  padding: 0.6875rem 0.875rem;
  border: 1px solid var(--borde);
  border-radius: 3px;
  background: var(--papel);
  color: var(--tinta);
  font: inherit;
}

textarea { resize: vertical; min-height: 6.5rem; }

input:hover, textarea:hover { border-color: var(--tinta); }

[aria-invalid="true"] { border-color: var(--error) !important; border-width: 2px !important; }

.opciones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 0.5rem;
}

.opcion {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--borde-suave);
  border-radius: 3px;
  cursor: pointer;
  line-height: 1.35;
}

.opcion:hover { border-color: var(--borde); }

.opcion:has(input:checked) { border-color: var(--tinta); background: var(--senal-palida); }

.opcion input { margin: 0.125rem 0 0; width: 1.125rem; height: 1.125rem; flex: none; accent-color: var(--tinta); }

.otro { margin-top: 0.5rem; }

.error { margin: 0.5rem 0 0; color: var(--error); font-weight: 600; font-size: 0.9375rem; }

.consentimiento { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--borde-suave); }

.consentimiento h3 { margin: 0 0 0.75rem; font-size: 1.125rem; font-stretch: 112%; }

.consentimiento .opcion { font-size: 0.9375rem; }

.trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* --- Acciones ---------------------------------------------------------------------------------------- */

.acciones {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--borde-suave);
}

.boton {
  margin-left: auto;
  padding: 0.8125rem 1.5rem;
  border: 2px solid var(--tinta);
  border-radius: 3px;
  background: var(--senal);
  color: var(--tinta);
  font: inherit;
  font-weight: 750;
  font-stretch: 112%;
  cursor: pointer;
  text-decoration: none;
}

.boton:hover { background: #ffc81f; }

.boton:disabled { opacity: 0.6; cursor: progress; }

.boton-secundario { margin-left: 0; background: var(--papel); border-color: var(--borde); font-weight: 600; }

.boton-secundario:hover { background: var(--papel); border-color: var(--tinta); }

.guardado { margin: 1rem 0 0; min-height: 1.5em; font-size: 0.875rem; color: var(--tinta-suave); }

.error-envio {
  margin-top: 1.5rem;
  padding: 0.875rem 1rem;
  border-left: 4px solid var(--error);
  background: #fdecea;
  color: var(--error);
  font-weight: 600;
}

/* --- Envío completado ------------------------------------------------------------------------------- */

.enviado { padding: 4rem 0; outline: none; }

.enviado h2 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 1.04;
  font-weight: 800;
  font-stretch: 125%;
}

.enviado h2::before {
  content: "";
  display: block;
  width: 3.5rem;
  height: 0.5rem;
  margin-bottom: 1.5rem;
  background: var(--senal);
}

.enviado p { max-width: 34em; color: var(--tinta-suave); }

/* --- Panel de administración ----------------------------------------------------------------------- */

.admin-marco { max-width: 70rem; margin: 0 auto; padding: 2rem 1rem 4rem; }

.admin-cabecera { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.5rem; margin-bottom: 1.5rem; }

.admin-cabecera h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); max-width: none; }

.admin-cabecera p { margin: 0; color: var(--tinta-suave); flex-basis: 100%; }

.admin-cabecera .boton { margin-left: 0; }

.admin a:not(.boton) { color: var(--tinta); text-underline-offset: 3px; }

.tabla-marco { overflow-x: auto; background: var(--papel); border: 1px solid var(--borde-suave); border-radius: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }

th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--borde-suave); white-space: nowrap; }

th { font-weight: 700; background: var(--concreto); }

.vacio { padding: 2rem; background: var(--papel); border: 1px solid var(--borde-suave); border-radius: 4px; }

.admin section {
  background: var(--papel);
  border: 1px solid var(--borde-suave);
  border-radius: 4px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
}

.admin section h2 { margin: 0 0 1rem; font-size: 1.375rem; font-stretch: 112%; }

dl { margin: 0; }

dt { font-weight: 600; margin-top: 1rem; }

dt:first-child { margin-top: 0; }

dd { margin: 0.25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

dd.sin { color: var(--tinta-suave); font-style: italic; }

/* --- Pantallas pequeñas y movimiento reducido -------------------------------------------------- */

@media (max-width: 40rem) {
  html { scroll-padding-top: 5rem; }
  body { font-size: 1rem; }
  .cabecera { padding-top: 1.75rem; }
  .pista li { min-width: 0; }
  .clip { height: 1.75rem; padding: 0; }
  .clip-nombre { display: none; }
  .cabezal { height: calc(1.75rem + 1.125rem); }
  .hoja { padding: 1.5rem 1rem 1.25rem; margin: 0 -0.25rem; scroll-margin-top: 4.5rem; }
  .seccion h2 { font-size: 1.5rem; }
  .opciones { grid-template-columns: 1fr; }
  .boton { padding: 0.75rem 1.125rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cabezal, .clip-relleno { transition: none; }
}
