/* AI-Ready CMDB Scorecard. Colour tokens first; every pair used for text meets WCAG AA. */

:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #13202b;
  --muted: #4b5a68;
  --border: #d3dae1;
  --border-strong: #8a98a6;
  --accent: #0b5f73;
  --accent-text: #ffffff;
  --accent-soft: #e2f0f3;
  --focus: #0b5f73;
  --not-ready: #b3261e;
  --partly-ready: #8a5300;
  --ready: #1d6b3a;
  --not-ready-soft: #fbe9e7;
  --partly-ready-soft: #fdf1dc;
  --ready-soft: #e4f3e8;
  --shadow: 0 1px 2px rgb(16 24 32 / 6%), 0 4px 16px rgb(16 24 32 / 6%);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1419;
    --surface: #161f27;
    --surface-2: #1d2832;
    --text: #e7edf2;
    --muted: #a7b4c0;
    --border: #2c3a46;
    --border-strong: #5d6e7d;
    --accent: #5cc4d8;
    --accent-text: #06181d;
    --accent-soft: #15333b;
    --focus: #7fd6e6;
    --not-ready: #ff8f85;
    --partly-ready: #f2c15a;
    --ready: #7fd69e;
    --not-ready-soft: #3a1d1b;
    --partly-ready-soft: #3a2e14;
    --ready-soft: #173323;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 16px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1419;
  --surface: #161f27;
  --surface-2: #1d2832;
  --text: #e7edf2;
  --muted: #a7b4c0;
  --border: #2c3a46;
  --border-strong: #5d6e7d;
  --accent: #5cc4d8;
  --accent-text: #06181d;
  --accent-soft: #15333b;
  --focus: #7fd6e6;
  --not-ready: #ff8f85;
  --partly-ready: #f2c15a;
  --ready: #7fd69e;
  --not-ready-soft: #3a1d1b;
  --partly-ready-soft: #3a2e14;
  --ready-soft: #173323;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 16px rgb(0 0 0 / 30%);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
p { margin: 0 0 0.75em; }
a { color: var(--accent); text-underline-offset: 0.15em; }
button, input { font: inherit; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
main:focus, [tabindex="-1"]:focus { outline: none; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 16px; }

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  background: var(--accent); color: var(--accent-text);
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 12px; }

