/* ---------------------------------------------------------------------------
   Compare Lab Tests — comparelabtests.com
   Visual language borrowed from the printed lab report: tabular monospace
   numerics, out-of-range flags, and the reference-range bracket — reused here
   to plot price instead of result. Category colours are vacutainer cap colours
   (lavender EDTA, gold SST, teal) so the taxonomy carries a real-world cue.
--------------------------------------------------------------------------- */

:root {
  --ink: #141a1f;
  --ink-2: #47555d;
  --ink-3: #6d7c85;
  --paper: #f5f7f7;
  --card: #ffffff;
  --rule: #dae0e0;
  --rule-strong: #b9c4c4;

  --lab-draw: #7c6baf;
  --at-home-kit: #b3811f;
  --membership: #0f6e68;
  --accent: #0f6e68;
  --accent-ink: #0a4b47;
  --flag: #c4372b;
  --ok: #2b6f4e;

  --display: 'IBM Plex Sans Condensed', 'Helvetica Neue', Arial, sans-serif;
  --body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --wrap: 74rem;
  --r: 3px;
  --shadow: 0 1px 2px rgb(20 26 31 / 0.05), 0 8px 24px -16px rgb(20 26 31 / 0.25);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8edee;
    --ink-2: #a3b1b8;
    --ink-3: #7d8d95;
    --paper: #10151a;
    --card: #171e24;
    --rule: #2a343c;
    --rule-strong: #3d4a53;
    --lab-draw: #a396d3;
    --at-home-kit: #d8a746;
    --membership: #45b3a9;
    --accent: #45b3a9;
    --accent-ink: #7fd4cb;
    --flag: #e8705f;
    --ok: #63b98c;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -16px rgb(0 0 0 / 0.8);
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 clamp(0.95rem, 0.9rem + 0.2vw, 1.0625rem)/1.6 var(--body);
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

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

.skip {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 20;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r);
  transition: top 0.15s;
}
.skip:focus { top: 0.5rem; }

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

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.1;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.4rem + 3vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 1.15rem + 1.1vw, 2rem); }
h3 { font-size: 1.125rem; }

.eyebrow {
  font: 600 0.75rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1rem;
}
.eyebrow a { color: inherit; }

.lede {
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  color: var(--ink-2);
  max-width: 62ch;
  text-wrap: pretty;
}

.note {
  font-size: 0.9375rem;
  color: var(--ink-2);
  border-left: 2px solid var(--rule-strong);
  padding-left: 0.875rem;
  margin: 1.25rem 0;
  max-width: 66ch;
}

.empty {
  color: var(--ink-3);
  font-style: italic;
}

/* --- masthead ----------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 3.75rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font: 700 1.0625rem/1 var(--display);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
/* Cap of a blood collection tube: the site's only piece of iconography. */
.brand__mark {
  width: 0.75rem;
  height: 1.25rem;
  border-radius: 2px 2px 1px 1px;
  background: linear-gradient(var(--lab-draw) 0 45%, var(--membership) 45% 100%);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
  flex: none;
}
.masthead nav {
  display: flex;
  gap: 1.25rem;
  font: 500 0.875rem/1 var(--body);
}
.masthead nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.masthead nav a:hover { color: var(--ink); }
.masthead nav a[aria-current='page'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* --- hero --------------------------------------------------------------- */

.hero {
  border-bottom: 1px solid var(--rule);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 60%),
    var(--paper);
}
.hero__inner { padding: clamp(2.5rem, 1.5rem + 4vw, 5rem) 0 clamp(2rem, 1.5rem + 2vw, 3rem); }
.hero h1 { max-width: 18ch; }
.hero .lede { margin-bottom: 2.5rem; }
.hero__jump {
  font: 500 0.875rem/1.6 var(--body);
  color: var(--ink-3);
  margin: 2rem 0 0;
}
.hero__jump a { color: var(--ink-2); }

/* --- signature: the price-spread bracket -------------------------------- */

