/* ==========================================================================
   Conscious Brain Lab - Modern Subscription-Free Design System
   Tailored for High-Impact Academic & Neuroscience Portfolios
   ========================================================================== */

:root {
  /* Core Color Palette - Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-header: rgba(255, 255, 255, 0.95);
  
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  --border-subtle: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Accent Colors (Neuroscience Deep Indigo & Cyan) */
  --accent-primary: #0284c7;
  --accent-hover: #0369a1;
  --accent-light: #e0f2fe;
  --accent-glow: rgba(2, 132, 199, 0.2);
  
  --accent-secondary: #6366f1;
  --accent-secondary-light: #eef2ff;

  --brand-gradient: linear-gradient(135deg, #0284c7 0%, #6366f1 100%);
  --brand-gradient-subtle: linear-gradient(135deg, rgba(2, 132, 199, 0.05) 0%, rgba(99, 102, 241, 0.05) 100%);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Plus Jakarta Sans', var(--font-sans);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Container */
  --max-width: 1200px;
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-tertiary: #131c31;
  --bg-card: #111a2e;
  --bg-card-hover: #18233d;
  --bg-header: rgba(15, 23, 42, 0.95);

  --border-color: #1e293b;
  --border-color-hover: #334155;
  --border-subtle: #162032;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-light: #475569;

  --accent-primary: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-light: rgba(56, 189, 248, 0.15);
  --accent-glow: rgba(56, 189, 248, 0.25);

  --accent-secondary: #818cf8;
  --accent-secondary-light: rgba(129, 140, 248, 0.15);

  --brand-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
  --brand-gradient-subtle: linear-gradient(135deg, rgba(56, 189, 248, 0.08) 0%, rgba(129, 140, 248, 0.08) 100%);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

ul {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
}

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

/* ==========================================================================
   Two-Tier Header (Top Brand Bar + Spacious Navigation Row)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-normal);
}

/* Row 1: Dedicated Top Brand Header Bar */
.header-top-bar {
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 0;
  background: var(--bg-secondary);
}

.top-bar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: contain;
  border: none;
  box-shadow: none;
  outline: none;
  display: block;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-sub {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* Row 2: Spacious Navigation Bar */
.header-nav-bar {
  padding: 0.35rem 0;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.nav-item {
  position: relative;
}

.nav-item.nav-item-right {
  margin-left: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

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

/* Dropdown Menu */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 110;
  animation: fadeIn 0.15s ease-out;
}

.nav-item:hover .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: block;
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--accent-light);
  color: var(--accent-primary);
}

/* Actions & Buttons */
.theme-toggle-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.45rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

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

.btn-admin {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  transition: all var(--transition-fast);
}

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

.mobile-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
}

/* ==========================================================================
   Hero Section with Iconic Starry Space Background
   ========================================================================== */
.hero-section {
  padding: 5.5rem 0 5rem;
  background-color: #071124;
  background-image: url('../images/starry_bg.jpg');
  background-image: -webkit-image-set(url('../images/starry_bg.avif') 1x, url('../images/starry_bg.jpg') 1x);
  background-image: image-set(
    url('../images/starry_bg.avif') type('image/avif'),
    url('../images/starry_bg.jpg') type('image/jpeg')
  );
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  text-align: center;
}

.hero-content-wrap {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1.1rem;
  background: rgba(14, 165, 233, 0.22);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1.75rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin-bottom: 1.75rem;
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.hero-description {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: #ffffff;
  line-height: 1.85;
  margin-bottom: 1.25rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.hero-video-container {
  width: 100%;
  max-width: 680px;
  margin: 2rem auto 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.2);
  background: #000;
}

.hero-video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.hero-video-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.hero-section .btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(8px);
}

.hero-section .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.55);
}

/* ==========================================================================
   Starry Background Infographic Section
   ========================================================================== */
.starry-infographic-section {
  padding: 5rem 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82) 0%, rgba(15, 23, 42, 0.96) 100%), url('../images/starry_bg.jpg') center / cover no-repeat;
  color: #ffffff;
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.starry-infographic-section h2,
.starry-infographic-section h3 {
  color: #ffffff;
}

.starry-infographic-section p {
  color: #e2e8f0;
}

/* Funder / Partner Bar */
.funder-bar {
  padding: 1.75rem 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.funder-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.funder-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.funder-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Sections */
.section-padding {
  padding: 5rem 0;
}

.section-header {
  margin-bottom: 3rem;
}

.section-subtitle {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.75rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section-intro {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 750px;
  line-height: 1.7;
}

/* ==========================================================================
   Cards & Layouts
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

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

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

/* Member Filter & Search Controls */
.member-anchor,
#members-grid {
  scroll-margin-top: 140px;
}

.member-anchor {
  display: block;
  position: relative;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  visibility: hidden;
}

.member-controls {
  scroll-margin-top: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.member-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.member-filter-btn {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

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

.member-filter-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 10px var(--accent-glow);
}

.member-search-box {
  position: relative;
  min-width: 260px;
  max-width: 380px;
  flex: 1;
}

.member-search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  color: var(--text-muted);
  pointer-events: none;
}

.member-search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  font-size: 0.9rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  outline: none;
  transition: all var(--transition-fast);
  box-sizing: border-box;
  font-family: inherit;
}

