/* Sonar front end — mirrors the report brand (src/sonar/report/templates/brand.css)
   exactly: light, airy, white cards on off-white, blue hairlines, no black
   shadows (tinted blue only). The spectrum gradient is the one luminous
   signature — it appears ONLY on the score band and the primary CTA. Amber means
   one thing: "validated against source".

   Fonts are served from /assets/fonts/ (the FastAPI app mounts the report's
   assets dir there); no CDNs, no build step. */

@font-face {
  font-family: "Hanken Grotesk";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/hanken-grotesk-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk";
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/hanken-grotesk-italic-variable.woff2") format("woff2");
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/space-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "Space Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/space-mono-700.woff2") format("woff2");
}

:root {
  --bg: #f7f4f4;
  --surface: #ffffff;
  --ink: #0a0a0a;
  --ink-secondary: #4b4b57;
  --ink-muted: #66666f;
  --primary: #4042e2;
  --primary-hover: #3335c6;
  --primary-soft: #e8e8fc;
  --border: #d9dcf5;
  --border-vivid: rgba(3, 44, 252, 0.30);
  --deep: #120f1e;
  --amber: #fbd23c;
  --rag-green: #34d27b;
  --rag-amber: #fbd23c;
  --rag-red: #ff6168;
  --grad: linear-gradient(18deg, #2a1ff5 0%, #531ec6 22%, #832da8 45%, #b94169 63%, #ea6952 80%, #fbd23c 100%);
  --shadow-soft: 0 12px 40px -12px rgba(64, 66, 226, 0.14);
  --shadow-card: 0 10px 34px -16px rgba(64, 66, 226, 0.22);
  --font-display: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 40px 64px;
}

/* keyboard escape hatch to the scanner */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 12px 0;
  text-decoration: none;
  z-index: 10;
}
.skip-link:focus { left: 0; }

/* visually hidden but available to screen readers */
.vh-label {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
  white-space: nowrap;
}

/* ---- masthead ------------------------------------------------------------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 36px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .mark { width: 34px; height: 34px; display: inline-flex; }
.brand .mark svg { width: 100%; height: 100%; display: block; }
.wordmark {
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-weight: 500;
}
.wordmark b { font-weight: 700; }
.wordmark-by { color: var(--ink-muted); font-weight: 400; }
.masthead-tag {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.masthead-tag::before { content: "◆"; color: var(--amber); font-size: 10px; }

/* ---- hero ----------------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--primary);
  margin: 0 0 14px;
}
.hero { padding: 16px 0 8px; }
.hero-title {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0 0 18px;
  max-width: 16ch;
}
.hero-sub {
  font-size: 1.08rem;
  color: var(--ink-secondary);
  margin: 0 0 30px;
  max-width: 56ch;
}

/* ---- scan form ------------------------------------------------------------ */
.scanform {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: stretch;
}
.scanform-field { flex: 1 1 280px; min-width: 0; }
.scanform input,
.gateform input {
  width: 100%;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 0 20px;
  font-family: var(--font-display);
  font-size: 1.02rem;
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.scanform input::placeholder,
.gateform input::placeholder { color: var(--ink-muted); }
.scanform input:focus-visible,
.gateform input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.scanform input[aria-invalid="true"],
.gateform input[aria-invalid="true"] {
  border-color: var(--rag-red);
  box-shadow: 0 0 0 3px rgba(255, 97, 104, 0.18);
}

/* the primary CTA — the second place the signature gradient is allowed */
.btn-primary {
  flex: none;
  position: relative;
  overflow: hidden;
  height: 56px;
  border: 0;
  border-radius: 16px;
  padding: 0 28px;
  /* Gradient set directly on the button (not a ::before overlay) so the label,
     a bare text node, paints on top. Dark half of the signature spectrum
     (blue -> indigo -> purple) keeps white text high-contrast; the full
     blue->amber spectrum is reserved for the large score band. */
  background: linear-gradient(115deg, #2a1ff5 0%, #4042e2 38%, #531ec6 70%, #832da8 100%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-soft);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 44px -14px rgba(64, 66, 226, 0.4); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.btn-primary:disabled { cursor: progress; opacity: 0.72; transform: none; }
/* keep the label readable over the gradient without a hard shadow */
.btn-primary { text-shadow: 0 1px 6px rgba(9, 7, 18, 0.45); }

.btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  border-radius: 999px;
  padding: 11px 22px;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover { background: var(--primary-soft); border-color: var(--border-vivid); }
.btn-ghost:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.hero-note {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
}
.form-error {
  margin: 12px 0 0;
  color: var(--rag-red);
  font-size: 0.92rem;
  font-weight: 500;
}

/* ---- status / loading ----------------------------------------------------- */
.status { margin-top: 36px; }
.status-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px 26px;
  box-shadow: var(--shadow-card);
}
.status-copy { min-width: 0; }
.status-line { margin: 0 0 4px; font-weight: 700; font-size: 1.04rem; letter-spacing: -0.01em; }
.status-sub { margin: 0; color: var(--ink-secondary); font-size: 0.94rem; }

.spinner {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- error ---------------------------------------------------------------- */
.errorbox { margin-top: 36px; }
.errorbox-card {
  background: var(--surface);
  border: 1px solid var(--rag-red);
  border-radius: 20px;
  padding: 24px 26px;
  box-shadow: 0 12px 40px -16px rgba(255, 97, 104, 0.28);
}
.errorbox-title { margin: 0 0 6px; font-weight: 700; font-size: 1.08rem; letter-spacing: -0.01em; }
.errorbox-sub { margin: 0 0 18px; color: var(--ink-secondary); font-size: 0.95rem; }

/* ---- result: score band (the signature) ----------------------------------- */
.result { margin-top: 40px; }

.scoreband {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  background: var(--deep);
  color: #fff;
  padding: 40px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  box-shadow: var(--shadow-card);
}
.scoreband::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad);
  opacity: 0.95;
}
.scoreband::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(125% 135% at 14% 28%,
    rgba(9, 7, 18, 0.82) 0%, rgba(9, 7, 18, 0.42) 40%, rgba(9, 7, 18, 0) 72%);
}
.scoreband > * { position: relative; z-index: 1; }

