/* ============================================================================
   OpenBioDx · open diagnostics intelligence
   Design language extracted from the placeholder landing page:
   calm medical publishing, signature blue #0077a8, molecular helix backdrop,
   backdrop-blur topbar, category pills, clean cards. System fonts only.
   No external fonts / scripts / CDNs.
   ============================================================================ */

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

:root {
  --bg: #f7f8fa;
  --bg-alt: #eef1f5;
  --text: #1a1f2e;
  --text-mid: #4a5068;
  --text-light: #6b7280;
  --accent: #0077a8;
  --accent-light: #e6f4fa;
  --accent-dark: #005a80;
  --helix: #d4e4ed;
  --border: #dce1e8;
  --border-soft: #e6e9ef;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px rgba(20, 32, 54, .05);
  --shadow-md: 0 4px 18px rgba(20, 32, 54, .07);
  --radius: 10px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif,
          "Apple Color Emoji", "Segoe UI Emoji";
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 50;
  background: var(--accent);
  color: var(--white);
  padding: .6rem 1rem;
  border-radius: 0 0 6px 0;
  font-size: .85rem;
}
.skip-link:focus { left: 0; color: var(--white); }

/* ── Molecular helix backdrop ──────────────────────────────────────────── */
.helix-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.helix-bg svg { position: absolute; opacity: .035; }
.helix-bg .h1 { top: -90px; right: -140px; width: 760px; height: 760px; transform: rotate(15deg); }
.helix-bg .h2 { bottom: -220px; left: -200px; width: 860px; height: 860px; transform: rotate(-25deg); }

/* ── Topbar / header ───────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: rgba(247, 248, 250, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: .7rem 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.2rem;
}

.brand { display: inline-flex; flex-direction: column; line-height: 1.15; }
.brand:hover { color: inherit; }
.brand-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}
.brand-name span { color: var(--accent); }
.brand-tagline {
  font-size: .72rem;
  color: var(--text-light);
  letter-spacing: .02em;
  margin-top: .1rem;
}

.mainnav { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.nav-row { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; align-items: center; }

.nav-primary { gap: .2rem; }
.nav-link {
  padding: .35rem .7rem;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-mid);
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--accent-light); color: var(--accent-dark); }
.nav-link.active { color: var(--accent-dark); background: var(--accent-light); }

.nav-cats { gap: .35rem; }
.cat-pill {
  display: inline-block;
  padding: .25rem .6rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--pill, var(--accent-dark));
  background: var(--accent-light);
  background: color-mix(in srgb, var(--pill, var(--accent)) 9%, var(--white));
  border: 1px solid var(--border);
  border: 1px solid color-mix(in srgb, var(--pill, var(--accent)) 22%, transparent);
  border-radius: 999px;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.cat-pill:hover, .cat-pill.active {
  background: var(--pill, var(--accent));
  color: var(--white);
  border-color: var(--pill, var(--accent));
}

.burger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .35rem;
  width: 40px;
  height: 40px;
  color: var(--text-mid);
  cursor: pointer;
}
.burger svg { width: 20px; height: 20px; }

/* ── Main layout ───────────────────────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3.5rem;
}

.page-head { margin-bottom: 1.8rem; }
.page-head h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.page-lead {
  margin-top: .6rem;
  font-size: 1.02rem;
  color: var(--text-mid);
  max-width: 62ch;
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero { margin-bottom: 2.6rem; }
.hero-inner {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.8rem 2rem;
  box-shadow: var(--shadow-md);
  transition: box-shadow .2s, transform .2s;
  color: inherit;
}
.hero-inner:hover { box-shadow: 0 8px 26px rgba(20, 32, 54, .1); transform: translateY(-2px); color: inherit; }
.hero-cat {
  display: inline-block;
  padding: .2rem .6rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--white);
  background: var(--pill, var(--accent));
  border-radius: 4px;
}
.hero-title {
  margin: .8rem 0 .5rem;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--text);
}
.hero-summary { color: var(--text-mid); font-size: 1.02rem; max-width: 66ch; }
.hero-meta {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem 1rem;
  font-size: .82rem;
  color: var(--text-light);
}

/* ── Sections ──────────────────────────────────────────────────────────── */
.section { margin-bottom: 2.8rem; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: .5rem;
}
.section-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.section-more { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.section-lead { color: var(--text-mid); margin: -.5rem 0 1rem; font-size: .95rem; }

/* ── Card grid ─────────────────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s, border-color .18s;
  color: inherit;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border);
  color: inherit;
}
.card-cat {
  align-self: flex-start;
  padding: .15rem .55rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--pill, var(--accent));
  background: var(--accent-light);
  background: color-mix(in srgb, var(--pill, var(--accent)) 11%, var(--white));
  border-radius: 4px;
}
.card-title {
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem .7rem;
  font-size: .8rem;
  color: var(--text-light);
  margin-top: auto;
}
.card-journal { font-style: italic; }

/* ── Significance badge ────────────────────────────────────────────────── */
.sig-badge {
  align-self: flex-start;
  display: inline-block;
  padding: .12rem .5rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--text-mid);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.sig-badge.sig-hi {
  color: var(--accent-dark);
  background: var(--accent-light);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ── Library / lists ───────────────────────────────────────────────────── */
.lib-jump {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 2rem;
}
.lib-jump a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .75rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-mid);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 999px;
  border-left: 3px solid var(--pill, var(--accent));
  transition: background .15s, color .15s;
}
.lib-jump a:hover { background: var(--bg-alt); color: var(--text); }
.lib-jump a span {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-light);
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 0 .4rem;
}

