/* ============================================================
   The Instrument — light app theme, indigo working colour,
   gold reserved for verdicts.
   ============================================================ */

:root {
  --purple-900: #2E1A34;
  --purple-800: #472850;
  --purple-700: #5E3568;
  --purple: #7A4686;
  --purple-300: #B08CB8;
  --purple-200: #D3BFD8;
  --purple-100: #EFE7F1;
  --gold-800: #86642F;
  --gold-700: #A87E3F;
  --gold: #C69A58;
  --gold-300: #DDC194;
  --gold-200: #ECD9BC;
  --indigo: #3D417B;
  --indigo-deep: #2E3160;
  --indigo-soft: #E9EAF4;
  --slateblue: #31445E;
  --teal: #478D9A;
  --mauve: #9A6B7E;
  --ink: #201826;
  --slate: #5B5560;
  --line: #E7E2EA;
  --wash: #F3EFF5;
  --surface: #FAF9FB;
  --white: #FFFFFF;

  --font-display: "Ubuntu", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Ubuntu Mono", Consolas, monospace;
  --font-body: "Mulish", system-ui, sans-serif;

  --shadow-sm: 0 1px 2px rgba(32,24,38,.06);
  --shadow-md: 0 8px 24px rgba(32,24,38,.08);
  --shadow-lg: 0 16px 48px rgba(46,49,96,.14);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --container: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--indigo-soft); color: var(--indigo-deep); }

.container { max-width: var(--container); margin: 0 auto; padding: 0 clamp(20px, 4vw, 44px); }

h1, h2, h3, h4 { font-family: var(--font-body); font-weight: 800; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.015em; color: var(--purple-900); }
p { margin: 0 0 1em; }
a { color: var(--indigo); }

.eyebrow {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .18em; color: var(--gold-800); margin-bottom: 18px;
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 14px 0;
  background: rgba(250,249,251,.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
  max-width: var(--container); margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 44px);
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand img { height: 28px; width: auto; display: block; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; }
.nav-links a:hover { color: var(--indigo); }
.nav-cta {
  padding: 9px 18px; border-radius: 8px;
  background: var(--indigo); color: #fff !important;
  transition: background .25s, transform .25s;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--indigo-deep); transform: translateY(-1px); }
@media (max-width: 640px) {
  .nav-links a:not(.nav-cta) { display: none; }
  .nav-brand img { height: 24px; }
}

/* ---------- hero ---------- */
.hero { padding: 150px 0 56px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(32px, 4.6vw, 54px);
  letter-spacing: -0.02em; margin-bottom: 20px;
}
.hero-sub { color: var(--slate); max-width: 62ch; font-size: 17px; margin-bottom: 44px; }

/* tool switcher */
.tool-switch {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.tswitch {
  text-align: left; cursor: pointer;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  font-family: var(--font-body);
  display: flex; flex-direction: column; gap: 3px;
  transition: transform .3s var(--spring), border-color .25s, box-shadow .3s, background .25s;
}
.tswitch:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--purple-200); }
.tswitch.active {
  border-color: var(--indigo);
  background: var(--indigo);
  box-shadow: var(--shadow-lg);
}
.tsw-n { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--gold-700); }
.tswitch.active .tsw-n { color: var(--gold-300); }
.tsw-name { font-size: 16px; font-weight: 800; color: var(--purple-900); }
.tswitch.active .tsw-name { color: #fff; }
.tsw-desc { font-size: 12.5px; color: var(--slate); }
.tswitch.active .tsw-desc { color: var(--purple-200); }
@media (max-width: 760px) { .tool-switch { grid-template-columns: 1fr; } }

/* ---------- tool panels ---------- */
.tool-panel { display: none; padding: 40px 0 90px; }
.tool-panel.active { display: block; animation: panelIn .5s var(--ease-out); }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.tool-grid {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px;
  align-items: start;
}
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(24px, 3.4vw, 44px);
  box-shadow: var(--shadow-sm);
}
.tool-head h2 { font-size: clamp(22px, 2.6vw, 30px); }
.tool-head p { color: var(--slate); font-size: 15.5px; max-width: 64ch; }
.tool-head { margin-bottom: 28px; }
.tool-head em { color: var(--purple-800); }

