/* ContextScore app styles — design tokens per docs/05-DESIGN-SYSTEM.md §2.
   Light + dark, themed to match the Shah Data Labs hub (same palette + fonts).
   The hosted report is NOT themed by this file — it renders its own fixed light
   CSS (scanner/report.py) so an emailed/printed report never breaks (rule 7). */
:root {
  --paper: #F6F2EB; --surface: #FFFFFF; --surface-2: #FBF8F1; --dark-panel: #0B1A2C;
  --ink: #0B1A2C; --muted: #546780; --hair: #D6CEBD; --hair-2: #E7E0D2;
  --on-dark: #E8E2D6; --on-dark-2: rgba(232, 226, 214, 0.66);
  --accent: #0C6E6E; --accent-2: #095656;
  --pass: #1E7F4F; --warn: #B07406; --risk: #C2541B; --fail: #B3322B;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(11, 26, 44, 0.04), 0 8px 24px -12px rgba(11, 26, 44, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}
/* Dark values — shared by an explicit toggle and by system-dark-without-a-choice. */
:root[data-theme='dark'] {
  --paper: #0A1622; --surface: #0F1E2E; --surface-2: #122537; --dark-panel: #060F1A;
  --ink: #ECE7DC; --muted: #8595A6; --hair: #243648; --hair-2: #1A2A3B;
  --on-dark: #ECE7DC; --on-dark-2: rgba(236, 231, 220, 0.7);
  --accent: #2DD4BF; --accent-2: #5EEAD4;
  --pass: #34D399; --warn: #E0A33A; --risk: #F0915E; --fail: #F08A7E;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -14px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0A1622; --surface: #0F1E2E; --surface-2: #122537; --dark-panel: #060F1A;
    --ink: #ECE7DC; --muted: #8595A6; --hair: #243648; --hair-2: #1A2A3B;
    --on-dark: #ECE7DC; --on-dark-2: rgba(236, 231, 220, 0.7);
    --accent: #2DD4BF; --accent-2: #5EEAD4;
    --pass: #34D399; --warn: #E0A33A; --risk: #F0915E; --fail: #F08A7E;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px -14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

/* Scroll-reveal — content is visible by default; only hidden once theme.js opts
   <html> into `.anim` (skipped for no-JS / reduced-motion), then revealed. */
html.anim .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
html.anim .reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: 0.06s; } .reveal.d2 { transition-delay: 0.12s; } .reveal.d3 { transition-delay: 0.18s; }

/* Theme toggle (in the nav) */
.nav-right { display: flex; align-items: center; gap: 16px; }
.theme-toggle {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: var(--radius-sm); background: transparent; border: 1px solid var(--hair);
  color: var(--muted); cursor: pointer; transition: color 0.18s, border-color 0.18s;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }
.theme-toggle .i-moon { display: none; }
:root[data-theme='dark'] .theme-toggle .i-sun { display: none; }
:root[data-theme='dark'] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme='light']) .theme-toggle .i-moon { display: block; }
  :root[data-theme='light'] .theme-toggle .i-sun { display: block; }
  :root[data-theme='light'] .theme-toggle .i-moon { display: none; }
}
.page { max-width: 860px; margin: 0 auto; padding: 48px 24px 64px; }
.mono, .mono-label, .step, .stage-list {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.display, h1, h2 {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 700; letter-spacing: -0.02em;
}
.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 12px;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* Hero + form */
.hero { margin-bottom: 56px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
.hero h1 { font-size: clamp(30px, 4.4vw, 44px); line-height: 1.12; margin: 0 0 16px; max-width: 18ch; }
.hero .sub { font-size: 18px; color: var(--muted); max-width: 48ch; margin: 0 0 20px; }
.who-for { font-size: 12px; color: var(--muted); max-width: 52ch; margin: 0 0 24px; }
.scan-form { display: grid; gap: 16px; max-width: 480px; }
/* Hero gauge — the brand mark + a peek at the sample score (links to /r/sample). */
.hero-aside { display: grid; place-items: center; }
.gauge-mark { position: relative; width: clamp(180px, 24vw, 240px); aspect-ratio: 1; display: grid; place-items: center; text-decoration: none; }
.gauge-mark svg { width: 100%; height: 100%; }
.gauge-mark .gtrack { fill: none; stroke: var(--hair); stroke-width: 7; }
.gauge-mark .garc { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; }
.gauge-cap { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; text-align: center; }
.gauge-cap .gn { font-size: clamp(34px, 5vw, 46px); font-weight: 700; color: var(--ink); line-height: 1; letter-spacing: -0.02em; }
.gauge-cap .gl { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
@media (max-width: 720px) { .hero-grid { grid-template-columns: 1fr; } .hero-aside { display: none; } }
/* Honeypot (09 §B2): off-screen and untabbable — humans never fill it, bots do. */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.mono-label {
  display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.scan-form input, .scan-form select, .scan-form textarea {
  width: 100%; padding: 12px 14px; font-size: 16px; border: 1px solid var(--hair);
  border-radius: 6px; background: var(--surface); color: var(--ink); font-family: inherit;
}
.scan-form textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
/* Waitlist (early-access) options */
.wl-options { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin: 4px 0 28px; }
.wl-card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.wl-card h2 { font-size: 20px; margin: 6px 0 10px; }
.wl-card p { font-size: 15px; margin: 0 0 10px; }
.wl-why { font-size: 13.5px; color: var(--muted); border-top: 1px solid var(--hair); padding-top: 10px; }
.wl-picks { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.wl-picks legend { float: left; width: 100%; }
.wl-check { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; }
.wl-check input { width: auto; }
.wl-hint { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .wl-options { grid-template-columns: 1fr; } }
.btn-ink {
  background: var(--ink); color: var(--paper); border: 0; border-radius: 6px;
  padding: 13px 22px; font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px; font-weight: 600; cursor: pointer; justify-self: start;
}
.form-error {
  border: 1px solid var(--fail); color: var(--fail); border-radius: 6px;
  padding: 12px 14px; margin-bottom: 16px; max-width: 480px; font-size: 14px;
}

/* Two-column lede (contact) + supporting aside */
.split { display: grid; grid-template-columns: 1.1fr 0.85fr; gap: clamp(32px, 5vw, 64px); align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.aside-block { padding: 18px 0; border-top: 1px solid var(--hair); }
.aside-block:first-child { border-top: 0; padding-top: 4px; }
.aside-block .mono-label { margin-bottom: 6px; }
.aside-block p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }

/* Sections */
section { margin-bottom: 56px; }
h2 { font-size: 26px; margin: 0 0 18px; }
.how-row { display: flex; gap: 20px; align-items: baseline; border-top: 1px solid var(--hair); padding: 14px 0; }
.how-row .step { min-width: 80px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.how-row p { margin: 0; color: var(--muted); }
.dim-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 32px; margin: 0; }
.dim-list dt { font-weight: 600; }
.dim-list dd { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.price-card { border: 1px solid var(--hair); border-radius: var(--radius); padding: 20px; background: var(--surface); box-shadow: var(--shadow); }
.price-card p { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.faq p { max-width: 70ch; }

/* Dark contrast panel — breaks the page rhythm so it doesn't read as one long
   light column. A contained rounded band (no fragile full-bleed math). */
.band {
  background: var(--dark-panel); color: var(--on-dark);
  border-radius: var(--radius); padding: clamp(28px, 5vw, 46px);
  box-shadow: var(--shadow);
}
.band h2 { color: var(--on-dark); }
.band p { color: var(--on-dark-2); }

/* Progress page */
.meta-row {
  display: flex; flex-wrap: wrap; gap: 8px 36px; font-size: 12px;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--hair);
  padding: 12px 0; margin-bottom: 24px;
}
.scan-bar { height: 6px; background: var(--hair); border-radius: 3px; overflow: hidden; }
.scan-bar > span {
  display: block; height: 100%; width: 0; background: var(--accent);
  border-radius: 3px; transition: width .5s ease;
}
.scan-hint { font-size: 12px; color: var(--muted); margin: 8px 0 32px; max-width: 64ch; }
.scan-hint #pct { color: var(--ink); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .scan-bar > span { transition: none; } }
.stage-list { list-style: none; padding: 0; font-size: 14px; }
.stage-list li { padding: 8px 0; color: var(--muted); }
.stage-list li.active { color: var(--ink); font-weight: 600; }
.stage-list li.active::after { content: " ▸"; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .stage-list li.active::after { animation: none; } }
.failure-card { max-width: 60ch; }
.failure-card h1 { font-size: 30px; }
.degraded { color: var(--warn); font-size: 12px; }

/* Header + footer */
.site-nav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; margin-bottom: 48px;
  border-bottom: 1px solid var(--hair); padding-bottom: 14px;
}
/* Brand lockup: the product name (→ scanner home) over a small parent line
   (→ the company), so the relationship is stated and "home" is one click. */
.brand-lockup { display: flex; flex-direction: column; gap: 2px; line-height: 1.15; }
.site-nav .brand {
  font-size: 14px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
}
.brand-parent { font-size: 10.5px; letter-spacing: .02em; color: var(--muted); text-decoration: none; }
.brand-parent:hover { color: var(--accent); }
.site-nav nav { display: flex; gap: 20px; font-size: 12px; flex-wrap: wrap; }
.site-nav nav a { color: var(--muted); text-decoration: none; white-space: nowrap; }
.site-nav nav a:hover { color: var(--accent); }
.site-footer {
  border-top: 1px solid var(--hair); padding-top: 20px; margin-top: 24px;
  display: flex; gap: 24px; flex-wrap: wrap; justify-content: space-between;
  font-size: 12px; color: var(--muted);
}
.site-footer nav { display: flex; gap: 18px; }

/* Admin — wider canvas than the public pages */
.admin { max-width: 1080px; margin: 0 auto; }
.page:has(.admin) { max-width: 1140px; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-title { font-size: 34px; margin: 0; }
.engine-switch { display: flex; align-items: center; gap: 12px; margin: 0; }
.engine-state .is-live { color: var(--risk); }
.engine-state .is-mock { color: var(--muted); }
.btn-sm {
  display: inline-block; background: var(--surface); border: 1px solid var(--hair); border-radius: 6px;
  padding: 6px 12px; font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; color: var(--ink); cursor: pointer; text-decoration: none; line-height: 1.4;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm:disabled { opacity: .4; cursor: default; }
.btn-sm-warn { border-color: var(--risk); color: var(--risk); }

/* KPI cards */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 14px 16px; }
.kpi-n { display: block; font-size: 26px; font-weight: 600; line-height: 1.1; }
.kpi-l { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

/* Panels + charts */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--hair); border-radius: 12px; padding: 20px 22px; margin: 0 0 20px; box-shadow: var(--shadow); }
.panels .panel { margin: 0; }
.panel-h { font-size: 18px; margin: 0 0 14px; }
.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-bar .panel-h { margin: 0; }
.panel-actions { display: flex; align-items: center; gap: 10px; }
.chart { width: 100%; height: auto; }
.chart .bar-accent { fill: var(--accent); }
.bar-pass { fill: var(--pass); } .bar-warn { fill: var(--warn); }
.bar-risk { fill: var(--risk); } .bar-fail { fill: var(--fail); }
.chart .gd-track { fill: var(--hair); }
.chart-tick, .gd-label, .gd-count {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 10px; fill: var(--muted);
}
.gd-label { fill: var(--ink); }

/* status chips */
.chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 24px; }
.chip { background: var(--surface); border: 1px solid var(--hair); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.chip-alert { border-color: var(--risk); color: var(--risk); }
.chip-alert strong { color: var(--risk); }
.tag { display: inline-block; background: rgba(12,110,110,.1); color: var(--accent); border-radius: 4px; padding: 1px 7px; font-size: 11px; margin-right: 4px; }

/* search + pager */
.search {
  padding: 8px 12px; border: 1px solid var(--hair); border-radius: 6px; background: var(--surface);
  font-family: inherit; font-size: 14px; min-width: 220px; color: var(--ink);
}
.pager { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.empty { color: var(--muted); font-size: 14px; padding: 16px 0; margin: 0; }

.inline-form { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; max-width: none; }
.inline-form .field { flex: 1 1 200px; }

/* Admin */
.nowrap { white-space: nowrap; }
.break { word-break: break-word; }
.admin-table .ok { color: var(--pass); } .admin-table .bad { color: var(--fail); }
.feed { list-style: none; padding: 0; font-size: 13px; line-height: 1.8; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; text-align: left;
  color: var(--muted); border-bottom: 1px solid var(--ink); padding: 0 8px 8px 0;
}
.admin-table td { border-bottom: 1px solid var(--hair); padding: 8px 8px 8px 0; vertical-align: top; }
.admin-table .actions { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.admin-table .actions form { display: inline; margin: 0; }
.linklike {
  background: none; border: 0; padding: 0; color: var(--accent);
  text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px;
}
.linklike.danger { color: var(--fail); }
.waitlist-list { list-style: none; padding: 0; font-size: 13px; }

/* Sample report card on landing (sits inside the dark band) */
.sample-card {
  display: block; border: 1px solid color-mix(in srgb, var(--on-dark) 16%, transparent);
  border-radius: var(--radius); background: color-mix(in srgb, var(--on-dark) 5%, transparent);
  padding: 22px; text-decoration: none; color: var(--on-dark); max-width: 520px;
  transition: border-color 0.18s, transform 0.18s var(--ease);
}
.sample-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.sample-card .score { font-size: 40px; font-weight: 700; }

/* Admin model selector */
.model-current { margin: 0 0 16px; font-size: 13px; }
.tier-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.tier { margin: 0; }
.tier-btn {
  width: 100%; height: 100%; text-align: left; cursor: pointer; background: var(--surface);
  border: 1px solid var(--hair); border-radius: 10px; padding: 12px 14px; color: var(--ink);
  display: flex; flex-direction: column; gap: 4px; font: inherit;
}
.tier-btn:hover:not(:disabled) { border-color: var(--accent); }
.tier-btn:disabled { opacity: .45; cursor: default; }
.tier-active .tier-btn { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tier-label { font-weight: 700; font-size: 14px; }
.tier-model { font-size: 11px; color: var(--muted); }
.tier-blurb { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.model-pick { margin-bottom: 12px; }
.model-pick-row { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.model-pick-row .search { min-width: 0; flex: 1; }
.model-note { font-size: 12.5px; max-width: 70ch; margin: 0; }
@media (max-width: 720px) { .tier-row { grid-template-columns: 1fr 1fr; } }

/* AI-access tool (/ai-access) */
.ai-form { margin-top: 8px; }
.ai-error { color: var(--fail); margin-top: 14px; }
.ai-result { margin-top: 44px; border-top: 1px solid var(--hair); padding-top: 36px; }
.ai-verdict { border: 1px solid; border-radius: var(--radius); padding: 18px 20px; font-size: 15.5px; line-height: 1.55; margin-bottom: 26px; box-shadow: var(--shadow); }
.ai-verdict strong { display: block; margin-bottom: 5px; font-size: 18px; }
.ai-open { background: rgba(30,127,79,.07); border-color: var(--pass); }
.ai-partial { background: rgba(176,116,6,.08); border-color: var(--warn); }
.ai-blocked { background: rgba(179,50,43,.07); border-color: var(--fail); }
.ai-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 22px; }
.ai-table th { text-align: left; font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--ink); padding: 0 10px 8px 0; }
.ai-table td { border-bottom: 1px solid var(--hair); padding: 9px 10px 9px 0; }
.ai-ok { color: var(--pass); font-weight: 600; }
.ai-bad { color: var(--fail); font-weight: 600; }
.ai-signals { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.ai-chip { font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 12px; border: 1px solid var(--hair); border-radius: 999px; padding: 4px 12px; color: var(--muted); }
.ai-chip.on { color: var(--pass); border-color: rgba(30,127,79,.4); }
.ai-captured { color: var(--pass); margin-bottom: 22px; }
.ai-cta { background: var(--dark-panel); color: var(--on-dark); border-radius: 12px; padding: 28px 30px; box-shadow: var(--shadow); }
.ai-cta h2 { color: var(--on-dark); font-size: 23px; margin: 0 0 10px; }
.ai-cta p { color: var(--on-dark-2); font-size: 15px; max-width: 60ch; margin: 0 0 18px; }
.ai-cta-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.ai-cta .btn-ink { background: var(--accent); color: #fff; }
.ai-cta .btn-ink:hover { background: var(--accent-2); }
.btn-link { color: var(--accent); text-decoration: underline; font-size: 14px; }
.ai-cta .btn-link { color: var(--on-dark); }

/* Static + message pages */
.prose { max-width: 64ch; }
.prose h2 { font-size: 19px; margin-top: 28px; }
.message-card { max-width: 60ch; }
.message-card h1 { font-size: 30px; }

@media (max-width: 640px) {
  .hero h1 { font-size: 30px; }
  .dim-list, .price-grid { grid-template-columns: 1fr; }
}
