@font-face { font-family: "Cormorant"; src: url("assets/CormorantGaramond-latin.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Jost"; src: url("assets/Jost-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --rosa: #F5CCCE;
  --rosa-soft: #fcebec;
  --rosa-deep: #a4545e;
  --choco: #3a1e13;
  --choco-soft: #6b4a3d;
  --card: #ffffff;
  --line: rgba(58, 30, 19, .14);
  --line-strong: rgba(58, 30, 19, .38);
  --error: #a63a2a;
  --radius: 22px;
  --radius-sm: 14px;
  --gutter: 16px;
  --serif: "Cormorant", "Cormorant Garamond", Georgia, serif;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--rosa);
  color: var(--choco);
  font: 400 17px/1.55 var(--sans);
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-style: normal; font-weight: 400; letter-spacing: 0; }

/* Cabecera */
.top { display: flex; justify-content: center; padding: calc(28px + env(safe-area-inset-top)) var(--gutter) 22px; }
.logo { display: block; width: 168px; height: auto; }

/* Contenedor y tarjetas */
.wrap { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 0 var(--gutter) 28px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 30px 22px 26px;
  box-shadow: 0 1px 0 rgba(58, 30, 19, .04), 0 18px 40px -28px rgba(58, 30, 19, .35);
}
.screen { animation: rise .35s ease both; }
/* Solo movimiento, sin transparencia: el contenido nunca puede quedarse invisible */
@keyframes rise { from { transform: translateY(8px); } to { transform: none; } }

/* Tipografía */
.eyebrow { margin: 0 0 14px; font-size: 12px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: var(--choco-soft); }
.display { margin: 0 0 12px; font: 600 42px/1.02 var(--serif); letter-spacing: -.01em; }
.display .emoji { font-size: .62em; vertical-align: .12em; }
.lead { margin: 0 0 20px; font: 500 23px/1.25 var(--serif); }
.prose p { margin: 0 0 12px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 500; }
.fineprint { margin: 18px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--choco-soft); text-align: center; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 26px;
  border: 0; border-radius: 999px;
  font: 500 16.5px/1 var(--sans); letter-spacing: .02em;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, background-color .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--choco); color: #fff; }
.btn-primary:hover { background: #2b150c; }
.btn-primary[disabled] { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; color: var(--choco); padding: 0 14px; }
.btn-ghost:hover { text-decoration: underline; text-underline-offset: 4px; }
.cover .btn { width: 100%; margin-top: 26px; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--rosa-deep); outline-offset: 3px; }
.step-title:focus, .display:focus { outline: none; }

/* Progreso */
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.progress-label { flex: none; font-size: 12.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--choco-soft); font-variant-numeric: tabular-nums; }
.progress-track { flex: 1; height: 3px; border-radius: 3px; background: var(--rosa-soft); overflow: hidden; }
.progress-bar { display: block; height: 100%; width: 12.5%; background: var(--choco); border-radius: 3px; transition: width .35s ease; }

/* Pasos */
.step { animation: rise .3s ease both; }
.step-title { display: block; margin: 0 0 22px; padding: 0; font: 600 28px/1.12 var(--serif); letter-spacing: -.005em; }
.step-title .emoji { font-size: .7em; vertical-align: .08em; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend.step-title { float: left; width: 100%; }
legend.step-title + * { clear: both; }

.field { margin-bottom: 24px; }
.field:last-child { margin-bottom: 0; }
.field > label:not(.step-title):not(.check-plain) { display: block; margin-bottom: 8px; font-weight: 500; font-size: 17px; }
.optional { display: inline-block; margin-left: 6px; padding: 1px 9px; border-radius: 999px; background: var(--rosa-soft); font: 500 12px/1.6 var(--sans); letter-spacing: .04em; color: var(--choco-soft); vertical-align: .2em; }
.step-title .optional { vertical-align: .45em; }
.help { margin: 8px 0 0; font-size: 14.5px; line-height: 1.45; color: var(--choco-soft); }
.help-top { margin: -12px 0 16px; }
.note { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--rosa-soft); font-size: 14.5px; line-height: 1.45; color: var(--choco-soft); }
.question { margin: -6px 0 16px; font-size: 17px; }

/* Entradas de texto */
input[type="text"], textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--choco);
  font: 400 17px/1.45 var(--sans);
  transition: border-color .2s ease, box-shadow .2s ease;
  -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; min-height: 96px; }
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--choco); box-shadow: 0 0 0 4px rgba(245, 204, 206, .7); }
input::placeholder, textarea::placeholder { color: rgba(58, 30, 19, .35); }
.field-short input { max-width: 130px; }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--choco-soft); pointer-events: none; }
.input-prefix input { padding-left: 34px; }
.invalid input[type="text"], .invalid textarea { border-color: var(--error); }
.error { margin: 8px 0 0; font-size: 14.5px; line-height: 1.4; color: var(--error); font-weight: 500; }
.error:empty { display: none; }