.spread {
  margin: 0;
  padding: 1.5rem 1.5rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.spread__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.25rem;
}
.spread__label {
  font: 600 0.75rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.spread__delta {
  font: 600 1rem/1 var(--mono);
  color: var(--flag);
  font-variant-numeric: tabular-nums;
}
.spread__scale {
  position: relative;
  height: 2.5rem;
  margin-bottom: 0.5rem;
}
/* The bracket rule itself, with serifs at each end like a printed range marker. */
.spread__bar {
  position: absolute;
  left: 0; right: 0; top: 0.6875rem;
  height: 2px;
  background: var(--rule-strong);
}
.spread__bar::before,
.spread__bar::after {
  content: '';
  position: absolute;
  top: -5px;
  width: 2px;
  height: 12px;
  background: var(--ink-3);
}
.spread__bar::before { left: 0; }
.spread__bar::after { right: 0; }

.spread__ticks {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  inset: 0;
}
.tick {
  position: absolute;
  left: var(--pos);
  top: 0;
}
.tick__mark {
  position: absolute;
  left: -3px;
  top: 0.25rem;
  width: 6px;
  height: 0.875rem;
  border-radius: 3px;
  background: var(--ink-3);
  transition: transform 0.15s, background 0.15s;
}
.tick--low .tick__mark { background: var(--ok); width: 8px; left: -4px; height: 1.125rem; top: 0.0625rem; }
.tick--high .tick__mark { background: var(--flag); width: 8px; left: -4px; height: 1.125rem; top: 0.0625rem; }
.tick:hover .tick__mark { transform: scaleY(1.25); background: var(--accent); }

.tick__label {
  position: absolute;
  top: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font: 400 0.8125rem/1.2 var(--body);
  color: var(--ink-2);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.tick__label b {
  font-family: var(--mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tick--low .tick__label { opacity: 1; left: 0; transform: none; }
.tick--high .tick__label { opacity: 1; left: auto; right: 0; transform: none; }
.tick:hover .tick__label,
.tick:focus-within .tick__label { opacity: 1; z-index: 2; }
.tick--low .tick__label b { color: var(--ok); }
.tick--high .tick__label b { color: var(--flag); }

.spread__caption {
  font-size: 0.875rem;
  color: var(--ink-3);
  margin: 1.75rem 0 0;
  max-width: 60ch;
}

@media (prefers-reduced-motion: no-preference) {
  .tick {
    animation: tick-in 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
    animation-delay: calc(var(--i) * 70ms + 150ms);
  }
  @keyframes tick-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
  }
}

/* --- disclosure --------------------------------------------------------- */

.disclosure {
  font-size: 0.875rem;
  color: var(--ink-2);
  max-width: 72ch;
}
.disclosure--top {
  margin: 2rem 0 0;
  padding: 0.875rem 1rem;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r);
  background: color-mix(in srgb, var(--card) 60%, transparent);
}

/* --- category sections -------------------------------------------------- */

.category { margin: clamp(3rem, 2rem + 3vw, 4.5rem) 0; scroll-margin-top: 5rem; }
.category__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.625rem;
  margin-bottom: 1rem;
}
.category__head h2 { margin: 0; flex: 1; }
.swatch {
  width: 0.625rem;
  height: 1.5rem;
  border-radius: 2px;
  flex: none;
}
.swatch--lab-draw { background: var(--lab-draw); }
.swatch--at-home-kit { background: var(--at-home-kit); }
.swatch--membership { background: var(--membership); }
.category__count {
  font: 500 0.75rem/1 var(--mono);
  color: var(--ink-3);
  letter-spacing: 0.06em;
}
.category__blurb {
  color: var(--ink-2);
  max-width: 68ch;
  margin: 0 0 1.75rem;
  font-size: 0.9375rem;
}
.category .spread { margin-bottom: 2rem; }

/* --- comparison table --------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--card);
}
.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.compare thead th {
  position: sticky;
  top: 0;
  background: var(--card);
  text-align: left;
  font: 600 0.6875rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
.compare thead th[data-sort-type] { cursor: pointer; user-select: none; }
.compare thead th[data-sort-type]:hover { color: var(--ink); }
.compare thead th[aria-sort]::after {
  content: '↑';
  margin-left: 0.375rem;
  color: var(--accent);
}
.compare thead th[aria-sort='descending']::after { content: '↓'; }
.compare tbody tr { border-bottom: 1px solid var(--rule); }
.compare tbody tr:last-child { border-bottom: 0; }
.compare tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.compare td,
.compare th[scope='row'] {
  padding: 0.875rem 1rem;
  vertical-align: middle;
  text-align: left;
  font-weight: 400;
}
.cell-name { min-width: 15rem; }
.product-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--ink);
  text-decoration: none;
  display: block;
  line-height: 1.25;
}
.product-name:hover { color: var(--accent-ink); text-decoration: underline; }
.product-vendor {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-3);
  margin-top: 0.125rem;
}
.price {
  font: 600 1.0625rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  display: block;
}
.was {
  display: block;
  margin-top: 0.125rem;
  font: 400 0.8125rem/1 var(--mono);
  color: var(--ink-3);
  text-decoration: line-through;
}
.price-note {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--ink-3);
  max-width: 22ch;
}
.promo {
  display: inline-block;
  margin-top: 0.3125rem;
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.06em;
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 0.1875rem 0.375rem;
  border-radius: 2px;
}
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.cell-cta { text-align: right; }

.stamp {
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.03em;
  white-space: nowrap;
  padding: 0.25rem 0.4375rem;
  border-radius: 2px;
  border: 1px solid;
}
.stamp--fresh { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.stamp--stale { color: var(--flag); border-color: color-mix(in srgb, var(--flag) 35%, transparent); }
.stamp--unverified { color: var(--ink-3); border-color: var(--rule-strong); border-style: dashed; }

.avail { font-size: 0.8125rem; white-space: nowrap; }
.avail--all { color: var(--ink-3); }
.avail--limited { color: var(--flag); }

.btn {
  display: inline-block;
  font: 600 0.875rem/1 var(--body);
  padding: 0.625rem 1rem;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--ink);
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--lg { padding: 0.8125rem 1.5rem; font-size: 1rem; }

/* Cards below the table breakpoint: a horizontal scroll on a phone hides the
   price column, which is the one thing the reader came for. */
@media (max-width: 60rem) {
  .table-wrap { border: 0; background: none; overflow: visible; }
  .compare thead { display: none; }
  .compare,
  .compare tbody,
  .compare tr,
  .compare td,
  .compare th[scope='row'] { display: block; width: auto; }
  .compare tbody tr {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--r);
    margin-bottom: 0.875rem;
    padding: 1rem;
    box-shadow: var(--shadow);
  }
  .compare td,
  .compare th[scope='row'] { padding: 0; }
  .cell-name { margin-bottom: 0.75rem; }
  .compare td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.375rem 0;
    border-top: 1px solid var(--rule);
  }
  .compare td::before {
    content: attr(data-label);
    font: 500 0.75rem/1.4 var(--mono);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    flex: none;
  }
  .compare td.cell-price { border-top: 0; padding-top: 0; }
  .compare .price { font-size: 1.375rem; }
  /* Qualified with .compare td so these beat the flex row rule above — an unqualified
     .cell-cta loses on specificity and the button silently stays inline. */
  .compare td.cell-cta { display: block; padding-top: 0.875rem; }
  .compare td.cell-cta::before { display: none; }
  .compare td.cell-cta .btn { display: block; text-align: center; }
}

