/* 
   Scientific Design Language (SDL) - Stylesheet
   Helix Research - Digital Headquarters
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Lora:ital,wght@0,400;0,500;0,600;1,400&display=swap');

/* --- Design Tokens --- */
:root {
  /* Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-surface: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent-primary: #0f62fe; /* Scientific Blue */
  --accent-secondary: #0d9488; /* Teal */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #be123c;
  --border-color: #e2e8f0;
  --border-focus: #0f62fe;
  
  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Lora', 'Georgia', serif;

  /* Layout & Spacing */
  --max-width: 1440px;
  --content-width: 1320px;
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;
  --space-3xl: 96px;

  /* Corner Radius */
  --radius-button: 8px;
  --radius-card: 12px;
  --radius-dialog: 16px;
  --radius-input: 10px;

  /* Shadows (Soft & Natural) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.06), 0 4px 12px -2px rgba(15, 23, 42, 0.03);

  /* Typography Scale */
  --fs-display-xxl: 3.5rem;
  --fs-display-xl: 2.75rem;
  --fs-heading-xl: 2.25rem;
  --fs-heading-lg: 1.75rem;
  --fs-heading-md: 1.25rem;
  --fs-body-lg: 1.125rem;
  --fs-body-std: 1rem;
  --fs-caption: 0.875rem;
  --fs-metadata: 0.75rem;

  /* Accessibility Defaults */
  --font-scale: 1;
}

/* --- Theme Adaptations --- */

/* High Contrast Mode */
body.high-contrast {
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-surface: #ffffff;
  --text-primary: #000000;
  --text-secondary: #1a1a1a;
  --accent-primary: #0000ee;
  --accent-secondary: #006666;
  --border-color: #000000;
  --border-focus: #0000ee;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
}

/* Dark Mode (Subtle & Scholarly) */
body.dark-mode {
  --bg-primary: #0b0f17;
  --bg-secondary: #111827;
  --bg-surface: #1f2937;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --accent-primary: #3b82f6;
  --accent-secondary: #14b8a6;
  --border-color: #374151;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: calc(16px * var(--font-scale));
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.30s ease, color 0.30s ease;
  overflow-x: hidden;
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
  width: 100%;
}

.page-section {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  border-bottom: 1px solid var(--border-color);
}

.page-section:last-of-type {
  border-bottom: none;
}

/* --- Custom Loading Screen --- */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

#loading-canvas {
  width: 300px;
  height: 100px;
  margin-bottom: var(--space-md);
}

.loading-wordmark {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: #0f62fe;
  opacity: 0;
  transform: translateY(10px);
  animation: fadeInWordmark 1.2s forwards 0.4s;
  text-transform: uppercase;
}

@keyframes fadeInWordmark {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Typography Helpers --- */
.serif-text {
  font-family: var(--font-serif);
}

.editorial-reading {
  font-family: var(--font-serif);
  font-size: var(--fs-body-lg);
  line-height: 1.75;
  color: var(--text-primary);
  max-width: 65ch;
  margin-left: auto;
  margin-right: auto;
}

.editorial-reading p {
  margin-bottom: var(--space-md);
}

.section-label {
  font-family: var(--font-sans);
  font-size: var(--fs-metadata);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: var(--space-xs);
  display: block;
}

/* --- Header / Navigation --- */
header.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(var(--bg-primary-rgb, 255, 255, 255), 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.3s;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.logo-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: var(--accent-primary);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.main-nav {
  display: flex;
  gap: var(--space-md);
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--fs-caption);
  font-weight: 500;
  transition: color 0.2s;
  padding: var(--space-xs) 0;
  position: relative;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--accent-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: var(--fs-caption);
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-button);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  gap: 8px;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #0050e0;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--text-secondary);
}

.btn-text {
  background: transparent;
  color: var(--accent-primary);
  padding: 0;
  font-weight: 600;
}

.btn-text:hover {
  color: var(--accent-secondary);
}

/* --- Search Controls --- */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  font-family: var(--font-sans);
  font-size: var(--fs-caption);
  padding: 8px 16px 8px 36px;
  border-radius: var(--radius-input);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  width: 200px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}

.search-input:focus {
  outline: none;
  width: 280px;
  background-color: var(--bg-primary);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.15);
}

.search-icon-btn {
  position: absolute;
  left: 12px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.search-icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
}

/* --- Accessibility & Settings Panel --- */
.settings-toggle {
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.settings-toggle:hover {
  background-color: var(--bg-secondary);
}

.settings-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--text-secondary);
  stroke-width: 2;
}