/* Opciones (radio / checkbox) */
.options { display: grid; gap: 10px; }
.option {
  position: relative;
  display: flex; align-items: flex-start; gap: 14px;
  padding: 15px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s ease, background-color .15s ease;
}
.option:hover { border-color: var(--line-strong); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option::before {
  content: ""; flex: none;
  width: 22px; height: 22px; margin-top: 0;
  border: 1.5px solid var(--line-strong); border-radius: 50%;
  background: #fff center / 12px no-repeat;
  transition: background-color .15s ease, border-color .15s ease;
}
.option-check::before { border-radius: 7px; }
.option:has(input:checked) { border-color: var(--choco); background: var(--rosa-soft); }
.option:has(input:checked)::before { border-color: var(--choco); background-color: var(--choco); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='3' fill='%23fff'/%3E%3C/svg%3E"); }
.option-check:has(input:checked)::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.6l4.6-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.option:has(input:focus-visible) { outline: 2px solid var(--rosa-deep); outline-offset: 2px; }
.invalid .option { border-color: rgba(166, 58, 42, .45); }
/* Respaldo para navegadores sin :has(): JS añade .is-checked */
.option.is-checked { border-color: var(--choco); background: var(--rosa-soft); }

/* Escala 1-10 */
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale label { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale span {
  display: flex; align-items: center; justify-content: center;
  height: 54px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font: 600 24px/1 var(--serif); font-variant-numeric: lining-nums;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.scale label:hover span { border-color: var(--line-strong); }
.scale input:checked + span { background: var(--choco); border-color: var(--choco); color: #fff; }
.scale input:focus-visible + span { outline: 2px solid var(--rosa-deep); outline-offset: 2px; }
.invalid .scale span { border-color: rgba(166, 58, 42, .45); }
@media (min-width: 520px) { .scale { grid-template-columns: repeat(10, 1fr); gap: 6px; } .scale span { height: 50px; font-size: 21px; } }

/* Aceptación legal */
.legal { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.check-plain { display: flex; gap: 12px; align-items: flex-start; font-size: 15.5px; line-height: 1.45; cursor: pointer; }
.check-plain input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--choco); }
.link-btn { margin-top: 10px; padding: 6px 0; border: 0; background: none; color: var(--choco-soft); font: 400 14.5px/1.4 var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Navegación */
.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 30px; }
.nav .btn-primary { flex: 1; max-width: 260px; margin-left: auto; padding: 0 18px; white-space: nowrap; }
.submit-error { margin: 22px 0 0; padding: 14px 16px; border-radius: var(--radius-sm); background: #fbe9e6; color: var(--error); font-size: 15px; line-height: 1.45; font-weight: 500; }
.setup-warning { margin: 18px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px dashed var(--error); color: var(--error); font-size: 14px; line-height: 1.45; }

/* Honeypot */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Final */
.done .display { font-size: 40px; margin-bottom: 18px; }
.signature { margin: 22px 0 0; font: 600 30px/1 var(--serif); }

/* Pie */
.foot { display: flex; justify-content: center; gap: 10px; padding: 6px var(--gutter) calc(24px + env(safe-area-inset-bottom)); font-size: 13.5px; color: var(--choco-soft); }

@media (min-width: 560px) {
  .top { padding-top: 48px; padding-bottom: 30px; }
  .logo { width: 210px; }
  .card { padding: 44px 44px 38px; }
  .display { font-size: 52px; }
  .step-title { font-size: 31px; }
}

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

/* ---------- Páginas legales ---------- */
.legal-page .card { padding-top: 34px; }
.legal-page h1 { margin: 0 0 6px; font: 600 36px/1.08 var(--serif); }
.legal-page h2 { margin: 30px 0 8px; font: 600 23px/1.2 var(--serif); }
.legal-page p, .legal-page li { font-size: 16px; line-height: 1.6; }
.legal-page ul { padding-left: 20px; }
.legal-page .meta { margin: 0 0 8px; font-size: 14px; color: var(--choco-soft); }
.legal-page .back { display: inline-block; margin-bottom: 18px; font-size: 14.5px; color: var(--choco-soft); }
.pending { padding: 1px 6px; border-radius: 6px; background: #fff3c4; color: #6b4a00; font-weight: 500; }

/* El atajo "font:" reinicia las cifras: forzamos cifras alineadas en Cormorant */
.display, .lead, .step-title, .signature, .legal-page h1, .legal-page h2 { font-variant-numeric: lining-nums; }
