/* ==========================================================================
   WET LAB & SEQUENCING SHARED DESIGN SYSTEM (wetlab-shared.css)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --font-primary: 'Poppins', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --bg-page: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  
  --text-dark: #0f172a;
  --text-muted: #475569;
  --text-light: #94a3b8;
  
  --border-light: rgba(226, 232, 240, 0.8);
  --border-active: rgba(14, 165, 233, 0.5);
  
  --accent-green: #0f766e;
  --accent-green-light: #16a34a;
  --accent-blue: #1d4ed8;
  --accent-blue-light: #0ea5e9;
  --accent-purple: #8b5cf6;
  --accent-indigo: #4f46e5;
  --accent-teal: #0d9488;
  --accent-amber: #d97706;
  --accent-red: #dc2626;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --glass-blur: blur(12px);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-primary);
  background-color: var(--bg-page);
  color: var(--text-dark);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Reading Progress Bar */
#reading-progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(226, 232, 240, 0.5);
  z-index: 1000;
}

#reading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-blue-light), var(--accent-green-light), var(--accent-purple));
  transition: width 0.1s linear;
}

/* Top Series Header & Nav Strip */
.series-nav-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 4px;
  z-index: 990;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent-blue);
}

.series-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.series-pill {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  background: #f1f5f9;
  color: var(--text-muted);
  transition: all 0.2s;
  border: 1px solid transparent;
}

.series-pill:hover, .series-pill.active {
  background: #e2e8f0;
  color: var(--text-dark);
}

.series-pill.plant { border-color: rgba(22, 163, 74, 0.4); color: var(--accent-green); }
.series-pill.blood { border-color: rgba(14, 165, 233, 0.4); color: var(--accent-blue); }
.series-pill.hair { border-color: rgba(139, 92, 246, 0.4); color: var(--accent-purple); }
.series-pill.sperm { border-color: rgba(79, 70, 229, 0.4); color: var(--accent-indigo); }
.series-pill.saliva { border-color: rgba(13, 148, 136, 0.4); color: var(--accent-teal); }
.series-pill.sequencing { border-color: rgba(37, 99, 235, 0.4); color: #2563eb; }

/* Page Layout */
.page-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 30px 20px 60px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 36px;
}

@media (max-width: 992px) {
  .page-container {
    grid-template-columns: 1fr;
  }
}

/* Sticky TOC Sidebar */
.toc-sidebar {
  position: sticky;
  top: 70px;
  align-self: start;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-md);
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.toc-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dark);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toc-link {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.toc-link:hover {
  background: rgba(241, 245, 249, 0.8);
  color: var(--text-dark);
}

.toc-link.active {
  background: #f0fdf4;
  color: var(--accent-green);
  border-left-color: var(--accent-green);
  font-weight: 600;
}

/* Main Article Content */
.main-article {
  min-width: 0;
}

/* Hero Section */
.hero-wrapper {
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(241, 245, 249, 0.8));
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.hero-header {
  margin-bottom: 20px;
}

.hero-subtitle {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-blue);
  margin-bottom: 8px;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.25;
  margin-bottom: 16px;
}

.hero-description {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 900px;
  margin-bottom: 24px;
}

.hero-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--text-dark);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.info-chip strong {
  color: var(--text-muted);
}

.hero-collage {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.hero-img-box {
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 140px;
  border: 1px solid var(--border-light);
  position: relative;
  background: #e2e8f0;
}

.hero-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
  cursor: pointer;
}

.hero-img-box:hover img {
  transform: scale(1.05);
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s, transform 0.2s;
}

.glass-card:hover {
  box-shadow: var(--shadow-lg);
}

.section-anchor {
  scroll-margin-top: 80px;
}

.section-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--text-dark);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Notice & Warning Banners */
.notice-banner {
  background: #eff6ff;
  border-left: 4px solid var(--accent-blue);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: #1e40af;
}

.warning-banner {
  background: #fffbe6;
  border-left: 4px solid var(--accent-amber);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: #92400e;
}

/* Icon Grids */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.icon-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.icon-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.icon-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.icon-card-icon {
  font-size: 1.5rem;
}

.icon-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-dark);
}

/* Step Accordion / Tabs */
.step-tabs-wrapper {
  margin-top: 20px;
}

