/* ── TOKENS ── */
:root {
  --bg: #f6f7fb;
  --paper: #ffffff;
  --ink: #111827;
  --muted: #4b5563;
  --line: #e5e7eb;
  --accent: #0f766e;
  --accent-dark: #134e4a;
  --p0-color: #7B2D8B;
  --adult-color: #2E8B57;
  --injured-color: #C0392B;
  --shadow-sm: 0 1px 4px rgba(17,24,39,0.07);
  --shadow: 0 10px 25px rgba(17,24,39,0.08);
  --shadow-lg: 0 20px 50px rgba(17,24,39,0.12);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

/* ════════════════════════════════════════
   TOPNAV
════════════════════════════════════════ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(19,78,74,0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topnav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

/* Lab link on the left */
.nav-lab-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  color: rgba(255,255,255,0.9);
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity 0.15s;
}
.nav-lab-link:hover { opacity: 0.75; }

.nav-lab-icon {
  font-size: 1.1rem;
  color: #6ee7b7;
  line-height: 1;
}

.nav-lab-name { letter-spacing: 0.01em; }

/* Tabs on the right */
.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.nav-tab {
  display: inline-block;
  text-decoration: none;
  color: rgba(255,255,255,0.7);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.3rem 0.85rem;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.nav-tab:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.nav-tab.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-color: rgba(255,255,255,0.25);
}

/* ════════════════════════════════════════
   BREADCRUMB
════════════════════════════════════════ */
.breadcrumb-bar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.breadcrumb-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.breadcrumb-inner a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.breadcrumb-inner a:hover { text-decoration: underline; }