.singles { margin-top: 1.5rem; }
.singles > summary {
  cursor: pointer;
  font: 600 0.8125rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}
.singles > summary:hover { color: var(--ink); }
.singles__blurb {
  font-size: 0.875rem;
  color: var(--ink-3);
  max-width: 62ch;
  margin: 0 0 1.25rem;
}

/* --- callouts ----------------------------------------------------------- */

.callout {
  margin: clamp(3rem, 2rem + 3vw, 4.5rem) 0;
  padding: clamp(1.75rem, 1.25rem + 2vw, 2.75rem);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  background: var(--card);
}
.callout h2 { margin-top: 0; }
.callout p { color: var(--ink-2); max-width: 66ch; }
.callout .btn { margin-top: 0.75rem; }
.callout--sheet { border-left-color: var(--lab-draw); }

/* --- coverage matrix ---------------------------------------------------- */

.table-wrap--matrix { margin-top: 2rem; max-height: 80vh; overflow: auto; }
.matrix {
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 100%;
}
.matrix th,
.matrix td {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.75rem;
  text-align: center;
}
.matrix thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--card);
  vertical-align: bottom;
}
.mx-corner {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--card);
  text-align: left;
  font: 600 0.6875rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mx-head {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 8rem;
  max-width: 11rem;
  text-align: left;
}
.mx-head b { font: 700 0.9375rem/1.2 var(--display); color: var(--ink); }
.mx-head span { font-size: 0.75rem; color: var(--ink-3); }
.mx-head__price {
  font-family: var(--mono) !important;
  font-weight: 600;
  color: var(--accent-ink) !important;
  font-variant-numeric: tabular-nums;
}
.mx-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--card);
  text-align: left;
  font-weight: 400;
  white-space: nowrap;
}
.mx-group__head th {
  position: sticky;
  left: 0;
  text-align: left;
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  font: 600 0.6875rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.mx { font-size: 1.125rem; line-height: 1; }
.mx--yes { color: var(--ok); }
.mx--no { color: var(--rule-strong); }
.pill {
  display: inline-block;
  margin-left: 0.5rem;
  font: 500 0.625rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lab-draw);
  border: 1px solid color-mix(in srgb, var(--lab-draw) 40%, transparent);
  border-radius: 2px;
  padding: 0.1875rem 0.3125rem;
  vertical-align: 1px;
}