.tool-aside { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 92px; }
.aside-card {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 26px;
}
.aside-card h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--purple); }
.aside-card p { font-size: 14px; color: var(--slate); margin: 0; }
.aside-card p + p { margin-top: 10px; }
.aside-quote { background: var(--purple-900); border-color: var(--purple-800); }
.aside-quote p { color: var(--purple-200); font-family: var(--font-display); font-size: 15.5px; line-height: 1.55; }

/* ---------- quiz ---------- */
.q-item { border-top: 1px solid var(--line); padding: 20px 0; }
.q-item:last-of-type { border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.q-text { font-size: 16px; font-weight: 700; color: var(--purple-900); margin: 0 0 12px; display: flex; gap: 10px; }
.q-n { font-family: var(--font-mono); font-size: 12px; color: var(--gold-700); font-weight: 700; padding-top: 3px; flex: 0 0 22px; }
.q-opts { display: flex; gap: 8px; flex-wrap: wrap; padding-left: 32px; }
.q-opt {
  font-family: var(--font-body); font-size: 13.5px; font-weight: 700;
  padding: 8px 16px; border-radius: 100px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--white); color: var(--slate);
  transition: all .2s var(--ease-out);
}
.q-opt:hover { border-color: var(--indigo); color: var(--indigo); }
.q-opt.sel { background: var(--indigo); border-color: var(--indigo); color: #fff; transform: scale(1.04); }
.quiz-progress {
  display: flex; align-items: center; gap: 14px; margin-top: 26px;
}
.qp-track { flex: 1; height: 6px; border-radius: 3px; background: var(--wash); overflow: hidden; }
.qp-fill { height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--indigo), var(--purple)); transition: width .4s var(--ease-out); }
.qp-label { font-family: var(--font-mono); font-size: 12px; color: var(--slate); }
.quiz-submit { margin-top: 22px; }
.btn {
  display: inline-block; padding: 13px 26px;
  font-family: var(--font-body); font-size: 15px; font-weight: 700;
  border-radius: 9px; cursor: pointer; border: none; text-decoration: none;
  transition: transform .25s var(--spring), box-shadow .25s, background .25s, opacity .2s;
}
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-deep); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-primary[disabled] { opacity: .35; pointer-events: none; }
.btn-ghost { background: transparent; color: var(--indigo); border: 1.5px solid var(--purple-200); }
.btn-ghost:hover { border-color: var(--indigo); transform: translateY(-2px); }
.btn-gold { background: var(--gold); color: var(--purple-900); }
.btn-gold:hover { background: var(--gold-300); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(198,154,88,.3); }

/* quiz result */
.quiz-result { text-align: center; padding-top: 8px; }
.qr-top { position: relative; width: 148px; margin: 0 auto 18px; }
.qr-ring { width: 148px; height: 148px; transform: rotate(-90deg); }
.qr-track { fill: none; stroke: var(--line); stroke-width: 10; }
.qr-fill {
  fill: none; stroke: url(#qrGrad), var(--indigo); stroke: var(--indigo);
  stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.2s var(--ease-out), stroke .4s;
}
.qr-score { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 2px; }
.qr-num { font-family: var(--font-display); font-weight: 700; font-size: 40px; color: var(--purple-900); }
.qr-of { font-family: var(--font-mono); font-size: 14px; color: var(--slate); padding-top: 14px; }
.quiz-result h3 { font-size: 24px; }
.quiz-result > p { color: var(--slate); max-width: 54ch; margin: 0 auto 18px; }
.qr-start {
  display: inline-block; margin: 0 0 22px;
  font-size: 14px; font-weight: 700; color: var(--purple-800);
  background: var(--purple-100); border-radius: 100px; padding: 9px 20px;
}
.qr-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- metric form ---------- */
.metric-form { display: flex; flex-direction: column; gap: 18px; }
.mf-row label {
  display: block; font-size: 13.5px; font-weight: 800; color: var(--purple-900);
  margin-bottom: 7px;
}
.mf-hint { font-weight: 600; color: var(--slate); font-size: 12px; margin-left: 6px; }
.mf-row input, .mf-row select {
  width: 100%; padding: 12px 14px;
  font-family: var(--font-body); font-size: 15px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--surface);
  transition: border-color .2s, box-shadow .2s;
}
.mf-row input:focus, .mf-row select:focus {
  outline: none; border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-soft);
  background: #fff;
}
.mf-half { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .mf-half { grid-template-columns: 1fr; } }
.mf-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

