/* Plataforma de Encuestas ILC · pantallas del participante
   Fuentes alojadas en el propio servidor (sin llamadas a terceros). */
@font-face { font-family: 'Manrope'; src: url('fonts/Manrope.ttf') format('truetype'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Source Serif 4'; src: url('fonts/SourceSerif4-Semibold.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root {
  --ink: #142033; --ink-2: #3A4659; --muted: #5B6577; --line: #DCE1E8; --line-strong: #C9D1DC;
  --ground: #F4F6F9; --surface: #FFFFFF; --accent: #E07B24; --accent-text: #9A4A12; --accent-soft: #FDF0E4;
  --ok: #1E7A57; --ok-text: #16603F; --ok-soft: #E3F3EC; --bad: #B4362F; --bad-text: #8E2A24; --bad-soft: #FBE7E5;
  --gold: #E3A23B; --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 16px/1.55 'Manrope', system-ui, sans-serif; }
a { color: var(--accent-text); }
a:hover { color: #6E330A; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2 { font-family: 'Source Serif 4', Georgia, serif; font-weight: 600; line-height: 1.2; margin: 0; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; }
p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page { min-height: 100vh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; background: var(--ground); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar img { width: 38px; height: auto; }
.topbar .title { font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.topbar .spacer { flex: 1; }

.hero { background: var(--ink); color: #fff; padding: 36px 24px 72px; display: flex; flex-direction: column; gap: 18px; }
.hero img { width: 56px; height: auto; }
.hero .company { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #A9B8CF; }
.hero h1 { color: #fff; font-size: 2rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.card.raised { margin: -44px 16px 0; border: none; box-shadow: 0 1px 2px rgba(20,32,51,.06), 0 8px 24px rgba(20,32,51,.08); }
.content { padding: 24px 16px; display: flex; flex-direction: column; gap: 16px; flex: 1; }
.points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.points li { display: flex; gap: 12px; color: var(--ink-2); font-size: .92rem; }
.points svg { flex-shrink: 0; margin-top: 2px; }
.small { font-size: .82rem; color: var(--muted); }

.actions { padding: 16px 16px 28px; display: flex; flex-direction: column; gap: 12px; }
.btn { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 20px; border-radius: var(--radius);
  font: 700 1rem 'Manrope', sans-serif; text-decoration: none; cursor: pointer; border: 1.5px solid transparent; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #0C1626; color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn-link { background: none; border: none; color: var(--accent-text); font: 600 .9rem 'Manrope', sans-serif; min-height: 44px; cursor: pointer; text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-weight: 600; font-size: .92rem; }
.field input, .field textarea { font: 400 1.05rem 'Manrope', sans-serif; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 0 14px; height: 52px; width: 100%; }
.field textarea { height: auto; min-height: 120px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #F8D9BD; }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.key-input { letter-spacing: .1em; text-transform: uppercase; }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-size: .92rem; }
.alert-error { background: var(--bad-soft); color: var(--bad-text); }
.alert-info { background: var(--accent-soft); color: #6E330A; }

/* Encuesta */
.progress-wrap { padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; z-index: 2; }
.progress-label { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.progress { height: 8px; border-radius: 999px; background: #E3E8EF; overflow: hidden; }
.progress > span { display: block; height: 8px; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.section-head { display: flex; flex-direction: column; gap: 4px; }
.eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
fieldset.question { margin: 0; padding: 18px 16px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
fieldset.question.has-error { border-color: var(--bad); }
fieldset.question legend { float: left; width: 100%; padding: 0; font-weight: 600; line-height: 1.45; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.scale.ten { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.opt { position: relative; display: block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt span { display: flex; align-items: center; justify-content: center; height: 48px; border-radius: 12px; border: 1.5px solid var(--line-strong);
  background: var(--surface); font-weight: 700; font-size: 1.05rem; transition: background .12s, color .12s; }
.opt input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.opt input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; gap: 12px; font-size: .78rem; color: var(--muted); }
.scale-ends span:last-child { text-align: right; }
/* Escala con texto en cada opción: una opción por fila, con la etiqueta visible. */
.scale.named { grid-template-columns: minmax(0, 1fr); }
.opt-text span { height: auto; min-height: 48px; justify-content: flex-start; text-align: left; padding: 10px 14px; }
.err { color: var(--bad-text); font-size: .85rem; font-weight: 600; }
.saved { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.survey-footer { padding: 12px 16px 24px; background: var(--surface); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; position: sticky; bottom: 0; }
.js [data-step][hidden] { display: none; }

dialog { border: none; border-radius: 20px; padding: 24px 20px; max-width: 420px; width: calc(100% - 32px); color: var(--ink); }
dialog::backdrop { background: rgba(20,32,51,.55); }
dialog .dialog-body { display: flex; flex-direction: column; gap: 14px; }

.done { background: var(--ink); color: #fff; min-height: 100vh; }
.done .content { justify-content: center; gap: 24px; padding: 32px 28px; }
.done h1 { color: #fff; font-size: 2.1rem; }
.done p { color: #DCE3EE; font-size: 1.05rem; }
.done .note { background: rgba(255,255,255,.08); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; color: #DCE3EE; }
.done .badge { width: 80px; height: 80px; border-radius: 999px; background: var(--ok); display: flex; align-items: center; justify-content: center; }
.done a { color: #fff; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (min-width: 641px) { .page { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* utilidades (sin estilos en línea: la política de seguridad de contenido los bloquea) */
.grow { flex: 1; }
.center { text-align: center; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.lead { color: var(--ink-2); }
.back { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 1.4rem; }
.exit-form { padding: 0 16px 16px; }
#btn-anterior[hidden] + #btn-siguiente, #btn-anterior[hidden] ~ #btn-revisar { grid-column: 1 / -1; }

/* Versión estática (Supabase) */
.ico { color: var(--accent-text); flex-shrink: 0; margin-top: 2px; display: inline-flex; }
button.back { background: none; border: none; cursor: pointer; font-family: inherit; }
button.btn { width: 100%; }
.btn:disabled { opacity: .6; cursor: progress; }
body.done { background: var(--ink); }
