/* ==========================================================================
   Mio Mortgage — pre-qualification wizard
   Builds on the tokens and components in styles.css
   ========================================================================== */

.pq-body { background: #fff; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.pq-header {
  position: sticky; top: 0; z-index: 40; height: 72px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px;
  padding-inline: var(--gutter); background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.pq-progress { justify-self: center; display: flex; align-items: center; gap: 14px; width: min(360px, 100%); }
.pq-progress-bar { flex: 1; height: 6px; border-radius: 6px; background: var(--mist); overflow: hidden; }
.pq-progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--teal-light)); transform-origin: left; transform: scaleX(var(--p, .08)); transition: transform .8s var(--ease); }
.pq-progress-label { font-family: var(--display); font-weight: 600; font-size: .74rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pq-call { font-family: var(--display); font-weight: 600; font-size: .86rem; color: var(--navy); white-space: nowrap; }
.pq-call-label { color: var(--muted); font-weight: 500; }
@media (max-width: 720px) {
  .pq-header { grid-template-columns: auto 1fr; gap: 16px; }
  .pq-call { display: none; }
  .pq-progress { justify-self: end; width: 100%; max-width: 220px; }
}

/* ---------- Layout ---------- */
.pq-layout { flex: 1; display: grid; }
@media (min-width: 1000px) { .pq-layout { grid-template-columns: minmax(360px, 36%) 1fr; } }

/* ---------- Aside ---------- */
.pq-aside { position: relative; background: var(--navy); color: #fff; overflow: hidden; isolation: isolate; }
.pq-aside-photo { position: absolute; inset: 0; z-index: -1; }
.pq-aside-photo img { width: 100%; height: 100%; object-fit: cover; animation: aside-zoom 24s var(--ease-in-out) infinite alternate; }
.pq-aside-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15, 23, 42, .25) 0%, rgba(15, 23, 42, .7) 40%, rgba(15, 23, 42, .97) 75%); }
@keyframes aside-zoom { from { transform: scale(1); } to { transform: scale(1.12); } }
.pq-aside-body { padding: 36px var(--gutter) 32px; display: grid; gap: 20px; }
.pq-title { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 1.2rem + 2vw, 3rem); line-height: 1.04; letter-spacing: -0.045em; text-wrap: balance; }
.pq-title .accent { color: var(--teal-light); }
.pq-points { display: grid; gap: 10px; }
.pq-points li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, .86); font-size: .96rem; }
.pq-points svg { width: 22px; height: 22px; flex: none; padding: 4px; border-radius: 50%; background: rgba(92, 184, 217, .18); color: var(--teal-light); }

.lo-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 14px 14px 14px; border-radius: 18px; margin-top: 6px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.lo-avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--teal); font-family: var(--display); font-weight: 700; font-size: .95rem; letter-spacing: .02em; }
.lo-name { font-family: var(--display); font-weight: 700; font-size: 1rem; }
.lo-role { font-size: .8rem; color: rgba(255, 255, 255, .62); }
.lo-phone { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #fff; color: var(--navy); transition: transform .4s var(--ease), background .3s; }
.lo-phone:hover { transform: rotate(-12deg) scale(1.06); background: var(--teal-light); }
.lo-phone svg { width: 20px; height: 20px; }

@media (min-width: 1000px) {
  .pq-aside { position: sticky; top: 72px; height: calc(100vh - 72px); height: calc(100svh - 72px); display: flex; align-items: flex-end; }
  .pq-aside-body { padding: 48px clamp(32px, 4vw, 56px); gap: 24px; }
}
@media (max-width: 999px) {
  .pq-aside-body { padding-top: 120px; }
  .pq-points { display: none; }
  .pq-started .pq-aside { display: none; }
}

/* ---------- Main / form ---------- */
.pq-main { padding: clamp(32px, 6vw, 80px) var(--gutter) 48px; display: flex; justify-content: center; }
.pq-form { width: 100%; max-width: 700px; display: flex; flex-direction: column; }
.pq-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.pq-step { display: grid; gap: 26px; }
.pq-step[hidden] { display: none; }
.pq-kicker { font-family: var(--display); font-weight: 600; font-size: .74rem; letter-spacing: .2em; text-transform: uppercase; color: var(--teal); }
.pq-q { font-family: var(--display); font-weight: 800; font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.7rem); line-height: 1.08; letter-spacing: -0.04em; color: var(--navy); margin-top: -14px; text-wrap: balance; outline: none; }
.pq-label { display: block; font-family: var(--display); font-weight: 600; font-size: .88rem; color: var(--navy); margin-bottom: 10px; padding: 0; }
.pq-opt { font-weight: 500; color: var(--muted); font-size: .8rem; margin-left: 4px; }
fieldset.pq-pills, fieldset.pq-cards { border: 0; padding: 0; margin: 0; min-width: 0; }

