/* ========================================
   Ma Lab - Modern Academic Lab Website
   ======================================== */

:root {
  --color-primary: #1a56db;
  --color-primary-dark: #1340a8;
  --color-secondary: #0891b2;
  --color-accent: #059669;
  --color-bg: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-text: #1e293b;
  --color-text-light: #64748b;
  --color-border: #e2e8f0;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-width: 1200px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

/* Navigation */
.navbar {
  background: white;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.95);
}
.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-logo {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary) !important;
  text-decoration: none;
  letter-spacing: -0.5px;
}
.nav-menu { display: flex; gap: 4px; list-style: none; }
.nav-link {
  padding: 8px 16px;
  color: var(--color-text-light);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 6px;
  transition: all .2s;
}
.nav-link:hover, .nav-link.active { color: var(--color-primary); background: rgba(26,86,219,0.06); }
.nav-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; }

/* Main Content */
.main-content { min-height: calc(100vh - 64px - 220px); }

/* Page Hero / Header */
.page-header {
  text-align: center;
  padding: 60px 24px 40px;
  background: linear-gradient(135deg, #f0f4ff 0%, #f8fafc 50%, #ecfdf5 100%);
  border-bottom: 1px solid var(--color-border);
}
.page-header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: 12px;
  letter-spacing: -1px;
}
.page-header p {
  font-size: 1.15rem;
  color: var(--color-text-light);
  max-width: 680px;
  margin: 0 auto;
}

/* Content Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 24px;
}
.container-narrow {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px;
}

/* Homepage - Hero Image */
.hero-image-section {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  overflow: hidden;
}
.hero-photo {
  width: 100%;
  height: 400px;
  display: block;
  object-fit: cover;
  object-position: center;
}
@media (max-width: 768px) {
  .hero-photo { height: 260px; }
}

/* Homepage */
.hero-section {
  text-align: center;
  padding: 72px 24px 48px;
  background: linear-gradient(135deg, #1e3a6e 0%, #1a56db 50%, #0891b2 100%);
  color: white;
  position: relative;
  overflow: hidden;
}
/* Bacteriophage decorative elements */
.phage-deco {
  position: absolute;
  pointer-events: none;
}

/* Phage 1: large, left-top, cyan */
.phage-1 {
  left: 3%;
  top: 8%;
  width: 100px;
  opacity: 0.35;
  animation: phage-drift-1 7s ease-in-out infinite;
}

/* Phage 2: medium, right-top, green */
.phage-2 {
  right: 5%;
  top: 12%;
  width: 80px;
  opacity: 0.3;
  animation: phage-drift-2 9s ease-in-out infinite;
}

/* Phage 3: small, right-bottom, violet */
.phage-3 {
  right: 10%;
  bottom: 6%;
  width: 65px;
  opacity: 0.25;
  animation: phage-drift-3 8s ease-in-out infinite;
}

/* Phage 4: medium, left-bottom, gold */
.phage-4 {
  left: 6%;
  bottom: 4%;
  width: 75px;
  opacity: 0.28;
  animation: phage-drift-4 10s ease-in-out infinite;
}

/* Phage 5: small, center-left, light blue */
.phage-5 {
  left: 18%;
  top: 55%;
  width: 50px;
  opacity: 0.22;
  animation: phage-drift-5 6s ease-in-out infinite;
}

/* === Animations === */
@keyframes phage-drift-1 {
  0%, 100% { transform: translate(0, 0) rotate(-5deg); }
  50% { transform: translate(15px, -20px) rotate(5deg); }
}
@keyframes phage-drift-2 {
  0%, 100% { transform: translate(0, 0) rotate(8deg); }
  50% { transform: translate(-12px, -25px) rotate(-3deg); }
}
@keyframes phage-drift-3 {
  0%, 100% { transform: translate(0, 0) rotate(12deg); }
  50% { transform: translate(-10px, -15px) rotate(20deg); }
}
@keyframes phage-drift-4 {
  0%, 100% { transform: translate(0, 0) rotate(-8deg); }
  50% { transform: translate(18px, -22px) rotate(2deg); }
}
@keyframes phage-drift-5 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(10px, -18px) rotate(10deg); }
}
.hero-content {
  position: relative;
  z-index: 1;
}
.hero-section h1 {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 16px;
  letter-spacing: -1.5px;
}
.hero-section .subtitle {
  font-size: 1.25rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.88rem;
  backdrop-filter: blur(4px);
}
.hero-section img {
  max-width: 140px;
  border-radius: 12px;
  margin-top: 32px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 28px;
  margin-top: 36px;
}
.card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  transition: all .25s;
}
.card:hover {
  box-shadow: var(--shadow), 0 8px 24px rgba(26,86,219,0.08);
  transform: translateY(-2px);
}
.card-icon { font-size: 2rem; margin-bottom: 14px; }
.card h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; color: var(--color-text); }
.card p { color: var(--color-text-light); font-size: 0.94rem; line-height: 1.65; }

