/* Audit page: form, progress and results. Tokens match public/index.html. */
:root {
  --cobalt: #163390; --aqua: #01646B; --copper: #B88338; --butterscotch: #FFBD59;
  --cobalt-deep: #0E1A4A; --cobalt-mid: #2E4FB8; --cobalt-tint: #E9EEFB;
  --aqua-tint: #E1F0F0; --copper-tint: #F7EEE2; --brick: #A6402B; --brick-tint: #F8E7E2;
  --bg: #EAEEF4; --bg-soft: #F4F6FA; --surface: #FFFFFF; --glass: rgba(244,247,251,0.82);
  --lift: 0 1px 1px rgba(255,255,255,0.9) inset, 0 -1px 1px rgba(103,120,145,0.08) inset, 0 18px 40px -22px rgba(52,72,110,0.35);
  --card-shadow: 0 1px 2px rgba(14,26,74,0.05), 0 28px 60px -30px rgba(22,51,144,0.35);
  --rule: #E2E6F0; --text: #4B5270; --faint: #5F6584;
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-body: 'Switzer', 'Helvetica Neue', Arial, sans-serif;
  --text-label: 0.75rem;
  --gutter: clamp(1rem, 0.5rem + 3vw, 3rem);
  --max: 1080px; --radius: 12px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --good: var(--aqua); --good-tint: var(--aqua-tint);
  --needs: #9A6A24; --needs-tint: var(--copper-tint);
  --poor: var(--brick); --poor-tint: var(--brick-tint);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: clamp(0.9375rem, 0.92rem + 0.1vw, 1rem); line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 400; color: var(--cobalt-deep); letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--cobalt-mid); }
:focus-visible { outline: 2px solid var(--cobalt-mid); outline-offset: 3px; border-radius: 2px; }
[hidden] { display: none !important; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.audit-main main { min-height: 60svh; }

.label {
  display: flex; align-items: center; gap: 0.625rem; margin: 0 0 1.25rem;
  font-family: var(--font-mono); font-size: var(--text-label); font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint);
}
.label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--aqua); flex: none; }

/* Header, footer and .btn-tactile come from site.css. */
.btn-lg { padding: 0.95rem 1.25rem; font-size: 1rem; border-radius: 14px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1rem; border-radius: 12px; cursor: pointer;
  background: var(--surface); color: var(--cobalt-deep); border: 1px solid var(--rule);
  font: 500 0.9rem/1.2 var(--font-body); text-decoration: none;
}
.btn-ghost:hover { border-color: #C8D0E4; }

/* ─── Form ─── */
.audit-intro { padding-top: clamp(2.5rem, 8svh, 5.5rem); text-align: center; }
.audit-intro .label { justify-content: center; }
.audit-intro h1 { font-size: clamp(2.5rem, 1.4rem + 4.4vw, 4.75rem); line-height: 1.02; letter-spacing: -0.035em; max-width: 14ch; margin: 0 auto; }
.lede { max-width: 34rem; margin: 1.25rem auto 0; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem); }
.audit-form {
  max-width: 34rem; margin: clamp(2rem, 1.5rem + 2vw, 3rem) auto 0; text-align: left;
  display: grid; gap: 1rem; padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; box-shadow: var(--card-shadow);
}
.field { display: grid; gap: 0.4rem; }
.field label { font-weight: 600; font-size: 0.875rem; color: var(--cobalt-deep); }
.field input {
  width: 100%; font: inherit; font-size: 1rem; /* 16px stops iOS zooming in on focus */
  padding: 0.8rem 0.9rem; border-radius: 10px; border: 1px solid #CDD3E2; background: var(--bg-soft); color: var(--cobalt-deep);
}
.field input:focus { outline: 2px solid var(--cobalt-mid); outline-offset: 1px; background: #fff; }
.field input[aria-invalid="true"] { border-color: var(--brick); }
.consent { display: grid; grid-template-columns: 1.25rem 1fr; gap: 0.6rem; align-items: start; font-size: 0.875rem; cursor: pointer; }
.consent input { width: 1.125rem; height: 1.125rem; margin: 0.2rem 0 0; accent-color: var(--cobalt); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-error { padding: 0.7rem 0.9rem; border-radius: 10px; background: var(--brick-tint); color: #7A2E1F; font-size: 0.9rem; }
.audit-form .btn-lg { width: 100%; margin-top: 0.25rem; }
.fineprint { font-size: 0.8rem; color: var(--faint); text-align: center; }

/* ─── Progress ─── */
.audit-progress { padding-top: clamp(2.5rem, 8svh, 5.5rem); max-width: 40rem; }
.audit-progress h2 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem); line-height: 1.05; overflow-wrap: anywhere; }
.steps { list-style: none; margin: 2rem 0 0; padding: 1.25rem 1.5rem; display: grid; gap: 1rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; box-shadow: var(--card-shadow); }
.steps li { display: flex; align-items: center; gap: 0.8rem; color: var(--faint); position: relative; }
.steps .st { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--rule); display: grid; place-items: center; flex: none; background: #fff; }
.steps .st svg { width: 12px; height: 12px; }
.steps .done { color: var(--cobalt-deep); }
.steps .done .st { background: var(--aqua); border-color: var(--aqua); color: #fff; }
.steps .now { color: var(--cobalt-deep); font-weight: 600; }
.steps .now .st { border-color: var(--butterscotch); animation: step-pulse 2.2s ease-out infinite; }
.steps .now .st::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--butterscotch); }
@keyframes step-pulse { 0% { box-shadow: 0 0 0 0 rgba(255,189,89,0.55); } 70%, 100% { box-shadow: 0 0 0 8px rgba(255,189,89,0); } }
.progress-note { margin-top: 1.25rem; font-size: 0.9rem; color: var(--faint); }