.lib-cat { margin-bottom: 2.4rem; scroll-margin-top: 120px; }
.lib-cat-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .8rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--border);
}
.lib-cat-dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.lib-cat-head h2 { font-size: 1.2rem; font-weight: 700; }
.lib-cat-count {
  margin-left: auto;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-light);
}

.lib-list {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lib-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: .8rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  color: inherit;
  transition: background .13s;
}
.lib-row:last-child { border-bottom: none; }
.lib-row:hover { background: var(--accent-light); color: inherit; }
.lib-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.lib-title { font-weight: 600; font-size: .95rem; color: var(--text); line-height: 1.35; }
.lib-journal {
  font-size: .8rem;
  font-style: italic;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.lib-year { font-size: .82rem; color: var(--text-light); font-variant-numeric: tabular-nums; }

.lib-more { margin-top: .8rem; }
.lib-more summary {
  cursor: pointer;
  display: inline-block;
  padding: .5rem .95rem;
  font-size: .85rem;
  font-weight: 650;
  color: var(--accent-dark);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: background .15s;
  list-style: none;
}
.lib-more summary::-webkit-details-marker { display: none; }
.lib-more summary::before { content: "▸ "; color: var(--accent); }
.lib-more[open] summary::before { content: "▾ "; }
.lib-more summary:hover { background: var(--accent-light); }
.lib-more .lib-list { margin-top: .8rem; }

.archive-list { max-width: 100%; }

/* ── Article detail ────────────────────────────────────────────────────── */
.article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  max-width: 780px;
}
.article-top { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; }
.article-cat {
  display: inline-block;
  padding: .2rem .6rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--white);
  background: var(--pill, var(--accent));
  border-radius: 5px;
}
.article-cat:hover { color: var(--white); opacity: .9; }
.article-title {
  font-size: 2rem;
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: -.02em;
  margin-bottom: .7rem;
}
.article-meta {
  font-size: .88rem;
  color: var(--text-light);
  margin-bottom: 1.6rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}
.article-meta .am-journal { font-style: italic; color: var(--text-mid); }
.article-summary {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 1rem;
}

