/* ==========================================================================
   Data Driven Materials and Molecular Science (DDMMS)
   Modern, Responsive, Dark/Light Themed Stylesheet
   ========================================================================== */

:root {
  /* Colors - Light Theme */
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --card-bg: #ffffff;
  --card-hover: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.88);
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --border-focus: #3b82f6;

  /* Brand Accents */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-gradient: linear-gradient(135deg, #2563eb 0%, #0284c7 100%);
  --accent-cyan: #0284c7;
  --accent-teal: #0d9488;
  --accent-purple: #7c3aed;
  
  /* Status & Badges */
  --badge-bg: #f1f5f9;
  --badge-text: #475569;
  --orcid-color: #a6ce39;
  --tag-author-bg: #ecfdf5;
  --tag-author-text: #065f46;
  --tag-author-border: #a7f3d0;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 25px rgba(37, 99, 235, 0.15);

  /* Layout & Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --container-max: 1200px;
  --nav-height: 72px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Colors - Dark Theme */
  --bg: #090d16;
  --bg-alt: #0f172a;
  --card-bg: #141e33;
  --card-hover: #192640;
  --nav-bg: rgba(9, 13, 22, 0.88);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #23314d;
  --border-focus: #60a5fa;

  /* Brand Accents */
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-light: #082f49;
  --primary-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  --accent-cyan: #38bdf8;
  --accent-teal: #2dd4bf;
  --accent-purple: #c084fc;

  /* Status & Badges */
  --badge-bg: #1e293b;
  --badge-text: #cbd5e1;
  --orcid-color: #a6ce39;
  --tag-author-bg: #064e3b;
  --tag-author-text: #6ee7b7;
  --tag-author-border: #047857;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 20px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 30px rgba(56, 189, 248, 0.15);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 1.5rem);
}

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

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
#site-header {
  display: contents;
}

