/* Lab-to-Market Readiness Scorer: lab instrument meets modern SaaS. */

:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --text: #0f1b2a;
  --text-muted: #46566a;
  --border: #d3dbe4;
  --accent: #0a5fd1;
  --accent-hover: #084aa6;
  --accent-contrast: #ffffff;
  --accent-soft: #e4eefc;
  --ok: #0b6b3a;
  --focus: #0a5fd1;
  --track: #dde4ec;
  --shadow: 0 1px 2px rgba(15, 27, 42, 0.06), 0 8px 24px rgba(15, 27, 42, 0.05);
  --radius: 14px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b121b;
    --surface: #121c29;
    --surface-2: #182536;
    --text: #e8eef6;
    --text-muted: #a8b6c7;
    --border: #2a3a4e;
    --accent: #5ea7ff;
    --accent-hover: #86bbff;
    --accent-contrast: #06121f;
    --accent-soft: #14304f;
    --ok: #4cd08b;
    --focus: #8cc2ff;
    --track: #2a3a4e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main { flex: 1; padding-block: 2rem 3rem; }

.wrap { width: 100%; max-width: 62rem; margin-inline: auto; padding-inline: 1rem; }

@media (min-width: 768px) { .wrap { padding-inline: 2rem; } }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.75rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.5rem); font-weight: 700; overflow-wrap: anywhere; }
h2 { font-size: 1.35rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1rem; }

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1:focus { outline: none; }

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

.skip-link {
  position: absolute; left: 1rem; top: -4rem; background: var(--accent); color: var(--accent-contrast);
  padding: 0.6rem 1rem; border-radius: 8px; z-index: 10; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 0.75rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 0.85rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); text-decoration: none; font-size: 0.95rem; min-width: 0; }
.brand strong { font-weight: 700; }
.brand-mark { fill: var(--accent); flex: none; }
.header-link { font-size: 0.9rem; font-weight: 500; white-space: nowrap; }

/* Progress */
.progress-region { margin-bottom: 1.25rem; }
.progress-meta { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.progress-meta > span:first-child { font-family: var(--mono); font-weight: 500; color: var(--text); white-space: nowrap; }
.progress-title { text-align: right; }
.progress { height: 8px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.3s ease; }
@media (max-width: 480px) { .progress-title { display: none; } }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem 1.25rem; box-shadow: var(--shadow);
}
@media (min-width: 768px) { .card { padding: 2.25rem 2.5rem; } }
.card-flat { box-shadow: none; }
.card-flat { padding: 1.5rem 1.25rem; }
@media (min-width: 768px) { .card-flat { padding: 1.5rem 1.5rem; } }
.card + .card, .two-col + .card, .results > * + * { margin-top: 1.25rem; }

.eyebrow {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem;
}
.lede { color: var(--text-muted); max-width: 42rem; margin-bottom: 1.75rem; }

