/* David Parra Trainer · Manual de identidad visual v1.0 */
:root {
  --bg-dark: #111111;
  --bg-light: #FAF8F3;
  --accent: #A6C615;
  --accent-dark: #5B6C0B;
  --accent-hover: #96b213;
  --dark-hover: #262626;
  --card-hover-bg: #f3f1ea;
  --error: #B3261E;
  --error-on-dark: #FF8A80;
  --input-bg: #FFFFFF;
  --radius: 4px;
  --radius-sm: 2px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ancho: 600px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--bg-dark); }

/* Dos temas con las mismas variables: oscuro (inicio y final) y claro (preguntas). */
body {
  --fondo: var(--bg-dark);
  --texto: var(--bg-light);
  --texto-2: rgba(250, 248, 243, .72);
  --borde: rgba(250, 248, 243, .33);
  --ceja: var(--accent);
  --foco: var(--accent);
  --color-error: var(--error-on-dark);
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--fondo);
  color: var(--texto);
  font-family: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.claro {
  --fondo: var(--bg-light);
  --texto: var(--bg-dark);
  --texto-2: rgba(17, 17, 17, .72);
  --borde: rgba(17, 17, 17, .2);
  --ceja: var(--accent-dark);
  --foco: var(--accent-dark);
  --color-error: var(--error);
}

::selection { background: var(--accent); color: var(--bg-dark); }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.caja { width: 100%; max-width: var(--ancho); margin: 0 auto; padding-left: 20px; padding-right: 20px; }
main { flex: 1; padding-top: 32px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

/* ---------- Cabecera ---------- */
.cabecera { background: var(--bg-dark); color: var(--bg-light); position: sticky; top: 0; z-index: 10; }
.cabecera-fila { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; }
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-punto { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.logo-texto { font-size: 1.0625rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.contador { font-size: .8125rem; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.avance { height: 4px; background: rgba(250, 248, 243, .14); }
.avance-relleno { height: 100%; width: 0; background: var(--accent); transition: width .38s var(--ease-out); }

/* ---------- Texto ---------- */
.pantalla { animation: entrar .38s var(--ease-out); }
@keyframes entrar { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.ceja { margin: 0 0 12px; font-size: .8125rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ceja); }
h1 { margin: 0 0 16px; font-size: clamp(1.625rem, 1.2rem + 2vw, 2.125rem); line-height: 1.15; font-weight: 700; text-wrap: balance; overflow-wrap: anywhere; }
p { margin: 0 0 16px; }
.entradilla { font-size: 1.125rem; }
.ayuda, .nota { color: var(--texto-2); }
.nota { font-size: .875rem; margin: 24px 0 0; }
#form-pregunta h1::before { content: ""; display: block; width: 40px; height: 3px; margin-bottom: 16px; background: var(--accent); }

/* ---------- Campos ---------- */
.etiqueta { display: block; margin: 24px 0 8px; font-size: .8125rem; font-weight: 700; }
.campo {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  background: var(--input-bg);
  color: var(--bg-dark);
  border: 1px solid rgba(17, 17, 17, .2);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1.0625rem; /* a partir de 16px iOS no hace zoom al escribir */
}
textarea.campo { min-height: 128px; resize: vertical; }
input[type="date"].campo { -webkit-appearance: none; appearance: none; }
.campo-id { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.campo[aria-invalid="true"] { border: 2px solid var(--error); }
.error { margin: 12px 0 0; font-size: .875rem; font-weight: 700; color: var(--color-error); }

/* ---------- Opciones y escalas ---------- */
.opciones { display: grid; gap: 12px; margin-top: 8px; }
.escala { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.escala-4 { grid-template-columns: repeat(4, 1fr); }
.opcion {
  min-height: 56px;
  padding: 14px 16px;
  background: var(--input-bg);
  color: var(--bg-dark);
  border: 1px solid rgba(17, 17, 17, .2);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, transform .1s ease;
}
.opciones .opcion { text-align: left; }
.escala .opcion { padding: 0; font-size: 1.125rem; }
.opcion:active { transform: scale(.97); }
.opcion[aria-pressed="true"] { background: var(--bg-dark); border-color: var(--bg-dark); color: var(--bg-light); }
@media (hover: hover) { .opcion[aria-pressed="false"]:hover { background: var(--card-hover-bg); border-color: var(--bg-dark); } }
.extremos { display: flex; justify-content: space-between; gap: 16px; margin: 10px 0 0; font-size: .875rem; color: var(--texto-2); }
.extremos span:last-child { text-align: right; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 30px;
  background: var(--accent);
  color: var(--bg-dark);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s ease, transform .1s ease;
}
.boton:active { transform: scale(.97); }
.boton:disabled { opacity: .5; cursor: default; transform: none; }
@media (hover: hover) { .boton:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); } }
.boton-ancho { width: 100%; margin-top: 24px; }
.boton-secundario { background: transparent; color: var(--texto); border-color: var(--borde); padding-left: 22px; padding-right: 22px; }
@media (hover: hover) { .boton-secundario:not(:disabled):hover { background: var(--card-hover-bg); border-color: var(--bg-dark); } }
.acciones { display: flex; gap: 12px; margin-top: 32px; }
.acciones .boton[type="submit"] { flex: 1; }

.enlace { min-height: 44px; padding: 0 2px; background: none; border: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Avisos y final ---------- */
.aviso { margin: 0 0 24px; padding: 6px 14px; background: rgba(166, 198, 21, .14); border: 1px solid var(--accent-dark); border-radius: var(--radius-sm); font-size: .875rem; }
.aviso-error { background: transparent; border-color: var(--color-error); color: var(--color-error); padding: 14px; }
.resultado { border-top: 4px solid var(--accent); padding-top: 28px; }

@media (max-width: 359px) {
  .caja { padding-left: 16px; padding-right: 16px; }
  .escala { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
