/* ═══════════════════════════════════════════════════════════════════
   CP Genome — genome.icpgc.org
   Production stylesheet. Ported from the CP Genome mockup (navy /
   blue / teal / amber data-resource palette) with the header brought
   into line with icpgc.org's teal.

   Sections:
     1. Tokens            5. Gene detail
     2. Base + header     6. About modal
     3. Intro banner      7. Utilities / responsive
     4. Catalogue table
   ═══════════════════════════════════════════════════════════════════ */

/* ───────────── 1. Tokens ───────────── */
:root {
  /* ICPGC brand (header + accents that must match icpgc.org) */
  --icpgc-teal-dark:   #235857;
  --icpgc-teal:        #3B8A7F;
  --icpgc-teal-light:  #8CBDB3;
  --icpgc-cream:       #F7F5F0;

  /* Data-resource palette (from the mockup) */
  --navy:    #0d1b2a;
  --blue:    #1a5276;
  --teal:    #0e6655;
  --accent:  #1abc9c;
  --amber:   #e67e22;
  --red:     #c0392b;
  --bg:      #f8fafc;
  --surface: #ffffff;
  --border:  #e2e8f0;
  --text:    #1a202c;
  --muted:   #718096;

  --font-serif: 'Libre Baskerville', Georgia, serif;
  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

  /* CP Description/Phenotype Score tiers */
  --tier1-bg: #1a5c35; --tier1-badge: #d4edda; --tier1-text: #1a5c35;
  --tier2-bg: #27ae60; --tier2-badge: #e8f8ee; --tier2-text: #1a6e3a;
  --tier3-bg: #e67e22; --tier3-badge: #fef3e2; --tier3-text: #a04a00;

  /* PanelApp Australia ratings */
  --pa-green: #1a5c35; --pa-green-bg: #e8f5e9;
  --pa-amber: #7d5a00; --pa-amber-bg: #fff6d6;
  --pa-red:   #8b0000; --pa-red-bg:   #fde8e8;

  /* ClinGen gene–disease validity — ClinGen's own convention */
  --cg-definitive: #0b6b2f; --cg-definitive-bg: #d9f2e1;
  --cg-strong:     #2e8b57; --cg-strong-bg:     #e3f4ea;
  --cg-moderate:   #7a8c00; --cg-moderate-bg:   #f1f5d6;
  --cg-limited:    #a36b00; --cg-limited-bg:    #fff1cf;
  --cg-disputed:   #b4530c; --cg-disputed-bg:   #fde5d3;
  --cg-refuted:    #9b1c1c; --cg-refuted-bg:    #fbe0e0;
  --cg-none:       #4b5563; --cg-none-bg:       #eceff3;
}

/* ───────────── 2. Base + header ───────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
button { font-family: inherit; }
:focus-visible { outline: 3px solid rgba(26,188,156,0.55); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.site-header {
  background: var(--icpgc-teal-dark);
  color: #fff;
  height: 60px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.site-header-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 2rem;
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand {
  display: flex; align-items: center; gap: 0.7rem;
  color: #fff; text-decoration: none;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.01em; }
.brand-sub  { font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.75; }

.site-nav { display: flex; align-items: center; gap: 0.25rem; }
.site-nav a, .site-nav button {
  color: rgba(255,255,255,0.82); text-decoration: none;
  font-size: 0.85rem; font-weight: 500;
  padding: 0.45rem 0.85rem; border-radius: 6px;
  background: none; border: 0; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.site-nav a:hover, .site-nav button:hover,
.site-nav a.active, .site-nav button.active { color: #fff; background: rgba(255,255,255,0.12); }
.site-nav .ext::after { content: " ↗"; font-size: 0.75em; opacity: 0.8; }

main { max-width: 1280px; margin: 0 auto; padding: 2rem; }

/* ───────────── 3. Intro banner ───────────── */
.intro-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  color: #fff;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex; justify-content: space-between; align-items: center;
  gap: 2rem; flex-wrap: wrap;
}
.intro-banner h1 { font-family: var(--font-serif); font-size: 1.75rem; margin-bottom: 0.4rem; }
.intro-banner p  { opacity: 0.85; font-size: 0.92rem; max-width: 560px; }
.intro-actions { margin-top: 0.9rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn-ghost {
  padding: 0.45rem 1rem;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff; border-radius: 6px;
  font-size: 0.82rem; font-weight: 500; cursor: pointer;
  transition: background 0.2s;
}
.btn-ghost:hover { background: rgba(255,255,255,0.25); }

.intro-stats { display: flex; gap: 1rem; flex-shrink: 0; flex-wrap: wrap; }
.intro-stat {
  text-align: center;
  background: rgba(255,255,255,0.1);
  border-radius: 8px; padding: 0.8rem 1.1rem; min-width: 96px;
}
.intro-stat .num { font-family: var(--font-serif); font-size: 1.7rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.intro-stat .lbl { font-size: 0.72rem; opacity: 0.75; margin-top: 0.2rem; }

/* ───────────── 4. Catalogue table ───────────── */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.1rem; color: var(--navy);
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); margin-left: 0.5rem; }

