/* ════════════════════════════════════════════════════════════════════════
   Encuesta de Satisfacción · IPS
   MOBILE-FIRST · Montserrat · paleta corporativa (variables de la intranet)
   Fuentes auto-alojadas, sin llamadas a terceros.
   ════════════════════════════════════════════════════════════════════════ */

@font-face { font-family:"Montserrat"; font-style:normal; font-weight:400; font-display:swap; src:url("fonts/montserrat-400.woff2") format("woff2"); }
@font-face { font-family:"Montserrat"; font-style:normal; font-weight:500; font-display:swap; src:url("fonts/montserrat-500.woff2") format("woff2"); }
@font-face { font-family:"Montserrat"; font-style:normal; font-weight:600; font-display:swap; src:url("fonts/montserrat-600.woff2") format("woff2"); }
@font-face { font-family:"Montserrat"; font-style:normal; font-weight:700; font-display:swap; src:url("fonts/montserrat-700.woff2") format("woff2"); }
@font-face { font-family:"Montserrat"; font-style:normal; font-weight:800; font-display:swap; src:url("fonts/montserrat-800.woff2") format("woff2"); }

/* ── Tokens (derivados de assets/css/core.css de la intranet) ────────── */
:root {
    --brand:        #008ecf;   /* IPS medium blue  */
    --brand-dark:   #004f9f;   /* IPS dark blue    */
    --brand-navy:   #243d75;   /* IPS navy         */
    --brand-sky:    #c9e8fb;   /* IPS sky          */
    --brand-teal:   #62b6be;

    --brand-tint:   #eaf4fc;   /* fondo seleccionado / inputs */
    --brand-tint-2: #f2f8fd;

    --ink:          #1a2744;   /* text-primary  */
    --ink-soft:     #334155;   /* text-secondary*/
    --ink-faint:    #64748b;   /* text-muted    */

    --paper:        #f4f4f4;
    --surface:      #ffffff;

    --accent:       #ef8b58;   /* IPS orange (acento cálido) */
    --req:          #ec6769;   /* IPS coral (obligatorio)    */
    --success:      #059669;
    --error:        #d64545;

    --line:         rgba(0, 78, 159, .12);
    --line-strong:  rgba(0, 78, 159, .26);

    --font: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --r:    16px;
    --r-sm: 10px;
    --shadow-sm: 0 1px 3px rgba(0, 78, 159, .06);
    --shadow-md: 0 4px 14px rgba(0, 78, 159, .08);
    --shadow-lg: 0 10px 34px rgba(0, 78, 159, .12);
    --ring:      0 0 0 3px rgba(0, 142, 207, .28);
    --maxw: 720px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}
::selection { background: var(--brand-sky); color: var(--brand-dark); }

/* ── Atmósfera de fondo ───────────────────────────────────────────────── */
.bg-atmosphere {
    position: fixed; inset: 0; z-index: -2; pointer-events: none;
    background:
        radial-gradient(130% 60% at 50% -8%, rgba(0, 142, 207, .16), transparent 60%),
        radial-gradient(90% 45% at 100% 0%, rgba(98, 182, 190, .10), transparent 55%),
        linear-gradient(180deg, #eef5fb 0%, var(--paper) 36%, #eef1f4 100%);
}

/* ════════ BASE = MÓVIL ════════ */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 26px 16px 40px; }

/* ── Logo ─────────────────────────────────────────────────────────────── */
.intro-logo {
    display: block; width: 120px; height: auto; margin: 0 0 18px;
    filter: drop-shadow(0 4px 12px rgba(0, 78, 159, .12));
}

/* ── Intro ────────────────────────────────────────────────────────────── */
.eyebrow {
    margin: 0 0 10px; font-size: .72rem; font-weight: 700;
    letter-spacing: .18em; text-transform: uppercase; color: var(--brand);
}
.eyebrow-light { color: rgba(255, 255, 255, .85); }

.intro h1 {
    font-weight: 800; font-size: clamp(2.1rem, 9vw, 3rem); line-height: 1.04;
    letter-spacing: -.02em; margin: 0 0 14px; color: var(--ink);
}
.intro h1 em { font-style: normal; color: var(--brand); }

.lead { font-size: 1.02rem; color: var(--ink-soft); margin: 0 0 16px; }
.req-note {
    font-size: .85rem; color: var(--ink-faint); display: flex; align-items: center;
    gap: 7px; margin: 0; flex-wrap: wrap;
}
.req { color: var(--req); font-weight: 800; font-size: .8em; }

