/* === LIVELY THEME REWRITE (COMPLETE RESTORE) === */

/* --- Configuration --- */
:root {
  --poly-red: #A20034;
  --text-color: #333;
  --bg-color: #fdfdfd;
  --header-height: 4.5rem;
}

/* --- Prevent Double Scrollbars Globally --- */
/* Ensure only body scrolls, not html or containers */
html {
  overflow-x: hidden !important;
  overflow-y: visible !important;
  height: auto !important;
  max-height: none !important;
}

html[data-md-scrollfix] {
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

/* Prevent Material theme containers from creating scrollbars */
.md-container,
.md-container__inner,
.md-wrapper,
.md-main,
.md-main__inner,
.md-tabs,
.md-tabs__list,
.md-tabs__item {
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* --- Base & Typography --- */
/* Modern Font Stack */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.75;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    /* Prevent horizontal scroll only, let browser handle vertical scroll naturally */
    overflow-x: hidden !important;
    overflow-y: visible !important;
    position: relative !important;
    height: auto !important;
    max-height: none !important;
}

code, pre, .highlight {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-weight: 500;
}

p {
    font-size: 1rem;
    line-height: 1.8;
    font-weight: 400;
    margin-bottom: 1.25rem;
}

.md-main h1 { 
    font-weight: 800; 
    color: #111; 
    font-size: 2.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.md-main h2 { 
    font-weight: 700; 
    color: #111; 
    font-size: 2rem;
    line-height: 1.3;
    letter-spacing: -0.015em;
    margin-bottom: 1.25rem;
}

.md-main h3 { 
    font-weight: 600; 
    color: #333; 
    font-size: 1.5rem;
    line-height: 1.4;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
}

.md-main h4 {
    font-weight: 600;
    color: #333;
    font-size: 1.25rem;
    line-height: 1.5;
    letter-spacing: -0.01em;
    margin-bottom: 0.875rem;
}

/* ============================================
   SCROLL OFFSET: Prevent header from遮挡ing TOC anchor links
   ============================================ */
/* Mobile: header only (4.5rem) + padding */
@media screen and (max-width: 76.1875em) {
    html {
        scroll-padding-top: calc(var(--header-height) + 1rem) !important; /* 5.5rem */
    }
    
    .md-main h1,
    .md-main h2,
    .md-main h3,
    .md-main h4,
    .md-content h1[id],
    .md-content h2[id],
    .md-content h3[id],
    .md-content h4[id],
    .md-content h5[id],
    .md-content h6[id],
    .md-typeset h1[id],
    .md-typeset h2[id],
    .md-typeset h3[id],
    .md-typeset h4[id],
    .md-typeset h5[id],
    .md-typeset h6[id] {
        scroll-margin-top: calc(var(--header-height) + 1rem) !important;
        scroll-padding-top: calc(var(--header-height) + 1rem) !important;
    }
}

/* Desktop: header (4.5rem) + tabs (~3.5rem) + padding = 8.5rem */
@media screen and (min-width: 76.1875em) {
    html {
        scroll-padding-top: 8.5rem !important; /* 136px */
    }
    
    .md-main h1,
    .md-main h2,
    .md-main h3,
    .md-main h4,
    .md-content h1[id],
    .md-content h2[id],
    .md-content h3[id],
    .md-content h4[id],
    .md-content h5[id],
    .md-content h6[id],
    .md-typeset h1[id],
    .md-typeset h2[id],
    .md-typeset h3[id],
    .md-typeset h4[id],
    .md-typeset h5[id],
    .md-typeset h6[id] {
        scroll-margin-top: 8.5rem !important;
        scroll-padding-top: 8.5rem !important;
    }
}
a {
    color: var(--poly-red);
    transition: all 0.2s ease-in-out;
}
a:hover {
    color: #333;
}

/* ============================================
   HEADER SECTION - Systematically Organized
   ============================================ */

/* --- Header Container: Sticky Positioning --- */
.md-header,
.md-header[data-md-state],
.md-header[data-md-state="hidden"],
.md-header[data-md-state="shadow"] {
  /* Layout & Positioning */
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 100 !important;
  height: var(--header-height) !important;
  
  /* Visual Styling */
  background: linear-gradient(to bottom, #ffffff 0%, #fafafa 100%) !important;
  backdrop-filter: blur(10px);
  box-shadow: none !important;
  border-bottom: none !important;
  
  /* Display & Visibility */
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  translate: 0 0 !important;
  max-height: none !important;
  clip: auto !important;
  clip-path: none !important;
  
  /* Performance */
  will-change: transform !important;
  transition: all 0.3s ease;
}

/* Override Material theme state-based hiding */
html .md-header,
html[data-md-state] .md-header,
html[data-md-state="hidden"] .md-header,
html[data-md-state="shadow"] .md-header,
body .md-header,
body[data-md-state] .md-header,
body[data-md-state="hidden"] .md-header,
body[data-md-state="shadow"] .md-header {
  position: sticky !important;
  top: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  display: flex !important;
}

/* --- Header Inner Container --- */
.md-header__inner {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  height: 100% !important;
  max-width: 1400px !important;
  padding: 0 2rem !important;
  margin: 0 auto !important;
  gap: 1rem !important;
  z-index: 100 !important;
  box-sizing: border-box !important;
  
  /* Ensure visibility */
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  translate: 0 0 !important;
}

/* Override Material theme state-based hiding for inner */
.md-header[data-md-state] .md-header__inner,
.md-header[data-md-state="hidden"] .md-header__inner,
.md-header[data-md-state="shadow"] .md-header__inner,
html[data-md-state] .md-header__inner,
html[data-md-state="hidden"] .md-header__inner,
html[data-md-state="shadow"] .md-header__inner,
body[data-md-state] .md-header__inner,
body[data-md-state="hidden"] .md-header__inner,
body[data-md-state="shadow"] .md-header__inner {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
}

/* --- Header Decorative Elements --- */
.md-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.08) 50%, transparent 100%);
}