.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 and footer */

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-bg { fill: var(--accent); }
.brand-tick { fill: none; stroke: var(--accent-text); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.theme-toggle {
  display: inline-grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .icon-moon { fill: currentColor; stroke: none; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

.site-footer { border-top: 1px solid var(--border); margin-top: 56px; padding: 24px 0 96px; color: var(--muted); font-size: 0.9rem; }
.site-footer p { margin: 0 0 0.4em; }
.noscript { padding: 32px 16px; }

/* Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-lg { min-height: 52px; padding: 12px 24px; font-size: 1.1rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; filter: none; }
.btn-link { background: none; border: 0; color: var(--accent); padding: 8px 0; min-height: 44px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 0.15em; }

/* Hero */

.hero { display: grid; gap: 32px; padding: 40px 0 16px; align-items: start; }
.eyebrow { color: var(--accent); font-weight: 650; font-size: 0.95rem; letter-spacing: 0.01em; margin-bottom: 0.6em; }
.hero h1 { font-size: clamp(2rem, 1.2rem + 3.2vw, 3.1rem); letter-spacing: -0.02em; margin-bottom: 0.4em; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 36em; }
.hero-cta { margin: 1.4em 0 0.6em; }
.note { color: var(--muted); font-size: 0.95rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.example-label {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 3px 10px; margin-bottom: 14px;
}
.caption { color: var(--muted); font-size: 0.92rem; margin: 14px 0 0; }

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.1fr 0.9fr; gap: 48px; padding-top: 64px; }
}

/* Result summary (used by the example and by the live result) */

.summary { display: flex; gap: 18px; align-items: center; }
.dial { position: relative; width: 116px; height: 116px; flex: none; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial .track { fill: none; stroke: var(--surface-2); stroke-width: 12; }
.dial .value { fill: none; stroke: var(--band); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 0.35s ease; }
.dial-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 750; letter-spacing: -0.02em; }
.dial-num small { font-size: 0.55em; font-weight: 650; margin-left: 1px; }

.band-not-ready { --band: var(--not-ready); --band-soft: var(--not-ready-soft); }
.band-partly-ready { --band: var(--partly-ready); --band-soft: var(--partly-ready-soft); }
.band-ready { --band: var(--ready); --band-soft: var(--ready-soft); }

.kicker { display: block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 2px; }
.band-name { font-size: 1.25rem; font-weight: 700; color: var(--band); margin: 0 0 4px; }
.band-msg { margin: 0; color: var(--text); }

.stage-row { margin: 16px 0 0; }
.stage-row strong { font-size: 1.05rem; }
.stage-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 8px; padding: 0; list-style: none; }
.stage-track li { font-size: 0.74rem; color: var(--muted); padding-top: 8px; border-top: 5px solid var(--surface-2); white-space: nowrap; }
.stage-track li.reached { border-top-color: var(--accent); color: var(--text); font-weight: 650; }

.rule-note { margin: 14px 0 0; padding: 10px 12px; border-left: 4px solid var(--band); background: var(--band-soft); border-radius: 0 8px 8px 0; font-size: 0.95rem; }

.gaps-heading { font-size: 1.05rem; font-weight: 700; margin: 20px 0 8px; }
.gaps { margin: 0; padding: 0; list-style: none; counter-reset: gap; }
.gaps li { counter-increment: gap; position: relative; padding: 10px 0 10px 34px; border-top: 1px solid var(--border); }
.gaps li::before {
  content: counter(gap); position: absolute; left: 0; top: 11px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; background: var(--accent-soft); color: var(--accent);
}
.gap-title { font-weight: 650; margin: 0 0 4px; }
.gap-line { margin: 0 0 4px; font-size: 0.95rem; }
.gap-line strong { font-weight: 650; }
.no-gaps { color: var(--muted); }

/* Questionnaire */

.quiz { display: grid; gap: 28px; padding-top: 32px; }
.quiz[hidden] { display: none; }
.quiz-main h2 { font-size: 1.6rem; }
.quiz-intro { color: var(--muted); }
.questions { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 16px; }

.q fieldset { margin: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.q.answered fieldset { border-color: var(--border-strong); }
.q legend { padding: 0; margin-bottom: 12px; float: left; width: 100%; }
.q legend + * { clear: both; }
.q-meta { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.q-text { display: block; font-size: 1.08rem; font-weight: 650; }
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; min-height: 44px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface);
}
.opt:hover { border-color: var(--border-strong); }
.opt input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt input:focus-visible { outline: none; }

@media (min-width: 640px) {
  .opts { grid-template-columns: 1fr 1fr; }
}

/* Live result panel */

.result-panel h2 { font-size: 1.35rem; margin-bottom: 4px; }
.progress { color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.provisional { color: var(--muted); font-size: 0.9rem; }
.result-panel .summary { margin-top: 12px; }
.actions { display: grid; gap: 10px; margin-top: 18px; padding: 16px 0 4px; border-top: 1px solid var(--border); }
.actions > p:last-child { margin: 0; }
#live-gaps .gaps-block { border-top: 1px solid var(--border); }
#live-gaps .gaps-heading { margin-top: 16px; }
.actions-locked { color: var(--muted); font-size: 0.9rem; margin: 0; }

.email-form { display: grid; gap: 8px; margin-top: 12px; padding: 16px; border-radius: 12px; background: var(--surface-2); }
.email-form[hidden] { display: none; }
.email-form label { font-weight: 600; }
.email-form input[type="email"] {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.hint { color: var(--muted); font-size: 0.9rem; margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500 !important; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.ts { min-height: 65px; }
.form-status { margin: 0; font-weight: 600; min-height: 1.5em; }
.form-status.ok { color: var(--ready); }
.form-status.err { color: var(--not-ready); }

@media (min-width: 1000px) {
  .quiz { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; gap: 32px; }
  .result-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
}

/* Phone: a slim bar keeps the score in view while answering */

.mobile-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgb(0 0 0 / 8%);
}
.mobile-bar[hidden], .mobile-bar.off { display: none; }
.mobile-bar .mb-score { font-weight: 750; font-size: 1.2rem; }
.mobile-bar .mb-progress { color: var(--muted); font-size: 0.9rem; }
@media (min-width: 1000px) { .mobile-bar { display: none; } }

.load-error { padding: 40px 0; }

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