/* ==========================================================================
   Encuesta La Unión — hoja de estilos propia (identidad académica)
   Prioridad móvil (375–430px). Diseño limpio, blanco, azul sobrio,
   bordes redondeados, sombra ligera y mucho espacio.
   ========================================================================== */

:root {
  --azul: #1e50c8;
  --azul-osc: #163a8f;
  --azul-muy-osc: #10254f;
  --azul-suave: #eaf0fc;
  --acento: #f2b705;
  --texto: #1b2434;
  --texto-suave: #566079;
  --gris-linea: #dbe1ec;
  --fondo-1: #f5f7fc;
  --fondo-2: #e9eef8;
  --blanco: #ffffff;
  --exito: #1a8f4c;
  --error: #c02626;
  --error-fondo: #fdecec;
  --radio: 16px;
  --radio-chico: 12px;
  --sombra: 0 1px 2px rgba(16, 37, 79, 0.06), 0 10px 30px rgba(16, 37, 79, 0.08);
  --sombra-sutil: 0 1px 3px rgba(16, 37, 79, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

/* El atributo hidden siempre oculta (evita que display de .boton lo anule). */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--texto);
  background: linear-gradient(180deg, var(--fondo-1) 0%, var(--fondo-2) 100%);
  background-attachment: fixed;
}

/* --- Utilidades de accesibilidad --- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.saltar-contenido {
  position: absolute; left: -999px; top: 0;
  background: var(--azul-osc); color: #fff;
  padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.saltar-contenido:focus { left: 0; }

/* --- Estructura --- */
.contenedor { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 16px; }
/* Contenedor ancho para el panel de resultados (mejor uso del escritorio). */
.contenedor-ancho { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.principal { padding-top: 24px; padding-bottom: 40px; }

/* --- Barra de marca simple (inicio / gracias / resultados) --- */
.marca-superior {
  background: var(--azul-muy-osc);
  color: #fff;
  border-bottom: 3px solid var(--acento);
}
.marca-superior__texto {
  display: block;
  padding: 12px 0;
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: .2px;
}

/* --- Barra fija del stepper (progreso) --- */
.barra {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--gris-linea);
}
.barra__fila {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding-top: 12px; padding-bottom: 10px;
}
.barra__marca {
  font-size: .82rem; font-weight: 700; color: var(--azul-osc);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barra__contador { font-size: .78rem; color: var(--texto-suave); white-space: nowrap; }
.barra__progreso { height: 5px; background: var(--fondo-2); overflow: hidden; }
.barra__progreso-fill {
  height: 100%; width: 8.33%;
  background: linear-gradient(90deg, var(--azul), var(--azul-osc));
  transition: width .4s ease;
}

/* --- Pie --- */
.pie {
  border-top: 1px solid var(--gris-linea);
  padding: 22px 0; margin-top: 8px;
}
.pie__aviso { margin: 0; text-align: center; color: var(--texto-suave); font-size: .85rem; }

/* --- Tarjetas --- */
.tarjeta {
  background: var(--blanco);
  border: 1px solid var(--gris-linea);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 26px 22px;
  margin-bottom: 20px;
}
.tarjeta--centrada { text-align: center; }

.eyebrow {
  display: inline-block;
  font-size: .74rem; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--azul);
  background: var(--azul-suave);
  padding: 5px 10px; border-radius: 999px; margin-bottom: 14px;
}
.titulo { font-size: 1.55rem; line-height: 1.25; margin: 0 0 6px; color: var(--azul-muy-osc); }
.subtitulo { margin: 0 0 18px; color: var(--texto-suave); font-weight: 600; }

.sitio-evaluado {
  margin: 18px 0 24px; background: var(--fondo-1);
  border-radius: var(--radio-chico); padding: 12px 14px; font-size: .95rem;
}
.sitio-evaluado__rotulo { display: block; font-weight: 700; color: var(--texto-suave); font-size: .85rem; }
.sitio-evaluado a { color: var(--azul); word-break: break-all; }

