/*
 * The audit page (/en/audit/, /fr/audit/): direction A, "the white sheet"
 * (docs/plans/2026-10-17-ai-audit-mockups/accepted-form-flow.html).
 * Scoped to this page on purpose: it breaks from the site's beige so nothing distracts from
 * the questions. Site fonts (Hanken Grotesk titles, Open Sans text, Rubik logo) and the site
 * blue; no serif anywhere. Mobile first; two-column answers and the static footer from 768 px.
 */
.audit {
  --a-white: #ffffff;
  --a-ink: #1a1a1a;
  --a-mute: #5f5b57;
  --a-line: #e4e2de;
  --a-field: #cfccc6;
  --a-soft: #f6f5f3;
  --a-track: #f0efec;
  --a-blue: #5b8cff;
  --a-blue-deep: #3556d8;
  --a-blue-tint: #eef3ff;
  --a-err: #c2401c;
  --a-heading: 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --a-body: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  --a-logo: 'Rubik', 'Helvetica Neue', Arial, sans-serif;

  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--a-white);
  color: var(--a-ink);
  font-family: var(--a-body);
}
html:has(body[data-page="audit"]), body[data-page="audit"] { background: #ffffff; }
/* Focused controls scroll clear of the sticky bottom bar on phones. */
html:has(body[data-page="audit"]) { scroll-padding-bottom: 104px; }
/* Every field at 16 px or more: iOS zooms the page on focus below that. */
.audit input, .audit textarea, .audit select { font-size: max(16px, 1em); }
.audit [hidden] { display: none !important; }

/* ---- Top: progress bar, logo, counter or language switch ------------------------------ */
.audit-prog { height: 4px; background: var(--a-track); flex: none; }
.audit-prog i { display: block; height: 4px; width: 0; background: var(--a-blue); transition: width 0.3s ease; }
.audit-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 16px 20px; flex: none;
}
.audit-logo { font-family: var(--a-logo); font-size: 14px; color: var(--a-ink); text-decoration: none; letter-spacing: 0.01em; white-space: nowrap; }
.audit-logo b { font-weight: 700; }
.audit-count, .audit-lang { font-size: 13px; color: var(--a-mute); margin: 0; }
/* Phones show the short counter; the long one stays readable by screen readers. */
.audit-count-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.audit-lang { display: flex; align-items: center; gap: 6px; }
.audit-lang a { color: var(--a-mute); text-decoration: none; padding: 6px 2px; }
.audit-lang a:hover { color: var(--a-ink); }
.audit-lang [aria-current] { color: var(--a-ink); font-weight: 700; padding: 6px 2px; }

/* ---- Screens -------------------------------------------------------------------------- */
.audit-form { flex: 1; display: flex; flex-direction: column; }
.audit-screen { padding: 0; flex: 1; display: flex; flex-direction: column; animation: audit-in 0.22s ease-out; }
@keyframes audit-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.audit-body { flex: 1; padding: 28px 20px 28px; }

.q-title {
  font-family: var(--a-heading); font-weight: 700; letter-spacing: -0.025em; line-height: 1.12;
  font-size: 28px; margin: 0; color: var(--a-ink);
}
.q-title:focus { outline: none; }
.q-title:focus-visible { outline: 2px solid var(--a-blue-deep); outline-offset: 4px; border-radius: 2px; }
.q-sub { font-family: var(--a-heading); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; font-size: 21px; margin: 34px 0 0; }
.q-help { color: var(--a-mute); margin: 10px 0 0; font-size: 15px; line-height: 1.5; }
.q-help strong { color: var(--a-ink); font-weight: 600; overflow-wrap: anywhere; }
fieldset.q { border: 0; margin: 0; padding: 0; min-width: 0; }

