@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Serif+Display:ital@0;1&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --slate-950: #0a0f1a;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50:  #f8fafc;

  --teal-600:  #0d9488;
  --teal-500:  #14b8a6;
  --teal-400:  #2dd4bf;
  --teal-100:  #ccfbf1;
  --teal-50:   #f0fdfa;

  --amber-400: #fbbf24;
  --red-400:   #f87171;
  --blue-400:  #60a5fa;

  --bg:        #f7f9fb;
  --surface:   #ffffff;
  --border:    #e4eaf0;
  --text:      #1a2332;
  --muted:     #64748b;
  --accent:    var(--teal-600);
  --accent-lt: var(--teal-50);

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --shadow-md: 0 8px 32px rgba(0,0,0,.09), 0 2px 8px rgba(0,0,0,.05);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Layout ── */
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.container--wide { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ── Header ── */
.site-header {
  background: var(--slate-900);
  border-bottom: 1px solid var(--slate-800);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 24px;
  height: 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.3px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo:hover { text-decoration: none; }

.logo__icon {
  width: 30px; height: 30px;
  background: var(--teal-500);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.logo__icon svg { width: 16px; height: 16px; fill: #fff; }
.logo__sub {
  font-size: 10px;
  font-weight: 400;
  color: var(--slate-400);
  display: block;
  line-height: 1;
  margin-top: 1px;
}

.header-search {
  flex: 1;
  max-width: 440px;
  position: relative;
}

.header-search input {
  width: 100%;
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius);
  padding: 9px 16px 9px 38px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.header-search input::placeholder { color: var(--slate-500); }
.header-search input:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20,184,166,.15);
}
.header-search__icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--slate-500);
  pointer-events: none;
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--slate-900);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 360px;
  overflow-y: auto;
  display: none;
  z-index: 200;
}
.search-dropdown.active { display: block; }
.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--slate-800);
  cursor: pointer;
  transition: background .1s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--slate-800); }
.search-item__name { color: #fff; font-size: 14px; font-weight: 500; }
.search-item__cat { color: var(--slate-400); font-size: 12px; }
.search-item__badge {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--slate-800);
  color: var(--slate-400);
  border: 1px solid var(--slate-700);
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.site-nav a {
  color: var(--slate-400);
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
  text-decoration: none;
}
.site-nav a:hover, .site-nav a.active {
  color: #fff;
  background: var(--slate-800);
}

/* ── Hero ── */
.hero {
  background: var(--slate-900);
  padding: 64px 24px 56px;
  text-align: center;
  border-bottom: 1px solid var(--slate-800);
}
.hero__tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--teal-400);
  margin-bottom: 16px;
  background: rgba(45,212,191,.08);
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid rgba(45,212,191,.2);
}
.hero__title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(32px, 5vw, 52px);
  color: #fff;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}
.hero__title em { color: var(--teal-400); font-style: italic; }
.hero__sub {
  color: var(--slate-400);
  font-size: 16px;
  max-width: 480px;
  margin: 0 auto 36px;
}

.hero-search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}
.hero-search input {
  width: 100%;
  background: var(--slate-800);
  border: 1px solid var(--slate-700);
  border-radius: 12px;
  padding: 16px 56px 16px 48px;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  outline: none;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
  transition: border-color .2s, box-shadow .2s;
}
.hero-search input::placeholder { color: var(--slate-500); }
.hero-search input:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 4px rgba(20,184,166,.15), 0 4px 24px rgba(0,0,0,.25);
}
.hero-search__icon {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
}
.hero-search__kbd {
  position: absolute;
  right: 16px; top: 50%;
  transform: translateY(-50%);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--slate-500);
  background: var(--slate-700);
  padding: 3px 8px;
  border-radius: 4px;
}

.search-dropdown--hero {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--slate-900);
  border: 1px solid var(--slate-700);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 200;
  text-align: left;
}
.search-dropdown--hero.active { display: block; }

.hero-stats {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  gap: 40px;
}
.hero-stat { text-align: center; }
.hero-stat__n {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  color: #fff;
}
.hero-stat__label {
  font-size: 12px;
  color: var(--slate-400);
  margin-top: 2px;
}

