/* ════════════════════════════════════════════════════════════════════
 * Escala RYFF de Bienestar Psicológico · sitio público SOPHIA
 * ════════════════════════════════════════════════════════════════════ */

:root {
  --paper: #FBF7EF;
  --bg-elevated: #FFFFFF;
  --bg-subtle: #F4EEE2;
  --text: #1F1A14;
  --text-muted: #6B6358;
  --text-subtle: #938A7C;
  --border: #E7E0D2;
  --border-strong: #D6CCB8;
  --accent: #C0112F;
  --accent-ink: #FFFFFF;
  --purple: #C0112F; /* este sitio usa todo rojo (no morado) */

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-full: 999px;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 40px; --s-8: 56px; --s-9: 72px;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: var(--s-5);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header / footer ── */
.site-header { padding: var(--s-5) 0 var(--s-7); text-align: center; }
.brand-logo { height: 54px; width: auto; display: inline-block; }
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.22em;
  font-size: 1.05rem;
  color: var(--accent);
}
.site-footer {
  margin-top: auto;
  padding: var(--s-7) 0 var(--s-3);
  text-align: center;
  color: var(--text-subtle);
  font-size: 0.8125rem;
}
.site-footer a { color: var(--text-muted); }

/* ── Card base ── */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-8);
}

.eyebrow {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: var(--s-2);
}

.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  line-height: 1.1;
  margin: 0 0 var(--s-4);
  font-variation-settings: "opsz" 144;
}

.lead {
  color: var(--text-muted);
  font-size: 1.0625rem;
  margin: 0 0 var(--s-6);
  max-width: 60ch;
}
.lead--tiempo { margin-top: calc(var(--s-5) * -1); font-weight: 600; color: var(--text); }

/* ── Botones ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  border: none;
  border-radius: var(--r-full);
  padding: 11px 22px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: #a50e29; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { background: var(--bg-subtle); }

/* ── Intro / lead form ── */
.intro { max-width: 640px; margin: 0 auto; }
.lead-form { display: flex; flex-direction: column; gap: var(--s-4); }
.field { display: flex; flex-direction: column; gap: var(--s-1); }
.field label { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.field .opt { color: var(--text-subtle); font-weight: 400; }
.field input {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--text);
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.tel-row { display: flex; gap: var(--s-2); }
.tel-code {
  flex: 0 0 auto;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
}
.tel-num { flex: 1 1 auto; min-width: 0; }
.tel-code:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
}
.check input { margin-top: 3px; accent-color: var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.privacy { font-size: 0.8125rem; color: var(--text-subtle); margin: var(--s-1) 0 0; }

/* Teléfono con código de país en el mismo renglón */
.phone-row { display: flex; gap: var(--s-2); }
.phone-row .lada {
  width: 116px;
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--text);
  cursor: pointer;
}
.phone-row .lada:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.phone-row input { flex: 1; min-width: 0; }

/* Sección "Comparte tus resultados" */
.share-block { text-align: center; }
.share-block h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; margin: 0 0 var(--s-2); }
.share-block p { color: var(--text-muted); margin: 0 0 var(--s-4); }
.share-row {
  display: flex;
  gap: var(--s-2);
  max-width: 540px;
  margin: 0 auto;
}
.share-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--text-muted);
}
.share-row .btn { flex-shrink: 0; }
.share-ok { font-size: 0.8125rem; color: #2E7D32; margin: var(--s-2) 0 0; min-height: 1.2em; }
.form-error {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: #8c0d22;
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  font-size: 0.9rem;
  margin-bottom: var(--s-4);
}

/* ── Progress + quiz ── */
.progress {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-bottom: var(--s-5);
}
.quiz__meta { display: flex; justify-content: flex-end; margin-bottom: var(--s-2); }
.progress__fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 0.35s ease;
}
.quiz { max-width: 680px; margin: 0 auto; min-height: 420px; display: flex; flex-direction: column; }
.quiz__counter { font-size: 0.8125rem; color: var(--text-subtle); }
.quiz__pilar {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); font-weight: 600; margin-bottom: var(--s-2);
}
.quiz__texto {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  line-height: 1.25;
  margin: 0 0 var(--s-7);
  font-variation-settings: "opsz" 120;
}