/* --- Logo Styling --- */
.md-logo {
  display: flex !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  height: 100% !important;
  order: 0 !important;
  transition: transform 0.2s ease;
}

.md-logo:hover {
  transform: scale(1.05);
}

.md-logo img {
  height: 2.5rem !important;
  width: auto !important;
  vertical-align: middle !important;
  display: block !important;
  margin: 0 !important;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
  transition: filter 0.2s ease;
}

.md-logo:hover img {
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

/* --- Header Title (Site Name) --- */
.md-header__title {
  /* Layout & Positioning */
  order: 1 !important;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
  min-width: auto !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  padding-left: 1rem !important;
  z-index: 101 !important;
  
  /* Typography */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-size: 1.1rem !important;
  font-weight: 500 !important;
  color: #333 !important;
  letter-spacing: 0.01em !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  
  /* Visibility */
  opacity: 1 !important;
  visibility: visible !important;
  
  /* Interaction */
  transition: color 0.2s ease;
}

.md-header__title:hover {
  color: var(--poly-red) !important;
}

/* Override Material theme hiding for title */
.md-header__title[hidden],
.md-header__title[aria-hidden="true"],
.md-header__title[data-md-state],
.md-header__title[data-md-state="hidden"],
.md-header__title[data-md-state="shadow"],
html .md-header__title,
html[data-md-state] .md-header__title,
html[data-md-state="hidden"] .md-header__title,
html[data-md-state="shadow"] .md-header__title,
body .md-header__title,
body[data-md-state] .md-header__title,
body[data-md-state="hidden"] .md-header__title,
body[data-md-state="shadow"] .md-header__title {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
}

/* --- Header Title Text Elements --- */
.md-header__title .md-header__ellipsis {
  display: flex !important;
  align-items: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
}

.md-header__title .md-header__topic {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  font-weight: 500 !important;
  color: #333 !important;
  letter-spacing: 0.01em !important;
  line-height: 1 !important;
  font-size: 1.1rem !important;
  transition: color 0.2s ease;
}

.md-header__title .md-header__topic .md-ellipsis {
  display: inline !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #333 !important;
  font-weight: 500 !important;
}

/* Override Material theme hiding for title text */
.md-header__title .md-header__ellipsis::before,
.md-header__title .md-header__topic::before {
  content: none !important;
}

html .md-header__title .md-header__ellipsis,
html[data-md-state] .md-header__title .md-header__ellipsis,
html[data-md-state="hidden"] .md-header__title .md-header__ellipsis,
html[data-md-state="shadow"] .md-header__title .md-header__ellipsis,
body .md-header__title .md-header__ellipsis,
body[data-md-state] .md-header__title .md-header__ellipsis,
body[data-md-state="hidden"] .md-header__title .md-header__ellipsis,
body[data-md-state="shadow"] .md-header__title .md-header__ellipsis {
  display: flex !important;
  align-items: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
}

html .md-header__title .md-header__topic,
html[data-md-state] .md-header__title .md-header__topic,
html[data-md-state="hidden"] .md-header__title .md-header__topic,
html[data-md-state="shadow"] .md-header__title .md-header__topic,
body .md-header__title .md-header__topic,
body[data-md-state] .md-header__title .md-header__topic,
body[data-md-state="hidden"] .md-header__title .md-header__topic,
body[data-md-state="shadow"] .md-header__title .md-header__topic {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
}

html .md-header__title .md-header__topic .md-ellipsis,
html[data-md-state] .md-header__title .md-header__topic .md-ellipsis,
body .md-header__title .md-header__topic .md-ellipsis,
body[data-md-state] .md-header__title .md-header__topic .md-ellipsis {
  display: inline !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Override any bold/black styles */
.md-header__title *,
.md-header__topic,
.md-header__ellipsis {
  font-weight: 500 !important;
  color: #333 !important;
  text-shadow: none !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* --- Header Buttons --- */
/* Ensure menu button is always on the left on mobile */
@media screen and (max-width: 76.1875em) {
  .md-header__inner {
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
  }
  
  /* Force drawer button to be first and on the left */
  .md-header__inner > label[for="__drawer"],
  .md-header__inner > .md-header__button[for="__drawer"],
  .md-header__inner > .md-header__button[aria-label="Open navigation"],
  .md-header__inner > .md-header__button[data-md-toggle="drawer"] {
    order: -999 !important;
    margin-left: 0 !important;
    margin-right: 0.5rem !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 201 !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .md-header__inner > .md-logo {
    order: -5 !important;
    margin-right: 0.5rem !important;
    flex-shrink: 0 !important;
  }
  
  .md-header__inner > .md-header__title {
    order: 0 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }
}

.md-header__button {
  color: #555 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0.6rem !important;
  flex-shrink: 0 !important;
  width: auto !important;
  height: auto !important;
  border-radius: 6px !important;
  transition: all 0.2s ease !important;
}

.md-header__button:hover {
  color: var(--poly-red) !important;
  background-color: rgba(162,0,52,0.08) !important;
}

.md-header__button svg {
  width: 1.6rem !important;
  height: 1.6rem !important;
}

/* --- Header + Tabs Relationship --- */
.md-header ~ .md-tabs {
  margin-top: 0 !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05) !important;
  background: linear-gradient(to bottom, #fafafa 0%, #ffffff 100%) !important;
}

/* --- Mobile Header Adjustments --- */
@media screen and (max-width: 76.1875em) {
  .md-header {
    box-shadow: 0 2px 10px rgba(0,0,0,0.08) !important;
  }
  .md-header::after {
    display: none !important;
  }
}

/* --- Wide Screen Header Adjustments --- */
@media screen and (min-width: 76.1875em) {
  /* Hide menu button on wide screens */
  .md-header__button[for="__drawer"],
  .md-header__button[aria-label="Open navigation"] {
    display: none !important;
  }
  
  /* Ensure header maintains sticky positioning */
  .md-header,
  .md-header[data-md-state],
  .md-header[data-md-state="hidden"],
  .md-header[data-md-state="shadow"],
  html .md-header,
  html[data-md-state] .md-header,
  html[data-md-state="hidden"] .md-header,
  html[data-md-state="shadow"] .md-header,
  body .md-header,
  body[data-md-state] .md-header,
  body[data-md-state="hidden"] .md-header,
  body[data-md-state="shadow"] .md-header {
    position: sticky !important;
    top: 0 !important;
  }
  
  /* Ensure title is visible on wide screens */
  .md-header__title,
  .md-header__title[hidden],
  .md-header__title[aria-hidden="true"],
  .md-header__title[data-md-state],
  .md-header__title[data-md-state="hidden"],
  .md-header__title[data-md-state="shadow"],
  html .md-header__title,
  html[data-md-state] .md-header__title,
  html[data-md-state="hidden"] .md-header__title,
  html[data-md-state="shadow"] .md-header__title,
  body .md-header__title,
  body[data-md-state] .md-header__title,
  body[data-md-state="hidden"] .md-header__title,
  body[data-md-state="shadow"] .md-header__title {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
  }
  
  /* Ensure title text is visible on wide screens */
  .md-header__title .md-header__ellipsis,
  html .md-header__title .md-header__ellipsis,
  html[data-md-state] .md-header__title .md-header__ellipsis,
  body .md-header__title .md-header__ellipsis,
  body[data-md-state] .md-header__title .md-header__ellipsis {
    display: flex !important;
    align-items: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
  }
  
  .md-header__title .md-header__topic,
  html .md-header__title .md-header__topic,
  html[data-md-state] .md-header__title .md-header__topic,
  body .md-header__title .md-header__topic,
  body[data-md-state] .md-header__title .md-header__topic {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
  }
  
  .md-header__title .md-header__topic .md-ellipsis,
  html .md-header__title .md-header__topic .md-ellipsis,
  body .md-header__title .md-header__topic .md-ellipsis {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
}
/* Ensure tabs container is sticky - Fused with header */
.md-tabs {
  background-color: white !important;
  position: sticky !important;
  top: var(--header-height) !important;
  z-index: 99 !important;
  border-bottom: 1px solid #e0e0e0 !important;
  border-top: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  margin-top: 0 !important;
  width: 100% !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  padding-top: 0 !important;
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  height: auto !important;
  max-height: none !important;
}

/* Hide tabs when menu button is visible (mobile/narrow screens) */
@media screen and (max-width: 76.1875em) {
  .md-tabs {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

.md-tabs__list {
  position: relative !important;
  z-index: 99 !important;
  display: flex !important;
  visibility: visible !important;
  overflow: visible !important;
  overflow-x: visible !important;
  overflow-y: visible !important;
  height: auto !important;
  max-height: none !important;
}

.md-tabs__item {
  z-index: 99 !important;
  visibility: visible !important;
}

.md-tabs__link {
  visibility: visible !important;
  opacity: 1 !important;
}
.md-tabs__link {
    color: #555;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: none;
    letter-spacing: -0.01em;
    padding: 0.6rem 1rem !important;
    transition: color 0.2s ease, background-color 0.2s ease;
    border-radius: 4px;
    margin: 0 0.25rem;
}
.md-tabs__link--active {
    color: var(--poly-red) !important;
    background-color: rgba(162,0,52,0.05) !important;
}
.md-tabs__link:hover {
    color: var(--poly-red) !important;
    background-color: rgba(162,0,52,0.03) !important;
}

/* Ensure tabs dropdown/more menu is clickable */
.md-tabs__more {
  z-index: 100 !important;
  pointer-events: auto !important;
}

.md-select__inner {
  z-index: 100 !important;
  pointer-events: auto !important;
}

.md-select__inner .md-nav__link {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* Ensure tabs dropdown menu appears above overlay */
.md-select {
  z-index: 100 !important;
}

.md-select__inner {
  background-color: white !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* --- HIDING ELEMENTS --- */
@media screen and (min-width: 76.1875em) { /* Hide sidebars on larger screens */
    .md-sidebar--primary, .md-sidebar--secondary {
        display: none !important;
    }
}
.md-search { /* Always hide search by default */
    display: none !important;
}
/* Explicitly hide the right-hand Table of Contents (TOC) */
.md-sidebar--secondary, .md-toc {
    display: none !important;
}
/* Hide the left-hand primary sidebar on desktop, but allow it on mobile */
@media screen and (min-width: 76.1875em) {
    .md-sidebar--primary {
        display: none !important;
    }
}

/* Fix drawer/overlay styling for mobile menu */
.md-drawer {
  background-color: white !important;
  z-index: 200 !important;
}

.md-drawer__inner {
  background-color: white !important;
}

/* Overlay - default hidden, only show when drawer is open (mobile menu) */
.md-overlay {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  z-index: 199 !important;
  background-color: rgba(0, 0, 0, 0.54) !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
}

/* Only show overlay when drawer is open (mobile menu) */
.md-drawer[data-md-state="open"] ~ .md-overlay {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Hide overlay when tabs dropdown is open - tabs dropdown should not trigger overlay */
.md-select[data-md-state="open"] ~ .md-overlay {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Note: Header sticky positioning is defined above in the Header Section */

.md-tabs {
  z-index: 99 !important;
  pointer-events: auto !important;
  position: relative !important;
}

/* Ensure tabs dropdown menu is above everything, including overlay */
.md-tabs__more,
.md-select,
.md-select__inner {
  z-index: 101 !important;
  pointer-events: auto !important;
  position: relative !important;
}

/* Specifically ensure tabs dropdown is always clickable */
.md-select__inner {
  background-color: white !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  border-radius: 4px !important;
  overflow: visible !important;
}

/* Make sure tabs dropdown items are clickable and visible */
.md-select__inner .md-nav__link {
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: 102 !important;
  color: #555 !important;
  background-color: white !important;
}

.md-select__inner .md-nav__link:hover {
  color: var(--poly-red) !important;
  background-color: rgba(162,0,52,0.05) !important;
}

.md-select__inner .md-nav__link--active {
  color: var(--poly-red) !important;
  background-color: rgba(162,0,52,0.1) !important;
}

/* Ensure dropdown menu text is always visible */
.md-select__inner .md-nav__item {
  color: #555 !important;
}

.md-select__inner .md-nav__item .md-ellipsis {
  color: #555 !important;
}

.md-select__inner .md-nav__item:hover .md-ellipsis,
.md-select__inner .md-nav__item:hover .md-nav__link {
  color: var(--poly-red) !important;
}

/* Ensure tabs more button is clickable */
.md-tabs__more button,
.md-tabs__more .md-icon {
  pointer-events: auto !important;
  cursor: pointer !important;
  z-index: 101 !important;
}

/* Ensure drawer is visible when open */
.md-drawer[data-md-state="open"] {
  visibility: visible !important;
  opacity: 1 !important;
  transform: translateX(0) !important;
}

.md-nav__title {
  background-color: white !important;
  color: #2c3e50 !important;
  font-weight: 600 !important;
  padding: 1rem 1.5rem !important;
  border-bottom: 1px solid #e0e0e0 !important;
}

.md-nav__list {
  background-color: white !important;
}

.md-nav__item {
  border-bottom: 1px solid #f0f0f0 !important;
}

.md-nav__link {
  color: #555 !important;
  padding: 0.75rem 1.5rem !important;
  transition: all 0.2s ease !important;
  display: block !important;
}

.md-nav__link {
  color: #555 !important;
}

.md-nav__link:hover,
.md-nav__link--active {
  color: var(--poly-red) !important;
  background-color: rgba(162,0,52,0.05) !important;
}

/* Ensure nav link text is always visible */
.md-nav__link .md-ellipsis {
  color: inherit !important;
}

.md-nav__item {
  color: #555 !important;
}

/* Ensure navigation is visible in drawer */
.md-drawer .md-nav {
  display: block !important;
  visibility: visible !important;
}

/* Ensure drawer nav items can expand/collapse */
.md-drawer .md-nav__item {
  position: relative !important;
}

.md-drawer .md-nav__toggle {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  cursor: pointer !important;
}

.md-drawer .md-nav__toggle:checked ~ .md-nav {
  display: block !important;
  visibility: visible !important;
}

.md-drawer .md-nav__toggle:checked ~ .md-nav__link {
  display: block !important;
}

/* Ensure nested nav items (sections) are visible when expanded - default to visible */
.md-drawer .md-nav__item .md-nav:not(.md-nav--secondary) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

.md-drawer .md-nav__item .md-nav__toggle:checked ~ .md-nav:not(.md-nav--secondary),
.md-drawer .md-nav__item .md-nav__toggle:checked + .md-nav__link ~ .md-nav:not(.md-nav--secondary),
.md-drawer .md-nav__item .md-nav__toggle:checked ~ label ~ .md-nav:not(.md-nav--secondary) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure nested nav items are visible when parent is active */
.md-drawer .md-nav__item--active .md-nav:not(.md-nav--secondary),
.md-drawer .md-nav__item .md-nav:not(.md-nav--secondary) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure all primary nav items (tabs) are visible */
.md-drawer .md-nav--primary .md-nav__item {
  display: block !important;
  visibility: visible !important;
}

/* Ensure nested nav items within tabs are visible */
.md-drawer .md-nav--primary .md-nav__item .md-nav:not(.md-nav--secondary) {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Ensure nav items with children show toggle icon */
.md-drawer .md-nav__item--nested .md-nav__link {
  padding-right: 3rem !important;
}

.md-drawer .md-nav__item--nested .md-nav__link::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform 0.2s ease;
}

.md-drawer .md-nav__item--nested .md-nav__toggle:checked ~ .md-nav__link::after {
  transform: translateY(-50%) rotate(180deg);
}

/* ============================================
   DRAWER: Hide TOC to avoid duplicates
   ============================================ */
/* Hide TOC in drawer to prevent duplicate navigation items */

/* Hide TOC toggle checkbox and label */
.md-drawer input#__toc {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.md-drawer label[for="__toc"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Hide TOC Container */
.md-drawer .md-nav__item--active .md-nav--secondary,
.md-drawer .md-nav__item--active nav.md-nav--secondary,
.md-drawer .md-nav--secondary {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
}

/* Hide TOC Title */
.md-drawer .md-nav--secondary .md-nav__title {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

/* Hide TOC List */
.md-drawer .md-nav--secondary .md-nav__list,
.md-drawer .md-nav--secondary .md-nav__list[data-md-component="toc"],
.md-drawer .md-nav__item--active .md-nav__list[data-md-component="toc"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
}

/* Hide TOC Items and Links */
.md-drawer .md-nav--secondary .md-nav__item,
.md-drawer .md-nav--secondary .md-nav__link,
.md-drawer .md-nav__item--active .md-nav--secondary .md-nav__item,
.md-drawer .md-nav__item--active .md-nav--secondary .md-nav__link {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* Ensure all nav items in drawer are visible */
.md-drawer .md-nav--primary .md-nav__list > .md-nav__item {
  display: block !important;
  visibility: visible !important;
}

.md-drawer .md-nav--primary .md-nav__list > .md-nav__item .md-nav__link {
  display: block !important;
  visibility: visible !important;
}

/* --- HOMEPAGE: Full-width Hero Banner --- */
.hero-banner {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: calc(-1 * var(--header-height));
  padding-top: var(--header-height);
  height: 60vh;
  min-height: 400px;
  background: linear-gradient(135deg, rgba(162,0,52,0.85) 0%, rgba(96,0,24,0.85) 100%), url('https://placehold.co/1920x1080/2c3e50/f8f9fa?text=Lab+Photo+Placeholder');
  background-size: cover;
  background-position: center;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-content {
  text-align: center;
  animation: fadeIn 1s ease-in-out;
}
.hero-content h1 {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: white;
  text-shadow: 0 3px 8px rgba(0,0,0,0.3);
}
.hero-content h3 {
    font-size: 1.6rem;
    font-weight: 300;
    opacity: 0.9;
    color: white;
}

/* --- Carousel Specific Styles --- */
.hero-carousel {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: calc(-1 * var(--header-height));
  padding-top: 0;
  height: 60vh;
  min-height: 400px;
  overflow: hidden; /* Hide overflow from slides */
  display: block; /* Changed from flex to block */
  background-color: transparent; /* Transparent fallback */
  /* Ensure carousel doesn't get clipped */
  box-sizing: border-box;
}

.hero-overlay-content {
  position: absolute;
  top: 50%; /* Center vertically */
  left: 50%; /* Center horizontally */
  transform: translate(-50%, -50%); /* Adjust for element's own size */
  z-index: 5; /* Ensure it's above slides and controls */
  text-align: center;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  animation: fadeIn 1s ease-in-out;
}

/* On mobile, ensure hero content doesn't cover drawer */
@media screen and (max-width: 76.1875em) {
  .hero-overlay-content {
    z-index: 2 !important;
  }
}

.hero-overlay-content h1 {
  font-size: 5rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  color: #ffffff;
  letter-spacing: -0.05em;
  line-height: 1.05;
  text-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.2),
    0 8px 16px rgba(0, 0, 0, 0.15);
  position: relative;
  display: inline-block;
  text-transform: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.hero-overlay-content h1::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-radius: 8px;
  padding: 1rem 2rem;
  margin: -1rem -2rem;
  backdrop-filter: blur(10px);
  z-index: -1;
}

.hero-overlay-content h3 {
    font-size: 1.4rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.98);
    letter-spacing: 0.01em;
    line-height: 1.6;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.3);
    max-width: 750px;
    margin: 0 auto;
    font-style: normal;
}

.carousel-slides {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform 0.5s ease-in-out;
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
  will-change: transform;
  /* Ensure slides container spans full width */
  min-width: 100%;
  /* Ensure flex container doesn't wrap */
  flex-wrap: nowrap;
}

.carousel-slide {
  flex: 0 0 100%; /* Don't grow, don't shrink, base width 100% */
  width: 100%;
  height: 100%;
  min-width: 100%;
  max-width: 100%;
  background-size: cover !important;
  background-position: center center !important;
  background-repeat: no-repeat !important;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  position: relative;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Ensure slide doesn't overflow */
  overflow: hidden;
  /* Ensure slide takes exactly 100% of container width */
  flex-shrink: 0;
  flex-grow: 0;
  /* Ensure background image covers entire slide */
  display: block;
}

.carousel-slide::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4); /* Dark overlay */
  z-index: 1;
}

.carousel-slide .hero-content {
  position: relative;
  z-index: 2;
}

.carousel-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  padding: 1rem 1.2rem;
  cursor: pointer;
  font-size: 1.5rem;
  z-index: 10;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

.carousel-control:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.carousel-control.prev {
  left: 1rem;
}

.carousel-control.next {
  right: 1rem;
}

.carousel-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 0.5rem;
}

.dot {
  height: 10px;
  width: 10px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  display: inline-block;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.dot.active, .dot:hover {
  background-color: white;
  transform: scale(1.2);
}

/* --- HOMEPAGE: Sections (Open Layout) --- */
.page-sections {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}
.page-sections section {
  margin: 4rem 0;
  padding: 2.5rem 0;
  border-bottom: 1px solid #eee;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUpFadeIn 0.8s forwards;
}
.page-sections section:first-of-type { /* Target the first section */
  margin-top: 3rem; /* Reduce top margin specifically for the first section */
}
.page-sections section:last-child {
  border-bottom: none;
  margin-bottom: 2rem;
}
.page-sections h2 {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 2.5rem;
  text-align: center;
  color: #2c3e50;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.welcome-section {
  display: flex;
  align-items: center;
  gap: 3rem;
}
.welcome-text { flex: 2; }
.welcome-image img {
  border-radius: 8px !important;
  border: 1px solid #e0e0e0 !important;
  width: 250px !important;
  height: 250px !important;
}
.highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2.5rem;
  margin-top: 1rem;
}
.highlight-card {
    text-align: center;
    padding: 1rem;
}
.highlight-card img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.highlight-card h3 { 
  font-size: 1.6rem; 
  font-weight: 800;
  margin-bottom: 1rem;
  color: #2c3e50;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.highlight-card p { 
  color: #666; 
  line-height: 1.6;
  font-size: 0.85rem;
  font-weight: 400;
  /* Add ellipsis for text overflow */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: calc(1.6em * 3); /* Approximately 3 lines */
}

/* --- HOMEPAGE: Research Interests Section --- */
.interests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  text-align: center;
}
.interest-item h4 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #34495e;
}
.interest-item p {
  color: #666;
  font-size: 0.8rem;
  line-height: 1.6;
}
/* .interest-card p is now defined above with ellipsis */

/* --- PEOPLE PAGE --- */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  justify-content: center;
}
.team-member {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.team-member:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(44, 62, 80, 0.1);
}
.team-member img {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 4px solid var(--poly-red);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.team-member h3 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #2c3e50;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.team-member .title {
  color: var(--poly-red);
  font-weight: 700;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.team-member .bio {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.6;
  font-weight: 400;
  /* Add ellipsis for text overflow */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: calc(1.6em * 4); /* Approximately 4 lines */
}

/* --- JOIN US SECTION ON PEOPLE PAGE --- */
.join-us-section {
  text-align: center;
  margin: 5rem auto;
  padding: 3rem 2rem;
  max-width: 800px;
  background-color: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}
.join-us-section h2 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #2c3e50;
}
.join-us-section p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 2rem;
  line-height: 1.7;
  font-weight: 400;
}
.button-join {
  display: inline-block;
  background-color: var(--poly-red);
  color: white !important;
  padding: 0.875rem 2rem;
  border-radius: 6px;
  text-decoration: none !important;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(162,0,52,0.2);
  border: none;
}
.button-join:hover {
  background-color: #8b0028; /* Slightly darker red */
  color: white !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(162,0,52,0.3);
}
.button-join:visited {
  color: white !important;
}
.button-join:active {
  color: white !important;
}
.button-join:focus {
  color: white !important;
  outline: 2px solid rgba(162,0,52,0.5);
  outline-offset: 2px;
}

/* --- RESEARCH PAGE: INTERESTS & TIMELINE --- */
.research-interests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.interest-card {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-left: 4px solid var(--poly-red);
  padding: 1.5rem 2rem;
  border-radius: 4px;
}
.interest-card h4 {
  margin-top: 0;
  color: var(--poly-red);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.interest-card p {
  font-size: 0.75rem;
  line-height: 1.6;
  font-weight: 400;
  color: #666;
  /* Add ellipsis for text overflow */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: calc(1.6em * 4); /* Approximately 4 lines */
}
.timeline {
  position: relative;
  max-width: 900px;
  margin: 2rem auto 1.5rem auto;
  padding-left: 2rem;
  border-left: 2px solid #e9ecef;
}
.timeline-item {
  position: relative;
  margin-bottom: 1.2rem;
  padding-bottom: 0.8rem;
}
.timeline-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.3rem;
  top: 0.15rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background-color: var(--poly-red);
  border: 2px solid white;
  box-shadow: 0 0 0 2px var(--poly-red);
}
.timeline-date {
  font-weight: 700;
  color: var(--poly-red);
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  line-height: 1.2;
}
.timeline-content h4 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 0.25rem;
}

/* --- Research Experience Section --- */
.timeline-content p {
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: 0;
    margin-top: 0;
    color: #555;
    /* Remove ellipsis to show full text */
    display: block;
    overflow: visible;
    text-overflow: clip;
    max-height: none;
}

/* --- ALL OTHER PAGES: Centered Content Card --- */
.md-main .md-content {
    background-color: white;
    box-shadow: 0 5px 25px rgba(0,0,0,0.05);
    padding: 2.5rem 3rem;
    border-radius: 8px;
    max-width: 1000px;
    margin: 2rem auto;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUpFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-sections section:nth-child(1) { animation-delay: 0.2s; }
.page-sections section:nth-child(2) { animation-delay: 0.4s; }
.page-sections section:nth-child(3) { animation-delay: 0.6s; }

/* --- Footer Styling --- */
.md-footer {
  background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
  border-top: 1px solid #e0e0e0;
  margin-top: 4rem;
  padding: 3rem 0 2rem 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
}

.md-footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.md-footer-copyright {
  text-align: center;
  margin-top: 0;
}

.md-footer-copyright p {
  text-align: center;
  font-size: 0.875rem;
  color: #666;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.8;
}

.md-footer-copyright p:first-child {
  font-size: 0.9rem;
  color: #555;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.md-footer-copyright p:last-child {
  font-size: 0.8rem;
  color: #999;
  font-weight: 400;
}

.md-footer-copyright a {
  color: var(--poly-red);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.md-footer-copyright a:hover {
  color: #800020;
  text-decoration: underline;
}

.md-footer-meta {
  background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
}

/* Ensure footer doesn't cover tabs */
.md-footer {
  position: relative;
  z-index: 1;
}

/* Ensure main content doesn't interfere with sticky tabs */
/* Note: overflow settings are defined at the top of the file */
.md-main {
  position: relative;
  z-index: 1;
}

.md-main__inner {
  position: relative;
  z-index: 1;
}

/* Ensure main content doesn't cover mobile drawer */
@media screen and (max-width: 76.1875em) {
  .md-main,
  .md-main__inner,
  .md-content,
  .hero-carousel,
  .hero-overlay-content,
  .hero-overlay-content h1,
  .hero-overlay-content h3,
  .page-sections {
    z-index: 1 !important;
    position: relative !important;
  }
  
  /* Ensure hero carousel and overlay don't cover drawer */
  .hero-carousel {
    z-index: 1 !important;
  }
  
  .hero-overlay-content {
    z-index: 2 !important;
  }
  
  .carousel-slides,
  .carousel-slide {
    z-index: 1 !important;
  }
  
  .carousel-control,
  .carousel-dots {
    z-index: 3 !important;
  }
}

/* Ensure container doesn't clip tabs and allows sticky positioning */
/* Note: overflow settings are defined at the top of the file */
.md-container {
  position: relative !important;
}

.md-container__inner {
  position: relative !important;
}

.md-container[data-md-component="container"] {
  /* Overflow handled globally at top */
}

/* Note: html overflow settings are defined at the top of the file */
html {
  scroll-behavior: smooth;
  position: relative !important;
}

/* Header inner z-index is already set above */

/* Force tabs to always be visible - override any Material theme defaults */
.md-header[data-md-state] ~ .md-tabs,
.md-header ~ .md-tabs,
body .md-tabs,
.md-header[data-md-state="shadow"] ~ .md-tabs,
.md-header[data-md-state="hidden"] ~ .md-tabs {
  position: sticky !important;
  top: var(--header-height) !important;
  z-index: 99 !important;
  visibility: visible !important;
  display: block !important;
  opacity: 1 !important;
  transform: none !important;
  height: auto !important;
  max-height: none !important;
}

/* Ensure tabs are visible even when scrolled */
html[data-md-state] .md-tabs,
html .md-tabs,
html[data-md-state="shadow"] .md-tabs,
html[data-md-state="hidden"] .md-tabs {
  position: sticky !important;
  top: var(--header-height) !important;
  z-index: 99 !important;
  visibility: visible !important;
  display: block !important;
  opacity: 1 !important;
}

/* Override any Material theme scroll behavior */
.md-tabs[hidden],
.md-tabs[aria-hidden="true"] {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Hide tabs on mobile/narrow screens when menu button is visible */
@media screen and (max-width: 76.1875em) {
  .md-header[data-md-state] ~ .md-tabs,
  .md-header ~ .md-tabs,
  body .md-tabs,
  .md-header[data-md-state="shadow"] ~ .md-tabs,
  .md-header[data-md-state="hidden"] ~ .md-tabs,
  html[data-md-state] .md-tabs,
  html .md-tabs,
  html[data-md-state="shadow"] .md-tabs,
  html[data-md-state="hidden"] .md-tabs,
  .md-tabs[hidden],
  .md-tabs[aria-hidden="true"],
  .md-header__inner + .md-tabs {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }
}

/* --- News List Styling --- */
.news-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}
.news-list li {
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
  line-height: 1.6;
  transition: padding-left 0.3s ease;
  font-size: 0.85rem;
  color: #666;
  /* Add ellipsis for text overflow */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: calc(1.6em * 2); /* Approximately 2 lines */
}
.news-list li:hover {
  padding-left: 0.5rem;
}
.news-list li:last-child {
  border-bottom: none;
}
.news-date {
  font-weight: 700;
  color: var(--poly-red);
  margin-right: 1rem;
  display: inline-block;
  min-width: 120px;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

/* --- Responsive Design --- */
@media screen and (max-width: 768px) {
  body {
    font-size: 0.95rem;
  }
  .md-header__inner {
    padding: 0 1rem !important;
    gap: 0.5rem !important;
    justify-content: flex-start !important;
    align-items: center !important;
  }
  /* Ensure menu button is on the left, then logo, then title */
  /* Button order is already set above in the mobile media query */
  .md-header__topic {
    font-size: 0.95rem !important;
  }
  .md-logo img {
    height: 2rem !important;
  }
  .md-header__button {
    padding: 0.5rem !important;
  }
  .md-header__button svg {
    width: 1.4rem !important;
    height: 1.4rem !important;
  }
  .hero-overlay-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    letter-spacing: -0.04em;
    padding: 0 1rem;
  }
  .hero-overlay-content h1::before {
    padding: 0.75rem 1.5rem;
    margin: -0.75rem -1.5rem;
  }
  .hero-overlay-content h3 {
    font-size: 1.1rem;
    padding: 0 1rem;
    letter-spacing: 0.01em;
  }
  .hero-carousel {
    height: 50vh;
    min-height: 300px;
  }
  .page-sections {
    padding: 1.5rem 1rem;
  }
  .page-sections h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
  }
  .page-sections section {
    margin: 3rem 0;
    padding: 2rem 0;
  }
  .highlights-grid,
  .research-interests-grid,
  .team-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .carousel-control {
    padding: 0.8rem 1rem;
    font-size: 1.2rem;
  }
  .carousel-control.prev {
    left: 0.5rem;
  }
  .carousel-control.next {
    right: 0.5rem;
  }
  .md-main .md-content {
    padding: 1.5rem 1.5rem;
  }
  .team-member img {
    width: 150px;
    height: 150px;
  }
  .news-date {
    display: block;
    margin-bottom: 0.5rem;
    min-width: auto;
  }
  .timeline {
    padding-left: 1.5rem;
  }
  .timeline-item::before {
    left: -2.2rem;
  }
}

@media screen and (max-width: 480px) {
  body {
    font-size: 0.9rem;
  }
  .hero-overlay-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
    padding: 0 1rem;
  }
  .hero-overlay-content h1::before {
    padding: 0.5rem 1rem;
    margin: -0.5rem -1rem;
  }
  .hero-overlay-content h3 {
    font-size: 1rem;
    padding: 0 1rem;
    letter-spacing: 0.01em;
  }
  .hero-carousel {
    height: 40vh;
    min-height: 250px;
  }
  .page-sections {
    padding: 1rem 0.8rem;
  }
  .page-sections h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
  }
  .page-sections section {
    margin: 2.5rem 0;
    padding: 1.5rem 0;
  }
  .highlight-card h3 {
    font-size: 1.4rem;
  }
  .highlight-card p {
    font-size: 0.8rem;
    -webkit-line-clamp: 2;
    max-height: calc(1.6em * 2);
  }
  .team-member h3 {
    font-size: 1.7rem;
  }
  .team-member .bio {
    font-size: 0.8rem;
    -webkit-line-clamp: 3;
    max-height: calc(1.6em * 3);
  }
  .news-list li {
    font-size: 0.8rem;
    -webkit-line-clamp: 1;
    max-height: calc(1.6em * 1);
  }
  .timeline-content p {
    font-size: 0.8rem;
    -webkit-line-clamp: 1;
    max-height: calc(1.6em * 1);
  }
  .md-main .md-content ul li {
    font-size: 0.8rem;
    -webkit-line-clamp: 1;
    max-height: calc(1.6em * 1);
  }
  .carousel-control {
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
  }
  .carousel-dots {
    bottom: 0.5rem;
  }
  .dot {
    height: 8px;
    width: 8px;
  }
}

/* --- Improved Card Hover Effects --- */
.highlight-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
}
.highlight-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
.highlight-card img {
  transition: transform 0.3s ease;
}
.highlight-card:hover img {
  transform: scale(1.05);
}

.interest-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.interest-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

/* --- Improved Link Styling --- */
.page-sections a {
  color: var(--poly-red);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}
.page-sections a:hover {
  color: #800020;
  text-decoration: underline;
}

/* --- Publications Page Styling --- */
.md-main .md-content ul {
  list-style: none;
  padding-left: 0;
}
.md-main .md-content ul li {
  padding: 0.6rem 0;
  border-bottom: 1px solid #eee;
  line-height: 1.4;
  transition: padding-left 0.3s ease;
  font-size: 0.7rem;
  color: #666;
  /* Remove ellipsis - show full content but with smaller font */
  display: block;
  overflow: visible;
  text-overflow: clip;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}
.md-main .md-content ul li:hover {
  padding-left: 0.5rem;
}
.md-main .md-content ul li:last-child {
  border-bottom: none;
}
/* General h2 styling for content pages */
.md-main .md-content h2,
.md-content h2,
.md-typeset h2 {
  color: var(--poly-red) !important;
  font-weight: 800 !important;
  margin-top: 2.5rem !important;
  margin-bottom: 1.5rem !important;
  padding-bottom: 0.5rem !important;
  border-bottom: 2px solid var(--poly-red) !important;
  letter-spacing: -0.02em !important;
  line-height: 1.3 !important;
  font-size: 1.5rem !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  overflow: visible !important;
}

.md-main .md-content h2:first-of-type,
.md-content h2:first-of-type,
.md-typeset h2:first-of-type {
  margin-top: 0 !important;
}

/* --- Resources Page Styling --- */
.md-main .md-content ul li {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.6;
}
.md-main .md-content ul li a {
  color: var(--poly-red);
  font-weight: 600;
  transition: color 0.2s ease;
  letter-spacing: -0.01em;
}
.md-main .md-content ul li a:hover {
  color: #800020;
}

/* --- Join Page Styling --- */
.md-main .md-content {
  font-size: 0.9rem;
  color: #666;
  line-height: 1.7;
}
.md-main .md-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #2c3e50;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}
.md-main .md-content h2:first-of-type {
  margin-top: 0;
}
.md-main .md-content ul li {
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.6;
}
.md-main .md-content strong {
  color: var(--poly-red);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 0.9rem;
}

/* --- C Letter Styling for Join Page --- */
.c-letter {
  font-size: 1.5em;
  font-weight: 900;
  color: var(--poly-red);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.02em;
}

/* Note: Smooth scrolling is defined above with html overflow settings */

/* --- Improved Typography --- */
.md-main .md-content {
  line-height: 1.7;
  font-size: 0.9rem;
  font-weight: 400;
  color: #666;
}
.md-main .md-content p {
  margin-bottom: 1.25rem;
  line-height: 1.7;
  font-size: 0.9rem;
  color: #666;
}
.md-main .md-content ul li {
  line-height: 1.5;
  font-size: 0.75rem;
  font-weight: 400;
  color: #666;
}