/* ── Section ── */
.section { padding: 56px 0; }
.section + .section { padding-top: 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}
.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: 24px;
  letter-spacing: -0.3px;
}
.section-link { font-size: 13px; color: var(--accent); }

/* ── Category Grid ── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: box-shadow .2s, border-color .2s, transform .15s;
  text-decoration: none;
  color: var(--text);
}
.cat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--teal-500);
  transform: translateY(-2px);
  text-decoration: none;
}
.cat-card__icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 4px;
}
.cat-card__name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
}
.cat-card__count {
  font-size: 12px;
  color: var(--muted);
}

/* ── Test List ── */
.test-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.test-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow .15s, border-color .15s;
  text-decoration: none;
  color: var(--text);
}
.test-row:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--teal-500);
  text-decoration: none;
}
.test-row__name { font-weight: 500; flex: 1; }
.test-row__alias { font-size: 13px; color: var(--muted); margin-left: 8px; }
.test-row__specimen {
  font-size: 12px;
  padding: 3px 10px;
  background: var(--slate-100);
  border-radius: 99px;
  color: var(--muted);
  font-family: 'JetBrains Mono', monospace;
}
.test-row__arrow { color: var(--slate-400); margin-left: 4px; }

/* ── Test Detail ── */
.test-detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 760px) {
  .test-detail { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.card-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-head h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 24px; }
.card-body p { color: var(--muted); font-size: 14px; line-height: 1.7; }

/* Test title block */
.test-title-block { margin-bottom: 28px; }
.test-title-block h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 34px;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin-bottom: 8px;
}
.test-aliases {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.alias-chip {
  background: var(--slate-100);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--slate-500);
}
.meta-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 99px;
  font-weight: 500;
}
.pill--specimen {
  background: var(--teal-50);
  color: var(--teal-600);
  border: 1px solid var(--teal-100);
}
.pill--unit {
  background: var(--slate-100);
  color: var(--slate-600);
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 400;
  font-size: 11px;
}

/* Reference Ranges Table */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.ref-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--slate-50);
}
.ref-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ref-table tr:last-child td { border-bottom: none; }
.ref-table tr:hover td { background: var(--slate-50); }

.range-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.sex-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
}
.sex-badge--male   { background: #dbeafe; color: #1d4ed8; }
.sex-badge--female { background: #fce7f3; color: #9d174d; }
.sex-badge--both   { background: var(--slate-100); color: var(--slate-600); }

/* Interpretation */
.interp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.interp-item { }
.interp-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.interp-label--low  { color: var(--blue-400); }
.interp-label--high { color: var(--red-400); }
.interp-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related-link {
  font-size: 13px;
  padding: 5px 12px;
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: 99px;
  color: var(--teal-600);
  transition: background .15s;
}
.related-link:hover { background: var(--teal-100); text-decoration: none; }

/* Sidebar stat card */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-card__label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat-card__value {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  color: var(--text);
}
.stat-card__sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb__sep { color: var(--slate-300); }
.breadcrumb__current { color: var(--text); }

/* ── Search Results ── */
.search-header {
  margin-bottom: 28px;
}
.search-header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  margin-bottom: 6px;
}
.search-header p { color: var(--muted); font-size: 14px; }
.search-highlight { color: var(--teal-600); }

/* ── Subcat tabs ── */
.subcat-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.subcat-tab {
  font-size: 13px;
  padding: 7px 16px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.subcat-tab:hover, .subcat-tab.active {
  background: var(--teal-600);
  border-color: var(--teal-600);
  color: #fff;
  text-decoration: none;
}

/* ── Empty State ── */
.empty {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
}
.empty__icon { font-size: 48px; margin-bottom: 16px; }
.empty h2 { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.empty p { font-size: 14px; }

/* ── Footer ── */
.site-footer {
  background: var(--slate-900);
  border-top: 1px solid var(--slate-800);
  padding: 32px 24px;
  text-align: center;
  color: var(--slate-500);
  font-size: 13px;
  margin-top: 80px;
}
.site-footer a { color: var(--slate-400); }

/* ── Utility ── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--slate-100) 25%, var(--slate-50) 50%, var(--slate-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 40px 16px 36px; }
  .hero-stats { gap: 24px; }
  .interp-grid { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .header-search { max-width: none; }
}