.band-eyebrow {
  color: rgba(255, 255, 255, 0.72);
  margin-bottom: 14px;
}
.band-word {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.04;
}
.score {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-top: 6px;
  font-family: var(--font-mono);
}
.score .num { font-size: clamp(3.6rem, 9vw, 5.6rem); font-weight: 700; letter-spacing: -0.05em; line-height: 0.9; }
.score .den { font-size: 1.5rem; font-weight: 400; color: rgba(255, 255, 255, 0.7); }
.counts {
  margin-top: 18px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.86);
}
.counts b { font-weight: 700; }

.sb-right { align-self: center; display: flex; flex-direction: column; gap: 11px; }
.catrow { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 11px; }
.catname { font-size: 14px; color: rgba(255, 255, 255, 0.92); }
.catscore { font-family: var(--font-mono); font-size: 13px; color: rgba(255, 255, 255, 0.7); }
.dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12); }
.dot-green { background: var(--rag-green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--rag-red); }
.dot-na { background: rgba(255, 255, 255, 0.4); }

.validated {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--amber);
}
.validated::before { content: "◆"; font-size: 10px; }

/* ---- coverage line -------------------------------------------------------- */
.coverage {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-muted);
  margin: 18px 2px 0;
  max-width: 70ch;
}

/* ---- what's running ------------------------------------------------------- */
.running { margin-top: 36px; }
.running-head { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 16px; }
.inv { display: flex; flex-wrap: wrap; gap: 9px; }
.inv-chip {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  color: var(--ink);
}

/* ---- email gate ----------------------------------------------------------- */
.gate {
  margin-top: 36px;
  border: 1px dashed var(--border-vivid);
  border-radius: 20px;
  padding: 26px 28px;
  background: var(--primary-soft);
}
.gate h3 { margin: 0 0 6px; font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.gate p { margin: 0 0 18px; color: var(--ink-secondary); font-size: 0.96rem; max-width: 60ch; }
.gateform { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; }
/* the gate sits on a tinted panel, so the inputs lose the blue glow shadow */
.gateform input { box-shadow: none; }

/* ---- full report ---------------------------------------------------------- */
.full { margin-top: 36px; }
.full-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.full-title { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 12px 14px 12px 22px;
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.12s ease;
}
.btn-download:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-download:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.btn-download .arrow {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.full-frame {
  width: 100%;
  height: 1400px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

/* ---- footer --------------------------------------------------------------- */
.page-foot {
  margin-top: 52px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.vh {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.vh::before { content: "◆"; color: var(--amber); font-size: 10px; }
.foot-by { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-muted); }

/* ---- responsive ----------------------------------------------------------- */
@media (max-width: 680px) {
  .page { padding: 24px 18px 48px; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 10px; }
  .scoreband { grid-template-columns: 1fr; gap: 26px; padding: 28px; }
  .scanform input, .gateform input, .btn-primary { height: 52px; }
  .btn-primary { width: 100%; }
  .full-frame { height: 1100px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .spinner { border-top-color: var(--primary); }
}

/* live scan progress bar */
.progress-bar {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 4%;
  border-radius: 999px;
  background: linear-gradient(115deg, #2a1ff5, #4042e2 40%, #531ec6 72%, #832da8);
  transition: width 0.4s var(--ease-out-expo, ease);
}
@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}
