/* ===== CSS Variables ===== */
:root {
  --color-primary: #8675B2;
  --color-primary-light: #A292C6;
  --color-secondary: #9B8CC2;
  --color-accent: #d4a574;
  --color-accent-light: #e8d0b8;
  --color-bg: #ffffff;
  --color-bg-alt: #f8f9fa;
  --color-text: #2d3436;
  --color-text-light: #636e72;
  --color-border: #e0e4e8;

  --font-heading: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);

  --max-width: 1200px;
  --nav-height: 70px;
  --radius: 8px;
  --transition: 0.3s ease;
}

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

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

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

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

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Section Common ===== */
.section {
  padding: 100px 0;
  display: none;
}

.section.section-visible {
  display: block;
}

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

.section-title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 16px;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text-light);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 20px;
}

.section-desc {
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.9rem;
  max-width: 800px;
  margin: 0 auto 60px;
  font-style: italic;
  line-height: 1.8;
}

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  transition: box-shadow var(--transition);
}

.nav.scrolled {
  box-shadow: var(--shadow-sm);
}

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

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.nav-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.nav-lab-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

.nav-institute {
  font-size: 0.65rem;
  color: var(--color-text-light);
  white-space: nowrap;
}

.nav-logo .logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
  position: relative;
  padding: 4px 0;
  transition: color var(--transition);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-secondary);
  transition: width var(--transition);
}

.nav-links a:hover {
  color: var(--color-secondary);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: var(--transition);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    url('../images/Lab%20Figures/home%20.jpg') center/cover no-repeat,
    linear-gradient(180deg, rgba(75, 29, 110, 0.3) 0%, rgba(0, 0, 0, 0.4) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  padding: 6px 20px;
  border: 1px solid var(--color-secondary);
  border-radius: 50px;
  color: var(--color-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 28px;
  letter-spacing: 0.5px;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 3.8rem;
  color: var(--color-primary);
  line-height: 1.2;
  margin-bottom: 16px;
}

.hero h1 .lab-name {
  display: block;
  font-size: 4.2rem;
  color: var(--color-secondary);
}

.hero-institute {
  font-size: 1rem;
  color: var(--color-secondary);
  font-weight: 500;
  margin: 0 auto 8px;
  letter-spacing: 0.5px;
}

.hero p {
  font-size: 1.2rem;
  color: var(--color-text-light);
  max-width: 560px;
  margin: 0 auto 36px;
}

.hero p .en {
  display: block;
  font-size: 0.95rem;
  color: var(--color-text-light);
  opacity: 0.7;
  margin-top: 6px;
}

.btn {
  display: inline-block;
  padding: 14px 36px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

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

.btn-primary:hover {
  background: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ===== Research Showcase ===== */
#research .showcase-gallery {
  display: flex;
  gap: 10px;
  overflow: hidden;
  background: var(--color-primary);
  padding: 10px 0;
  margin-bottom: 60px;
}

.showcase-gallery .gallery-track {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.showcase-gallery img {
  height: 208px;
  width: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.showcase-gallery img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  #research .showcase-gallery {
    padding: 10px 0;
    margin-bottom: 40px;
  }
  .showcase-gallery img {
    height: 143px;
  }
}
.research-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.research-card {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: all var(--transition);
  text-align: center;
}

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

.research-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: linear-gradient(135deg, rgba(75, 29, 110, 0.1), rgba(124, 63, 173, 0.1));
}

.research-card h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.research-card p {
  color: var(--color-text-light);
  font-size: 0.95rem;
  line-height: 1.8;
}

/* ===== Publications ===== */
.pub-list {
  max-width: 900px;
  margin: 0 auto;
}

.pub-item {
  display: flex;
  gap: 28px;
  padding: 28px 0;
  border-bottom: 1px solid var(--color-border);
  transition: padding var(--transition);
}

.pub-item:first-child {
  padding-top: 0;
}

.pub-item:hover {
  padding-left: 12px;
}

.pub-year {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.pub-info h4 {
  font-size: 1.05rem;
  color: var(--color-text);
  margin-bottom: 6px;
  line-height: 1.5;
}

.pub-authors {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 4px;
}

.pub-journal {
  font-size: 0.85rem;
  color: var(--color-secondary);
  font-weight: 600;
  font-style: italic;
}

.pub-comment {
  font-size: 0.8rem;
  color: var(--color-accent);
  margin-top: 6px;
  line-height: 1.5;
}

.pub-image {
  margin-top: 12px;
  border-radius: var(--radius);
  max-width: 300px;
  box-shadow: var(--shadow-sm);
  display: block;
}

.pub-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--color-accent);
  font-weight: 500;
  transition: color var(--transition);
}

.pub-link:hover {
  color: var(--color-secondary);
}

/* ===== Team Section ===== */
/* ===== Team Section ===== */
.team-section {
  margin-bottom: 56px;
}

.team-section:last-child {
  margin-bottom: 0;
}

.team-group-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  color: var(--color-primary);
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--color-border);
}

