/* Cuestionario de sueño — tokens tomados de plataforma/app/globals.css
   Los contrastes ya están medidos ahí contra WCAG 2.x; no inventar colores nuevos. */

:root {
  /* marca */
  --brand: #5d4e8c;
  --brand-mid: #7c6bad;
  --brand-light: #9b8bc4;
  --brand-deep: #4a3d73;
  --soft: #e6dff2;
  --soft-lighter: #f6f2fb;
  --rose: #c77b97;
  --rose-deep: #a0597a;
  --rose-ink: #8f4c6b;
  --rose-soft: #f8eef2;

  /* texto */
  --ink: #333333;
  --ink-muted: #5f5a6b;
  --ink-soft: #6b6675;

  /* semánticos */
  --error: #b3261e;
  --error-soft: #fbe9e7;
  --success: #2e7d5b;
  --success-soft: #e6f4ee;

  --surface: #ffffff;
  --line: #e3dbef;
  --line-strong: #cdc0e0;

  /* radios */
  --r-campo: 0.75rem;
  --r-fila: 1rem;
  --r-tarjeta: 1.5rem;

  /* sombras con tinte lavanda */
  --shadow-card: 0 1px 2px rgb(93 78 140 / .06), 0 8px 24px rgb(93 78 140 / .08);
  --shadow-cta: 0 8px 20px rgb(93 78 140 / .25);

  --display: "Fredoka", "Trebuchet MS", sans-serif;
  --sans: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --hand: "Caveat", "Segoe Script", cursive;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--soft-lighter);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
}

/* foco de marca, global */
:where(a, button, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--brand-mid);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- layout ---------- */

.shell { max-width: 720px; margin: 0 auto; padding: 0 20px 80px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--soft-lighter) 94%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}

.site-header.is-stuck { border-bottom-color: var(--line); }

.site-header__inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo { height: 38px; width: auto; display: block; }

.site-header__meta {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- progreso ---------- */

.progress { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; }

.progress__bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand-mid), var(--brand));
  border-radius: 99px;
  transition: width .4s var(--ease);
}

/* ---------- pantallas ---------- */

.screen { display: none; }
.screen.is-active { display: block; animation: aparecer .5s var(--ease) both; }

@keyframes aparecer {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-tarjeta);
  box-shadow: var(--shadow-card);
  padding: 36px;
  margin-top: 28px;
}

@media (max-width: 560px) { .card { padding: 24px 18px; border-radius: var(--r-fila); } }

/* ---------- bienvenida ---------- */

.welcome { text-align: center; padding-top: 48px; }
.welcome .logo-lg { height: 104px; width: auto; margin: 0 auto 26px; display: block; }

h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.875rem, 1.4rem + 2vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -.01em;
  text-wrap: balance;
  color: var(--brand);
  margin: 0 0 16px;
}

.welcome__text {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 52ch;
  margin: 0 auto 28px;
  white-space: pre-line;
}

.tips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 30px; }

.tip {
  font-size: 13px;
  color: var(--ink-muted);
  background: var(--soft);
  border-radius: 99px;
  padding: 7px 15px;
}

/* ---------- paso ---------- */

.step__eyebrow {
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rose-ink);
  margin: 0 0 10px;
}

.step__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.3;
  color: var(--brand);
  margin: 0 0 6px;
  text-wrap: balance;
}

.step__intro { color: var(--ink-soft); margin: 0 0 4px; }

/* ---------- preguntas ---------- */

.q { padding: 26px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; padding-top: 18px; }

.q__label { display: block; font-size: 16.5px; font-weight: 700; line-height: 1.5; margin-bottom: 4px; }