/* ─── Message ─── */
.audit-message { padding-top: clamp(2.5rem, 8svh, 5.5rem); max-width: 40rem; }
.audit-message h2 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); line-height: 1.05; margin-bottom: 1rem; }
.audit-message .btn-lg { margin-top: 1.75rem; }

/* ─── Results ─── */
.audit-results { padding-top: clamp(2rem, 6svh, 4rem); display: grid; gap: clamp(1.25rem, 1rem + 1vw, 2rem); }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; box-shadow: var(--card-shadow); padding: clamp(1.25rem, 1rem + 1.5vw, 2.25rem); min-width: 0; }
.card h2 { font-size: clamp(1.625rem, 1.3rem + 1.3vw, 2.25rem); line-height: 1.1; }
.card-sub { margin-top: 0.4rem; color: var(--faint); font-size: 0.9rem; }

.summary { display: grid; gap: 1.5rem; align-items: center; }
@media (min-width: 760px) { .summary { grid-template-columns: auto 1fr; gap: 2.5rem; } }
.summary h1 { font-size: clamp(2rem, 1.3rem + 2.8vw, 3.25rem); line-height: 1.04; overflow-wrap: anywhere; }
.summary .verdict { margin-top: 0.75rem; font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem); max-width: 34rem; }
.summary .meta { margin-top: 0.75rem; font-family: var(--font-mono); font-size: var(--text-label); color: var(--faint); letter-spacing: 0.04em; }
.summary-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.25rem; }

.band-good { --tone: var(--good); --tone-tint: var(--good-tint); }
.band-needs_work { --tone: var(--needs); --tone-tint: var(--needs-tint); }
.band-poor { --tone: var(--poor); --tone-tint: var(--poor-tint); }
.band-unknown { --tone: var(--faint); --tone-tint: var(--bg-soft); }

.gauge { position: relative; display: grid; place-items: center; width: var(--size, 120px); aspect-ratio: 1; flex: none; }
.gauge svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge .track { stroke: var(--tone-tint); }
.gauge .value { stroke: var(--tone); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); }
.gauge .num { font-family: var(--font-display); font-size: calc(var(--size, 120px) * 0.36); line-height: 1; color: var(--cobalt-deep); letter-spacing: -0.03em; }
.gauge-xl { --size: clamp(150px, 120px + 8vw, 200px); margin: 0 auto; }
.pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; border-radius: 999px; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.03em; background: var(--tone-tint); color: var(--tone); white-space: nowrap; }