/* Research Direction Cards */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 32px;
  margin-top: 36px;
}
.research-card {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  transition: all .25s;
}
.research-card:hover { box-shadow: var(--shadow); }
.research-card-header {
  padding: 28px 28px 0;
}
.research-card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.research-card-body { padding: 20px 28px 28px; }
.research-card-body p { color: var(--color-text-light); font-size: 0.93rem; line-height: 1.7; }
.research-tag {
  display: inline-block;
  background: rgba(26,86,219,0.08);
  color: var(--color-primary);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-right: 6px;
  margin-bottom: 6px;
}

/* Team Table */
.team-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.team-table th {
  background: var(--color-bg-alt);
  padding: 14px 18px;
  text-align: left;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--color-border);
}
.team-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
}
.team-table tr:last-child td { border-bottom: none; }
.team-table tr:hover td { background: #fafbff; }
.team-table strong { color: var(--color-primary); }

.pi-profile {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 32px;
}
.team-pi-photo {
  width: 160px;
  height: auto;
  flex-shrink: 0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--color-border);
}
.pi-info h2 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 800;
}
.pi-info h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text-light);
}
.pi-info p {
  margin: 0;
}

@media (max-width: 640px) {
  .pi-profile {
    flex-direction: column;
    text-align: center;
  }
  .team-pi-photo {
    width: 140px;
  }
}

.section-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--color-text);
  letter-spacing: -0.5px;
}
.section-subtitle {
  color: var(--color-text-light);
  font-size: 1rem;
  margin-bottom: 28px;
}

/* Publications */
.authorship-legend {
  font-size: 0.95rem;
  color: var(--color-text);
  margin-bottom: 0;
}
.authorship-legend sup {
  font-size: 0.72em;
  font-weight: 600;
}
.pub-title-inline {
  color: var(--color-primary);
  font-weight: 700;
}
.content .selected-highlights {
  list-style: disc;
  padding-left: 22px;
}
.content .selected-highlights li {
  margin-bottom: 18px;
  line-height: 1.7;
  font-size: 0.95rem;
}
.content .selected-highlights li::marker {
  color: var(--color-primary);
}

/* Publication item cards (legacy) */
.pub-item {
  background: white;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 22px 26px;
  margin-bottom: 18px;
  transition: all .2s;
}
.pub-item:hover { box-shadow: var(--shadow); }
.pub-journal {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.9rem;
}
.pub-title {
  font-weight: 600;
  font-size: 1.02rem;
  margin: 6px 0 8px;
  line-height: 1.45;
}
.pub-authors {
  color: var(--color-text-light);
  font-size: 0.88rem;
  line-height: 1.55;
}
.highlight-pub {
  border-left-color: var(--color-accent);
  background: linear-gradient(135deg, #f0fdf4 0%, white 100%);
  border: 1px solid #bbf7d0;
}
.highlight-pub .pub-journal { color: var(--color-accent); }

/* Blog Post */
.blog-post {
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 24px;
  transition: all .2s;
}
.blog-post:hover { box-shadow: var(--shadow); }
.blog-post-date {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 8px;
}
.blog-post h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}
.blog-post a { color: var(--color-primary); text-decoration: none; }
.blog-post a:hover { text-decoration: underline; }

/* Join Us */
.join-box {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  margin: 32px 0;
}
.join-box h3 { font-size: 1.4rem; margin-bottom: 12px; }
.join-box p { color: var(--color-text-light); max-width: 600px; margin: 0 auto; }
.btn-primary {
  display: inline-block;
  background: var(--color-primary);
  color: white !important;
  padding: 12px 28px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all .2s;
  margin-top: 16px;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,86,219,0.3);
}

/* Markdown content */
.content h2 {
  font-size: 1.65rem;
  font-weight: 800;
  margin: 44px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-bg-alt);
  color: var(--color-text);
}