.scale { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-7); }
.scale__label { font-size: 0.75rem; color: var(--text-subtle); flex-shrink: 0; max-width: 84px; }
.scale__dots { display: flex; align-items: center; justify-content: space-between; gap: var(--s-1); flex: 1; }
.dot {
  background: none; border: none; cursor: pointer;
  display: grid; place-items: center; padding: 6px;
}
.dot__circle {
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}
.dot__circle--1 { width: 22px; height: 22px; }
.dot__circle--2 { width: 28px; height: 28px; }
.dot__circle--3 { width: 34px; height: 34px; }
.dot__circle--4 { width: 40px; height: 40px; }
.dot__circle--5 { width: 46px; height: 46px; }
.dot__circle--6 { width: 52px; height: 52px; }
.dot:hover .dot__circle { border-color: var(--dim, var(--accent)); transform: scale(1.06); }
.dot.is-active .dot__circle { border-color: var(--dim, var(--accent)); background: var(--dim, var(--accent)); }

.quiz__nav { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }

/* Layout 2 columnas del quiz: sidebar de dimensiones + pregunta */
.quiz-card { max-width: 880px; margin: 0 auto; padding: 0; overflow: hidden; }
.quiz-layout { display: flex; gap: 0; min-height: 440px; }
.quiz-sidebar {
  width: 230px; flex-shrink: 0;
  padding: 26px 20px;
  border-right: 1px solid var(--border);
  background: #FCF9F2;
}
.quiz-sidebar__title {
  margin: 0 0 18px; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-subtle); font-weight: 600;
}
.quiz-main { flex: 1; min-width: 0; padding: 30px 32px 24px; display: flex; flex-direction: column; }

/* Items de dimension: pendiente -> activo -> palomita (en su color) */
.dimnav__item { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.dimnav__item:last-child { margin-bottom: 0; }
.dimnav__icon {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  margin-top: 1px; transition: all 0.3s ease;
}
.dimnav__icon--pending { background: transparent; }
.dimnav__dot { width: 7px; height: 7px; border-radius: 50%; display: block; }
.dimnav__info { flex: 1; min-width: 0; }
.dimnav__name { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.dimnav__prog { font-size: 10px; color: var(--text-subtle); margin-top: 2px; }
.dimnav__bar { height: 3px; background: rgba(0,0,0,0.07); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.dimnav__bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }

/* Boton "Ver mis resultados": color de la dimension (inline), texto blanco */
.btn-next { color: #FFFFFF; }
.btn-next:hover { filter: brightness(0.94); }

@media (max-width: 720px) {
  .card.quiz-card { max-width: 100%; padding: 0; }
  .quiz-layout { flex-direction: column; }
  .quiz-sidebar {
    width: 100%; border-right: none; border-bottom: 1px solid var(--border);
    padding: 14px 18px; display: flex; flex-wrap: nowrap; justify-content: space-between; align-items: center;
  }
  .quiz-sidebar__title { display: none; }
  .dimnav__item { margin-bottom: 0; gap: 0; }
  .dimnav__info { display: none; }
  .quiz-main { padding: 22px 20px; }
}

/* ── Resultados ── */
.results { display: flex; flex-direction: column; gap: var(--s-5); }
.results__head { text-align: center; margin-bottom: var(--s-2); }
.results__head .title { margin-bottom: 0; }

.overview {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 1fr;
  align-items: center;
  gap: var(--s-7);
}
.overview__chart { display: grid; place-items: center; }
.radar { width: 100%; height: auto; max-width: 470px; display: block; }
.overview__summary { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); }
.global__pct {
  font-family: var(--font-display);
  font-size: 3.25rem; line-height: 0.95; font-weight: 500; color: var(--accent);
  font-variation-settings: "opsz" 144;
}
.global__label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted);
}
.overview__text { color: var(--text-muted); font-size: 0.9375rem; margin: var(--s-2) 0 0; }