/* --- vendor pages ------------------------------------------------------- */

.vendor { padding: clamp(2rem, 1.5rem + 2vw, 3.5rem) 0; }
.vendor__facts,
.panel__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  margin: 1.5rem 0;
  padding: 0;
}
.vendor__facts div,
.panel__facts div { margin: 0; }
.vendor__facts dt,
.panel__facts dt {
  font: 600 0.6875rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.375rem;
}
.vendor__facts dd,
.panel__facts dd { margin: 0; font-size: 0.9375rem; }
.code {
  font: 600 0.875rem/1 var(--mono);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-ink);
  padding: 0.25rem 0.4375rem;
  border-radius: 2px;
}
.panels {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  margin-top: 1.5rem;
}
.panel {
  border: 1px solid var(--rule);
  border-radius: var(--r);
  background: var(--card);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.75rem;
}
.panel__head h3 { margin: 0; }
.panel__price {
  font: 600 1.125rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.panel__facts { gap: 1rem 1.75rem; margin: 1rem 0; }
.panel__markers { margin: 0 0 1rem; }
.panel__markers summary {
  cursor: pointer;
  font: 500 0.8125rem/1 var(--body);
  color: var(--accent-ink);
}
.marker-list {
  list-style: none;
  margin: 0.875rem 0 0;
  padding: 0;
  columns: 2;
  column-gap: 1.5rem;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.marker-list li { break-inside: avoid; padding: 0.125rem 0; }
.panel .btn { margin-top: auto; text-align: center; }

/* --- prose -------------------------------------------------------------- */

.prose { padding: clamp(2rem, 1.5rem + 2vw, 3.5rem) 0; max-width: 42rem; }
.prose h2 { margin-top: 2.5rem; }
.prose p { color: var(--ink-2); }

/* --- footer ------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding: 2.5rem 0 3.5rem;
  background: var(--card);
}
.footer__legal,
.footer__meta {
  font-size: 0.8125rem;
  color: var(--ink-3);
  max-width: 72ch;
}
.footer__meta {
  font-family: var(--mono);
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}
