/* Korevor client intake form.
   Built to the standard the engagement sells: WCAG 2.2 AA. Contrast is checked
   against the tokens below, focus is always visible, nothing is signaled by
   colour alone, and every target clears 44px. No rounded-full controls. */

:root {
  --ink: #14181d;
  --ink-2: #414b57;
  --line: #c8cfd8;
  --line-2: #e3e8ee;
  --bg: #ffffff;
  --bg-2: #f5f7f9;
  --accent: #144a8c;      /* 8.6:1 on white */
  --accent-ink: #ffffff;
  --focus: #b8500a;       /* distinct from accent, 4.9:1 on white */
  --err: #a4161a;         /* 7.0:1 on white */
  --ok: #14532d;
  --maxw: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9edf2; --ink-2: #b3bdc9; --line: #48525e; --line-2: #2a3038;
    --bg: #14181d; --bg-2: #1c2229; --accent: #8fc0f5; --accent-ink: #0b1521;
    --focus: #ffab6b; --err: #ff9d9d; --ok: #86efac;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.62 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 74rem; margin: 0 auto; padding: 0 1.25rem; }

/* --- focus: one visible, high-contrast treatment everywhere --------------- */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-ink);
  padding: .85rem 1.25rem; z-index: 50; text-decoration: none;
}
.skip:focus { left: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- header --------------------------------------------------------------- */
.top { border-bottom: 1px solid var(--line-2); padding: 2rem 0 1.5rem; }
.brand {
  margin: 0 0 .5rem; font-size: .78rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-2); font-weight: 600;
}
.top h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.22; }
.sub { margin: .45rem 0 0; color: var(--ink-2); font-size: .95rem; }
.dot { padding: 0 .5rem; }

/* --- progress ------------------------------------------------------------- */
.progwrap {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line-2);
  padding: .6rem 0;
}
.progrow { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.prog {
  flex: 1 1 12rem; height: 10px; background: var(--bg-2);
  border: 1px solid var(--line); overflow: hidden;
}
.bar { height: 100%; width: 0; background: var(--accent); transition: width .25s; }
.progtext, .saved { margin: 0; font-size: .85rem; color: var(--ink-2); }
.saved { min-width: 8rem; }
.saved.on { color: var(--ok); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  .bar { transition: none; }
  * { scroll-behavior: auto !important; }
}

/* --- layout --------------------------------------------------------------- */
.cols { display: grid; grid-template-columns: 15rem minmax(0, var(--maxw)); gap: 3rem; padding-top: 2rem; }
@media (max-width: 62rem) { .cols { grid-template-columns: 1fr; gap: 1.5rem; } }

.toc { position: sticky; top: 4.4rem; align-self: start; max-height: 80vh; overflow: auto; }
@media (max-width: 62rem) { .toc { position: static; max-height: none; } }
.toch { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
        color: var(--ink-2); margin: 0 0 .6rem; }
/* The link text already carries "1.", "2." and so on, so the list marker would
   double the number. It also gets clipped past item 9 in the narrow sidebar,
   which turns section 10 into "0.". Drop the marker and keep the real <ol>. */
.toc ol { margin: 0; padding: 0; font-size: .88rem; list-style: none; }
.toc li { margin: .35rem 0; }
.toc a { color: var(--ink-2); text-decoration: none; display: block; padding: .2rem 0;
         text-indent: -1.05rem; padding-left: 1.05rem; }
.toc a:hover, .toc a:focus-visible { color: var(--accent); text-decoration: underline; }
.toc li.done > a::after { content: " (done)"; color: var(--ok); font-size: .8em; }

/* --- content -------------------------------------------------------------- */
.intro {
  border-left: 4px solid var(--accent); padding: .1rem 0 .1rem 1.1rem;
  margin: 0 0 2.5rem; color: var(--ink-2);
}
.intro p { margin: .7rem 0; }
.intro strong { color: var(--ink); }

.sec { margin: 0 0 3.5rem; scroll-margin-top: 4.6rem; }
.sec h2 {
  font-size: 1.28rem; margin: 0 0 .9rem; padding-bottom: .55rem;
  border-bottom: 2px solid var(--line-2); line-height: 1.3;
}
.secnum {
  display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: .3rem; font-weight: 600;
}

.why { margin: 0 0 1.6rem; font-size: .92rem; }
.why summary {
  cursor: pointer; color: var(--accent); font-weight: 600;
  padding: .55rem 0; min-height: 44px; display: flex; align-items: center;
}
.why p { margin: .2rem 0 .6rem; color: var(--ink-2); background: var(--bg-2);
         padding: .9rem 1rem; border: 1px solid var(--line-2); }

/* --- questions ------------------------------------------------------------ */
.q { margin: 0 0 2rem; border: 0; padding: 0; min-width: 0; }
.q > label, .q legend {
  display: block; font-weight: 600; margin-bottom: .55rem; padding: 0; line-height: 1.45;
}
.qn { color: var(--ink-2); font-variant-numeric: tabular-nums; margin-right: .3rem; font-weight: 700; }
.hint { margin: -.25rem 0 .6rem; font-size: .87rem; color: var(--ink-2); }

input[type=text], input[type=email], input[type=tel], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 3px; padding: .7rem .8rem;
  min-height: 44px;
}
textarea { resize: vertical; }
input[type=text]:hover, input[type=email]:hover, input[type=tel]:hover,
textarea:hover { border-color: var(--ink-2); }