.metric-preview {
  border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  background: var(--white);
}
.metric-preview canvas { width: 100%; height: auto; display: block; }

/* ---------- checklist ---------- */
.cl-group { margin-bottom: 26px; }
.cl-group-title {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
}
.cl-sev-1 { color: var(--indigo); }
.cl-sev-2 { color: var(--gold-800); }
.cl-sev-3 { color: var(--mauve); }
.cl-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 13px 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--white);
  cursor: pointer; margin-bottom: 8px;
  transition: border-color .2s, background .2s, transform .2s var(--ease-out);
  user-select: none;
}
.cl-item:hover { border-color: var(--purple-200); transform: translateX(3px); }
.cl-item.done { border-color: var(--teal); background: #F2F8F9; }
.cl-box {
  flex: 0 0 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--purple-200); margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s var(--spring);
  position: relative;
}
.cl-item.done .cl-box { background: var(--teal); border-color: var(--teal); }
.cl-box::after {
  content: ""; width: 10px; height: 6px;
  border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) scale(0); margin-top: -2px;
  transition: transform .25s var(--spring);
}
.cl-item.done .cl-box::after { transform: rotate(-45deg) scale(1); }
.cl-text strong { display: block; font-size: 15px; color: var(--purple-900); }
.cl-text span { font-size: 13px; color: var(--slate); }

.check-verdict { text-align: center; }
.cv-ring { width: 116px; height: 116px; transform: rotate(-90deg); margin: 4px auto 8px; display: block; }
.cv-fill { stroke: var(--teal); transition: stroke-dashoffset .6s var(--ease-out), stroke .4s; }
.cv-num { font-family: var(--font-mono); font-size: 13px; color: var(--slate); margin: 0 0 6px !important; }
.check-verdict h4 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--purple-900); margin-bottom: 6px; }

/* ---------- method ---------- */
.method { background: var(--purple-900); padding: clamp(80px, 10vw, 130px) 0; }
.method-inner { max-width: 640px; }
.method h2 { color: #fff; }
.method p { color: var(--purple-200); }
.method .btn { margin-top: 10px; }

/* ---------- footer ---------- */
.footer { background: var(--ink); padding: 56px 0; color: var(--purple-200); }
.footer-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.footer-logo { height: 26px; width: auto; margin-bottom: 16px; }
.footer-line { font-size: 14px; color: var(--purple-300); max-width: 44ch; }
.footer-meta { font-size: 13.5px; text-align: right; }
.footer-meta p { margin: 0 0 8px; }
.footer-meta a { color: var(--gold-300); }
.footer-credit { color: var(--purple-300); opacity: .75; }
@media (max-width: 700px) { .footer-meta { text-align: left; } }

/* toast */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--purple-900); color: #fff;
  font-size: 14px; font-weight: 700;
  padding: 13px 24px; border-radius: 100px;
  box-shadow: var(--shadow-lg);
  transition: transform .45s var(--spring);
  z-index: 200;
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