/* Answers: real radio and checkbox inputs, drawn as rows. */
.list { margin-top: 22px; display: grid; grid-template-columns: 1fr; gap: 8px; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px;
  border: 1px solid var(--a-line); border-radius: 6px; padding: 12px 14px; background: var(--a-white);
  font-size: 15px; line-height: 1.3; cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease;
}
.row:hover { border-color: #c9c6c0; }
.row-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.row kbd {
  font: 600 11px var(--a-body); width: 22px; height: 22px; flex: none;
  border: 1px solid var(--a-line); border-radius: 4px; color: var(--a-mute); background: var(--a-white);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.row.is-on { border-color: var(--a-blue); background: var(--a-blue-tint); }
.row.is-on kbd { background: var(--a-blue); border-color: var(--a-blue); color: #fff; }
.row:has(.row-input:focus-visible) { outline: 2px solid var(--a-blue-deep); outline-offset: 2px; }
.row-other { cursor: default; flex-wrap: wrap; }
.row-pick { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.other-input {
  flex: 1; min-width: 8rem; border: 0; border-bottom: 1.5px solid var(--a-line); border-radius: 0;
  font: 16px var(--a-body); color: var(--a-ink); padding: 4px 2px; background: transparent;
}
.other-input:focus { outline: none; border-bottom-color: var(--a-blue); }
.other-input::placeholder, .q-text::placeholder { color: #9a958f; }
.q-text {
  display: block; width: 100%; margin-top: 22px; resize: vertical; min-height: 9rem;
  border: 1px solid var(--a-field); border-radius: 6px; padding: 12px; background: var(--a-white);
  font: 16px/1.5 var(--a-body); color: var(--a-ink);
}
.q-text:focus, .field input:focus { outline: 2px solid var(--a-blue); outline-offset: 0; border-color: var(--a-blue); }

.audit-error { color: var(--a-err); font-size: 14px; line-height: 1.45; margin: 16px 0 0; }
.audit-error:empty, .field-error:empty { display: none; }
.audit-error a, .field-error a { color: inherit; }

/* ---- Bottom bar: sticky on phones so Continue is always in reach ---------------------- */
.audit-foot {
  position: sticky; bottom: 0; z-index: 2; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--a-line); background: var(--a-white);
}
.audit-foot .btn-go { flex: 1; }
.btn-go {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  font: 600 16px var(--a-body); line-height: 1.25; color: #fff; background: var(--a-blue);
  border: 0; border-radius: 8px; padding: 15px 24px; cursor: pointer; text-decoration: none;
  transition: background-color 0.15s ease;
}
.btn-go:hover { background: var(--a-blue-deep); color: #fff; }
.btn-go:disabled { opacity: 0.6; cursor: progress; }
.btn-back { font: 600 15px var(--a-body); background: none; border: 0; color: var(--a-mute); cursor: pointer; padding: 15px 2px; }
.btn-back:hover { color: var(--a-ink); }
.btn-go:focus-visible, .btn-back:focus-visible, .audit-logo:focus-visible, .audit-lang a:focus-visible,
.audit a:focus-visible { outline: 2px solid var(--a-blue-deep); outline-offset: 3px; border-radius: 4px; }
.audit-hint { display: none; color: var(--a-mute); font-size: 13px; }

/* ---- Welcome -------------------------------------------------------------------------- */
.audit-start { padding-top: 40px; }
.audit-start .q-title { font-size: 34px; }
.audit-promises { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 14px; }
.audit-promises li { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; line-height: 1.45; }
.audit-promises span {
  width: 26px; height: 26px; border-radius: 50%; flex: none; margin-top: -2px;
  background: var(--a-blue-tint); color: var(--a-blue-deep); font: 700 13px var(--a-heading);
  display: inline-flex; align-items: center; justify-content: center;
}
.audit-foot-start { flex-direction: column; align-items: stretch; gap: 10px; }
.audit-fine { font-size: 13px; color: var(--a-mute); margin: 0; text-align: center; }
.audit-noscript p { font-size: 16px; line-height: 1.6; max-width: 34rem; }
.audit-noscript a { color: var(--a-ink); }

/* ---- Last screen ---------------------------------------------------------------------- */
.audit-last { padding-top: 22px; }
.field { margin-top: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input {
  display: block; width: 100%; border: 1px solid var(--a-field); border-radius: 6px;
  padding: 12px; font: 16px var(--a-body); color: var(--a-ink); background: var(--a-white);
}
.field input[aria-invalid="true"] { border-color: var(--a-err); }
.field-error { color: var(--a-err); font-size: 13.5px; margin: 6px 0 0; }
.consent { position: relative; display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 13.5px; line-height: 1.45; color: #3b3835; }
/* The real checkbox, invisible, over a 32 px square around the drawn box (a finger-sized target). */
.consent-input { position: absolute; left: -7px; top: -6px; width: 32px; height: 32px; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.consent .box {
  width: 18px; height: 18px; flex: none; margin-top: 1px; position: relative; pointer-events: none;
  border: 1.5px solid #b9b5af; border-radius: 4px; background: var(--a-white);
}
.consent-input:checked + .box { background: var(--a-blue); border-color: var(--a-blue); }
.consent-input:checked + .box::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.consent-input:focus-visible + .box { outline: 2px solid var(--a-blue-deep); outline-offset: 2px; }
.consent-input[aria-invalid="true"] + .box { border-color: var(--a-err); }
.consent label { cursor: pointer; }
.consent a { color: var(--a-ink); text-decoration: underline; text-underline-offset: 2px; }
.consent + .field-error { margin-left: 28px; }
.turnstile-slot { margin-top: 18px; min-height: 65px; }

/* ---- Confirmation --------------------------------------------------------------------- */
.audit-sent { padding-top: 64px; }
.audit-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--a-blue-tint); position: relative; margin-bottom: 22px; }
.audit-mark::after {
  content: ""; position: absolute; left: 21px; top: 13px; width: 11px; height: 22px;
  border: solid var(--a-blue-deep); border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.audit-call { margin-top: 30px; padding: 18px; background: var(--a-soft); border-radius: 8px; }
.audit-call h3 { font-family: var(--a-heading); font-size: 18px; letter-spacing: -0.01em; margin: 0 0 6px; }
.audit-call p { margin: 0 0 14px; font-size: 14px; color: var(--a-mute); line-height: 1.5; }
.audit-call .btn-go { width: 100%; }

/* ---- From 768 px: one 720 px column, two-column answers, footer under the answers ---- */
@media (min-width: 768px) {
  .audit-head { padding: 18px 40px; }
  .audit-count-long { position: static; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; }
  .audit-count-short { display: none; }
  .audit-body, .audit-foot { width: 100%; max-width: 760px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
  .audit-body { flex: none; padding-top: clamp(40px, 9vh, 84px); padding-bottom: 0; }
  .q-title { font-size: 42px; }
  .audit-start .q-title { font-size: 48px; }
  .q-sub { font-size: 24px; }
  .q-help { font-size: 16px; }
  .list { grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 30px; }
  .row { font-size: 15.5px; }
  .row-other { grid-column: 1 / -1; flex-wrap: nowrap; }
  .audit-foot { position: static; border-top: 0; padding-top: 26px; padding-bottom: 64px; background: none; }
  .audit-foot .btn-go { flex: none; min-width: 11rem; }
  .audit-foot .btn-go { order: 1; }
  .audit-hint { order: 2; }
  .audit-foot .btn-back { order: 3; margin-left: auto; }
  .has-keys .audit-hint { display: inline; }
  .audit-foot-start { flex-direction: row; align-items: center; gap: 18px; }
  .audit-fine { text-align: left; order: 2; }
  .audit-start .audit-promises li { font-size: 16px; }
  .audit-call .btn-go { width: auto; }
  .audit-call { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .audit-screen { animation: none; }
  .audit-prog i, .row, .row kbd, .btn-go { transition: none; }
}
