:root {
  color-scheme: light;
  --blue: #0759a5;
  --blue-dark: #003d73;
  --blue-soft: #eaf3fb;
  --cyan: #3ca6c7;
  --surface: rgba(255, 255, 255, .92);
  --ink: #172033;
  --muted: #5c667a;
  --line: #d9dfE8;
  --error: #b42318;
  --success: #067647;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 5%, rgba(60, 166, 199, .16), transparent 28rem),
    radial-gradient(circle at 94% 28%, rgba(7, 89, 165, .12), transparent 30rem),
    linear-gradient(180deg, #f8fbfd 0%, #eef4f8 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: auto -8rem -12rem auto;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  background: rgba(60, 166, 199, .08);
  filter: blur(2px);
  pointer-events: none;
}

button, input, textarea, select { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem max(1rem, calc((100vw - 980px) / 2));
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid rgba(217, 223, 232, .85);
  box-shadow: 0 4px 18px rgba(17, 42, 75, .04);
  backdrop-filter: blur(14px);
}

.brand-row { display: flex; align-items: center; gap: 1.1rem; }
.brand-row img { --logo-scale: 1; width: 108px; height: 42px; object-fit: contain; transform: scale(var(--logo-scale)); transition: transform .25s ease, opacity .25s ease; }
.brand-row .logo-nodo { --logo-scale: 1.5; }
.brand-row img:hover { transform: translateY(-2px) scale(var(--logo-scale)); opacity: .88; }

.language-switch { display: flex; gap: .35rem; }
.language-switch button {
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: #fff;
  color: var(--blue-dark);
  padding: .45rem .65rem;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease;
}
.language-switch button:hover { border-color: var(--blue); transform: translateY(-1px); }
.language-switch button[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }

.shell { width: min(860px, calc(100% - 2rem)); margin: 1.65rem auto 4rem; }
.progress-wrap {
  position: sticky;
  top: 69px;
  z-index: 15;
  margin-bottom: 1rem;
  padding: .75rem .9rem;
  border: 1px solid rgba(217, 223, 232, .85);
  border-radius: .8rem;
  background: rgba(248, 251, 253, .88);
  box-shadow: 0 7px 22px rgba(17, 42, 75, .05);
  backdrop-filter: blur(12px);
}
.progress-meta { display: flex; justify-content: space-between; font-size: .86rem; color: var(--muted); }
.progress-track { height: .48rem; margin-top: .4rem; overflow: hidden; background: #dfe6ee; border-radius: 999px; }
#progress-bar { width: 0; height: 100%; background: linear-gradient(90deg, var(--blue-dark), var(--blue), var(--cyan)); border-radius: inherit; transition: width .7s cubic-bezier(.22, 1, .36, 1); }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(217, 223, 232, .9);
  border-radius: 1.2rem;
  box-shadow: 0 18px 50px rgba(17, 42, 75, .09);
  padding: clamp(1.2rem, 3vw, 2.4rem);
  overflow: hidden;
  scroll-margin-top: 9rem;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: .28rem;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue), var(--cyan));
}

.card.page-enter { animation: page-in .78s cubic-bezier(.16, 1, .3, 1) both; }
.card.page-leave { animation: page-out .3s cubic-bezier(.4, 0, 1, 1) both; pointer-events: none; }

.card > .eyebrow, .card > h1, .card > .intro, .card > .actions {
  animation: rise-in .42s cubic-bezier(.22, 1, .36, 1) both;
}
.card > h1 { animation-delay: 45ms; }
.card > .intro { animation-delay: 80ms; }
.card > .actions { animation-delay: 120ms; }

.eyebrow { margin: 0 0 .4rem; color: var(--blue); font-size: .8rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1.15; }
.intro { max-width: 68ch; margin: 1rem 0 1.6rem; color: var(--muted); line-height: 1.65; white-space: pre-line; }

.question {
  margin: .8rem 0;
  padding: 1.15rem;
  border: 1px solid #e1e7ef;
  border-radius: .85rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(247, 250, 252, .92));
  box-shadow: 0 5px 15px rgba(17, 42, 75, .035);
  opacity: 0;
  transform: translateY(20px) scale(.992);
  transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.question.question-visible { animation: question-in .58s cubic-bezier(.16, 1, .3, 1) both; animation-delay: var(--delay, 0ms); }