/* Step entrance (direction-aware, staggered) */
.pq-step.anim-fwd > *, .pq-step.anim-back > * { animation: pq-in-up .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
.pq-step.anim-back > * { animation-name: pq-in-down; }
@keyframes pq-in-up { from { opacity: 0; transform: translateY(26px); } }
@keyframes pq-in-down { from { opacity: 0; transform: translateY(-26px); } }

/* Big option cards */
.pq-cards { display: grid; gap: 12px; }
@media (min-width: 640px) { .pq-cards-3 { grid-template-columns: repeat(3, 1fr); } }
.pq-card {
  position: relative; display: grid; gap: 4px; align-content: start; cursor: pointer;
  padding: 22px 20px 20px; border-radius: 20px; background: #fff; border: 1.5px solid var(--line);
  transition: border-color .3s, background .3s, transform .45s var(--ease), box-shadow .45s var(--ease);
}
.pq-card input { position: absolute; opacity: 0; pointer-events: none; }
.pq-card:hover { border-color: var(--teal); transform: translateY(-3px); box-shadow: 0 18px 36px -22px rgba(0, 107, 143, .5); }
.pq-card:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.pq-card:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 3px; }
.pq-card-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--mist); color: var(--navy); margin-bottom: 12px; transition: background .3s, color .3s, transform .5s var(--ease); }
.pq-card-ico svg { width: 28px; height: 28px; }
.pq-card:has(input:checked) .pq-card-ico { background: var(--teal); color: #fff; transform: rotate(-6deg); }
.pq-card-title { font-family: var(--display); font-weight: 700; font-size: 1.08rem; color: var(--navy); letter-spacing: -0.02em; }
.pq-card-sub { font-size: .86rem; color: var(--muted); }
.pq-tick { position: absolute; top: 14px; right: 14px; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: #fff; transition: background .3s, border-color .3s, transform .4s var(--ease); }
.pq-tick svg { width: 14px; height: 14px; transform: scale(0); transition: transform .4s var(--ease); }
.pq-card:has(input:checked) .pq-tick { background: var(--teal); border-color: var(--teal); }
.pq-card:has(input:checked) .pq-tick svg { transform: scale(1); }
@media (max-width: 639px) {
  .pq-card { grid-template-columns: auto 1fr; column-gap: 16px; align-items: center; padding: 16px 52px 16px 16px; }
  .pq-card-ico { grid-row: span 2; margin: 0; width: 46px; height: 46px; }
  .pq-tick { top: 50%; transform: translateY(-50%); }
}

/* Pills */
.pq-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pq-pills > legend { width: 100%; float: left; }
.pq-pill { position: relative; cursor: pointer; }
.pq-pill input { position: absolute; opacity: 0; pointer-events: none; }
.pq-pill span {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff;
  font-family: var(--display); font-weight: 500; font-size: .9rem; color: var(--navy);
  transition: background .3s var(--ease), color .3s, border-color .3s, transform .3s var(--ease);
}
.pq-pill:hover span { border-color: var(--teal); color: var(--teal); }
.pq-pill input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.pq-pill input[type="checkbox"]:checked + span::before { content: ""; width: 12px; height: 12px; background: var(--teal-light); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 7' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12.5l5 5L20 7' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.pq-pill input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.pq-pill:active span { transform: scale(.96); }
.pq-yn { display: grid; gap: 22px; }

/* Inputs */
.pq-field { display: grid; min-width: 0; }
.pq-field[hidden], .pq-pills[hidden] { display: none; }
.pq-grid-2 { display: grid; gap: 18px; }
@media (min-width: 600px) { .pq-grid-2 { grid-template-columns: 1fr 1fr; } }
.pq-input {
  display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 16px; border-radius: 14px;
  background: var(--mist); border: 1.5px solid transparent; transition: border-color .3s, background .3s, box-shadow .3s;
}
.pq-input:focus-within { background: #fff; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0, 107, 143, .1); }
.pq-input input, .pq-input textarea { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 1.05rem; color: var(--navy); }
.pq-input input::placeholder, .pq-input textarea::placeholder { color: #9aa5b5; }
.pq-input > span { color: var(--muted); font-weight: 500; }
.pq-input-short { max-width: 180px; }
.pq-input-area { height: auto; padding: 14px 16px; }
.pq-input-area textarea { resize: vertical; min-height: 84px; font: inherit; }
.pq-field.is-invalid .pq-input, .pq-select.is-invalid select { border-color: #c2410c; background: #fff7f3; }
.pq-pills.is-invalid .pq-pill span, .pq-cards.is-invalid .pq-card { border-color: #f0a585; }
.pq-select { position: relative; }
.pq-select select { width: 100%; height: 56px; padding: 0 44px 0 16px; border-radius: 14px; background: var(--mist); border: 1.5px solid transparent; font-size: 1.05rem; color: var(--navy); -webkit-appearance: none; appearance: none; outline: none; transition: border-color .3s, background .3s, box-shadow .3s; }
.pq-select select:focus { background: #fff; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(0, 107, 143, .1); }
.pq-select::after { content: ""; position: absolute; right: 20px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

.pq-range-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.pq-range-top output { font-family: var(--display); font-weight: 800; font-size: clamp(1.3rem, 1rem + 1vw, 1.9rem); letter-spacing: -0.035em; color: var(--navy); font-variant-numeric: tabular-nums; }

/* Errors / nav */
.pq-error { color: #c2410c; font-size: .9rem; font-weight: 500; min-height: 1.4em; margin-top: 18px; }
.pq-error:empty { visibility: hidden; }
.pq-nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 10px; padding-top: 24px; border-top: 1px solid var(--line); }
.pq-back { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 600; font-size: .92rem; color: var(--muted); padding: 12px 6px; transition: color .3s; }
.pq-back svg { width: 18px; height: 18px; transform: scaleX(-1); transition: transform .4s var(--ease); }
.pq-back:hover { color: var(--navy); }
.pq-back:hover svg { transform: scaleX(-1) translateX(4px); }
.pq-back[hidden] { visibility: hidden; display: inline-flex; }
.pq-next-btn { min-width: 180px; }
.pq-next-btn.is-loading { pointer-events: none; }
.pq-next-btn.is-loading svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pq-hint { margin-top: 12px; text-align: right; font-size: .78rem; color: var(--muted); }
.pq-hint kbd { font-family: var(--display); font-size: .7rem; font-weight: 600; padding: 3px 7px; border-radius: 6px; background: var(--mist); border: 1px solid var(--line); }
@media (hover: none) { .pq-hint { display: none; } }
.pq-done .pq-nav, .pq-done .pq-hint, .pq-done .pq-error { display: none; }

/* ---------- Snapshot ---------- */
.snap { background: var(--navy); color: #fff; border-radius: 24px; padding: clamp(22px, 4vw, 34px); display: grid; gap: 22px; position: relative; overflow: hidden; }
.snap::before { content: ""; position: absolute; width: 360px; height: 360px; right: -140px; top: -180px; border-radius: 50%; background: radial-gradient(closest-side, rgba(92, 184, 217, .3), transparent); }
.snap-label { font-family: var(--display); font-weight: 600; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--teal-light); }
.snap-big { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 1.8rem + 3vw, 4rem); letter-spacing: -0.05em; line-height: 1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.snap-sub { color: rgba(255, 255, 255, .7); font-size: .92rem; margin-top: 8px; }
.snap-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-light); padding-top: 18px; }
.snap-stats div { display: grid; gap: 2px; }
.snap-stats div + div { padding-left: 16px; border-left: 1px solid var(--line-light); }
.snap-stats dt { font-size: .74rem; color: rgba(255, 255, 255, .58); }
.snap-stats dd { font-family: var(--display); font-weight: 700; font-size: clamp(1rem, .9rem + .5vw, 1.3rem); font-variant-numeric: tabular-nums; }
.snap-dti { position: relative; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .1); }
.snap-dti span { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--dti-color, #2aa3cc); transition: width 1.1s var(--ease), background .4s; }
.snap-dti i { position: absolute; top: -5px; bottom: -5px; width: 2px; background: rgba(255, 255, 255, .55); border-radius: 2px; }
.snap-programs ul { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.snap-programs li { padding: 8px 14px; border-radius: 999px; background: rgba(92, 184, 217, .16); color: #dff2f9; font-family: var(--display); font-weight: 600; font-size: .82rem; animation: pop .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 80ms + .3s); }

/* Review list */
.review { display: grid; gap: 10px; }
.review-group { border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review-head h3 { font-family: var(--display); font-weight: 700; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.review-edit { font-family: var(--display); font-weight: 600; font-size: .82rem; color: var(--teal); padding: 4px 8px; border-radius: 8px; }
.review-edit:hover { background: var(--teal-soft); }
.review dl { display: grid; gap: 6px; }
.review dl div { display: flex; justify-content: space-between; gap: 16px; font-size: .94rem; }
.review dt { color: var(--muted); }
.review dd { color: var(--navy); font-weight: 500; text-align: right; }

.pq-consent { display: flex; gap: 12px; align-items: flex-start; font-size: .8rem; line-height: 1.55; color: var(--muted); cursor: pointer; padding: 16px; border-radius: 14px; background: var(--mist); }
.pq-consent input { flex: none; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--teal); }
.pq-consent.is-invalid { background: #fff7f3; color: #9a3412; box-shadow: inset 0 0 0 1.5px #f0a585; }
.pq-fine { font-size: .76rem; color: var(--muted); line-height: 1.5; }

/* ---------- Success ---------- */
.pq-success { justify-items: start; }
.pq-success-badge { width: 96px; height: 96px; color: var(--teal); }
.pq-success-badge svg { width: 100%; height: 100%; }
.pq-success-badge circle { stroke-dasharray: 340; stroke-dashoffset: 340; animation: draw 1.1s var(--ease) forwards; }
.pq-success-badge path { stroke-dasharray: 80; stroke-dashoffset: 80; animation: draw .7s var(--ease) .7s forwards; }
.pq-success .pq-q { margin-top: 0; }
.pq-success-text { font-size: var(--fs-lede); color: var(--text); max-width: 52ch; }
.pq-success-text a { color: var(--navy); font-weight: 600; border-bottom: 2px solid var(--teal); }
.pq-next { display: grid; gap: 10px; width: 100%; }
.pq-next li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; padding: 16px; border-radius: 16px; background: var(--mist); }
.pq-next li > span { width: 40px; height: 40px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 700; }
.pq-next strong { display: block; font-family: var(--display); color: var(--navy); }
.pq-next div { font-size: .94rem; color: var(--muted); }

/* ---------- Footer ---------- */
.pq-footer { padding: 20px var(--gutter); border-top: 1px solid var(--line); font-size: .76rem; color: var(--muted); text-align: center; }
.pq-footer a { text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .pq-aside-photo img { animation: none; }
}