.member-search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-card);
}

/* Member Cards */
.member-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
}

.member-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 1.25rem;
  border: 3px solid var(--accent-light);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.member-name {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.member-role {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-primary);
  margin-bottom: 0.85rem;
}

.member-bio {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.member-links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* News Cards with Images */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.news-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

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

.news-card-img-wrap {
  width: 100%;
  height: 230px;
  overflow: hidden;
  background: var(--bg-tertiary);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.news-card-img.news-card-logo,
.news-card-img[data-type="logo"] {
  object-fit: contain;
  background: var(--bg-tertiary);
}

.news-card:hover .news-card-img {
  transform: scale(1.03);
}

.news-card-video-wrap {
  width: 100%;
  height: 230px;
  background: #000;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-card-video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.news-card-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: block;
}

.news-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

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

.news-card-title {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.news-card-desc {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  flex: 1;
}

/* ==========================================================================
   Project Cards with Authentic Media
   ========================================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2.25rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-color-hover);
}

.project-card-img-wrap {
  width: 100%;
  height: 250px;
  overflow: hidden;
  background: var(--bg-tertiary);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.project-card:hover .project-card-img {
  transform: scale(1.04);
}

.project-card-body {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project-card-tag {
  align-self: flex-start;
  margin-bottom: 0.75rem;
}

.project-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.project-card-desc {
  color: var(--text-secondary);
  line-height: 1.75;
  font-size: 0.95rem;
  margin: 0;
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
  box-shadow: 0 2px 4px var(--accent-glow);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

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

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.tag-accent {
  background: var(--accent-light);
  color: var(--accent-primary);
}

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

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

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
  margin-bottom: 3.5rem;
}

.footer-heading {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.footer-links li {
  margin-bottom: 0.65rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  transition: color var(--transition-fast);
}

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

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

/* ==========================================================================
   Modals & Toasts
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-publications-list::-webkit-scrollbar {
  width: 6px;
}

.modal-publications-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.modal-publications-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.modal-publications-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.modal-pub-item em {
  font-style: italic;
  color: var(--text-primary);
}

.modal-pub-item strong {
  font-weight: 700;
  color: var(--text-primary);
}


.pub-inline-icon {
  opacity: 0.8;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.pub-inline-icon:hover {
  opacity: 1;
  transform: translateY(-1px);
}




.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.modal-title {
  font-size: 1.25rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-close-btn:hover {
  color: var(--text-primary);
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--text-primary);
  color: var(--bg-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: slideUp 0.25s ease-out;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 850px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 999;
  }
  .header-nav-bar {
    display: none;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 65px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .header-nav-bar.open,
  .header-nav-bar.mobile-open {
    display: block !important;
    animation: fadeIn 0.2s ease-out;
  }
  .mobile-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .main-nav {
    padding: 1rem 0;
  }
  .nav-menu {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.25rem;
    padding: 0 0.5rem;
  }
  .nav-item {
    width: 100%;
  }
  .nav-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
  }
  .nav-link:hover,
  .nav-link.active {
    background: var(--accent-light);
    color: var(--accent-primary);
  }
  .nav-item.nav-item-right {
    margin-left: 0;
  }
  .dropdown-menu {
    position: static;
    display: block;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--accent-light);
    margin-left: 1.25rem;
    padding: 0.25rem 0 0.5rem 0.5rem;
    background: transparent;
  }
  .dropdown-item {
    padding: 0.45rem 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
  }
  .dropdown-item:hover {
    color: var(--accent-primary);
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .member-anchor,
  .member-controls,
  #members-grid {
    scroll-margin-top: 85px;
  }
}

@media (max-width: 640px) {
  .header-top-bar {
    padding: 0.6rem 0;
  }
  .brand-logo-img {
    width: 40px;
    height: 40px;
  }
  .brand-logo-link {
    gap: 0.6rem;
  }
  .brand-title {
    font-size: 1.15rem;
  }
  .brand-sub {
    font-size: 0.72rem;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .top-bar-actions {
    gap: 0.4rem;
  }
  .btn-admin {
    font-size: 0;
    padding: 0.5rem;
    min-width: 36px;
    justify-content: center;
  }
  .btn-admin svg {
    margin: 0;
    width: 17px;
    height: 17px;
  }
  .theme-toggle-btn,
  .mobile-toggle-btn {
    width: 38px;
    height: 38px;
  }
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .page-header {
    padding: 2.5rem 0 1.5rem;
  }
  .page-title {
    font-size: 1.75rem;
  }
}

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

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