.question:focus-within { border-color: rgba(7, 89, 165, .45); box-shadow: 0 8px 24px rgba(7, 89, 165, .08); }
.question legend, .question-label { display: block; width: 100%; margin-bottom: .8rem; font-weight: 700; line-height: 1.45; }
.required { color: var(--error); }
.hint { margin: -.35rem 0 .85rem; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.selection-count { display: block; width: fit-content; margin-top: .55rem; padding: .28rem .58rem; border-radius: 999px; background: #edf2f7; color: var(--blue-dark); font-weight: 700; transition: color .2s ease, background-color .2s ease, transform .2s ease; }
.selection-count.limit-reached { background: var(--blue); color: #fff; transform: scale(1.02); }
.group-title { margin: 1.8rem 0 .75rem; padding: .85rem 1rem; border-left: .3rem solid var(--blue); border-radius: 0 .7rem .7rem 0; background: linear-gradient(90deg, var(--blue-soft), rgba(234, 243, 251, .35)); font-size: 1.05rem; font-weight: 750; }

.options { display: grid; gap: .65rem; }
.question:has(input[data-question="pais"]) .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.question:has(input[data-question="pais"]) .option { align-items: center; min-height: 4rem; }
.country-flag { flex: 0 0 auto; width: 2.6rem; height: 1.95rem; border: 1px solid rgba(23, 32, 51, .12); border-radius: .2rem; box-shadow: 0 2px 6px rgba(17, 42, 75, .12); transition: transform .2s cubic-bezier(.22, 1, .36, 1); }
.option:hover .country-flag, .option:has(input:checked) .country-flag { transform: scale(1.12) rotate(-2deg); }
.option {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .78rem .9rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  cursor: pointer;
  line-height: 1.35;
  background: #fff;
  transition: transform .2s cubic-bezier(.22, 1, .36, 1), border-color .2s ease, background-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.option:hover, .option:focus-within { border-color: var(--blue); background: var(--blue-soft); transform: translateY(-1px); }
.option:has(input:checked) { border-color: var(--blue); background: linear-gradient(90deg, var(--blue-soft), #f6fbff); box-shadow: 0 0 0 2px rgba(7, 89, 165, .1); transform: translateX(.2rem); }
.option.is-disabled { opacity: .48; cursor: not-allowed; background: #f5f6f8; }
.option.is-disabled:hover { border-color: var(--line); transform: none; }
.option input { margin-top: .18rem; accent-color: var(--blue); }

input[type="text"], input[type="email"], input[type="date"], input[type="number"], textarea {
  width: 100%;
  border: 1px solid #aeb8c7;
  border-radius: .6rem;
  padding: .75rem .85rem;
  color: var(--ink);
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
textarea { min-height: 8rem; resize: vertical; }
input:focus, textarea:focus { outline: 3px solid rgba(7, 89, 165, .18); border-color: var(--blue); }

.currency-input { display: grid; grid-template-columns: auto 1fr; overflow: hidden; border: 1px solid #aeb8c7; border-radius: .7rem; background: #fff; transition: border-color .2s ease, box-shadow .2s ease; }
.currency-input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(7, 89, 165, .18); }
.currency-prefix { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; background: var(--blue-soft); color: var(--blue-dark); }
.currency-prefix strong { font-size: 1.05rem; }
.currency-flag { width: 2rem; height: 1.5rem; flex: 0 0 auto; border-radius: .15rem; box-shadow: 0 1px 4px rgba(17, 42, 75, .18); }
.currency-input input[type="number"] { min-width: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0; font-size: 1.08rem; font-weight: 700; }
.currency-input input[type="number"]:focus { outline: 0; }

.political-scale { padding: .7rem .25rem .15rem; }
.range-input {
  width: 100%;
  height: 1.6rem;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: grab;
}
.range-input:active { cursor: grabbing; }
.range-input::-webkit-slider-runnable-track {
  height: .65rem;
  border: 1px solid rgba(23, 32, 51, .08);
  border-radius: 999px;
  background: linear-gradient(90deg, #cb5965 0%, #d8b6c4 32%, #eef1f5 50%, #9dbfd9 68%, var(--blue) 100%);
  box-shadow: inset 0 1px 2px rgba(23, 32, 51, .1);
}
.range-input::-moz-range-track {
  height: .65rem;
  border: 1px solid rgba(23, 32, 51, .08);
  border-radius: 999px;
  background: linear-gradient(90deg, #cb5965 0%, #d8b6c4 32%, #eef1f5 50%, #9dbfd9 68%, var(--blue) 100%);
  box-shadow: inset 0 1px 2px rgba(23, 32, 51, .1);
}
.range-input::-webkit-slider-thumb {
  width: 1.55rem;
  height: 1.55rem;
  margin-top: -.5rem;
  appearance: none;
  border: .25rem solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 2px var(--blue), 0 5px 12px rgba(17, 42, 75, .24);
  transition: transform .16s ease, box-shadow .16s ease;
}
.range-input::-moz-range-thumb {
  width: 1.1rem;
  height: 1.1rem;
  border: .25rem solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 2px var(--blue), 0 5px 12px rgba(17, 42, 75, .24);
}
.range-input:hover::-webkit-slider-thumb, .range-input:focus-visible::-webkit-slider-thumb { transform: scale(1.12); box-shadow: 0 0 0 4px rgba(7, 89, 165, .2), 0 6px 14px rgba(17, 42, 75, .25); }
.range-input:focus { outline: none; }
.range-input:focus-visible { outline: 3px solid rgba(7, 89, 165, .18); outline-offset: 5px; border-radius: 999px; }
.scale-labels { display: grid; grid-template-columns: 1fr 1fr 1fr; margin-top: .35rem; color: var(--muted); font-size: .8rem; }
.scale-labels span { display: flex; flex-direction: column; gap: .1rem; }
.scale-labels span:nth-child(2) { align-items: center; text-align: center; }
.scale-labels span:last-child { align-items: flex-end; text-align: right; }
.scale-labels strong { color: var(--ink); font-size: .9rem; }
.scale-centre { position: relative; }
.scale-centre::before { content: ""; position: absolute; top: -1.35rem; width: 2px; height: .62rem; border-radius: 999px; background: rgba(23, 32, 51, .35); }
.range-value { display: flex; align-items: center; justify-content: center; gap: .55rem; width: fit-content; min-width: 8rem; margin: .85rem auto 0; padding: .45rem .75rem; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); }
.range-value strong { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--blue); color: #fff; }
.range-value span { font-size: .9rem; font-weight: 700; }

.error { margin: .65rem 0 0; color: var(--error); font-size: .9rem; font-weight: 650; }
.question.has-error { border-color: rgba(180, 35, 24, .45); box-shadow: inset .25rem 0 0 var(--error); }

.actions { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; }
.button {
  border: 0;
  border-radius: .65rem;
  padding: .78rem 1.2rem;
  font-weight: 750;
  cursor: pointer;
}
.button-primary { margin-left: auto; background: var(--blue); color: #fff; }
.button-primary { box-shadow: 0 5px 14px rgba(7, 89, 165, .2); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { background: #edf1f5; color: var(--ink); }
.button:disabled { opacity: .55; cursor: wait; }
.button { transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease; }
.button:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(17, 42, 75, .14); }
.button:active { transform: translateY(0) scale(.98); }

.save-state { min-height: 1.4rem; margin: .65rem .25rem; color: var(--muted); font-size: .86rem; text-align: right; }
.save-state.error-state { color: var(--error); }
.save-state.saved { color: var(--success); }
.finish { max-width: 42rem; margin: auto; text-align: center; padding: 2.5rem .5rem; }
.finish-mark { display: grid; place-items: center; width: 3.6rem; height: 3.6rem; margin: 0 auto 1.2rem; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 1.65rem; font-weight: 800; box-shadow: 0 0 0 .5rem rgba(234, 243, 251, .6); }
.finish-mark.complete { background: #e6f6ef; color: var(--success); box-shadow: 0 0 0 .5rem rgba(230, 246, 239, .6); }
.finish-mark.declined { background: #f1f3f6; color: var(--muted); box-shadow: 0 0 0 .5rem rgba(241, 243, 246, .65); }
.finish h1 { margin-bottom: 1rem; }
.finish p { max-width: 60ch; margin: .85rem auto; color: var(--muted); line-height: 1.65; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes question-in {
  from { opacity: 0; transform: translateY(20px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes page-in {
  from { opacity: 0; filter: blur(3px); transform: translate3d(42px, 20px, 0) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes page-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; filter: blur(2px); transform: translate3d(-24px, -8px, 0) scale(.99); }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
  .card.page-enter { animation: fade-in .24s ease both !important; }
  .card.page-leave { animation: fade-out .18s ease both !important; }
  .question.question-visible { animation: fade-in .2s ease both !important; }
}

@media (max-width: 640px) {
  .site-header { align-items: flex-start; }
  .brand-row { gap: .55rem; flex-wrap: wrap; }
  .brand-row img { width: 76px; height: 34px; }
  .brand-row .logo-nodo { --logo-scale: 1.35; }
  .shell { width: min(100% - 1rem, 900px); margin-top: 1rem; }
  .progress-wrap { top: 68px; padding-inline: .7rem; }
  .card { border-radius: .75rem; padding: 1rem; }
  .question { padding: 1rem .85rem; }
  .question:has(input[data-question="pais"]) .options { grid-template-columns: 1fr; }
  .actions { position: sticky; bottom: 0; padding: .8rem 0; background: rgba(255,255,255,.96); }
}