.band {
  display: inline-flex; align-items: center;
  padding: 5px 12px; border-radius: var(--r-full);
  border: 1.5px solid currentColor;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap;
}

.dims { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4); }
.dim {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 4px solid var(--dim, var(--accent));
  border-radius: var(--r-lg);
  padding: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.dim__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); }
.dim__name { font-family: var(--font-display); font-size: 1.125rem; font-weight: 500; font-variation-settings: "opsz" 144; }
.dim__pct { font-weight: 700; font-size: 1.125rem; color: var(--dim, var(--accent)); }
.dim__bar { height: 8px; border-radius: var(--r-full); background: var(--bg-subtle); overflow: hidden; }
.dim__bar > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--dim, var(--accent)); }
.dim .band { align-self: flex-start; margin-top: var(--s-1); }
.dim__desc { font-size: 0.8125rem; color: var(--text-subtle); font-style: italic; margin: 0; }
.dim__lead { font-size: 0.9rem; color: var(--text); margin: 0; line-height: 1.55; }
.dim__steps-label { font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; color: var(--text-muted); margin-top: var(--s-1); }
.dim__steps { margin: 0; padding-left: var(--s-4); display: flex; flex-direction: column; gap: var(--s-1); }
.dim__steps li { font-size: 0.875rem; color: var(--text-muted); line-height: 1.45; }

.note { font-size: 0.8125rem; color: var(--text-subtle); text-align: center; max-width: 70ch; margin: 0 auto; font-style: italic; }

.cta-block {
  text-align: center;
  background: linear-gradient(135deg, #C0112F 0%, #8E0C23 100%);
  border-color: transparent;
  color: #FFFFFF;
}
.cta-block h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; margin: 0 0 var(--s-2); color: #FFFFFF; }
.cta-block p { color: rgba(255,255,255,0.88); margin: 0 0 var(--s-4); }
.cta-block .btn-accent { background: #FFFFFF; color: #C0112F; }
.cta-block .btn-accent:hover { background: #F4EEE2; }

/* Compartir / guardar resultados */
.share { text-align: center; }
.share h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.25rem; margin: 0 0 var(--s-2); }
.share p { color: var(--text-muted); margin: 0 0 var(--s-4); }
.share__row { display: flex; gap: var(--s-2); max-width: 560px; margin: 0 auto; }
.share__input {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-body); font-size: 0.9rem;
  padding: 11px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--paper); color: var(--text-muted);
}
.share__input:focus { outline: none; border-color: var(--accent); }
.share__row .btn { flex: 0 0 auto; }
@media (max-width: 560px) {
  .share__row { flex-direction: column; }
  .share__row .btn { width: 100%; }
}

/* ── Loading / error ── */
.loading, .error-state { text-align: center; max-width: 520px; margin: 0 auto; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto var(--s-4);
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-state h2 { font-family: var(--font-display); font-weight: 500; }

/* ── Responsive ── */
@media (max-width: 720px) {
  .card { padding: var(--s-6) var(--s-5); }
  .overview { grid-template-columns: 1fr; }
  .overview__summary { align-items: center; text-align: center; }
  .dims { grid-template-columns: 1fr; }
  .scale { flex-wrap: wrap; justify-content: space-between; gap: 12px 0; }
  .scale__dots { order: -1; flex: 0 0 100%; }
  .scale__label { display: block; width: 100px; max-width: 100px; flex-shrink: 0; font-size: 0.72rem; line-height: 1.25; }
  .scale__label:first-child { text-align: left; }
  .scale__label:last-child { text-align: right; }
  .btn { white-space: nowrap; }
  .dot__circle--1 { width: 18px; height: 18px; }
  .dot__circle--2 { width: 24px; height: 24px; }
  .dot__circle--3 { width: 30px; height: 30px; }
  .dot__circle--4 { width: 36px; height: 36px; }
  .dot__circle--5 { width: 42px; height: 42px; }
  .dot__circle--6 { width: 48px; height: 48px; }
}