/* ── Stepper ──────────────────────────────────────────────────────────── */
.stepper { margin: 26px 0 22px; }
.stepper ol {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
}
.stepper-item {
    position: relative; display: flex; flex-direction: column; align-items: center;
    gap: 7px; text-align: center;
}
/* Conector entre pasos – centrado verticalmente respecto al dot */
.stepper-item::before {
    content: ""; position: absolute;
    top: 17px;                          /* centrado vertical = (34/2) = 17px */
    left: calc(-50% + 2px);             /* arranca desde el borde del dot anterior */
    width: calc(100% - 4px);            /* termina justo antes del dot actual */
    height: 3px;
    background: var(--line-strong); z-index: 0; border-radius: 3px;
    transform: translateY(-50%);
}
.stepper-item:first-child::before { display: none; }
.stepper-item.is-active::before,
.stepper-item.is-complete::before { background: var(--brand); }

.stepper-dot {
    position: relative; z-index: 1;
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 2px solid var(--line-strong);
    color: var(--ink-faint); font-weight: 800; font-size: .9rem;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    transition: transform .25s ease, background .25s, border-color .25s, color .25s;
}
.stepper-item.is-active .stepper-dot {
    background: var(--brand); border-color: var(--brand); color: #fff;
    transform: scale(1.1); box-shadow: 0 6px 16px -6px rgba(0, 142, 207, .8);
}
.stepper-item.is-complete .stepper-dot {
    background: var(--brand-tint); border-color: var(--brand);
    color: var(--brand-dark); font-size: 0;
}
.stepper-item.is-complete .stepper-dot::after {
    content: "✓"; font-size: .95rem;
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%;
}
.stepper-label {
    font-size: .66rem; font-weight: 700; color: var(--ink-faint);
    text-transform: uppercase; letter-spacing: .04em; transition: color .25s;
}
.stepper-item.is-active .stepper-label { color: var(--brand-dark); }
.stepper-item.is-complete .stepper-label { color: var(--ink-soft); }

/* ── Tarjetas ─────────────────────────────────────────────────────────── */
.card {
    position: relative; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r);
    padding: 20px 18px; margin: 0 0 14px; box-shadow: var(--shadow-sm);
    transition: box-shadow .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-index {
    position: absolute; top: 16px; right: 18px;
    font-weight: 800; font-size: 1.1rem; color: var(--brand-sky);
    font-feature-settings: "tnum"; letter-spacing: .02em;
    line-height: 1;
}

.section-head {
    margin: 4px 0 16px; padding: 20px 18px; border-radius: var(--r);
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    color: #fff; box-shadow: var(--shadow-md);
}
.section-head h2 { font-weight: 800; font-size: 1.4rem; line-height: 1.12; letter-spacing: -.01em; margin: 0 0 4px; }
.section-head p { margin: 0; color: rgba(255, 255, 255, .9); font-size: .92rem; }

/* ── Pregunta ─────────────────────────────────────────────────────────── */
.q {
    display: block; width: 100%; min-width: 0; box-sizing: border-box;
    font-weight: 700; font-size: 1.04rem; line-height: 1.38;
    color: var(--ink); margin: 0 0 16px; padding: 0 28px 0 0;
}

/* ── Opciones ─────────────────────────────────────────────────────────── */
.opts { display: flex; flex-direction: column; gap: 9px; }
.opts-compact { display: flex; flex-direction: column; gap: 9px; }

.opt {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 14px 15px; min-height: 52px;
    border: 1.5px solid var(--line); border-radius: var(--r-sm);
    background: var(--brand-tint-2); cursor: pointer; color: var(--ink);
    transition: border-color .15s, background .15s, transform .12s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.opt:hover { border-color: var(--line-strong); background: var(--brand-tint); }
.opt:active { transform: scale(.99); }
.opt input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

/* Radio mark – centrado vertical perfecto */
.opt-mark {
    flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--line-strong); background: #fff;
    position: relative;
    display: flex; align-items: center; justify-content: center;
    transition: border-color .15s;
}
.opt-text { font-weight: 500; font-size: .98rem; line-height: 1.3; }
.opt input:checked + .opt-mark { border-color: var(--brand); }
.opt input:checked + .opt-mark::after {
    content: ""; width: 12px; height: 12px; border-radius: 50%;
    background: var(--brand); animation: pop .2s ease;
    /* centrado absoluto dentro del padre flex */
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.opt:has(input:checked) {
    border-color: var(--brand); background: var(--brand-tint);
    box-shadow: inset 3.5px 0 0 var(--brand), var(--shadow-sm);
}
.opt:has(input:checked) .opt-text { color: var(--brand-dark); font-weight: 700; }
.opt input:focus-visible + .opt-mark { box-shadow: var(--ring); }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0); } to { transform: translate(-50%, -50%) scale(1); } }