.opts { display: grid; gap: .1rem; }
.opts.inline { grid-auto-flow: column; justify-content: start; gap: 2rem; }
@media (max-width: 30rem) { .opts.inline { grid-auto-flow: row; gap: .1rem; } }

.opt { display: flex; align-items: flex-start; gap: .7rem; flex-wrap: wrap;
       padding: .5rem 0; min-height: 44px; }
.opt input[type=radio], .opt input[type=checkbox] {
  width: 22px; height: 22px; margin: .28rem 0 0; flex: none; accent-color: var(--accent);
}
.opt label { font-weight: 400; flex: 1 1 12rem; cursor: pointer; padding: .1rem 0; }
.writein { flex: 1 1 100%; margin-left: 1.9rem; max-width: calc(100% - 1.9rem); }

/* --- attestation and signature -------------------------------------------- */
.attestbody {
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 1.2rem 1.3rem; margin: 0 0 2rem; font-size: .94rem; color: var(--ink-2);
}
.attestbody p { margin: 0; }

.signblock { border: 2px solid var(--accent); padding: 1.4rem 1.4rem .4rem; margin-top: 2rem; }
.signblock h3 { margin: 0 0 .6rem; font-size: 1.1rem; }
.sigfield {
  font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem;
  padding: .8rem; letter-spacing: .01em;
}
.consent { border-top: 1px solid var(--line-2); margin-top: 1rem; padding-top: 1rem; }
.signed-on { font-size: .85rem; color: var(--ink-2); }

/* --- errors --------------------------------------------------------------- */
.errsum {
  border: 2px solid var(--err); padding: 1rem 1.2rem; margin: 0 0 2rem;
  background: var(--bg-2);
}
.errsum h2 { margin: 0 0 .5rem; font-size: 1.05rem; color: var(--err); border: 0; padding: 0; }
.errsum ul { margin: 0; padding-left: 1.2rem; }
.errsum a { color: var(--err); }
.q.invalid > label, .q.invalid legend { color: var(--err); }
.q.invalid input[type=text], .q.invalid input[type=email], .q.invalid textarea {
  border-color: var(--err); border-width: 2px;
}
.q.invalid::before {
  content: "Needs an answer"; display: inline-block; font-size: .8rem;
  color: var(--err); font-weight: 700; margin-bottom: .3rem;
}

/* --- actions -------------------------------------------------------------- */
.actions { border-top: 2px solid var(--line-2); padding-top: 1.6rem; margin-top: 2.5rem;
           display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 3px;
  padding: .8rem 1.4rem; min-height: 48px;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.12); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.note { flex: 1 1 14rem; margin: 0; font-size: .85rem; color: var(--ink-2); }

.foot { border-top: 1px solid var(--line-2); margin-top: 4rem; padding: 1.6rem 0 3rem;
        color: var(--ink-2); font-size: .85rem; }
.foot p { margin: .35rem 0; }

/* --- print / save as PDF -------------------------------------------------- */
@media print {
  .progwrap, .toc, .actions, .skip, .why summary { display: none !important; }
  .why[open] p { background: none; border: 0; padding: 0; }
  body { font-size: 11pt; color: #000; background: #fff; }
  .cols { display: block; }
  .sec { page-break-inside: auto; margin-bottom: 1.5rem; }
  .q { page-break-inside: avoid; margin-bottom: .8rem; }
  .signblock { page-break-inside: avoid; }
  a[href]::after { content: ""; }
}

/* --- receipt page --------------------------------------------------------- */
.solo { max-width: 44rem; padding-top: 2.5rem; }
.panel h2 { font-size: 1.35rem; margin: 0 0 .6rem; }
.panel h3 { font-size: 1rem; margin: 2.2rem 0 .6rem; }
.panel > p { color: var(--ink-2); margin: 0 0 1rem; max-width: 38rem; }
.receipt {
  display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.4rem;
  margin: 0 0 1.4rem; padding: 1.1rem 1.2rem;
  border: 1px solid var(--line-2); border-radius: 3px; background: var(--bg-2);
}
.receipt dt { color: var(--ink-2); font-size: .85rem; }
.receipt dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        font-size: .78rem; font-weight: 400 !important; letter-spacing: -.01em; }
@media (max-width: 30rem) { .receipt { grid-template-columns: 1fr; gap: .1rem 0; }
  .receipt dd { margin-bottom: .7rem; } }