.toolbar {
  display: flex; gap: 0.75rem; margin-bottom: 1rem;
  align-items: center; flex-wrap: wrap;
}
.search-input {
  flex: 1 1 240px; min-width: 200px;
  padding: 0.6rem 1rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; font-family: var(--font-sans);
  outline: none; background: var(--surface);
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--blue); }
.filter-select {
  padding: 0.6rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.84rem; font-family: var(--font-sans);
  background: var(--surface); cursor: pointer; outline: none;
  color: var(--text);
}
.filter-select:focus { border-color: var(--blue); }
.filter-check {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.84rem; color: var(--text);
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer; user-select: none;
}
.filter-check input { accent-color: var(--blue); }
.btn-clear {
  padding: 0.55rem 0.9rem; font-size: 0.82rem; font-weight: 500;
  background: none; border: 1.5px solid transparent; color: var(--muted);
  border-radius: 8px; cursor: pointer;
}
.btn-clear:hover { color: var(--text); border-color: var(--border); }

/* Gene ↔ Locus view toggle */
.view-toggle {
  display: inline-flex; border: 1.5px solid var(--border);
  border-radius: 8px; overflow: hidden; background: var(--surface);
}
.view-toggle button {
  padding: 0.55rem 0.95rem; font-size: 0.82rem; font-weight: 600;
  background: none; border: 0; color: var(--muted); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-toggle button + button { border-left: 1.5px solid var(--border); }
.view-toggle button[aria-pressed="true"] { background: var(--navy); color: #fff; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; margin-bottom: 2rem;
}
.table-scroll { overflow-x: auto; }
table.gene-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 900px; }
table.gene-table thead th {
  background: var(--navy); color: #fff;
  padding: 0.75rem 0.9rem; text-align: left;
  font-weight: 600; font-size: 0.78rem; letter-spacing: 0.04em;
  white-space: nowrap; user-select: none;
}
table.gene-table thead th.sortable { cursor: pointer; }
table.gene-table thead th.sortable:hover { background: #1a2c45; }
table.gene-table thead th .sort-ind { opacity: 0.45; margin-left: 0.3rem; font-size: 0.75em; }
table.gene-table thead th[aria-sort="ascending"] .sort-ind,
table.gene-table thead th[aria-sort="descending"] .sort-ind { opacity: 1; }
table.gene-table thead th.num { text-align: right; }
table.gene-table tbody tr { border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.12s; }
table.gene-table tbody tr:hover, table.gene-table tbody tr:focus-within { background: #f0f7ff; }
table.gene-table td { padding: 0.65rem 0.9rem; vertical-align: middle; }
table.gene-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.gene-table th.col-ind, table.gene-table td.col-ind { width: 230px; }
tr.chr-group-row td {
  background: #eef2f7; color: var(--navy);
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.4rem 0.9rem; cursor: default;
}
tr.chr-group-row:hover td { background: #eef2f7; }
.gene-sym { font-weight: 700; color: var(--blue); font-size: 0.92rem; }
.gene-sym a { color: inherit; text-decoration: none; }
.gene-sym a:hover { text-decoration: underline; }
.gene-fullname { display: block; font-size: 0.74rem; color: var(--muted); font-weight: 400; margin-top: 1px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-cell { font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }

/* Fixed three-column grid so bars and numbers line up on every row;
   the Not CP flag has its own column and reads as a separate marker. */
.ind-cell { display: grid; grid-template-columns: 56px 3ch 92px; align-items: center; column-gap: 0.55rem; justify-content: end; }
.ind-bar { width: 56px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.ind-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.ind-num { text-align: right; font-variant-numeric: tabular-nums; }
.ind-zero { color: var(--muted); }
.ind-lit { color: #64748b; font-style: italic; cursor: help; }
.ind-bar.lit > span { background: #b7c6d6; }
.ind-flag { justify-self: start; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.18rem 0.65rem; border-radius: 99px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
}
.badge-t1 { background: var(--tier1-badge); color: var(--tier1-text); }
.badge-t2 { background: var(--tier2-badge); color: var(--tier2-text); }
.badge-t3 { background: var(--tier3-badge); color: var(--tier3-text); }
.badge-tna { background: #eef0f3; color: #4b5563; font-weight: 600; }
.tier-block .tier-num.tna { color: #6b7280; font-size: 2rem; padding: 0.5rem 0; }
.tier-row.tna { background: #f6f7f9; border-color: #9ca3af; } .tna .tb { color: #6b7280; }

/* Inheritance pills */
.inh { display: inline-flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
.inh-pill { font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 99px; white-space: nowrap; letter-spacing: 0.02em; cursor: help; }
.inh-pill.ad { background: #ede9fe; color: #5b21b6; }
.inh-pill.ar { background: #fef3c7; color: #92400e; }
.inh-pill.xl { background: #fce7f3; color: #9d174d; }
.inh-pill.dn { background: #e0f2fe; color: #075985; border: 1px dashed #7dd3fc; }
.found-flag { display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; font-size: 0.72rem; font-weight: 700; color: #92400e; background: #fef3c7; border-radius: 99px; padding: 2px 8px; }
.found-flag svg { width: 12px; height: 12px; }
.btn-csv {
  padding: 0.5rem 0.9rem; font-size: 0.82rem; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--border); color: var(--blue);
  border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem;
}
.btn-csv:hover { border-color: var(--blue); background: #f0f7ff; }

.pa-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 2px 9px; border-radius: 4px;
  font-size: 0.74rem; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.pa-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pa-badge.green { background: var(--pa-green-bg); color: var(--pa-green); }
.pa-badge.amber { background: var(--pa-amber-bg); color: var(--pa-amber); }
.pa-badge.red   { background: var(--pa-red-bg);   color: var(--pa-red); }
.pa-badge:hover { filter: brightness(0.95); text-decoration: underline; }

.cg-chip {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 0.74rem; font-weight: 700; white-space: nowrap; text-decoration: none;
}
.cg-chip.definitive { background: var(--cg-definitive-bg); color: var(--cg-definitive); }
.cg-chip.strong     { background: var(--cg-strong-bg);     color: var(--cg-strong); }
.cg-chip.moderate   { background: var(--cg-moderate-bg);   color: var(--cg-moderate); }
.cg-chip.limited    { background: var(--cg-limited-bg);    color: var(--cg-limited); }
.cg-chip.disputed   { background: var(--cg-disputed-bg);   color: var(--cg-disputed); }
.cg-chip.refuted    { background: var(--cg-refuted-bg);    color: var(--cg-refuted); }
.cg-chip.none       { background: var(--cg-none-bg);       color: var(--cg-none); }
.cg-chip.other-count { background: #fff; color: var(--muted); border: 1px solid var(--border); font-weight: 600; margin-left: 0.3rem; }
.cell-none { color: var(--muted); font-size: 0.8rem; }

.notcp-flag {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.03em;
  background: #fff; color: #8b0000; border: 1px solid #e5b4b4;
  border-radius: 4px; padding: 1px 6px;
  cursor: help; white-space: nowrap;
}
.notcp-flag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #c0392b; }

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1rem; border-top: 1px solid var(--border);
  font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; gap: 0.6rem;
}
.page-btns { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.page-btn {
  padding: 0.3rem 0.65rem; border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface); cursor: pointer; font-size: 0.82rem; color: var(--text);
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled), .page-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-size { display: inline-flex; align-items: center; gap: 0.4rem; }
.page-size select { padding: 0.25rem 0.4rem; border: 1px solid var(--border); border-radius: 5px; font-size: 0.8rem; background: var(--surface); }

.empty-state { padding: 3rem 1rem; text-align: center; color: var(--muted); font-size: 0.9rem; }

/* ───────────── 5. Gene detail ───────────── */
#gene-detail {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; margin-bottom: 2rem;
  scroll-margin-top: 76px;
}
#gene-detail.open { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.detail-header {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff; padding: 1.4rem 2rem;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
}
.detail-header h2 { font-family: var(--font-serif); font-size: 2rem; margin-bottom: 0.2rem; line-height: 1.1; }
.detail-header .detail-fullname { font-size: 0.95rem; opacity: 0.9; }
.detail-header .detail-meta { font-size: 0.78rem; opacity: 0.7; margin-top: 0.35rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.detail-header .detail-meta span b { font-weight: 600; opacity: 0.9; }
.detail-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.btn-hdr {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 0.4rem 0.85rem; border-radius: 6px;
  cursor: pointer; font-size: 0.8rem; transition: background 0.2s; text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.btn-hdr:hover { background: rgba(255,255,255,0.26); }

.detail-body { display: grid; grid-template-columns: 300px 1fr; }
.detail-sidebar { border-right: 1px solid var(--border); padding: 1.4rem; background: #f9fafb; }
.detail-main { padding: 1.4rem 2rem 2rem; min-width: 0; }

.tier-block {
  text-align: center; padding: 1.1rem 1rem 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 0.9rem; position: relative;
}
.tier-block .tier-num { font-family: var(--font-serif); font-size: 3.2rem; font-weight: 700; line-height: 1; }
.tier-block .tier-num.t1 { color: var(--tier1-bg); }
.tier-block .tier-num.t2 { color: var(--tier2-bg); }
.tier-block .tier-num.t3 { color: var(--tier3-bg); }
.tier-block .tier-lbl { font-size: 0.68rem; color: var(--muted); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-top: 0.35rem; }
.tier-block .tier-desc { font-size: 0.76rem; color: #4b5563; margin-top: 0.35rem; line-height: 1.45; }
.help-dot {
  position: absolute; top: 0.5rem; right: 0.5rem;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(26,82,118,0.08); color: var(--blue);
  border: 1px solid rgba(26,82,118,0.25);
  font-size: 0.7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.help-dot:hover { background: var(--blue); color: #fff; }

.side-section { margin-bottom: 1.1rem; }
.side-section h4 {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: #334155; margin-bottom: 0.45rem;
  display: flex; align-items: center; justify-content: space-between;
}
.side-section h4 a { font-size: 0.68rem; font-weight: 600; text-transform: none; letter-spacing: 0; }

.ev-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.7rem 0.8rem; margin-bottom: 0.5rem;
}
.ev-tile-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.ev-tile .ev-lbl { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ev-tile .ev-sub { font-size: 0.72rem; color: var(--muted); margin-top: 0.3rem; }
.ev-tile .ev-none { font-size: 0.78rem; color: var(--muted); font-style: italic; }
.ev-tile.pa.green { border-color: #a7d4b4; background: linear-gradient(180deg,#f0faf4,#fff 70%); }
.ev-tile.pa.amber { border-color: #fcd34d; background: linear-gradient(180deg,#fffbeb,#fff 70%); }
.ev-tile.pa.red   { border-color: #fca5a5; background: linear-gradient(180deg,#fef2f2,#fff 70%); }

/* ClinGen button stacks — coloured (CP GCEP) and outlined (other GCEPs) */
.cg-btns { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.3rem; }
.cg-btn {
  display: flex; flex-direction: column; gap: 1px;
  padding: 0.45rem 0.7rem; border-radius: 7px;
  text-decoration: none; font-size: 0.8rem; font-weight: 700;
  border: 1.5px solid transparent;
  transition: transform 0.1s, filter 0.15s;
}
.cg-btn:hover { transform: translateY(-1px); filter: brightness(0.97); }
.cg-btn small { font-weight: 500; font-size: 0.7rem; opacity: 0.85; }
.cg-btn.cp.definitive { background: var(--cg-definitive); color: #fff; }
.cg-btn.cp.strong     { background: var(--cg-strong);     color: #fff; }
.cg-btn.cp.moderate   { background: var(--cg-moderate);   color: #fff; }
.cg-btn.cp.limited    { background: var(--cg-limited);    color: #fff; }
.cg-btn.cp.disputed   { background: var(--cg-disputed);   color: #fff; }
.cg-btn.cp.refuted    { background: var(--cg-refuted);    color: #fff; }
.cg-btn.cp.none       { background: var(--cg-none);       color: #fff; }
.cg-btn.other { background: #fff; color: #111; border-color: #111; font-weight: 600; }
.cg-btn.other .cg-cls { font-weight: 700; }
.cg-btn.other:hover { background: #f7f7f7; }
.cg-btn.plain { background: #fff; color: var(--blue); border-color: var(--border); font-weight: 600; text-align: center; }
.cg-divider { font-size: 0.66rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 0.45rem 0 0.1rem; }

.count-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }
.count-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.55rem 0.6rem; text-align: center; }
.count-tile .cnum { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.count-tile .clbl { font-size: 0.64rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.15rem; }
.count-tile.wide { grid-column: 1 / -1; }
.count-tile .notcp-flag { margin-top: 0.3rem; }

.link-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem 0.6rem; }
.link-list a {
  display: inline-flex; align-items: center; gap: 0.3rem;
  color: var(--blue); text-decoration: none; font-size: 0.82rem; padding: 0.2rem 0;
}
.link-list a::after { content: '↗'; font-size: 0.7em; opacity: 0.6; }
.link-list a:hover { color: var(--teal); text-decoration: underline; }

.foundation {
  display: block;
  background: #fef9ec; border: 1px solid #fde68a; border-radius: 8px;
  padding: 0.55rem 0.7rem; text-decoration: none; color: var(--text);
  font-size: 0.8rem; margin-bottom: 0.4rem; transition: background 0.2s;
}
.foundation:hover { background: #fef3c7; }
.foundation .f-name { font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.foundation .f-name::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); flex-shrink: 0; }
.foundation .f-meta { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; }
.foundation .f-desc { font-size: 0.74rem; color: #4b5563; margin-top: 0.25rem; line-height: 1.45; }

.tab-bar { display: flex; flex-wrap: nowrap; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.4rem; overflow-x: auto; scrollbar-width: thin; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
  min-height: 50px;
  padding: 0.55rem 0.68rem 0.5rem; font-size: 0.84rem; font-weight: 500; color: var(--muted);
  cursor: pointer; border: 0; background: none; line-height: 1.25;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  white-space: nowrap; transition: all 0.15s; flex-shrink: 0;
}
.tab[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.tab:hover:not([aria-selected="true"]):not(:disabled) { color: var(--text); }
.tab:disabled { cursor: not-allowed; opacity: 0.55; }
.tab .tab-count { font-size: 0.74em; opacity: 0.8; margin-left: 0.2rem; }
.tab .tab-count:empty { display: none; }
.tab .cs-label {
  display: block; font-size: 0.56rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: #fef3c7; color: #92400e; border-radius: 99px; padding: 1px 6px; margin: 0;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.summary-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.05rem 1.2rem 1.15rem; margin-bottom: 1rem;
}
.summary-card-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--border); }
.summary-card-title { font-family: var(--font-serif); font-size: 1rem; font-weight: 700; color: var(--navy); }
.summary-tag { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 99px; }
.summary-tag.lay { background: #ede9fe; color: #5b21b6; }
.summary-tag.sci { background: #dbeafe; color: #1e40af; }
.summary-body { font-size: 0.875rem; line-height: 1.7; color: #374151; }
.summary-body.lay { font-size: 0.92rem; }

/* Summary tab blocks (moved out of the sidebar) */
.sum-block { margin-top: 1.4rem; }
.sum-block h4 { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #334155; margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.5rem; }
.sum-block h4::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.count-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; }
.count-strip .count-tile { text-align: center; padding: 0.7rem 0.85rem; }
.count-strip .count-tile .inh { justify-content: center; }
.count-strip .notcp-flag { margin: 0 auto; }
.count-strip .count-tile .cnum { font-size: 1.6rem; }
.count-strip .count-tile .clbl { margin-top: 0.1rem; }
.link-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.link-chips a {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.35rem 0.75rem; border: 1px solid var(--border); border-radius: 99px;
  background: var(--surface); color: var(--blue); text-decoration: none; font-size: 0.8rem; font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.link-chips a::after { content: '↗'; font-size: 0.7em; opacity: 0.6; }
.link-chips a:hover { border-color: var(--blue); background: #f0f7ff; }
.found-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.6rem; }
.found-grid .foundation { margin-bottom: 0; }
@media (max-width: 640px) { .count-strip { grid-template-columns: 1fr 1fr; } }

.mini-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.mini-table th {
  background: #f1f5f9; padding: 0.5rem 0.75rem; text-align: left;
  font-weight: 600; font-size: 0.76rem; color: var(--muted); letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.mini-table td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table tbody tr:hover td { background: #f8faff; }
.mini-table td.num, .mini-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-table td.ctr, .mini-table th.ctr { text-align: center; font-variant-numeric: tabular-nums; }
.mini-table code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; background: #f3f4f6; padding: 1px 5px; border-radius: 4px; }
.mini-table .nr { color: var(--muted); font-style: italic; }
.mini-table-scroll { overflow-x: auto; }
tr.grp-a td { background: #fbfcfe; }
.grp-tag { display: inline-block; font-size: 0.66rem; font-weight: 700; color: #3730a3; background: #eef2ff; border-radius: 4px; padding: 1px 5px; margin-left: 0.3rem; }
.notcp-row td:first-child { box-shadow: inset 3px 0 0 #c0392b; }

.quality { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 0.72rem; font-weight: 700; }
.quality.high     { background: #d4edda; color: #1a5c35; }
.quality.moderate { background: #fff6d6; color: #7d5a00; }
.quality.low      { background: #fde8e8; color: #8b0000; }

.note {
  background: #f8fafc; border: 1px solid var(--border); border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0; padding: 0.7rem 0.9rem;
  font-size: 0.8rem; color: #374151; line-height: 1.55; margin-bottom: 1rem;
}
.note.amber { border-left-color: #f59e0b; background: #fffbeb; }
.tab-footnote { margin-top: 1rem; font-size: 0.75rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 0.7rem; line-height: 1.55; }

.coming-soon {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 10px; background: #fafafa;
}
.coming-soon h3 { font-family: var(--font-serif); color: var(--navy); font-size: 1.05rem; margin-bottom: 0.4rem; }
.coming-soon p { font-size: 0.86rem; max-width: 520px; margin: 0 auto; line-height: 1.6; }

/* Clinical trials */
.trial-card { border: 1px solid var(--border); border-radius: 10px; padding: 0.95rem 1.05rem; margin-bottom: 0.7rem; background: #fff; transition: box-shadow 0.15s; }
.trial-card:hover { box-shadow: 0 2px 12px rgba(27,94,139,0.10); }
.trial-title { font-weight: 600; font-size: 0.88rem; color: var(--navy); margin-bottom: 0.35rem; line-height: 1.4; }
.trial-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.45rem; }
.trial-badge { font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.trial-badge.recruiting { background: #e8f5e9; color: #1a5c35; }
.trial-badge.active     { background: #e3f2fd; color: #1565c0; }
.trial-badge.completed  { background: #f3f4f6; color: #555; }
.trial-badge.other      { background: #fef9e7; color: #7d5a00; }
.trial-badge.phase      { background: #f0f4ff; color: #3730a3; }
.trial-sub { font-size: 0.76rem; color: var(--muted); }
.trial-sub a { color: var(--teal); }
.trials-count { font-size: 0.8rem; color: var(--muted); margin-bottom: 0.9rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.trials-state { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.88rem; }

/* ───────────── 6. About modal ───────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(10,20,30,0.6); z-index: 1000;
  backdrop-filter: blur(3px);
  align-items: center; justify-content: center; padding: 1.5rem;
}
.overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px; max-width: 780px; width: 100%; max-height: 88vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-header {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff; padding: 1.3rem 1.8rem; border-radius: 14px 14px 0 0;
  display: flex; justify-content: space-between; align-items: flex-start;
}
.modal-header h2 { font-family: var(--font-serif); font-size: 1.2rem; margin-bottom: 0.15rem; }
.modal-header p { font-size: 0.8rem; opacity: 0.75; }
.modal-close {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: 1rem;
}
.modal-close:hover { background: rgba(255,255,255,0.3); }
.modal-tabs { display: flex; border-bottom: 2px solid var(--border); padding: 0 1.8rem; flex-wrap: wrap; background: #fff; position: sticky; top: 0; z-index: 2; }
.modal-tabs button {
  padding: 0.7rem 1.1rem; font-size: 0.85rem; font-weight: 500; cursor: pointer;
  border: 0; background: none; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.modal-tabs button[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.modal-body { padding: 1.5rem 1.8rem 1.8rem; }
.modal-panel { display: none; }
.modal-panel.active { display: block; }
.modal-body h3 { font-family: var(--font-serif); font-size: 1rem; color: var(--navy); margin: 1.3rem 0 0.5rem; }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p, .modal-body li { font-size: 0.88rem; color: #374151; line-height: 1.7; }
.modal-body p { margin-bottom: 0.6rem; }
.modal-body ul { padding-left: 1.2rem; margin-bottom: 0.6rem; }
.modal-body blockquote { border-left: 3px solid var(--border); padding: 0.3rem 0.9rem; color: #4b5563; font-size: 0.86rem; margin: 0.6rem 0; }

.fig-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin: 0.6rem 0 1rem; }
@media (max-width: 640px) { .fig-grid { grid-template-columns: repeat(2, 1fr); } }
.fig { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.7rem; }
.fig .fnum { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.fig .flbl { font-size: 0.7rem; color: var(--muted); margin-top: 0.15rem; line-height: 1.3; }

.tier-row { display: flex; gap: 1rem; align-items: flex-start; padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 0.5rem; border-left: 4px solid transparent; }
.tier-row.t1 { background: #f0faf4; border-color: var(--tier1-bg); }
.tier-row.t2 { background: #f4fdf6; border-color: var(--tier2-bg); }
.tier-row.t3 { background: #fff8f0; border-color: var(--tier3-bg); }
.tier-row .tb { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; line-height: 1; flex-shrink: 0; width: 2.2rem; text-align: center; }
.t1 .tb { color: var(--tier1-bg); } .t2 .tb { color: var(--tier2-bg); } .t3 .tb { color: var(--tier3-bg); }
.tier-row strong { display: block; font-size: 0.88rem; color: var(--text); margin-bottom: 0.15rem; }
.tier-row p { font-size: 0.83rem; color: var(--muted); margin: 0; line-height: 1.55; }

.card-row { display: flex; gap: 0.8rem; margin-top: 0.7rem; flex-wrap: wrap; }
.card { flex: 1; min-width: 170px; border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 0.9rem; }
.card h4 { font-size: 0.8rem; font-weight: 700; color: var(--navy); margin-bottom: 0.25rem; display: flex; align-items: center; gap: 0.4rem; }
.card h4 .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.card p { font-size: 0.78rem; color: var(--muted); margin: 0; line-height: 1.5; }

.def-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 1.1rem; }
.def-row { display: grid; grid-template-columns: 170px 1fr; border-bottom: 1px solid var(--border); }
.def-row:last-child { border-bottom: 0; }
.def-row > div:first-child { padding: 0.65rem 0.9rem; background: #f8fafc; font-weight: 700; font-size: 0.84rem; color: var(--navy); border-right: 1px solid var(--border); }
.def-row > div:first-child small { display: block; font-weight: 400; font-size: 0.72rem; color: var(--muted); }
.def-row > div:last-child { padding: 0.65rem 0.9rem; font-size: 0.84rem; line-height: 1.6; color: #374151; }
.eyebrow { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 1.1rem 0 0.5rem; }
.release-note { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--muted); line-height: 1.6; }
.release-note table { width: 100%; border-collapse: collapse; font-size: 0.76rem; margin-top: 0.4rem; }
.release-note td { padding: 0.25rem 0.4rem; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.release-note td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; width: 38%; }

/* Tooltip */
#tooltip {
  position: fixed; background: var(--navy); color: #fff;
  padding: 0.6rem 0.85rem; border-radius: 8px; font-size: 0.78rem; line-height: 1.5;
  pointer-events: none; opacity: 0; transition: opacity 0.15s; z-index: 1200;
  max-width: 300px; box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
#tooltip.show { opacity: 1; }
#tooltip strong { display: block; margin-bottom: 0.2rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 2rem; padding: 1.4rem 2rem 2rem;
  font-size: 0.78rem; color: var(--muted);
}
.site-footer-inner { max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.site-footer a { color: var(--teal); }

/* ───────────── 7. Responsive ───────────── */
@media (max-width: 900px) {
  .detail-body { grid-template-columns: 1fr; }
  .detail-sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .count-grid { grid-template-columns: repeat(4, 1fr); }
  .count-tile.wide { grid-column: span 2; }
}
@media (max-width: 640px) {
  main { padding: 1rem; }
  .site-header-inner { padding: 0 1rem; }
  .brand-sub { display: none; }
  .intro-banner { padding: 1.4rem; }
  .detail-header { padding: 1.1rem 1.2rem; flex-direction: column; }
  .detail-main { padding: 1.1rem 1.2rem 1.5rem; }
  .count-grid { grid-template-columns: 1fr 1fr; }
  .def-row { grid-template-columns: 1fr; }
  .def-row > div:first-child { border-right: 0; border-bottom: 1px solid var(--border); }
  .modal-tabs { padding: 0 1rem; }
  .modal-body { padding: 1.1rem 1.2rem 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