.bc-sep { color: #9ca3af; font-size: 0.85rem; }

.bc-current {
  color: var(--ink);
  font-weight: 500;
}

/* ════════════════════════════════════════
   HERO (index.html)
════════════════════════════════════════ */
.hero {
  position: relative;
  background: linear-gradient(125deg, #0f766e 0%, #134e4a 50%, #111827 100%);
  color: #fff;
  padding: 5rem 1.25rem 4rem;
  overflow: hidden;
}

.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  opacity: 0.65;
  text-transform: uppercase;
}

.hero-title {
  margin: 0 0 1.5rem;
  font-family: "Lora", serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 600;
  line-height: 1.28;
}

.hero-title em { font-style: italic; color: #6ee7b7; }

.authors {
  margin: 0 0 0.4rem;
  font-size: 0.97rem;
  opacity: 0.9;
  line-height: 1.7;
}

.authors sup { font-size: 0.7em; opacity: 0.8; }

.affiliations {
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
  opacity: 0.62;
  line-height: 1.5;
}

.email-link { color: #6ee7b7; text-decoration: none; }
.email-link:hover { text-decoration: underline; }

.hero-actions {
  display: flex;
  gap: 0.75rem;
  margin: 1.75rem 0 1.5rem;
  flex-wrap: wrap;
}

.hero-btn {
  display: inline-block;
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  padding: 0.65rem 1.4rem;
  border-radius: 10px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.hero-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }

.hero-btn-primary  { background: #fff; color: var(--accent-dark); }
.hero-btn-secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
}

.pill-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }

.pill {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.82);
  font-size: 0.75rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.02em;
}

/* ════════════════════════════════════════
   PAGE HEADER (data.html)
════════════════════════════════════════ */
.page-header {
  background: linear-gradient(110deg, #0f766e 0%, #134e4a 100%);
  color: #fff;
  padding: 2.5rem 1.25rem;
}

.page-header-inner { max-width: 1100px; margin: 0 auto; }

.page-header-title {
  margin: 0 0 0.5rem;
  font-family: "Lora", serif;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 600;
}

.page-header-sub {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.85;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.sample-tag {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.3);
}

.p0-tag      { background: rgba(123,45,139,0.4); }
.adult-tag   { background: rgba(46,139,87,0.4); }
.injured-tag { background: rgba(192,57,43,0.4); }

/* ════════════════════════════════════════
   SECTIONS (index.html)
════════════════════════════════════════ */
.section-wrap { padding: 4rem 1.25rem; }

.alt-bg {
  background:
    radial-gradient(circle at 5% 50%, #dff4f2 0, transparent 40%),
    radial-gradient(circle at 95% 50%, #ffe4e6 0, transparent 35%),
    var(--bg);
}

.section-inner { max-width: 1100px; margin: 0 auto; }

.section-title {
  margin: 0 0 0.4rem;
  font-family: "Lora", serif;
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  font-weight: 600;
}

.section-subtitle { margin: 0 0 2rem; color: var(--muted); font-size: 1rem; }

/* Abstract two-col */
.two-col {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.col-label { padding-top: 0.15rem; }

.section-tag {
  display: inline-block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
}

.abstract-text {
  margin: 0;
  font-family: "Lora", serif;
  font-size: 1.05rem;
  line-height: 1.88;
  color: #1f2937;
}

.abstract-text strong { color: var(--ink); font-weight: 600; }

/* ── KEY FINDINGS ── */
.findings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.finding-card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem;
  border-top: 5px solid transparent;
  transition: transform 0.2s, box-shadow 0.2s;
}

.finding-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.finding-card-1 { border-top-color: var(--p0-color); }
.finding-card-2 { border-top-color: var(--adult-color); }
.finding-card-3 { border-top-color: var(--injured-color); }

.finding-number {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.finding-card h3 { margin: 0 0 0.7rem; font-size: 1.02rem; font-weight: 600; line-height: 1.35; }
.finding-card p  { margin: 0 0 1rem; font-size: 0.91rem; color: #374151; line-height: 1.65; }

.finding-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.finding-tags span {
  font-size: 0.74rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0.15rem 0.52rem;
  color: var(--muted);
}

/* ── STUDY DESIGN / TIMELINE ── */
.design-timeline {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 0;
}

.timeline-connector {
  flex: 1;
  min-width: 40px;
  position: relative;
  height: 2px;
  background: linear-gradient(90deg, var(--p0-color), var(--adult-color));
}

/* Arrowhead at the right end of each connector */
.timeline-connector::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  border-left: 10px solid var(--adult-color);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.timeline-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 0 0 auto;
  width: 220px;
}

.tl-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.tl-label {
  margin: 0 0 0.15rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tl-title { margin: 0 0 0.4rem; font-weight: 600; font-size: 0.95rem; }
.tl-desc  { margin: 0; font-size: 0.82rem; color: var(--muted); line-height: 1.55; }

.methods-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.method-badge {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.28rem 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

/* Data CTA */
.data-cta {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.data-cta p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.data-cta-btn {
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1.1rem;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s, transform 0.15s;
}

.data-cta-btn:hover { background: var(--accent-dark); transform: translateX(2px); }

/* ── CITATION ── */
.citation-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.citation-text {
  margin: 0;
  flex: 1;
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--muted);
}

.citation-text em { color: var(--ink); font-style: italic; }

.copy-btn {
  flex-shrink: 0;
  font-size: 0.82rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.copy-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.contact-row { font-size: 0.9rem; color: var(--muted); line-height: 1.8; }
.contact-row a { color: var(--accent); text-decoration: none; }
.contact-row a:hover { text-decoration: underline; }
.affil-full { margin: 0.25rem 0 0; font-size: 0.85rem; }

/* ════════════════════════════════════════
   DATA PAGE SECTIONS
════════════════════════════════════════ */
.data-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  display: grid;
  gap: 1.5rem;
}

.data-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
}

.data-section-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
}

/* Summary cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.card h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }

.stat {
  font-size: 1.75rem;
  margin: 0.15rem 0;
  font-weight: 700;
  line-height: 1.2;
}

.meta { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.85rem; }

/* Download */
.download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.dl-group { display: flex; flex-direction: column; gap: 0.45rem; }

.dl-sample {
  margin: 0;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dl-p0      { color: var(--p0-color); }
.dl-adult   { color: var(--adult-color); }
.dl-injured { color: var(--injured-color); }

.dl-links { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.dl-btn {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.28rem 0.6rem;
  border-radius: 8px;
  font-size: 0.8rem;
  transition: background 0.15s, color 0.15s;
}

.dl-btn:hover { background: var(--accent); color: #fff; }

/* Browser */
.browser-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.controls input[type="text"] {
  flex: 1;
  min-width: 220px;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
}

.controls input[type="text"]:focus { outline: none; border-color: var(--accent); }

input, button, select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  font-family: inherit;
}

button {
  border-color: var(--accent);
  color: var(--accent);
  background: #fff;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-size: 0.88rem;
}

button:hover { background: var(--accent); color: #fff; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-item { display: flex; align-items: center; gap: 0.35rem; }

.swatch {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 3px;
  flex-shrink: 0;
}

.swatch-split { background: linear-gradient(90deg, var(--c1) 50%, var(--c2) 50%); }

#igvContainer {
  width: 100%;
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.hint { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.88rem; }

/* ════════════════════════════════════════
   FOOTER
════════════════════════════════════════ */
.site-footer {
  background: #111827;
  color: rgba(255,255,255,0.55);
  padding: 2rem 1.25rem;
}

.footer-inner { max-width: 1200px; margin: 0 auto; }

.footer-top {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  min-width: 160px;
}

.footer-col-right { text-align: right; }

.footer-label {
  margin: 0 0 0.1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.footer-link:hover { color: #6ee7b7; }

.footer-paper {
  margin: 0;
  font-weight: 600;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.8);
}

.footer-muted {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
  line-height: 1.6;
}

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 768px) {
  .hero { padding: 3rem 1rem 2.5rem; }
  .section-wrap { padding: 2.5rem 1rem; }
  .two-col { grid-template-columns: 1fr; gap: 1rem; }
  .col-label { padding-top: 0; }

  .topnav-inner { gap: 0.5rem; }
  .nav-lab-name { display: none; }
  .nav-tab { font-size: 0.8rem; padding: 0.25rem 0.55rem; }

  .design-timeline { flex-direction: column; gap: 0.75rem; }
  .timeline-connector { display: none; }
  .timeline-item { width: 100%; }
  .tl-card { text-align: left; }

  .footer-col-right { text-align: left; }
  .footer-top { gap: 1.5rem; }

  .data-main { padding: 1rem 0.75rem 2rem; }
}

/* ── IGV compat ── */
#higlassMount { width: 100%; min-height: 560px; background: #f8fafc; }
#juiceboxFrame { width: 100%; min-height: 560px; border: 0; background: #f8fafc; }
.iframe-wrap { margin-top: 0.6rem; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table-wrap { margin-top: 0.8rem; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.88rem; }
th, td { border: 1px solid var(--line); padding: 0.4rem; text-align: left; }
th { background: #f3f4f6; }
