/* Owner-facing scanner.
 *
 * Palette and spacing are carried over from landing/index.html so the scanner and
 * the page that introduces it read as one product. The TYPEFACES are deliberately
 * not: the landing page loads Barlow Condensed and IBM Plex from Google Fonts,
 * and this page runs under `style-src 'self'` because it takes input that spends
 * money.
 *
 * DECIDED 2026-08-30 (S519, Cloud's call): the policy stays `style-src 'self'`.
 * The scanner keeps the system stack below, shaped to sit in the same family --
 * condensed weight and tracking on headings, a monospace eyebrow, the same
 * measure. Two more third-party origins on the spend-bearing page buys nothing
 * measurable in a beta with zero live scans.
 *
 * If exact typeface parity is wanted later, self-host the woff2 files under
 * public/fonts/ and @font-face them. That needs NO CSP change: there is no
 * font-src directive, so it falls back to `default-src 'self'`. Widening
 * style-src is not the route and should not be reopened as one.
 */

:root {
  color-scheme: light dark;
  --ground: #EDF0F1;
  --surface: #FFFFFF;
  --sunk: #E3E8EA;
  --ink: #12191F;
  --ink-soft: #55636C;
  --ink-faint: #7C8890;
  --rule: #D2D9DD;
  --rule-strong: #B7C1C7;
  --accent: #C0451A;
  --accent-soft: #F3E2DB;
  --on-accent: #FFFFFF;
  --good: #2C6E4E;
  --good-soft: #E4EFE9;
  --bad: #A32718;
  --bad-soft: #F6E4E1;
  --warn: #8A6212;
  --warn-soft: #F7EEDA;
  --shadow: 0 1px 2px rgba(18, 25, 31, .06), 0 8px 24px -12px rgba(18, 25, 31, .18);
  --measure: 63ch;
  --wrap: 54rem;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0E1418;
    --surface: #171F24;
    --sunk: #121A1F;
    --ink: #E7EDF0;
    --ink-soft: #9BAAB3;
    --ink-faint: #7B8992;
    --rule: #28333A;
    --rule-strong: #37454D;
    --accent: #E4652F;
    --accent-soft: #2A1B15;
    --on-accent: #140A06;
    --good: #54AC7E;
    --good-soft: #10241A;
    --bad: #DE7263;
    --bad-soft: #2A1616;
    --warn: #C99A38;
    --warn-soft: #2A2013;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 28px -14px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.25rem 5rem;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

main { max-width: var(--wrap); margin: 0 auto; }

h1, h2, h3 {
  margin: 0;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -.01em;
  text-wrap: balance;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Masthead ----------------------------------------------------------- */

.masthead { padding: 3.5rem 0 1.5rem; max-width: var(--measure); }

.eyebrow {
  margin: 0 0 .9rem;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 { font-size: clamp(1.75rem, 4.5vw, 2.7rem); margin-bottom: 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 1rem; }
h3 { font-size: 1.15rem; }

.lede { margin: 0 0 .85rem; font-size: 1.06rem; color: var(--ink-soft); }
.guard { margin: 0; color: var(--ink-faint); font-size: .9rem; }

/* --- Panels ------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 1.75rem;
  margin: 1.75rem 0;
  box-shadow: var(--shadow);
}

.status-banner {
  margin: 0 0 1.5rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  background: var(--good-soft);
  color: var(--good);
  border: 1px solid transparent;
  font-size: .92rem;
}
.status-banner.is-off { background: var(--warn-soft); color: var(--warn); }

/* --- Form --------------------------------------------------------------- */

.field { margin-bottom: 1.35rem; }
label { display: block; font-weight: 600; margin-bottom: .4rem; font-size: .95rem; }

input[type="url"], input[type="text"] {
  width: 100%;
  padding: .7rem .85rem;
  font: inherit;
  color: var(--ink);
  background: var(--sunk);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input:disabled { opacity: .55; }

.hint { margin: .4rem 0 0; font-size: .85rem; color: var(--ink-faint); }

button {
  font: inherit;
  font-weight: 650;
  letter-spacing: .01em;
  padding: .8rem 1.5rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.turnstile { margin: 1.25rem 0; }
.error { margin: 1rem 0 0; color: var(--bad); font-size: .92rem; }

.method { margin-top: 1.75rem; border-top: 1px solid var(--rule); padding-top: 1.25rem; }
.method ul { margin: .85rem 0 0; padding-left: 1.15rem; color: var(--ink-soft); font-size: .92rem; }
.method li { margin-bottom: .6rem; }

summary { cursor: pointer; font-weight: 600; }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- The subject line and the four answers ------------------------------ */

.subject { padding: 2.5rem 0 .5rem; }
.subject-name {
  margin: 0;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -.012em;
}
.subject-meta {
  margin: .45rem 0 0;
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--ink-faint);
  letter-spacing: .02em;
}

/* Each answer is its own slab. The index is a fixed marker, not a score: four
 * questions, four answers, same order every time. */
.answer {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  border-radius: 14px;
  padding: 1.6rem 1.75rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}
.answer-index {
  margin: 0 0 .35rem;
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .16em;
  color: var(--ink-faint);
}
.answer h3 { margin-bottom: .9rem; }
.answer-lede { margin: 0 0 1rem; font-size: 1.02rem; max-width: var(--measure); }
.answer > p:last-child { margin-bottom: 0; }

/* State colours the rail only. A whole card washed red reads as a verdict, and
 * "we could not collect enough answers" is not a verdict about the business. */
.answer.state-mentioned_and_cited { border-left-color: var(--good); }
.answer.state-mentioned_not_cited { border-left-color: var(--warn); }
.answer.state-not_mentioned { border-left-color: var(--bad); }
.answer.state-unavailable,
.answer.state-insufficient_sample { border-left-color: var(--rule-strong); }
.answer.action { border-left-color: var(--accent); background: var(--accent-soft); }

.method-tally { list-style: none; margin: 0 0 1rem; padding: 0; }
.method-tally li {
  padding: .6rem 0;
  border-top: 1px solid var(--rule);
  font-size: .92rem;
  color: var(--ink-soft);
}
.method-tally strong { color: var(--ink); }
.flag {
  display: block;
  margin-top: .3rem;
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .04em;
  color: var(--warn);
}

/* A ranked list, deliberately not a bar chart: the counts are small integers
 * out of a small denominator and a bar would imply a precision they lack. */
.rank { list-style: none; margin: 0 0 .75rem; padding: 0; counter-reset: rank; }
.rank li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .55rem 0;
  border-top: 1px solid var(--rule);
}
.rank li::before {
  counter-increment: rank;
  content: counter(rank, decimal-leading-zero);
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--ink-faint);
  min-width: 1.8rem;
}
.rank-name { flex: 1; font-weight: 500; overflow-wrap: anywhere; }
.rank-count { font-family: var(--mono); font-size: .8rem; color: var(--ink-faint); white-space: nowrap; }
.rank li.is-you .rank-name { color: var(--accent); font-weight: 650; }

/* --- Evidence ----------------------------------------------------------- */

#evidence-panel { margin-top: 2.5rem; }
#evidence details { border-top: 1px solid var(--rule); padding: 1rem 0; }
#evidence details:first-child { border-top: 0; padding-top: 0; }

.example {
  border-left: 2px solid var(--rule);
  padding: .5rem 0 .5rem 1rem;
  margin: 1rem 0;
}
.example-method {
  margin: 0;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.example-prompt { margin: .3rem 0; font-weight: 500; }
.verdict { margin: .5rem 0; font-weight: 650; color: var(--good); }
.verdict.is-unavailable { color: var(--ink-faint); font-weight: 500; }
blockquote {
  margin: .6rem 0;
  padding: .6rem .9rem;
  background: var(--sunk);
  border-radius: 8px;
  font-size: .92rem;
  color: var(--ink-soft);
}

.doc-check { list-style: none; margin: .85rem 0; padding: 0; }
.doc-check li { padding: .4rem 0; font-size: .92rem; color: var(--ink-soft); }
.pill {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.pill-present { background: var(--good-soft); color: var(--good); }
.pill-missing { background: var(--bad-soft); color: var(--bad); }
.pill-could-not-inspect { background: var(--warn-soft); color: var(--warn); }

.table-scroll { overflow-x: auto; margin: .85rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .82rem; }
th, td {
  text-align: left;
  padding: .45rem .6rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  white-space: nowrap;
}
th {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
td:nth-child(2) { white-space: normal; min-width: 18rem; }
tr.is-unavailable td { color: var(--ink-faint); }

footer {
  max-width: var(--wrap);
  margin: 3rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-size: .84rem;
}

@media (max-width: 40rem) {
  .panel, .answer { padding: 1.25rem; border-radius: 10px; }
  body { padding: 0 .9rem 4rem; }
}

/* --- Optional email capture --------------------------------------------- */

#email-panel { margin-top: 2rem; }
.consent {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin: 0 0 1.25rem;
  font-weight: 400;
  font-size: .92rem;
  color: var(--ink-soft);
}
.consent input { margin-top: .25rem; width: auto; }
input[type="email"] {
  width: 100%;
  padding: .7rem .85rem;
  font: inherit;
  color: var(--ink);
  background: var(--sunk);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
}