.tabs { display: inline-flex; padding: 0.25rem; gap: 0.25rem; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--rule); margin-top: 1.25rem; }
.tabs button { font: 500 0.875rem/1 var(--font-body); padding: 0.6rem 1rem; border-radius: 9px; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--cobalt-deep); box-shadow: 0 1px 3px rgba(14,26,74,0.12); }
.gauges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1rem; margin-top: 1.75rem; }
@media (min-width: 760px) { .gauges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.gauge-cell { display: grid; justify-items: center; text-align: center; gap: 0.6rem; --size: clamp(88px, 70px + 4vw, 112px); }
.gauge-cell h3 { font-family: var(--font-body); font-weight: 600; font-size: 0.95rem; color: var(--cobalt-deep); letter-spacing: 0; }
.gauge-cell p { font-size: 0.8rem; color: var(--faint); max-width: 15rem; }

.vitals { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.vitals h3 { font-family: var(--font-body); font-weight: 600; font-size: 0.95rem; color: var(--cobalt-deep); letter-spacing: 0; }
.vitals-note { font-size: 0.8rem; color: var(--faint); margin-top: 0.2rem; }
.vitals-grid { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.vital { padding: 0.9rem 1rem; border-radius: 12px; background: var(--bg-soft); border-left: 3px solid var(--tone); }
.vital-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.vital-name { font-weight: 600; font-size: 0.875rem; color: var(--cobalt-deep); }
.vital-val { font-family: var(--font-mono); font-size: 1rem; color: var(--tone); white-space: nowrap; }
.vital p { font-size: 0.8rem; color: var(--faint); margin-top: 0.25rem; }

.checks, .fixes { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.check, .fix { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.9rem; padding: 1rem 1.1rem; border-radius: 14px; border: 1px solid var(--rule); background: var(--bg-soft); }
.check-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; grid-row: span 3; background: var(--tone-tint); color: var(--tone); }
.check-icon svg { width: 14px; height: 14px; }
.band-unknown .check-icon { background: var(--surface); border: 1px solid var(--rule); }
.check-head, .fix-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; }
.check h3, .fix h3 { font-family: var(--font-body); font-weight: 600; font-size: 1rem; color: var(--cobalt-deep); letter-spacing: 0; }
.check p, .fix p { font-size: 0.9rem; }
.todo { color: var(--cobalt-deep); }
.todo strong { font-weight: 600; }

.fix-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; grid-row: span 3; background: var(--cobalt); color: #fff; font-family: var(--font-mono); font-size: 0.8rem; }
.tag { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.empty { margin-top: 1rem; }

.cant-see { margin: 1rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; color: var(--cobalt-deep); }
.more-link { display: inline-block; margin-top: 1rem; font-weight: 600; color: var(--cobalt-mid); }
.cta { background: var(--aqua); color: #D8ECEC; border: 0; }
.cta h2 { color: #fff; }
.cta p { margin-top: 0.75rem; max-width: 36rem; }
.cta .btn-tactile { margin-top: 1.5rem; background: #fff; color: var(--aqua); box-shadow: 0 10px 30px -12px rgba(0,0,0,0.45); }
.cta .btn-tactile .arrow { background: var(--aqua-tint); }
.cta :focus-visible { outline-color: #fff; }

.source { font-size: 0.8rem; color: var(--faint); }
.source a { color: inherit; }
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); padding: 0.6rem 1rem; border-radius: 10px; background: var(--cobalt-deep); color: #fff; font-size: 0.875rem; z-index: 30; }

@media (max-width: 520px) {
  .summary { text-align: center; }
  .summary .label { justify-content: center; }
  .summary-actions { justify-content: center; }
  .summary-actions > * { flex: 1 1 auto; justify-content: center; }
  .tabs { display: flex; }
  .tabs button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