/* Publications page: year headings and list spacing */
.publications-content h2 {
  color: var(--color-primary);
  border-bottom-color: var(--color-border);
  margin-top: 48px;
}
.publications-content ul {
  list-style: disc;
  padding-left: 22px;
}
.publications-content li {
  margin-bottom: 16px;
  line-height: 1.7;
  font-size: 0.95rem;
}
.publications-content li::marker {
  color: var(--color-primary);
}
.publications-content sup {
  font-size: 0.72em;
  font-weight: 600;
}

  font-size: 1.3rem;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--color-text);
}
.content p { margin-bottom: 16px; color: var(--color-text); font-size: 0.96rem; }
.content ul, .content ol { padding-left: 24px; margin-bottom: 16px; }
.content li { margin-bottom: 6px; color: var(--color-text); font-size: 0.96rem; }
.content a { color: var(--color-primary); text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content strong { font-weight: 700; color: var(--color-text); }
.content code {
  font-family: var(--font-mono);
  background: var(--color-bg-alt);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.88em;
}
.content blockquote {
  border-left: 4px solid var(--color-primary);
  background: var(--color-bg-alt);
  padding: 16px 22px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
  color: var(--color-text-light);
  font-style: italic;
}
.content hr {
  border: none;
  height: 1px;
  background: var(--color-border);
  margin: 36px 0;
}
/* Selected Highlights on Homepage */
.highlight-list {
  list-style: disc;
  padding-left: 22px;
  margin-bottom: 0;
}
.highlight-list li {
  margin-bottom: 20px;
  line-height: 1.75;
  color: var(--color-text);
  font-size: 0.97rem;
}
.highlight-list li::marker {
  color: var(--color-primary);
  font-size: 1rem;
}
.highlight-title {
  color: var(--color-primary);
  font-weight: 700;
}
.highlight-title:hover {
  text-decoration: underline;
  cursor: pointer;
}
.highlight-list sup {
  font-size: 0.72em;
  font-weight: 600;
}

.content th, .content td {
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  text-align: left;
  font-size: 0.91rem;
}
.content th { background: var(--color-bg-alt); font-weight: 600; }

/* Footer */
.footer {
  background: linear-gradient(135deg, #f0f4ff 0%, #f8fafc 50%, #ecfdf5 100%);
  color: var(--color-text-light);
  padding: 40px 24px 24px;
  margin-top: 48px;
  border-top: 1px solid var(--color-border);
}
.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}
.footer-info { font-size: 0.88rem; line-height: 1.8; margin-bottom: 16px; }
.footer-info strong { color: var(--color-text); }
.footer-info a { color: var(--color-primary); text-decoration: none; }
.footer-links { font-size: 0.85rem; margin-bottom: 16px; }
.footer-links a { color: var(--color-text-light); text-decoration: none; }
.footer-links a:hover { color: var(--color-primary); }
.footer-copy { font-size: 0.82rem; color: #94a3b8; border-top: 1px solid var(--color-border); padding-top: 16px; }

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  }
  .nav-menu.open { display: flex; }
  .hero-section h1 { font-size: 2rem; }
  .page-header h1 { font-size: 1.85rem; }
  .cards-grid, .research-grid { grid-template-columns: 1fr; }
  .container, .container-narrow { padding: 32px 16px; }
  .content table { display: block; overflow-x: auto; }
  .team-table { font-size: 0.84rem; }
  .team-table th, .team-table td { padding: 10px 12px; }
}

/* Contact Page */
.contact-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 0;
  margin-bottom: 0.5em;
}

.contact-info h3 {
  color: var(--color-text);
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.contact-info p {
  margin-bottom: 0.6em;
  line-height: 1.6;
  font-size: 1rem;
}

.contact-info a {
  color: var(--color-primary);
  text-decoration: none;
}

.contact-info a:hover {
  text-decoration: underline;
}

/* Publications Tabs */
.pub-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.pub-tab {
  display: inline-block;
  padding: 10px 24px;
  border: 1px solid var(--color-primary);
  border-radius: 6px;
  color: var(--color-primary);
  background: white;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.pub-tab.active,
.pub-tab:hover {
  background: var(--color-primary);
  color: white;
}

.pub-section {
  display: none;
}

.pub-section.active {
  display: block;
}

.patent-list {
  list-style: disc;
  padding-left: 24px;
}

.patent-list li {
  margin-bottom: 20px;
  line-height: 1.75;
  color: var(--color-text);
  font-size: 0.97rem;
}

.patent-list li::marker {
  color: var(--color-primary);
  font-size: 1rem;
}
