/* GenoPro: clinical genomics. Calm navy and teal on cool neutrals; Source Sans 3 and Source Code Pro
 * (SIL OFL, assets/fonts/OFL.txt). Served at /site.css after /base.css. Print stylesheet at the end. */

@font-face {
  font-family: 'Source Sans 3';
  src: url('/assets/fonts/SourceSans3-VF.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('/assets/fonts/SourceSans3-Italic-VF.woff2') format('woff2');
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Source Code Pro';
  src: url('/assets/fonts/SourceCodePro-VF.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #0d2b45;
  --navy-2: #163c5e;
  --teal: #0b6b6b;        /* 6.6:1 on white */
  --teal-2: #3fb8af;      /* on navy only */
  --teal-tint: #e7f3f2;
  --amber: #7a4b00;       /* 7.4:1 on its tint */
  --amber-tint: #fdf4e3;
  --bg: #eef2f5;
  --surface: #ffffff;
  --ink: #15202b;
  --muted: #4a5866;       /* 7.0:1 on white, 6.2:1 on --bg */
  --line: #d3dbe2;
  --line-2: #e6ebef;
  --accent: var(--teal);
  --accent-ink: #ffffff;
  --radius: 6px;
  --font: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Source Code Pro', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --wide: 1120px;
  font-size: 100%;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body { font-size: 1.0625rem; font-feature-settings: 'kern', 'liga'; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }
code { font-family: var(--mono); font-size: 0.9em; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
a { color: var(--teal); text-underline-offset: 0.15em; }
a:hover { color: var(--navy); }

.skip-link:focus { left: 12px; top: 12px; background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 8px 12px; }

/* ----- Frame ----- */
.site-header, .site-main, .site-footer { max-width: none; padding: 0; }
.bar, .site-main { width: 100%; max-width: var(--wide); margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.site-header { background: var(--navy); color: #fff; }
.site-header .bar { display: flex; align-items: center; gap: 12px 20px; min-height: 60px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.site-brand { color: #fff; font-size: 1.25rem; font-weight: 700; letter-spacing: 0; gap: 10px; }
.site-brand:hover { color: #fff; }
.site-brand:focus-visible, .site-nav a:focus-visible { outline-color: #fff; }
.site-logo { width: 32px; height: 32px; border-radius: 7px; box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25); }
.site-tagline { margin: 0; padding-left: 16px; border-left: 1px solid rgb(255 255 255 / 0.25); color: #c8d5e1; font-size: 0.95rem; }
.site-nav { margin-left: auto; }
.site-nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 6px 2px; border-bottom: 2px solid transparent; }
.site-nav a[aria-current='page'] { border-bottom-color: var(--teal-2); }
.site-nav a:hover { border-bottom-color: #c8d5e1; }
.env-badge { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--navy); background: #f2c14e; padding: 3px 8px; border-radius: 4px; }

.site-main { padding-top: 32px; padding-bottom: 56px; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.875rem; }
.site-footer .bar { padding-top: 18px; padding-bottom: 18px; }
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 2px; }

/* ----- Catalogue ----- */
.page-head { margin-bottom: 36px; }
.page-head h1 { font-size: 2rem; margin: 0 0 8px; }
.lede { max-width: 68ch; margin: 0; color: var(--muted); font-size: 1.125rem; }
.how { list-style: none; counter-reset: how; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0; margin: 24px 0 0; }
.how li { counter-increment: how; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.how li::before { content: counter(how); grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 700; font-size: 0.875rem; }
.how b { font-weight: 650; }
.how span { color: var(--muted); font-size: 0.95rem; }

.cat-group { margin-top: 36px; }
.cat-group-head { display: flex; align-items: baseline; gap: 4px 20px; flex-wrap: wrap; border-bottom: 2px solid var(--navy); padding-bottom: 8px; margin-bottom: 16px; }
.cat-group-head h2 { font-size: 1.375rem; margin: 0; color: var(--navy); }
.cat-group-head p { margin: 0; color: var(--muted); font-size: 0.95rem; flex: 1 1 32ch; }

.test-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.test-item {
  position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px 16px; transition: border-color 0.15s, box-shadow 0.15s;
}
.test-item:hover { border-color: var(--teal); box-shadow: 0 2px 10px rgb(13 43 69 / 0.08); }
.test-item:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px rgb(11 107 107 / 0.35); }
.test-name { font-size: 1.125rem; margin: 0 0 6px; }
.test-name a { display: inline; padding: 0; background: none; height: auto; color: var(--navy); text-decoration: none; }
.test-name a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.test-name a:focus-visible { outline: none; }
.test-why { margin: 0 0 14px; color: var(--muted); font-size: 0.95rem; }
.test-reads { margin: auto 0 0; padding-top: 12px; border-top: 1px solid var(--line-2); display: grid; gap: 4px; font-size: 0.9rem; }
.test-reads div { display: grid; grid-template-columns: 4.5rem 1fr; }
.test-reads dt { color: var(--muted); }
.test-reads dd { margin: 0; }
.test-genes { font-style: italic; color: var(--ink); font-size: inherit; }
.test-snps code { white-space: nowrap; margin-right: 6px; }
.test-cta { margin-top: 12px; color: var(--teal); font-weight: 600; font-size: 0.95rem; }
.test-cta::after { content: ' \2192'; }

/* ----- Test page: details + consent ----- */
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 0; margin: 0 0 20px; font-size: 0.9rem; color: var(--muted); }
.crumbs li + li::before { content: '/'; margin-right: 4px; color: var(--line); }
.crumbs [aria-current] { color: var(--ink); }

.order { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 24px; align-items: start; }
.test-head { grid-column: 1 / -1; }
.test-head .test-why { font-size: 1.125rem; color: var(--muted); max-width: 70ch; margin: 0; }
.test-intro, .consent { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.eyebrow { margin: 0 0 4px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal); }
.test-title { font-size: 2rem; margin: 0 0 8px; }
.test-intro h2, .consent-head h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 28px 0 10px; }
.test-intro h2:first-child { margin-top: 0; }
.consent-head h2 { margin-top: 0; color: var(--navy); }
.test-asks { color: var(--muted); font-size: 0.9rem; margin: 8px 0 0; }

.reads-table, .cr-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.reads-table th, .reads-table td, .cr-table th, .cr-table td { border: 0; border-bottom: 1px solid var(--line-2); padding: 8px 12px 8px 0; text-align: left; vertical-align: top; }
.reads-table th, .cr-table th { font-size: 0.875rem; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); }

.patient-view { margin: 0; border-left: 3px solid var(--line); padding: 2px 0 2px 16px; }
.patient-view figcaption { font-weight: 650; }
.patient-view blockquote { margin: 4px 0 8px; color: var(--muted); }
.patient-view blockquote p { margin: 0; }
.patient-view ul { margin: 0; padding-left: 1.2em; font-size: 0.9rem; color: var(--muted); }

.consent { position: sticky; top: 16px; text-align: left; }
.consent-steps { margin: 0 0 8px; padding-left: 1.3em; color: var(--muted); font-size: 0.95rem; }
.consent-steps li + li { margin-top: 2px; }
.consent-expiry { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.consent:not(:has(.widget[data-state='waiting'])) .consent-expiry { display: none; }
.consent:not(:has(.widget:is([data-state='idle'], [data-state='starting'], [data-state='waiting']))) .consent-steps { display: none; }

/* The shared widget (states are shown or hidden by base.css). */
.widget { background: none; padding: 0; margin: 16px 0 0; border-radius: 0; text-align: center; }
.widget-hint { margin: 0 0 4px; color: var(--ink); font-weight: 600; }
.widget-qrbox { display: inline-block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 6px 0 10px; }
.widget-qrbox svg { width: min(280px, 64vw); margin: 0; }
.widget-qr .widget-link { display: block; background: none; color: var(--teal); padding: 4px; border-radius: 0; font-weight: 600; font-size: 0.95rem; text-decoration: underline; }
.widget-msg { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--teal-tint); color: var(--ink); text-align: left; font-size: 0.975rem; }
.widget-msg[data-for='waiting'] { background: none; padding: 0; text-align: center; color: var(--muted); }
.widget-msg[data-for='waiting']::before, .widget-msg[data-for='starting']::before, .widget-msg[data-for='granted']::before, .widget-msg[data-for='working']::before {
  content: ''; display: inline-block; width: 0.75em; height: 0.75em; margin-right: 8px; border-radius: 50%;
  border: 2px solid var(--teal); border-right-color: transparent; vertical-align: -0.05em; animation: spin 1s linear infinite;
}
.widget-msg:is([data-for='declined'], [data-for='expired'], [data-for='error']) { background: var(--amber-tint); color: var(--amber); border-left: 4px solid #c58a1c; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .widget-msg::before { animation: none; } }
.widget-again, .cr-print, .btn {
  display: inline-block; margin-top: 16px; border: 1px solid var(--teal); border-radius: var(--radius); padding: 10px 20px;
  background: var(--teal); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.widget-again:hover, .cr-print:hover { background: #095858; }
/* On the report, Print is the primary action; Next patient (discards the report) is secondary. */
.cr-print { margin: 0; padding: 8px 16px; font-size: 0.95rem; }
.cr-print[hidden] { display: none; }
.widget[data-state='ready'] .widget-again { background: var(--surface); color: var(--teal); padding: 8px 16px; }
.widget[data-state='ready'] .widget-again:hover { background: var(--teal-tint); }

/* Report ready: the report takes the whole page. */
.order:has(.widget[data-state='ready']) { grid-template-columns: minmax(0, 1fr); }
.order:has(.widget[data-state='ready']) .test-intro,
.order:has(.widget[data-state='ready']) .test-head,
.order:has(.widget[data-state='ready']) .consent-head { display: none; }
.order:has(.widget[data-state='ready']) .consent { position: static; background: none; border: 0; padding: 0; }
.widget[data-state='ready'] { margin: 0 auto; max-width: 920px; text-align: right; }
.widget-result { text-align: left; }
.widget-result:focus { outline: none; }
.widget-result:focus-visible .clinical-result { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ----- Clinical report ----- */
.clinical-result {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 3px rgb(13 43 69 / 0.06);
  padding: 32px 40px 28px; max-width: 920px; margin: 0 auto; color: var(--ink); font-size: 1rem;
}
.cr-header { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 12px 28px; padding-bottom: 16px; border-bottom: 3px solid var(--navy); }
.cr-brand { display: flex; align-items: center; gap: 10px; }
.cr-brand img { border-radius: 7px; }
.cr-brand p { margin: 0; display: flex; flex-direction: column; line-height: 1.15; }
.cr-brand b { font-size: 1.125rem; color: var(--navy); }
.cr-brand span { font-size: 0.85rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cr-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 28px; justify-self: end; font-size: 0.9rem; }
.cr-meta dt { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.cr-meta dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.cr-meta [data-session-ref] { font-family: var(--mono); font-weight: 500; }

.cr-title { margin: 22px 0 18px; }
.cr-test { font-size: 1.625rem; margin: 0; color: var(--navy); }
.cr-genes { margin: 2px 0 0; color: var(--muted); }
.cr-fill { display: none; }

.cr-phenotype { background: var(--teal-tint); border-left: 5px solid var(--teal); border-radius: 0 var(--radius) var(--radius) 0; padding: 16px 20px; margin: 0 0 24px; }
.cr-phenotype h3, .cr-section h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 0 0 6px; }
.cr-phenotype h3 { color: var(--teal); }
.cr-phenotype-value { font-size: 1.625rem; font-weight: 700; line-height: 1.2; margin: 0; color: var(--ink); }
.cr-level-act { border-left-color: var(--navy); }
/* Action and data-quality tags: neutral navy/teal for what to do, amber only for incomplete data. */
.cr-tags { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 10px 0 0; }
.cr-tag { display: inline-block; border: 1px solid; border-radius: 4px; padding: 2px 9px; font-size: 0.9rem; font-weight: 650; line-height: 1.4; }
.cr-tag-act { background: var(--navy); border-color: var(--navy); color: #fff; }
.cr-tag-check { background: var(--surface); border-color: var(--navy); color: var(--navy); }
.cr-tag-none { background: var(--surface); border-color: var(--teal); color: var(--teal); }
.cr-tag-unknown { background: var(--surface); border-color: var(--muted); color: var(--muted); }
.cr-tag-incomplete { background: var(--amber-tint); border-color: #c58a1c; color: var(--amber); }
.cr-calls { margin: 10px 0 0; display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.cr-calls div { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
.cr-calls dt { color: var(--muted); font-size: 0.85rem; min-width: 7.5rem; }
.cr-calls dd { margin: 0; font-weight: 600; }
.cr-summary { margin: 10px 0 0; max-width: 72ch; }

.cr-section { margin: 0 0 22px; }
.cr-section > p, .cr-section li { max-width: 78ch; }
.cr-section p { margin: 0; }
.cr-scroll { overflow-x: auto; }
.cr-table td:first-child, .cr-table th:first-child { padding-left: 0; }
.cr-table code, .cr-table td:first-child { font-family: var(--mono); font-size: 0.95em; }
.cr-table td:first-child::before { font-family: var(--font); }
.cr-row:is(.cr-missing, .cr-nocall, .cr-unexpected) td { background: var(--amber-tint); }
.cr-gt-flag { color: var(--amber); font-weight: 600; }
.cr-strand { color: var(--muted); font-size: 0.9em; white-space: nowrap; }
.cr-note { margin-top: 6px !important; font-size: 0.85rem; color: var(--muted); }

.cr-considerations ul, .cr-limitations ul { margin: 0; padding-left: 1.2em; }
.cr-considerations li + li, .cr-limitations li + li { margin-top: 8px; }
.cr-source { font-size: 0.875rem; color: var(--muted); margin-top: 2px !important; }
.cr-source::before { content: 'Source: '; font-weight: 600; }
.cr-references ol { margin: 0; padding-left: 1.5em; font-size: 0.9rem; color: var(--muted); }
.cr-references li + li { margin-top: 4px; }
.cr-references a { overflow-wrap: anywhere; }

.cr-notice { border: 1px solid #c58a1c; background: var(--amber-tint); color: var(--amber); border-radius: var(--radius); padding: 10px 14px; margin: 24px 0 0; }
.cr-notice strong { color: #5c3800; }
.cr-foot { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 0.8rem; color: var(--muted); }

.not-found { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.not-found h1 { margin-top: 0; }

/* ----- Tablet and phone ----- */
@media (max-width: 900px) {
  .order { grid-template-columns: minmax(0, 1fr); }
  .consent { position: static; }
  .test-intro { order: 1; }
  .how { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .bar, .site-main { padding-left: 16px; padding-right: 16px; }
  .site-tagline, .site-nav { display: none; }
  .env-badge { margin-left: auto; }
  .site-main { padding-top: 20px; }
  .page-head h1 { font-size: 1.625rem; }
  .test-intro, .consent { padding: 20px 16px; }
  .test-title { font-size: 1.5rem; }
  .clinical-result { padding: 20px 16px; }
  .cr-header { grid-template-columns: 1fr auto; }
  .cr-meta { grid-column: 1 / -1; grid-row: 2; justify-self: start; gap: 6px 20px; }
  .cr-phenotype-value { font-size: 1.375rem; }
  .cr-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cr-table, .cr-table tbody { display: block; }
  .cr-table tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .cr-table td { display: block; border: 0; padding: 0; }
  .cr-table td::before { display: block; font-size: 0.8rem; color: var(--muted); }
  .cr-table td:nth-child(1)::before { content: 'rsID'; }
  .cr-table td:nth-child(2)::before { content: 'Gene'; }
  .cr-table td:nth-child(3)::before { content: 'Variant'; }
  .cr-table td:nth-child(4)::before { content: 'Effect allele'; }
  .cr-table td:nth-child(5)::before { content: 'Genotype'; }
  .cr-table td:nth-child(6)::before { content: 'Copies'; }
  .cr-row:is(.cr-missing, .cr-nocall, .cr-unexpected) { background: var(--amber-tint); padding-left: 8px; padding-right: 8px; }
}

/* ----- Print: the report only, A4 ----- */
@page {
  size: A4;
  margin: 13mm 15mm 17mm;
  /* The report replaces this content with its test name and ref (a <style data-cr-page> in site.js). */
  @bottom-left { content: 'GenoPro genotype report · Demonstration only, not for clinical decisions'; font: 7.5pt/1.35 'Source Sans 3', sans-serif; color: #4a5866; white-space: pre; vertical-align: top; padding-top: 3mm; width: 150mm; }
  @bottom-right { content: 'Page ' counter(page) ' of ' counter(pages); font: 7.5pt 'Source Sans 3', sans-serif; color: #4a5866; vertical-align: top; padding-top: 3mm; width: 30mm; text-align: right; }
}
@media print {
  :root { --bg: #fff; font-size: 9.25pt; }
  html, body { background: #fff; }
  body { display: block; min-height: 0; font-size: 1rem; line-height: 1.4; }
  .skip-link, .site-header, .site-footer, .crumbs, .widget-again, .cr-print, .consent-expiry, .cr-foot { display: none !important; }
  .site-main { max-width: none; padding: 0; }
  .order:has(.widget[data-state='ready']) .consent { display: block; }
  .test-intro, .consent { border: 0; padding: 0; }
  .order { display: block; }
  .clinical-result { border: 0; box-shadow: none; padding: 0; max-width: none; font-size: 1rem; }
  .cr-header { grid-template-columns: auto 1fr; padding-bottom: 8px; border-bottom-width: 2pt; }
  .cr-meta { gap: 2px 20px; font-size: 8.5pt; }
  .cr-title { margin: 8px 0 4px; }
  .cr-test { font-size: 15pt; }
  .cr-fill { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin: 4px 0 10px; font-size: 8pt; color: #4a5866; }
  .cr-fill dd { margin: 11px 0 0; border-bottom: 0.75pt solid #8a96a3; }
  .cr-phenotype { padding: 7px 12px; margin-bottom: 9px; break-inside: avoid; }
  .cr-phenotype-value { font-size: 14pt; }
  .cr-tags { margin-top: 5px; }
  .cr-tag { font-size: 8.5pt; padding: 0 6px; }
  .cr-calls, .cr-summary { margin-top: 5px; }
  .cr-phenotype h3, .cr-section h3 { font-size: 8pt; margin-bottom: 2px; break-after: avoid; }
  .cr-section { margin-bottom: 8px; }
  .cr-section li, .cr-section > p { line-height: 1.35; }
  .cr-section > p, .cr-section li, .cr-summary, .cr-note { max-width: none; }
  .cr-genotypes, .cr-considerations li, .cr-limitations li, .cr-references li { break-inside: avoid; }
  .cr-table th, .cr-table td { padding: 3px 10px 3px 0; }
  .cr-table th { font-size: 7.5pt; }
  .cr-scroll { overflow: visible; }
  .cr-considerations li + li, .cr-limitations li + li { margin-top: 2px; }
  .cr-source { font-size: 8pt; margin-top: 0 !important; }
  .cr-note { font-size: 7.5pt; margin-top: 3px !important; }
  .cr-references ol { font-size: 7.5pt; line-height: 1.3; }
  .cr-references li + li { margin-top: 1px; }
  .cr-references a { color: inherit; text-decoration: none; }
  /* The notice never sits alone on a page: it stays with the references above it. */
  .cr-notice { padding: 5px 10px; margin-top: 8px; break-inside: avoid; break-before: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
