/* ==========================================================================
   VFit: intake form
   ========================================================================== */

.form-page { background: var(--white); }

.intake { display: grid; grid-template-columns: minmax(320px, 420px) 1fr; min-height: 100vh; min-height: 100dvh; }

/* ---------- Aside ---------- */
.intake-aside {
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  background: var(--soft); color: var(--ink); padding: 40px 44px;
  display: flex; flex-direction: column; gap: 40px; overflow: hidden;
}
.aside-copy h1 { text-wrap: balance; font-family: var(--display); font-weight: 700; font-size: 32px; line-height: 1.05; letter-spacing: -.02em; margin: 0 0 16px; }
.aside-copy blockquote { margin: 0; font-size: 15px; line-height: 1.7; color: var(--muted); }

.aside-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.aside-steps li { display: flex; align-items: center; gap: 14px; font-size: 15px; color: #9a9a9f; padding: 6px 0; transition: color .3s; }
.aside-steps li .dot {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid #d4d4d1;
  display: grid; place-items: center; font-size: 12px; font-weight: 500; flex: none; transition: all .3s var(--ease);
}
.aside-steps li.is-done { color: var(--muted); }
.aside-steps li.is-done .dot { background: var(--ink); border-color: var(--ink); color: #fff; }
.aside-steps li.is-current { color: var(--ink); font-weight: 500; }
.aside-steps li.is-current .dot { border-color: var(--ink); color: var(--ink); background: #fff; }

.aside-note { margin: auto 0 0; font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: flex-start; }
.aside-note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.aside-note a { color: var(--ink); }

/* ---------- Main ---------- */
.intake-main { display: flex; flex-direction: column; padding: 32px clamp(20px, 6vw, 96px) 40px; max-width: 860px; width: 100%; }

.topbar { display: flex; align-items: center; justify-content: flex-end; min-height: 40px; margin-bottom: 14px; }
.topbar .logo { display: none; }
.logo--dark { color: var(--ink); }
.step-count { font-size: 14px; font-weight: 600; color: var(--muted); }

.progress { height: 6px; background: #efefea; border-radius: 99px; overflow: hidden; margin-bottom: 48px; }
.progress-fill { height: 100%; width: 0; background: var(--ink); border-radius: inherit; transition: width .6s var(--ease); }

form { flex: 1; display: flex; flex-direction: column; }

.honey { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* Step */
.step:focus { outline: none; }
.step { border: 0; margin: 0; padding: 0; min-width: 0; animation: stepIn .5s var(--ease) both; }
.step.is-back { animation-name: stepInBack; }
@keyframes stepIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes stepInBack { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

legend { padding: 0; font-family: var(--display); font-size: clamp(30px, 3.4vw, 42px); font-weight: 600; letter-spacing: -.02em; line-height: 1.05; margin-bottom: 12px; }
legend .kicker { display: block; font-family: var(--font); letter-spacing: 0;  font-size: 14px; font-weight: 500; color: var(--muted); margin-bottom: 12px; }
.hint { color: var(--muted); margin: 0 0 28px; font-size: 16px; }
legend + .options, legend + .field, legend + .grid-2, legend + .segmented, legend + .summary { margin-top: 28px; }

.field { margin-bottom: 28px; }
.label { display: block; font-size: 15px; font-weight: 500; margin: 0 0 10px; }
.opt { font-weight: 300; color: var(--muted); font-size: 13px; margin-left: 4px; }

/* Option cards */
.options { display: grid; gap: 12px; }
.options--grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 560px) { .options--grid { grid-template-columns: 1fr; } }

.option {
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; border: 1.5px solid var(--line); border-radius: var(--radius); background: #fff;
  cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease), background .2s;
}
.options--grid .option { flex-direction: column; align-items: flex-start; gap: 14px; padding: 28px 24px; min-height: 120px; justify-content: flex-end; }
.option:hover { border-color: #c9c9c3; transform: translateY(-2px); }
.option input, .segmented input, .chip input { position: absolute; opacity: 0; pointer-events: none; }
.option-emoji { font-size: 30px; line-height: 1; }
.option-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.option-title { font-weight: 500; font-size: 17px; }
.option-desc { font-size: 14px; color: var(--muted); line-height: 1.45; }
.tick {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); flex: none;
  display: grid; place-items: center; transition: all .2s var(--ease);
}
.options--grid .tick { position: absolute; top: 18px; right: 18px; }
.option:has(input:checked) { border-color: var(--ink); background: #fcfcfa; box-shadow: 0 0 0 1px var(--ink), var(--shadow); }
.option:has(input:checked) .tick { background: var(--ink); border-color: var(--ink); }
.option:has(input:checked) .tick::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.option:has(input:focus-visible) { outline: 3px solid #8a8a8f; outline-offset: 3px; }

/* Segmented */
.segmented { display: flex; gap: 8px; padding: 6px; background: #f3f3ef; border-radius: 16px; }
.segmented label { flex: 1; position: relative; }
.segmented span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 12px;
  border-radius: 11px; font-weight: 500; font-size: 15px; cursor: pointer; color: #4a4a4f;
  transition: background .2s, color .2s, box-shadow .2s; text-align: center; line-height: 1.2;
}
.segmented span:hover { color: var(--ink); background: rgb(255 255 255 / .6); }
.segmented input:checked + span { background: var(--ink); color: #fff; box-shadow: 0 6px 16px -8px rgb(0 0 0 / .6); }
.segmented input:focus-visible + span { outline: 3px solid #8a8a8f; outline-offset: 2px; }
.segmented--sm span { min-height: 50px; font-size: 14px; padding: 0 6px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; }
.chip span {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  border: 1.5px solid var(--line); font-size: 15px; font-weight: 400; cursor: pointer; transition: all .2s;
}
.chip span:hover { border-color: #c9c9c3; }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:checked + span::before { content: "✓"; font-size: 13px; }
.chip input:focus-visible + span { outline: 3px solid #8a8a8f; outline-offset: 2px; }

/* Inputs */
.input {
  width: 100%; min-height: 54px; padding: 14px 18px; border: 1.5px solid var(--line); border-radius: 14px;
  font: 400 16px/1.4 var(--font); color: var(--ink); background: #fff; transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
textarea.input { resize: vertical; min-height: 120px; }
.input::placeholder { color: #a8a8a3; }
.input:hover { border-color: #c9c9c3; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgb(11 11 12 / .08); }
.input[type=number] { -moz-appearance: textfield; }
.input::-webkit-outer-spin-button, .input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.input-unit { position: relative; }
.input-unit .input { padding-right: 54px; }
.input-unit span { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }

.select-wrap { position: relative; }
.select-wrap::after { content: ""; position: absolute; right: 20px; top: 50%; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
select.input { cursor: pointer; padding-right: 48px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

.counter { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: right; }

/* Checkboxes */
.consents { display: grid; gap: 4px; margin-top: 8px; padding-top: 24px; border-top: 1px solid var(--line); }
.check { display: flex; gap: 14px; align-items: flex-start; font-size: 15px; line-height: 1.55; cursor: pointer; padding: 8px 0; }
.check input {
  -webkit-appearance: none; appearance: none; flex: none; width: 24px; height: 24px; margin: 0; margin-top: 1px;
  border: 1.5px solid #c9c9c3; border-radius: 7px; background: #fff; cursor: pointer; display: grid; place-items: center; transition: all .2s;
}
.check input::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform .2s var(--ease); }
.check input:checked { background: var(--ink); border-color: var(--ink); }
.check input:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.check a { color: var(--ink); font-weight: 500; }

/* Notices / errors */
.notice { padding: 16px 20px; border-radius: 14px; background: #f3f3ef; border: 1px solid var(--line); font-size: 15px; color: #3d3d42; animation: stepIn .4s var(--ease) both; }
.reveal-field { margin-top: 24px; animation: stepIn .4s var(--ease) both; }
.fine-print { font-size: 13px; color: var(--muted); margin: 28px 0 0; }

.error { display: none; margin: 8px 0 0; font-size: 14px; color: var(--error); font-weight: 400; }
.error::before { content: "! "; font-weight: 700; }
.has-error .error, .error.is-shown { display: block; }
.has-error > .input, .has-error .input-unit .input { border-color: var(--error); }
.has-error .options .option, .has-error .segmented { border-color: rgb(214 52 44 / .5); }
.has-error .segmented { box-shadow: inset 0 0 0 1.5px rgb(214 52 44 / .5); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* Summary */
.summary { display: grid; gap: 12px; }
.summary-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; }
.summary-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.summary-head h3 { font-size: 15px; font-weight: 600; margin: 0; }
.summary-head button { background: none; border: 0; font: 500 14px var(--font); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px 0; }
.summary-head button:hover { text-decoration: underline; }
.summary dl { margin: 0; display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: 6px 16px; font-size: 15px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 400; word-break: break-word; white-space: pre-line; }
@media (max-width: 480px) { .summary dl { grid-template-columns: 1fr; gap: 0; } .summary dd { margin-bottom: 8px; } }

.error--block { padding: 14px 18px; border-radius: 12px; background: #fdecea; margin-top: 16px; }
.error--block::before { content: none; }
.error--block a { color: inherit; font-weight: 600; }

/* Actions */
.actions { display: flex; align-items: center; gap: 16px; margin-top: auto; padding-top: 40px; }
#next-btn { margin-left: auto; min-width: 170px; }
.enter-hint { margin-left: auto; font-size: 13px; color: var(--muted); }
.enter-hint:not([hidden]) + #next-btn { margin-left: 0; }
kbd { font: 500 12px var(--font); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); background: #f7f7f4; }
@media (hover: none), (max-width: 700px) { .enter-hint { display: none; } .enter-hint:not([hidden]) + #next-btn { margin-left: auto; } }

.btn.is-loading { pointer-events: none; }
.btn.is-loading .arrow { display: none; }
.btn.is-loading::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgb(255 255 255 / .35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Success */
.success { text-align: center; padding-top: 40px; max-width: 520px; margin-inline: auto; outline: none; }
.success-mark { width: 88px; height: 88px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; margin: 0 auto 28px; animation: pop .6s var(--ease) both .1s; }
.success-mark svg { width: 40px; height: 40px; }
.success h2 { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 4vw, 40px); }
.success p { color: #3d3d42; }
.success .muted { color: var(--muted); font-size: 15px; margin-bottom: 32px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.08); } to { transform: scale(1); opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .intake { grid-template-columns: 1fr; }
  .intake-aside { display: none; }
  .topbar { justify-content: space-between; }
  .topbar .logo { display: inline-flex; }
  .intake-main { margin-inline: auto; padding-top: 20px; }
  .progress { margin-bottom: 36px; }
}
@media (max-width: 560px) {
  .actions { position: sticky; bottom: 0; background: linear-gradient(transparent, #fff 30%); padding: 28px 0 16px; margin-inline: -4px; }
  #next-btn { flex: 1; }
}