.tab-buttons {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 8px 18px;
  background: none;
  border: none;
  font-family: var(--font-primary);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: var(--text-dark);
}

.tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.tab-content {
  display: none;
  background: #ffffff;
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.tab-content.active {
  display: block;
}

/* Scientific Tables */
.table-responsive {
  overflow-x: auto;
  margin: 20px 0;
}

.sci-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: #ffffff;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.sci-table th {
  background: #f1f5f9;
  color: var(--text-dark);
  font-weight: 600;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid #e2e8f0;
}

.sci-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-muted);
}

.sci-table tr:last-child td {
  border-bottom: none;
}

.sci-table tr:hover td {
  background: #f8fafc;
}

/* Animated Flow / Mini Diagram */
.flow-diagram {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #ffffff;
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin: 20px 0;
  flex-wrap: wrap;
}

.flow-step {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
  text-align: center;
  flex: 1;
  min-width: 110px;
}

.flow-arrow {
  color: var(--text-light);
  font-size: 1.2rem;
  font-weight: bold;
}

/* Image Placeholders & Callouts */
.img-placeholder-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.img-container {
  position: relative;
  width: 100%;
  max-height: 420px;
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.img-container img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  cursor: pointer;
}

.img-caption {
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
}

/* Callout markers on images */
.img-callout {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-red);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.8);
  cursor: pointer;
}

/* Interactive Comparison Slider */
.comparison-slider-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  height: 360px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  margin: 24px 0;
  user-select: none;
}

.comparison-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.comparison-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  border-right: 3px solid #ffffff;
}

.comparison-overlay img {
  width: 800px;
  height: 360px;
  max-width: none;
  object-fit: cover;
}

.comparison-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  z-index: 10;
  color: var(--text-dark);
  font-weight: bold;
}

.comparison-label {
  position: absolute;
  bottom: 12px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
}

.label-before { left: 12px; }
.label-after { right: 12px; }

/* Glossary Tooltips */
.tooltip-term {
  border-bottom: 1.5px dotted var(--accent-blue);
  color: var(--text-dark);
  font-weight: 500;
  cursor: help;
  position: relative;
}

.tooltip-popup {
  visibility: hidden;
  opacity: 0;
  width: 240px;
  background: var(--text-dark);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: normal;
  padding: 10px 14px;
  border-radius: 6px;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  transition: opacity 0.2s;
  box-shadow: var(--shadow-md);
  line-height: 1.4;
  pointer-events: none;
}

.tooltip-popup::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--text-dark) transparent transparent transparent;
}

.tooltip-term:hover .tooltip-popup {
  visibility: visible;
  opacity: 1;
}

/* Lightbox Modal */
.lightbox-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px;
}

.lightbox-modal.active {
  display: flex;
}

.lightbox-content {
  max-width: 90%;
  max-height: 80vh;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}

.lightbox-caption {
  margin-top: 16px;
  color: #ffffff;
  font-size: 0.95rem;
  text-align: center;
  max-width: 800px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: #ffffff;
  font-size: 2rem;
  cursor: pointer;
  background: none;
  border: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #ffffff;
  font-size: 2.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* Final Animated Timeline */
.timeline-wrapper {
  position: relative;
  padding-left: 30px;
  margin: 30px 0;
}

.timeline-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 12px;
  width: 3px;
  background: #e2e8f0;
}

.timeline-node {
  position: relative;
  margin-bottom: 24px;
}

.timeline-dot {
  position: absolute;
  left: -30px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.8);
}

.timeline-content {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-dark);
}

/* Footer Collection Showcase */
.collection-footer {
  margin-top: 60px;
  padding-top: 40px;
  border-top: 2px solid #e2e8f0;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.collection-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-decoration: none;
  color: var(--text-dark);
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
}

.collection-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-active);
}

.collection-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.collection-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Print Stylesheet */
@media print {
  #reading-progress-container,
  .series-nav-bar,
  .toc-sidebar,
  .lightbox-modal,
  .comparison-handle,
  .collection-footer {
    display: none !important;
  }
  
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }
  
  .page-container {
    display: block !important;
    max-width: 100% !important;
    padding: 0 !important;
  }
  
  .glass-card, .hero-wrapper {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: #ffffff !important;
    page-break-inside: avoid;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }
}