/* --- Autoría --- */
.autoria { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--gris-linea); }
.autoria__principal { margin: 0 0 10px; font-size: .9rem; color: var(--texto-suave); text-align: center; line-height: 1.5; }
.autoria__principal strong { color: var(--texto); }
.autoria__nota { margin: 0; font-size: .78rem; color: var(--texto-suave); text-align: center; }

/* --- Botones --- */
.boton {
  display: inline-flex; align-items: center; justify-content: center;
  text-align: center; padding: 15px 22px; min-height: 52px;
  border: 2px solid transparent; border-radius: 12px;
  font-size: 1.02rem; font-weight: 700; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.boton:active { transform: scale(.98); }
.boton--primario { background: var(--azul); color: #fff; box-shadow: 0 6px 16px rgba(30, 80, 200, 0.22); }
.boton--primario:hover { background: var(--azul-osc); }
.boton--secundario { background: #fff; color: var(--azul-osc); border-color: var(--azul); }
.boton--secundario:hover { background: var(--azul-suave); }
.boton--ghost { background: transparent; color: var(--texto-suave); min-height: 52px; padding: 12px 14px; }
.boton--ghost:hover { color: var(--azul); }
.boton:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }

.tarjeta--inicio .boton--primario,
.tarjeta--centrada .boton { width: 100%; }

/* --- Stepper --- */
.body--stepper { }
.stepper { width: 100%; max-width: 640px; margin: 0 auto; padding: 92px 16px 40px; }
.tarjeta--paso { padding: 24px 22px 22px; }

.paso { border: 0; margin: 0; padding: 0; min-width: 0; }
.paso[hidden] { display: none; }
.paso:not([hidden]) { animation: aparecer .28s ease; }
@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.paso__contador { margin: 0 0 6px; font-size: .76rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--azul); }
.paso__pregunta { display: block; width: 100%; padding: 0; margin: 0 0 20px; font-size: 1.28rem; font-weight: 700; line-height: 1.35; color: var(--azul-muy-osc); }

/* --- Opciones (botones grandes) --- */
.opciones { display: grid; gap: 12px; }
.opciones--sino { grid-template-columns: 1fr 1fr; }
.opciones--lista { grid-template-columns: 1fr; }
.opciones--escala { grid-template-columns: repeat(5, 1fr); gap: 8px; }

.opcion {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: 54px; padding: 12px 16px;
  border: 2px solid var(--gris-linea); border-radius: 14px;
  background: #fff; cursor: pointer; line-height: 1.3;
  transition: border-color .12s ease, background-color .12s ease, transform .1s ease, box-shadow .12s ease;
}
.opcion input[type="radio"] {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}
.opcion:hover { border-color: var(--azul); background: #f7f9ff; }
.opcion:active { transform: scale(.98); }
.opcion:focus-within { outline: 3px solid var(--acento); outline-offset: 2px; }
.opcion:has(input:checked) {
  border-color: var(--azul); background: var(--azul-suave); color: var(--azul-osc);
  box-shadow: inset 0 0 0 1px var(--azul), 0 4px 12px rgba(30, 80, 200, 0.14);
}
.opcion__texto { font-weight: 600; }

/* Sí / No: dos botones grandes centrados */
.opcion--sino { justify-content: center; min-height: 68px; font-size: 1.1rem; }

/* Lista (opciones categóricas): ancho completo, alineado a la izquierda */
.opcion--lista { justify-content: flex-start; }

/* Escala 1–5: botones numéricos */
.opcion--escala { justify-content: center; min-height: 60px; padding: 8px 4px; }
.opcion__num { font-size: 1.35rem; font-weight: 800; }
.escala-extremos {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 10px; font-size: .78rem; color: var(--texto-suave);
}
.escala-extremos span { max-width: 46%; }
.escala-extremos span:last-child { text-align: right; }

/* No aplica (pregunta 6): botón separado y más discreto */
.opcion--na {
  margin-top: 14px; justify-content: center; min-height: 50px;
  border-style: dashed; background: var(--fondo-1); color: var(--texto-suave);
  font-size: .92rem; text-align: center;
}

/* --- Campo "Otro" --- */
.campo-otro { margin-top: 14px; }
.campo-otro[hidden] { display: none; }
.campo-otro__label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.campo-otro input[type="text"] {
  width: 100%; padding: 13px 14px; font-size: 1rem;
  border: 1.5px solid var(--gris-linea); border-radius: 12px;
}
.campo-otro input[type="text"]:focus-visible {
  outline: 3px solid var(--acento); outline-offset: 1px; border-color: var(--azul);
}

/* --- Navegación --- */
.nav { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.nav .boton--primario { flex: 1; }
.nav .boton--ghost { flex: 0 0 auto; }

/* --- Avisos / errores --- */
.paso__aviso { margin: 14px 0 0; color: var(--error); font-weight: 600; font-size: .92rem; }
.paso--error .opciones .opcion { border-color: var(--error); }
.campo__error { color: var(--error); font-weight: 600; margin: 10px 2px 0; }
.aviso-error {
  background: var(--error-fondo); border: 1px solid var(--error); color: var(--error);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-weight: 600;
}
.aviso-error ul { margin: 0; padding-left: 18px; }

/* --- Página de gracias --- */
.marca-exito {
  width: 76px; height: 76px; line-height: 76px; margin: 4px auto 14px;
  border-radius: 50%; background: #e5f4ec; font-size: 2.2rem;
}

/* --- Resultados (sin cambios de comportamiento) --- */
.muestra-oficial {
  margin: 0 0 16px; padding: 10px 14px; font-size: .98rem;
  background: var(--azul-suave); border-radius: 10px; color: var(--azul-muy-osc);
}
.boton--auto { width: auto; }

.resumen { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 18px 0; }
.resumen__dato { background: var(--fondo-1); border-radius: 12px; padding: 16px 10px; text-align: center; }
.resumen__dato--ok { background: #e5f4ec; }
.resumen__dato--fuera { background: #f6ede0; }
.resumen__numero { display: block; font-size: 2rem; font-weight: 800; color: var(--azul-muy-osc); }
.resumen__etiqueta { font-size: .85rem; color: var(--texto-suave); }
.nota-metodo { background: var(--azul-suave); border-left: 4px solid var(--azul); border-radius: 8px; padding: 12px 14px; font-size: .95rem; }

.pregunta-resultado__cabecera {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 6px;
}
.pregunta-resultado__titulo { font-size: 1.15rem; color: var(--azul-osc); margin: 0; }
.boton-descarga {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: var(--azul-osc);
  border: 1.5px solid var(--gris-linea); border-radius: 10px;
  padding: 9px 14px; min-height: 40px;
  font-size: .88rem; font-weight: 600; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.boton-descarga:hover { border-color: var(--azul); background: var(--azul-suave); }
.boton-descarga:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }

.grafico-caja { position: relative; height: 360px; margin: 12px 0 18px; }

.tabla-resultados { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabla-resultados th, .tabla-resultados td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--gris-linea); }
.tabla-resultados thead th { background: var(--fondo-1); color: var(--texto-suave); }
.tabla-resultados .num { text-align: right; white-space: nowrap; }
.vacio { color: var(--texto-suave); text-align: center; margin: 8px 0; }

/* --- Movimiento reducido --- */
@media (prefers-reduced-motion: reduce) {
  .paso:not([hidden]) { animation: none; }
  .barra__progreso-fill { transition: none; }
  .boton:active, .opcion:active { transform: none; }
}

/* --- Pantallas más anchas --- */
@media (min-width: 620px) {
  .titulo { font-size: 1.8rem; }
  .paso__pregunta { font-size: 1.4rem; }
  .tarjeta { padding: 30px 28px; }
  /* Resumen: tres tarjetas en una fila. */
  .resumen { grid-template-columns: repeat(3, 1fr); }
}

/* Escritorio: gráficos más altos para que sean legibles como evidencia. */
@media (min-width: 860px) {
  .grafico-caja { height: 440px; }
}