.team-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px 48px;
  max-width: 900px;
}

.team-row {
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform var(--transition);
}

.team-row:hover {
  transform: translateX(6px);
}

.team-photo {
  width: 200px;
  height: 240px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.team-row:hover .team-photo {
  box-shadow: var(--shadow-md);
}

.team-info h3 {
  font-size: 1.05rem;
  color: var(--color-text);
  margin-bottom: 2px;
}

.team-role {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 0;
}

.team-role.en {
  font-size: 0.82rem;
  opacity: 0.7;
  margin-bottom: 0;
}

.team-contact {
  font-size: 0.85rem;
  color: var(--color-accent);
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--transition);
}

.team-card:hover .team-contact {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Moments Section ===== */
.moments-list {
  max-width: 1000px;
  margin: 0 auto;
}

.moment-item {
  display: flex;
  gap: 24px;
  padding: 32px 0;
  border-bottom: 1px solid var(--color-border);
}

.moment-item:first-child {
  padding-top: 0;
}

.moment-date {
  flex-shrink: 0;
  text-align: center;
  min-width: 60px;
}

.moment-date .day {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-secondary);
  line-height: 1;
}

.moment-date .month {
  font-size: 0.8rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.moment-content h4 {
  font-size: 1.05rem;
  color: var(--color-text);
  margin-bottom: 4px;
}

.moment-content p {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 16px;
}

.moment-gallery {
  display: flex;
  gap: 10px;
  overflow: hidden;
  border-radius: 6px;
}

.moment-gallery .gallery-track {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.moment-gallery img {
  height: 200px;
  width: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}

.moment-gallery img:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* ===== Gallery Progress Bar ===== */
.gallery-progress {
  width: 100%;
  margin-top: 12px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.gallery-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-secondary);
  cursor: pointer;
  transition: transform var(--transition);
}

.gallery-progress::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.gallery-progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-secondary);
  cursor: pointer;
  border: none;
}

/* ===== Gallery Counter ===== */
.gallery-counter {
  text-align: center;
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-secondary);
}

/* ===== Lightbox ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 2001;
  background: none;
  border: none;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  background: none;
  border: none;
  opacity: 0.7;
  transition: opacity var(--transition);
  padding: 16px;
  z-index: 2001;
}

.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
}

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

/* ===== Contact Section ===== */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  max-width: 900px;
  margin: 0 auto;
}

.contact-info h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-primary);
  margin-bottom: 24px;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.contact-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(75, 29, 110, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.contact-item strong {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 2px;
}

.contact-item span {
  font-size: 0.95rem;
  color: var(--color-text);
}

/* ===== Footer ===== */
.footer {
  background: var(--color-primary);
  color: rgba(255, 255, 255, 0.75);
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 40px;
}

.footer h4 {
  font-family: var(--font-heading);
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.footer p {
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer a {
  color: rgba(255, 255, 255, 0.75);
  transition: color var(--transition);
  font-size: 0.9rem;
}

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

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--color-secondary);
  transform: translateY(-3px);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  :root {
    --nav-height: 64px;
  }

  .section {
    padding: 64px 0;
  }

  .section-title {
    font-size: 1.9rem;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    flex-direction: column;
    gap: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    box-shadow: var(--shadow-sm);
  }

  .nav-links.active {
    max-height: 320px;
  }

  .nav-links a {
    padding: 16px 24px;
    width: 100%;
    border-bottom: 1px solid var(--color-border);
  }

  .nav-toggle {
    display: flex;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .hero h1 .lab-name {
    font-size: 2.8rem;
  }

  .research-grid {
    grid-template-columns: 1fr;
  }

  .team-list {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .pub-item {
    flex-direction: column;
    gap: 16px;
  }

  .pub-year {
    width: 56px;
    height: 56px;
    font-size: 1rem;
  }
}

@media (max-width: 576px) {
  .hero h1 {
    font-size: 2rem;
  }

  .hero h1 .lab-name {
    font-size: 2.2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .team-list {
    grid-template-columns: 1fr;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .research-card {
    padding: 28px 20px;
  }

  .moment-item {
    flex-direction: column;
    gap: 8px;
  }

  .moment-date {
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .moment-gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}