.site-header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  background-color: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

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

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.brand-logo-img {
  height: 42px;
  width: auto;
  max-width: 48px;
  object-fit: contain;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-title-main {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.025em;
  color: var(--text);
}

.brand-title-sub {
  font-weight: 500;
  font-size: 0.725rem;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  white-space: nowrap;
}

.brand-link:hover .brand-logo-img {
  transform: scale(1.05);
}

.brand-text-fallback {
  display: none;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.5rem;
}

.nav-item a {
  padding: 0.5rem 0.85rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
}

.nav-item a:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-item a.active {
  color: var(--primary);
  font-weight: 600;
  background: var(--primary-light);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: var(--badge-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Mobile Hamburger Toggle */
.mobile-toggle-btn {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 8px;
  transition: var(--transition);
}

.mobile-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.hamburger-icon {
  width: 22px;
  height: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-line {
  display: block;
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.mobile-toggle-btn[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-toggle-btn[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}
.mobile-toggle-btn[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile Navigation Drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  width: 100%;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem 1.5rem 1.75rem;
  z-index: 999;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.mobile-drawer.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-nav-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.mobile-nav-item a:hover,
.mobile-nav-item a.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.mobile-actions {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
  position: relative;
  padding: 5rem 0 4rem;
  overflow: hidden;
  background: radial-gradient(circle at 80% 20%, rgba(37, 99, 235, 0.08) 0%, transparent 60%),
              radial-gradient(circle at 10% 80%, rgba(13, 148, 136, 0.06) 0%, transparent 50%);
}

[data-theme="dark"] .hero-section {
  background: radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.12) 0%, transparent 60%),
              radial-gradient(circle at 10% 80%, rgba(45, 212, 191, 0.08) 0%, transparent 50%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 3.5rem;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero-badge .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.hero-title {
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
}

.hero-title .gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.18rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 620px;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  min-height: 44px;
}

.btn:hover {
  background: var(--badge-bg);
  border-color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--card-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.hero-card-display {
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero-card-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
}

.hero-card-logo {
  max-height: 140px;
  margin: 0 auto 1.5rem;
  object-fit: contain;
}

.hero-card-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.hero-stat-item {
  text-align: center;
}

.hero-stat-num {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}

/* ==========================================================================
   Section Headers
   ========================================================================== */
.section-wrapper {
  padding: 5rem 0;
  border-bottom: 1px solid var(--border);
}

.section-wrapper.bg-alt {
  background-color: var(--bg-alt);
}

.section-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 3.5rem;
}

.section-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.85rem;
}

.section-title {
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==========================================================================
   About Section
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: start;
}

.about-text {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  font-size: 1.05rem;
  color: var(--text);
}

.about-text p {
  line-height: 1.7;
  color: var(--text-muted);
}

.about-text strong {
  color: var(--text);
}

.about-pillars {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 1rem;
}

.pillar-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.pillar-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.pillar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.pillar-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.about-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.news-box-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.news-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.news-item {
  position: relative;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border);
}

.news-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.news-date {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.news-headline {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

/* ==========================================================================
   Research Section
   ========================================================================== */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem;
}

.research-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
}

.research-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.research-card-top {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.research-tag {
  align-self: flex-start;
  padding: 0.2rem 0.6rem;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.research-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.research-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.research-highlights {
  list-style: none;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.research-highlights li {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.research-highlights li::before {
  content: '→';
  color: var(--primary);
  font-weight: bold;
}

/* ==========================================================================
   People Section
   ========================================================================== */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.person-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: var(--transition);
}

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

.person-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.person-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  border: 2px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}

.person-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 50%;
  display: block;
}

.person-title-wrap h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.person-role {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 0.25rem;
}

.person-affiliation {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.person-bio {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.person-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.person-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: var(--radius-full);
}

.person-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.person-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  background: var(--badge-bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.person-link-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.person-link-btn svg {
  width: 14px;
  height: 14px;
}

.person-tenure {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: var(--radius-full);
  margin-top: 0.25rem;
  letter-spacing: 0.02em;
}

.person-badge-dest {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 0.25rem;
}

.subnav-pills {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.subnav-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.subnav-pill:hover,
.subnav-pill:focus {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   Code & Software Section
   ========================================================================== */
.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 2rem;
}

.code-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: var(--transition);
}

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

.code-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.code-title-group h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.code-desc {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.code-install-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow-x: auto;
}

.copy-snippet-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  margin-left: 0.5rem;
  border-radius: 4px;
  transition: var(--transition);
}

.copy-snippet-btn:hover {
  color: var(--primary);
}

.code-features-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.code-features-list li {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.code-features-list li::before {
  content: '✓';
  color: var(--accent-teal);
  font-weight: bold;
}

/* ==========================================================================
   Publications Section (Integrated from ../pubs)
   ========================================================================== */
.pubs-controls-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.pubs-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 42px;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.pubs-controls-extra {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}

.pubs-results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pubs-counter {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.pubs-counter strong {
  color: var(--text);
}

.pubs-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.year-section {
  margin-bottom: 2.5rem;
}

.year-header {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--primary);
}

.year-count-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--badge-bg);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
}

.pub-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

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

.pub-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.pub-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}

.pub-title a:hover {
  color: var(--primary);
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.pub-authors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.author-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--tag-author-bg);
  color: var(--tag-author-text);
  border: 1px solid var(--tag-author-border);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}

.author-chip:hover {
  opacity: 0.85;
}

.orcid-icon {
  width: 13px;
  height: 13px;
  fill: var(--orcid-color);
  flex-shrink: 0;
}

.pub-venue {
  color: var(--text-muted);
  font-style: italic;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--badge-bg);
  color: var(--badge-text);
}

.badge-year {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.badge-doi {
  background: #f3e8ff;
  color: #6b21a8;
  border: 1px solid #e9d5ff;
  text-decoration: none;
  transition: opacity 0.15s;
}

[data-theme="dark"] .badge-doi {
  background: #3b0764;
  color: #d8b4fe;
  border-color: #581c87;
}

.pub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
  align-items: center;
}

.btn-action {
  padding: 0.3rem 0.65rem;
  font-size: 0.775rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background: var(--badge-bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 32px;
}

.btn-action:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: 4rem 0 2rem;
  margin-top: 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(2, 1fr);
  gap: 2.5rem;
  margin-bottom: 3rem;
}

.footer-brand h4 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.footer-brand p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 320px;
}

.footer-col h5 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 9999;
}

[data-theme="dark"] .toast {
  background: #f8fafc;
  color: #0f172a;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Mobile & Responsive Queries
   ========================================================================== */
@media (max-width: 992px) {
  .nav-desktop {
    display: none;
  }
  .mobile-toggle-btn {
    display: flex;
  }
  .mobile-drawer {
    display: block;
  }
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .hero-visual {
    order: -1;
  }
  .hero-card-display {
    max-width: 100%;
  }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  :root {
    --nav-height: 64px;
  }
  .brand-title-sub {
    display: none;
  }
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .section-wrapper {
    padding: 3.5rem 0;
  }
  .hero-section {
    padding: 3rem 0 2.5rem;
  }
  .hero-title {
    font-size: 2rem;
  }
  .hero-subtitle {
    font-size: 1rem;
  }
  .about-pillars {
    grid-template-columns: 1fr;
  }
  .research-grid,
  .people-grid,
  .code-grid {
    grid-template-columns: 1fr;
  }
  .pubs-controls-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .hero-card-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .pub-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

/* Math Typography and Rendering */
.katex {
  font-size: 1.05em;
}

.math-rendered {
  font-family: "KaTeX_Math", "Cambria Math", "Times New Roman", Times, serif;
  font-style: normal;
  white-space: nowrap;
}

.math-rendered em {
  font-family: "KaTeX_Math", "Cambria Math", "Times New Roman", Times, serif;
  font-style: italic;
}

.math-rendered sub,
.math-rendered sup {
  font-size: 0.75em;
  font-family: "KaTeX_Math", "Cambria Math", "Times New Roman", Times, serif;
}