.q__num {
  display: inline-block;
  min-width: 2.2em;
  color: var(--brand-mid);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.q__opt { font-weight: 400; color: var(--ink-soft); font-size: 14px; }
.q__help { font-size: 14px; color: var(--ink-soft); margin: 0 0 12px 2.2em; }
.q__field { margin-left: 2.2em; margin-top: 12px; }

@media (max-width: 560px) {
  .q__field, .q__help { margin-left: 0; }
  .q__num { min-width: 1.9em; }
}

/* ---------- campos ---------- */

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"], textarea, select {
  width: 100%;
  min-height: 2.75rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-campo);
  padding: 11px 14px;
  transition: border-color .15s;
}

textarea { min-height: 7rem; resize: vertical; line-height: 1.7; }

input:focus, textarea:focus, select:focus { border-color: var(--brand-mid); }
::placeholder { color: #9b94a8; }

/* opciones */

.choices { display: grid; gap: 8px; }

.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 2.75rem;
  padding: 12px 15px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-campo);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.choice:hover { border-color: var(--brand-light); background: var(--soft-lighter); }
.choice input { margin: 4px 0 0; accent-color: var(--brand); flex: none; width: 18px; height: 18px; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.choice span { flex: 1; }

.choice-other { margin-top: 8px; margin-left: 30px; }

/* sí / no */

.yesno { display: flex; gap: 10px; }

.yesno button {
  flex: 1;
  max-width: 160px;
  min-height: 2.75rem;
  font: inherit;
  font-weight: 700;
  padding: 11px 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-campo);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.yesno button:hover { border-color: var(--brand-light); background: var(--soft-lighter); }
.yesno button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* escala */

.scale { display: flex; gap: 8px; flex-wrap: wrap; }

.scale button {
  width: 2.75rem;
  height: 2.75rem;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-campo);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.scale button:hover { border-color: var(--brand-light); background: var(--soft-lighter); }
.scale button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.scale__labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 8px;
  gap: 16px;
}

/* ---------- validación ---------- */

.q.has-error .q__field input,
.q.has-error .q__field textarea { border-color: var(--error); }

.q__error { display: none; font-size: 13.5px; color: var(--error); margin-top: 8px; }
.q.has-error .q__error { display: block; }

.alert {
  background: var(--error-soft);
  border: 1px solid #f0cdc9;
  color: var(--error);
  border-radius: var(--r-campo);
  padding: 12px 15px;
  font-size: 14.5px;
  margin-top: 20px;
}

.alert[hidden] { display: none !important; }

/* ---------- botones ---------- */

.btn {
  font: inherit;
  font-weight: 700;
  min-height: 2.75rem;
  padding: 12px 28px;
  border-radius: 99px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.btn--primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-cta); }
.btn--primary:hover { background: var(--brand-mid); }
.btn--primary:active { background: var(--brand-deep); }
.btn--ghost { background: transparent; color: var(--ink-soft); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--brand-light); color: var(--brand); }
.btn--lg { padding: 15px 38px; font-size: 17px; }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.actions__spacer { margin-left: auto; }

/* ---------- guardado / reanudar ---------- */

.saved-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 18px;
}

.saved-note__icono { flex: none; margin-top: 4px; color: var(--success); }

.resume {
  background: var(--soft);
  border-radius: var(--r-fila);
  padding: 18px 20px;
  margin-top: 26px;
  text-align: left;
}

.resume p { margin: 0 0 14px; font-size: 15px; }
.resume__row { display: flex; gap: 10px; flex-wrap: wrap; }
.resume[hidden] { display: none !important; }

/* ---------- gracias ---------- */

.done { text-align: center; padding-top: 52px; }
.done .logo-lg { height: 92px; width: auto; margin: 0 auto 24px; display: block; }
.done__text { font-size: 17px; color: var(--ink-soft); max-width: 50ch; margin: 0 auto; white-space: pre-line; }

.check {
  width: 64px;
  height: 64px;
  border-radius: 99px;
  background: var(--success-soft);
  color: var(--success);
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
}

.footer {
  text-align: center;
  font-family: var(--hand);
  font-size: 20px;
  color: var(--brand-light);
  margin-top: 44px;
}