/* Original-source block */
.source-block {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  margin: 1.8rem 0;
  box-shadow: var(--shadow-sm);
}
.source-heading {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
  margin-bottom: .8rem;
}
.source-origtitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .9rem;
  line-height: 1.4;
}
.source-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .4rem 1.1rem;
  font-size: .9rem;
  margin-bottom: 1.2rem;
}
.source-dl dt { font-weight: 700; color: var(--text-light); }
.source-dl dd { color: var(--text-mid); }
.read-original {
  display: inline-block;
  padding: .7rem 1.4rem;
  font-size: .92rem;
  font-weight: 700;
  color: var(--white);
  background: var(--accent);
  border-radius: 8px;
  transition: background .15s, transform .15s;
}
.read-original:hover { background: var(--accent-dark); color: var(--white); transform: translateY(-1px); }

/* Original abstract */
.abstract {
  margin: 1.8rem 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
}
.abstract-heading {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
  margin-bottom: .8rem;
}
.abstract p {
  font-size: .96rem;
  color: var(--text-mid);
  line-height: 1.72;
  margin-bottom: .9rem;
}

/* Related */
.related { max-width: 780px; }
.related-head {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: .9rem;
  padding-bottom: .4rem;
  border-bottom: 2px solid var(--border);
}
.related-list {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Category page head ────────────────────────────────────────────────── */
.cat-head { border-left: 4px solid var(--pill, var(--accent)); padding-left: 1.1rem; }
.cat-head-tag {
  display: inline-block;
  padding: .2rem .6rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--white);
  background: var(--pill, var(--accent));
  border-radius: 4px;
  margin-bottom: .6rem;
}
.empty-note { color: var(--text-light); font-style: italic; padding: 2rem 0; }

/* ── Prose (GeneralPage / About) ───────────────────────────────────────── */
.prose { max-width: 720px; font-size: 1.02rem; color: var(--text-mid); }
.prose h2 { font-size: 1.4rem; color: var(--text); margin: 1.8rem 0 .7rem; }
.prose h3 { font-size: 1.15rem; color: var(--text); margin: 1.4rem 0 .5rem; }
.prose p { margin-bottom: 1rem; line-height: 1.75; }
.prose ul, .prose ol { margin: 0 0 1rem 1.4rem; }
.prose li { margin-bottom: .4rem; }
.prose a { font-weight: 600; }
.page-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.page-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow-sm);
}

/* ── Error page ────────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 5rem 1.5rem; }
.error-page h1 { font-size: 2.2rem; margin-bottom: .8rem; }
.error-page p { color: var(--text-mid); margin-bottom: 1.6rem; }
.error-back { font-weight: 700; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  background: rgba(238, 241, 245, .6);
  margin-top: auto;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  text-align: center;
}
.footer-nav { font-size: .88rem; color: var(--text-light); margin-bottom: .6rem; }
.footer-nav a { color: var(--text-mid); font-weight: 600; }
.footer-nav a:hover { color: var(--accent); }
.footer-attrib { font-size: .78rem; color: var(--text-light); letter-spacing: .01em; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .topbar-inner { grid-template-columns: 1fr auto; }
  .mainnav {
    grid-column: 1 / -1;
    order: 3;
    align-items: stretch;
    display: none;
    padding-top: .6rem;
    border-top: 1px solid var(--border-soft);
    margin-top: .6rem;
  }
  .mainnav.open { display: flex; }
  .nav-row { justify-content: flex-start; }
  .burger { display: inline-flex; }
}

@media (max-width: 600px) {
  main { padding: 1.6rem 1.1rem 2.5rem; }
  .topbar-inner { padding: .6rem 1.1rem; }
  .page-head h1 { font-size: 1.6rem; }
  .hero-inner { padding: 1.3rem 1.3rem; }
  .hero-title { font-size: 1.35rem; }
  .article-title { font-size: 1.55rem; }
  .card-grid { grid-template-columns: 1fr; }
  .lib-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "dot title title" "dot journal year";
    gap: .2rem .7rem;
  }
  .lib-dot { grid-area: dot; }
  .lib-title { grid-area: title; }
  .lib-journal { grid-area: journal; max-width: none; }
  .lib-year { grid-area: year; text-align: right; }
  .lib-row .sig-badge { display: none; }
  .source-dl { grid-template-columns: 1fr; gap: .1rem; }
  .source-dl dd { margin-bottom: .5rem; }
}

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