.accessibility-panel {
  position: absolute;
  right: var(--space-md);
  top: 90px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-dialog);
  padding: var(--space-md);
  width: 320px;
  z-index: 1010;
  display: none;
  flex-direction: column;
  gap: var(--space-sm);
}

.accessibility-panel.show {
  display: flex;
  animation: slideDownFade 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-header {
  font-weight: 600;
  font-size: var(--fs-caption);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-xs);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accessibility-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--fs-caption);
}

.size-controls {
  display: flex;
  gap: var(--space-xs);
}

.size-btn {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.size-btn:hover {
  background-color: var(--accent-primary);
  color: white;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* --- Hero Section --- */
.hero-section {
  position: relative;
  background-color: var(--bg-secondary);
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-3xl);
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

/* Custom Daylighting Effect Overlay */
.hero-daylight {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: radial-gradient(circle at 75% 20%, rgba(243, 244, 246, 0.4) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

body.dark-mode .hero-daylight {
  background: radial-gradient(circle at 75% 20%, rgba(59, 130, 246, 0.08) 0%, rgba(11, 15, 23, 0) 70%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-2xl);
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-headline {
  font-family: var(--font-serif);
  font-size: var(--fs-display-xl);
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.hero-subtext {
  font-size: var(--fs-body-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}

.hero-ctas {
  display: flex;
  gap: var(--space-sm);
}

.hero-visual {
  position: relative;
}

/* Scientific documentary photo frame */
.photo-frame {
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  position: relative;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0));
  color: white;
  padding: var(--space-sm) var(--space-md) var(--space-xs);
  font-size: var(--fs-metadata);
}

.helix-mode-bar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  z-index: 5;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.helix-mode-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: unset !important;
}

.helix-mode-btn:hover {
  color: #ffffff;
}

.helix-mode-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
}

/* --- Section Title Layouts --- */
.section-header {
  text-align: center;
  max-width: 800px;
  margin: 0 auto var(--space-2xl);
}

.section-title {
  font-family: var(--font-serif);
  font-size: var(--fs-heading-xl);
  font-weight: 500;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.section-subtitle {
  font-size: var(--fs-body-lg);
  color: var(--text-secondary);
}

/* --- Card Grid Layouts --- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
}

/* --- Cards Design --- */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-xs);
}

.card-title {
  font-family: var(--font-sans);
  font-size: var(--fs-heading-md);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.card-body {
  flex-grow: 1;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.card-footer {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-xs);
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- Research Dashboard Specifics --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2.2fr 0.8fr;
  gap: var(--space-lg);
}

.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.dashboard-section-title {
  font-size: var(--fs-heading-md);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-xs);
  margin-bottom: var(--space-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- Charts SVG / CSS --- */
.chart-container {
  height: 200px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: var(--space-md);
}

.chart-bar {
  flex-grow: 1;
  margin: 0 4px;
  background-color: var(--bg-secondary);
  border-radius: 4px 4px 0 0;
  position: relative;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.chart-bar-fill {
  background-color: var(--accent-primary);
  border-radius: 4px 4px 0 0;
  width: 100%;
  height: 0%;
  transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.chart-bar:hover .chart-bar-fill {
  background-color: var(--accent-secondary);
}

.chart-label {
  font-size: var(--fs-metadata);
  color: var(--text-secondary);
  position: absolute;
  bottom: -22px;
  white-space: nowrap;
}

.chart-value {
  font-size: var(--fs-metadata);
  font-weight: 600;
  position: absolute;
  top: -20px;
  color: var(--text-primary);
  opacity: 0;
  transition: opacity 0.2s;
}

.chart-bar:hover .chart-value {
  opacity: 1;
}

/* --- Research Area tabs/nodes --- */
.research-questions-selector {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.research-question-tab {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: var(--space-sm);
  border-radius: var(--radius-card);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: var(--fs-body-lg);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.research-question-tab:hover, .research-question-tab.active {
  border-color: var(--accent-primary);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.research-question-tab.active {
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

.tab-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--border-color);
  margin-right: var(--space-xs);
}

.research-question-tab.active .tab-indicator {
  background-color: var(--accent-primary);
}

.research-area-connections {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background-color: var(--bg-secondary);
  padding: var(--space-md);
  min-height: 350px;
}

.connections-title {
  font-weight: 600;
  font-size: var(--fs-caption);
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.connection-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.connection-node {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: var(--fs-caption);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}

.connection-node.active {
  border-color: var(--accent-secondary);
  background-color: rgba(13, 148, 136, 0.05);
}

/* --- Global Collaboration Map --- */
.map-canvas-container {
  position: relative;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-card);
  border: 1px solid var(--border-color);
  overflow: hidden;
  height: 420px;
  width: 100%;
}

.collaboration-svg {
  width: 100%;
  height: 100%;
}

.map-node {
  cursor: pointer;
  transition: r 0.2s ease, fill 0.2s ease;
}

.map-node:hover {
  fill: var(--accent-secondary);
}

.map-line {
  stroke: var(--accent-primary);
  stroke-dasharray: 4, 4;
  stroke-width: 1.5;
  opacity: 0.4;
  animation: dash 15s linear infinite;
}

@keyframes dash {
  to {
    stroke-dashoffset: -100;
  }
}

.map-tooltip {
  position: absolute;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  font-size: var(--fs-metadata);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

/* --- Discovery Timeline --- */
.timeline-wrapper {
  position: relative;
  padding: var(--space-md) 0;
}

.timeline-line {
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--border-color);
}

.timeline-event {
  position: relative;
  padding-left: 50px;
  margin-bottom: var(--space-lg);
}

.timeline-node {
  position: absolute;
  left: 11px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: var(--bg-primary);
  border: 2px solid var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.timeline-event.active .timeline-node {
  background-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.15);
}

.timeline-title {
  font-weight: 600;
  font-size: var(--fs-caption);
  color: var(--text-primary);
  margin-bottom: 4px;
}

.timeline-desc {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}

.timeline-meta {
  font-size: var(--fs-metadata);
  color: var(--accent-secondary);
  font-weight: 500;
  margin-top: 4px;
}

/* --- Publications Details & Filters --- */
.filter-bar {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-sm);
}

.filter-btn {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: var(--fs-caption);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
  background-color: var(--accent-primary);
  color: white;
}

.pub-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.pub-item {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-md);
}

.pub-item:last-of-type {
  border-bottom: none;
}

.pub-title {
  font-family: var(--font-serif);
  font-size: var(--fs-heading-md);
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.pub-authors {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.pub-meta {
  font-size: var(--fs-metadata);
  color: var(--text-secondary);
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.pub-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pub-summary-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  background-color: var(--bg-secondary);
  padding: var(--space-sm);
  border-radius: var(--radius-card);
}

.pub-summary-title {
  font-size: var(--fs-metadata);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.pub-summary-text {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
}

/* --- Datasets Page --- */
.dataset-card {
  padding: var(--space-md);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.dataset-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-metadata);
  color: var(--text-secondary);
}

.dataset-format {
  background-color: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.citation-box {
  background-color: var(--bg-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 6px;
  font-family: monospace;
  font-size: var(--fs-metadata);
  border: 1px dashed var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-xs);
  word-break: break-all;
}

.btn-copy {
  background: transparent;
  cursor: pointer;
  color: var(--accent-primary);
  font-weight: 600;
  flex-shrink: 0;
}

/* --- AI Research Assistant --- */
.assistant-widget-btn {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  background-color: var(--accent-primary);
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  z-index: 990;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.assistant-widget-btn:hover {
  transform: scale(1.05);
  background-color: #0050e0;
}

.assistant-panel {
  position: fixed;
  bottom: 90px;
  right: var(--space-md);
  width: 380px;
  height: 500px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-dialog);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
  animation: slideUpFade 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.assistant-panel.show {
  display: flex;
}

.assistant-header {
  background-color: var(--accent-primary);
  color: white;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.assistant-title {
  font-weight: 600;
  font-size: var(--fs-caption);
}

.assistant-close {
  background: transparent;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
}

.assistant-chat {
  flex-grow: 1;
  padding: var(--space-md);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background-color: var(--bg-secondary);
}

.chat-message {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: var(--fs-caption);
  max-width: 85%;
  line-height: 1.4;
}

.chat-message.assistant {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  align-self: flex-start;
  border: 1px solid var(--border-color);
}

.chat-message.user {
  background-color: var(--accent-primary);
  color: white;
  align-self: flex-end;
}

.ai-disclaimer {
  font-size: var(--fs-metadata);
  color: var(--text-secondary);
  background-color: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--color-warning);
  padding: var(--space-xs);
  border-radius: 4px;
  margin-top: 4px;
}

.ai-sources {
  font-size: var(--fs-metadata);
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
  padding-top: 4px;
  color: var(--accent-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.assistant-input-area {
  padding: var(--space-sm);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-xs);
  background-color: var(--bg-surface);
}

.assistant-input {
  flex-grow: 1;
  font-family: var(--font-sans);
  font-size: var(--fs-caption);
  padding: 8px 12px;
  border-radius: var(--radius-input);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.assistant-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background-color: var(--bg-primary);
}

.assistant-send {
  background-color: var(--accent-primary);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-button);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* --- Footer --- */
footer.app-footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-xl);
}

.footer-library-quote {
  text-align: center;
  max-width: 700px;
  margin: 0 auto var(--space-2xl);
  font-family: var(--font-serif);
  font-size: var(--fs-heading-md);
  color: var(--text-secondary);
  font-style: italic;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.footer-brand-title {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.footer-brand-desc {
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  max-width: 250px;
}

.footer-col-title {
  font-family: var(--font-sans);
  font-size: var(--fs-metadata);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.footer-link-item a {
  text-decoration: none;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  transition: color 0.2s;
}

.footer-link-item a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: var(--space-md);
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-metadata);
  color: var(--text-secondary);
}

/* --- Views Management --- */
.view-container {
  display: none;
  min-height: 60vh;
}

.view-container.active-view {
  display: block;
}

/* --- 404 View CSS --- */
.error-404-container {
  text-align: center;
  max-width: 600px;
  margin: var(--space-3xl) auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.error-404-canvas {
  width: 280px;
  height: 180px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Clinical Research layout --- */
.accordion-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  margin-bottom: var(--space-xs);
  overflow: hidden;
  background-color: var(--bg-surface);
}

.accordion-header {
  padding: var(--space-sm) var(--space-md);
  background-color: var(--bg-surface);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: var(--fs-body-std);
  color: var(--text-primary);
  transition: background-color 0.2s;
}

.accordion-header:hover {
  background-color: var(--bg-secondary);
}

.accordion-content {
  padding: 0 var(--space-md);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
  font-size: var(--fs-caption);
  color: var(--text-secondary);
  border-top: 0 solid var(--border-color);
}

.accordion-item.active .accordion-content {
  padding: var(--space-sm) var(--space-md);
  max-height: 500px;
  border-top-width: 1px;
}

/* --- Responsive Media Queries --- */
@media (max-width: 1024px) {
  :root {
    --fs-display-xxl: 3rem;
    --fs-display-xl: 2.25rem;
    --fs-heading-xl: 1.75rem;
  }
  
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
  
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --fs-display-xxl: 2.5rem;
    --fs-display-xl: 2rem;
    --fs-heading-xl: 1.5rem;
    --fs-heading-lg: 1.35rem;
  }

  .header-container {
    height: auto;
    flex-direction: column;
    padding: var(--space-sm) 0;
    gap: var(--space-sm);
  }

  .main-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
  }
  
  .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .pub-summary-section {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* ============================================================
   MOBILE OPTIMIZATION
   ============================================================ */
@media (pointer: coarse) {
  .btn, .nav-link, .settings-toggle, .size-btn,
  .research-question-tab, .accordion-header, a, button {
    min-height: 44px;
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
  }
  .btn { padding: 14px 22px; }
  .nav-link { padding: 12px 8px; }
  body { cursor: auto; -webkit-text-size-adjust: 100%; }
  html, body { overflow-x: hidden; overscroll-behavior-x: none; }
}

/* Mobile hamburger button */
.mobile-menu-btn {
  display: none;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  background: transparent; border: none;
  cursor: pointer; flex-direction: column; gap: 5px;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-btn span {
  display: block; width: 22px; height: 2px;
  background: var(--text-primary);
  transition: transform 0.3s, opacity 0.2s;
  border-radius: 1px;
}
.mobile-menu-btn.open span:first-child { transform: translateY(7px) rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:last-child { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .mobile-menu-btn { display: flex; }
  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    position: fixed;
    top: 80px; left: 0; right: 0; bottom: 0;
    background: var(--bg-primary);
    flex-direction: column;
    padding: var(--space-md);
    z-index: 999;
    gap: var(--space-xs);
  }
  .main-nav.open .nav-link { font-size: 1.1rem; padding: 14px 0; }
}

@media (max-width: 480px) {
  .hero-headline { font-size: 1.75rem; line-height: 1.2; }
  .hero-subtext { font-size: 0.95rem; }
  .hero-ctas { flex-direction: column; width: 100%; }
  .hero-ctas .btn { width: 100%; justify-content: center; }
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr !important; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .container { padding-left: 16px; padding-right: 16px; }
  .page-section { padding-top: 32px; padding-bottom: 32px; }
  .section-title { font-size: 1.35rem; }
  .card { padding: var(--space-sm); }
  .accessibility-panel { width: 95vw; right: 2.5vw; }
  .search-input { width: 100%; }
  .search-input:focus { width: 100%; }
}