/* ── Campos de texto ──────────────────────────────────────────────────── */
.field { display: block; }
.field-label { display: block; font-weight: 700; font-size: .92rem; margin: 0 0 8px; color: var(--ink); }
.reveal-field { margin-top: 14px; animation: slide-down .3s ease both; }
@keyframes slide-down { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.grid-2 { display: flex; flex-direction: column; gap: 16px; }

input[type="text"], input[type="tel"], input[type="email"], textarea {
    width: 100%; font-family: inherit; font-size: 16px; color: var(--ink);
    padding: 13px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
    background: var(--brand-tint-2);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, textarea:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 130px; line-height: 1.5; }
.field-help { font-size: .8rem; color: var(--ink-faint); margin: 7px 2px 0; text-align: right; font-variant-numeric: tabular-nums; }

/* Desplegable (select) con apariencia propia, coherente con los inputs. */
.select-wrap { display: block; }
select {
    width: 100%; font-family: inherit; font-size: 16px; color: var(--ink); cursor: pointer;
    padding: 13px 42px 13px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-sm);
    background-color: var(--brand-tint-2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 15px;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
select:focus { outline: none; border-color: var(--brand); background-color: #fff; box-shadow: var(--ring); }
select.invalid { border-color: var(--error); background-color: #fdf2f2; }

input.invalid, textarea.invalid { border-color: var(--error); background: #fdf2f2; }
.field-error {
    color: var(--error); font-size: .83rem; font-weight: 600;
    margin: 8px 0 0; display: block; min-height: 0;
}
.field-error:empty { margin: 0; }

/* ── Fieldset reset ──────────────────────────────────────────────────── */
fieldset.card {
    border: 1px solid var(--line);
    padding: 20px 18px;
    margin: 0 0 14px;
}

/* ── Política ─────────────────────────────────────────────────────────── */
.policy {
    display: flex; gap: 14px; align-items: flex-start;
    background: var(--brand-tint-2);
}
.policy-badge {
    flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px;
    /* Centrado perfecto del icono SVG */
    display: flex; align-items: center; justify-content: center;
    color: var(--brand-dark);
    background: var(--brand-tint); border: 1px solid var(--brand-sky);
    margin-top: 2px;    /* alinear óptico con el primer renglón de texto */
}
.policy-badge svg {
    display: block;     /* elimina espacio fantasma inline */
    flex-shrink: 0;
}
.policy-body { flex: 1; min-width: 0; }
.policy-body p { color: var(--ink-soft); margin: 0 0 11px; font-size: .92rem; line-height: 1.5; }
.policy-body p:last-child { margin-bottom: 0; }
.policy a {
    color: var(--brand-dark); font-weight: 600;
    text-decoration: underline; text-underline-offset: 2px;
    transition: color .15s;
}
.policy a:hover { color: var(--brand); }

/* ── Consentimiento ───────────────────────────────────────────────────── */
.consent-card { background: var(--brand-tint-2); }
.consent {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.consent input { position: absolute; opacity: 0; width: 0; height: 0; }
.consent-box {
    flex: 0 0 24px; width: 24px; height: 24px; border-radius: 7px;
    border: 2px solid var(--line-strong); background: #fff;
    position: relative;
    /* Centrado perfecto del ícono de check */
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s;
}
.consent input:checked + .consent-box { background: var(--brand); border-color: var(--brand); }
.consent input:checked + .consent-box::after {
    content: "";
    width: 6px; height: 12px;
    border: solid #fff; border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
    /* Ajuste fino: desplazar 1px arriba para compensar el eje óptico */
    margin-top: -2px;
}
.consent input:focus-visible + .consent-box { box-shadow: var(--ring); }
.consent-text { font-weight: 600; font-size: .94rem; color: var(--ink); line-height: 1.45; }

/* ── Honeypot ─────────────────────────────────────────────────────────── */
.hp { position: absolute !important; left: -9999px !important; top: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ── Navegación (barra inferior pegajosa en móvil) ───────────────────── */
.nav {
    position: sticky; bottom: 0; z-index: 5;
    display: flex; gap: 10px; align-items: center;
    margin: 14px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(244, 244, 244, 0), var(--paper) 38%);
}

/* ── Botones ──────────────────────────────────────────────────────────── */
.btn {
    font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; letter-spacing: .01em;
    border-radius: 999px; padding: 15px 22px; min-height: 52px; border: 1.5px solid transparent;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: background .15s, box-shadow .15s, transform .1s, color .15s, border-color .15s;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;   /* Asegura que las flechas (← →) se alineen con el texto */
}
.btn span[aria-hidden] {
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1; font-size: 1.15em;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary {
    background: var(--brand); color: #fff;
    box-shadow: 0 8px 20px -10px rgba(0, 142, 207, .9);
    flex: 1;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost {
    background: var(--surface); color: var(--brand-dark);
    border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn[disabled] { opacity: .65; cursor: progress; }

.form-error {
    color: var(--error); background: #fdf2f2; border: 1px solid #f3c9c9;
    border-radius: var(--r-sm); padding: 12px 14px; margin-top: 12px;
    font-weight: 600; font-size: .9rem;
}

/* ── Éxito ────────────────────────────────────────────────────────────── */
.success { text-align: center; padding: 40px 22px; box-shadow: var(--shadow-lg); }
.success-check {
    width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%;
    background: var(--success); color: #fff;
    /* Centrado perfecto del SVG check */
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 14px 30px -12px rgba(5, 150, 105, .7);
    animation: pop-in .5s cubic-bezier(.2, .9, .3, 1.3) both;
}
.success-check svg {
    display: block;    /* elimina espacio fantasma inline */
    flex-shrink: 0;
}
@keyframes pop-in { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.success h2 { font-weight: 800; font-size: 1.6rem; margin: 0 0 10px; color: var(--ink); }
.success p { color: var(--ink-soft); margin: 0 auto; max-width: 42ch; font-size: .96rem; line-height: 1.5; }

/* ── Pie ──────────────────────────────────────────────────────────────── */
.foot { text-align: center; color: var(--ink-faint); font-size: .76rem; margin-top: 26px; }
.foot p { margin: 0; }

/* ── Animaciones de entrada ───────────────────────────────────────────── */
@keyframes reveal-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.reveal { animation: reveal-up .6s cubic-bezier(.2, .7, .2, 1) both; }
.intro.reveal   { animation-delay: .04s; }
.stepper.reveal { animation-delay: .1s; }
form.reveal     { animation-delay: .16s; }
.step:not([hidden]) .card,
.step:not([hidden]) .section-head { animation: reveal-up .45s cubic-bezier(.2, .7, .2, 1) both; }
.step:not([hidden]) .card:nth-child(2) { animation-delay: .05s; }
.step:not([hidden]) .card:nth-child(3) { animation-delay: .1s; }
.step:not([hidden]) .card:nth-child(4) { animation-delay: .15s; }
.step:not([hidden]) .card:nth-child(5) { animation-delay: .2s; }
.step:not([hidden]) .card:nth-child(6) { animation-delay: .25s; }

/* ════════ TABLET ≥ 640px ════════ */
@media (min-width: 640px) {
    body { font-size: 16.5px; }
    .wrap { padding: 44px 24px 56px; }
    .intro-logo { width: 150px; margin-bottom: 22px; }
    .intro h1 { font-size: clamp(2.6rem, 6vw, 3.4rem); }
    .lead { font-size: 1.1rem; max-width: 56ch; }
    .eyebrow { font-size: .76rem; }

    .stepper { margin: 32px 0 26px; }
    .stepper ol { gap: 6px; }
    .stepper-dot { width: 38px; height: 38px; font-size: .95rem; }
    .stepper-item::before { top: 19px; }    /* centrado = 38/2 = 19px */
    .stepper-label { font-size: .74rem; text-transform: none; letter-spacing: 0; }

    .card { padding: 28px 28px; margin-bottom: 18px; }
    fieldset.card { padding: 28px 28px; }
    .card-index { font-size: 1.4rem; top: 22px; right: 26px; }
    .section-head { padding: 24px 28px; margin-bottom: 18px; }
    .section-head h2 { font-size: 1.85rem; }
    .q { font-size: 1.12rem; }

    .opts-compact { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }

    /* La barra de navegación deja de ser pegajosa en pantallas grandes */
    .nav {
        position: static; margin: 8px 0 0; padding: 0; background: none;
    }
    .btn-primary { flex: 0 0 auto; }
    #btnNext, #btnSubmit { margin-left: auto; }

    .success { padding: 52px 28px; }
    .success h2 { font-size: 2rem; }
}

/* ════════ ESCRITORIO ≥ 980px ════════ */
@media (min-width: 980px) {
    .intro h1 { font-size: 3.5rem; }
}

/* ── Accesibilidad: movimiento reducido ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