/* Form */
.field { margin-bottom: 1.25rem; max-width: 32rem; }
label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
input[type="text"], select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1.5px solid var(--border); border-radius: 10px; padding: 0.75rem 0.9rem; min-height: 3rem;
}
input[type="text"]:hover, select:hover { border-color: var(--text-muted); }
input[type="text"]:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }
[aria-invalid="true"] { border-color: #c62828; }
@media (prefers-color-scheme: dark) { [aria-invalid="true"] { border-color: #ff8a80; } }
.field-error { color: #b3261e; font-size: 0.9rem; margin: 0.4rem 0 0; font-weight: 500; }
@media (prefers-color-scheme: dark) { .field-error { color: #ff9c94; } }

fieldset.question { border: 0; border-top: 1px solid var(--border); margin: 0; padding: 1.25rem 0; min-width: 0; }
fieldset.question:first-of-type { border-top: 0; padding-top: 0; }
fieldset.question legend { font-weight: 600; padding: 0; margin-bottom: 0.25rem; float: left; width: 100%; }
fieldset.question .help { clear: both; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
.choices { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.choice { margin: 0; position: relative; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 6.5rem; min-height: 2.75rem;
  padding: 0.5rem 1.1rem; border: 1.5px solid var(--border); border-radius: 10px; background: var(--bg);
  font-weight: 500; cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.choice:hover span { border-color: var(--accent); }
.choice input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 600; }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Buttons */
.actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1.75rem; flex-wrap: wrap; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.btn {
  font: inherit; font-weight: 600; min-height: 2.9rem; padding: 0.6rem 1.25rem; border-radius: 10px;
  border: 1.5px solid transparent; cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 480px) {
  .actions { flex-direction: column-reverse; align-items: stretch; }
  .btn-row { flex-direction: column; }
  .btn { width: 100%; }
}

/* Results */
.results-head { margin-bottom: 1.5rem; }
.score-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .score-grid { grid-template-columns: 1fr 1fr; } }
.two-col { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .two-col { grid-template-columns: 1fr 1fr; } }
.results > .score-grid, .results > .two-col { margin-top: 0; }
.results .score-grid + .two-col { margin-top: 1.25rem; }

.score-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem 1.25rem; box-shadow: var(--shadow); min-width: 0;
}
.score-kicker { font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 600; margin-bottom: 0.25rem; }
.score-number { font-family: var(--mono); font-weight: 600; font-size: 3.6rem; line-height: 1.1; margin-bottom: 0.9rem; }
.score-number .abbr { font-size: 1.3rem; color: var(--accent); margin-right: 0.15rem; }
.score-number .of { font-size: 1.2rem; color: var(--text-muted); }

.stepbar { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; }
.stepbar li { height: 14px; background: var(--track); border-radius: 3px; }
.stepbar li.filled { background: var(--accent); }
.stepbar li.current { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.stepbar-scale { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.75rem; color: var(--text-muted); margin: 0.4rem 0 1rem; }

.level-title { font-weight: 700; margin-bottom: 0.25rem; }
.level-def { color: var(--text); margin-bottom: 0.4rem; }
.source { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.inline-note { margin: 0.9rem 0 0; padding: 0.6rem 0.8rem; background: var(--surface-2); border-radius: 8px; font-size: 0.85rem; color: var(--text-muted); }

.callout {
  background: var(--accent-soft); border: 1px solid var(--accent); border-left-width: 6px;
  border-radius: var(--radius); padding: 1.5rem 1.25rem;
}
.callout h2 { margin-bottom: 0.5rem; }
.callout p:last-child { margin-bottom: 0; }

.biz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.biz-list li { display: flex; gap: 0.6rem; align-items: baseline; }
.biz-list .mark { font-weight: 700; width: 1.1rem; text-align: center; flex: none; }
.biz-list .done .mark { color: var(--ok); }
.biz-list .open { color: var(--text-muted); }

.milestones { list-style: none; counter-reset: ms; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.milestones li { counter-increment: ms; display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 0.9rem; align-items: start; padding-left: 0; }
.milestones li::before {
  content: counter(ms); grid-row: 1 / span 2; font-family: var(--mono); font-weight: 600; width: 2rem; height: 2rem;
  border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); display: grid; place-items: center; font-size: 0.9rem;
}
.tag { justify-self: start; font-family: var(--mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.m-text { grid-column: 2; }

.summary { font-size: 1.02rem; background: var(--surface-2); border-radius: 10px; padding: 1rem 1.1rem; margin: 0; overflow-wrap: anywhere; }

/* About panel */
.about { margin-top: 3rem; scroll-margin-top: 1rem; }
.about details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.about summary { cursor: pointer; padding: 1.1rem 1.25rem; list-style: none; display: flex; align-items: center; justify-content: space-between; border-radius: var(--radius); }
.about summary::-webkit-details-marker { display: none; }
.about summary::after { content: "+"; font-family: var(--mono); font-size: 1.5rem; color: var(--accent); }
.about details[open] summary::after { content: "–"; }
.about summary h2 { margin: 0; }
#about-body { padding: 0 1.25rem 1.5rem; }
.scale-block + .scale-block { margin-top: 2rem; }
.scale-block p { color: var(--text-muted); max-width: 46rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 0.75rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 34rem; }
th, td { text-align: left; padding: 0.65rem 0.8rem; vertical-align: top; border-bottom: 1px solid var(--border); }
thead th { background: var(--surface-2); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
tbody tr:last-child > * { border-bottom: 0; }
th.lvl { font-family: var(--mono); font-weight: 600; color: var(--accent); width: 3.5rem; }
td.plain { color: var(--text-muted); }

.notice { padding: 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding-block: 1.5rem; font-size: 0.9rem; }
.site-footer p { margin: 0 0 0.4rem; }
.disclaimer { color: var(--text-muted); max-width: 46rem; }

/* Print: results only, light, no chrome */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --surface-2: #f1f3f5; --text: #000; --text-muted: #333; --border: #bbb;
    --accent: #0a4fb0; --accent-soft: #eaf1fb; --track: #ddd; --ok: #0b6b3a; --shadow: none;
  }
  body { background: #fff; font-size: 11pt; display: block; }
  .site-header, .progress-region, .about, .no-print, .skip-link { display: none !important; }
  main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .card, .score-card, .callout { box-shadow: none; break-inside: avoid; }
  .stepbar li, .stepbar li.filled, .callout, .tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .site-footer { border: 0; padding-top: 1rem; }
  a { color: inherit; text-decoration: none; }
}

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