/*--------------------Color Pallete------------------- */
:root {
  --crimson: #A51417;
  --charcoal: #2C2C2C;
  --light-gray: #EAEAEA;
  --off-white: #F5F5F5;
  --beige: #F5E9DA;
  --white: #FFFFFF;
}

/* ------------------ Global Styles ------------------ */
body {
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  background-color: #f9f9f9;
  color: #333;
  font-size: 16px;
}

/* ------------------ Header ------------------ */
header {
  position: fixed;
  top: 0;
  width: 100%;
  /*background-color: #004080;*/
  color: beige;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  padding: 0.5rem 1rem;
  text-align: center;
}

.header-top {
  margin-bottom: 0.5rem;
}

.header-top h1 {
  margin: 0;
  font-size: 1.5rem;
}

.header-top p {
  margin: 0;
  font-size: 1rem;
  opacity: 0.85;
}

header h1 a {
  color: #fff;
  text-decoration: none;
}

header p {
  display: none;
}

.header-top h1,
.header-top p {
  line-height: 1.2;
}

/* ------------------ Header Banner ------------------ */

.header {
  width: 100%;
  z-index: 10;
  position: fixed;
  top: 0;
  left: 0;
  transition: opacity 0.3s ease;
}

.header-banner {
    background: linear-gradient(
    to right,
    white 0%,
    white 20%,
    #a3002f 60%,
    #1e1e1e 100%
  );
  /*background-color: #004080; /* your blue; change later */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.2rem;
}

/* Default (all screen sizes) */
.lab-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 175px;
  cursor: pointer;
}

.menu-toggle {
  font-size: 28px;
  color: white;
  background: none;
  border: none;
  cursor: pointer;
}

.header.faded {
  opacity: 0.35;
}

/* Small tweak: ensure header fading doesn't make the menu transparent */
.header.faded .mobile-menu {
  opacity: 1 !important;
}

/* ------------------ Mobile Menu ------------------ */

/* Mobile menu (fixed/opaque, readable on long pages) */
.mobile-menu {
  position: fixed;          /* follow the header */
  top: var(--header-height); /* dynamically controlled */
  left: 0;
  width: 100%;
  /* solid-ish background so text is readable */
  background-color: rgba(255, 255, 255, 0.98);
  /* optional soft blur for devices that support it */
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  /* make sure it sits above header content but below modals */
  z-index: 2000;
  /* default hidden */
  display: none;
  flex-direction: column;
  text-align: center;
  padding: 1rem 0;
  /* animation for when it becomes visible */
  animation: fadeIn 0.22s ease forwards;
  /* ensure the menu text is dark (readable on white bg) */
  color: var(--charcoal, #222);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.mobile-menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu li {
  margin: 1rem 0;
}

/* Menu links */
.mobile-menu a {
  color: var(--charcoal, #222);
  text-decoration: none;
  font-size: 1.05rem;
  padding: 0.6rem 1rem;
  display: block;
}

/* Hover/focus states to improve touch feedback */
.mobile-menu a:hover,
.mobile-menu a:focus {
  background-color: rgba(0,0,0,0.03);
  text-decoration: none;
}

/* When menu is visible, use flex layout */
.mobile-menu.show {
  display: flex;
}

/* Fade-in keyframes (kept short) */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Faded logo when menu is open */
.logo-faded {
  opacity: 0.2;
}

.logo-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: auto;
  height: auto;
  flex: 0 0 auto;      /* don't grow or shrink in flex layouts */

  cursor: pointer;
}

/* ------------------ Navigation ------------------ */
nav ul.nav-menu,
.nav-menu {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0 0;
}

.nav-menu li {
  position: relative;
}

.nav-menu a,
nav a {
  color: #fff;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s ease;
  display: block;
}

.nav-menu a:hover,
nav a:hover {
  background-color: #004080;
  color: #fff;
}

/* Dropdown menu */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #003366;
  border-radius: 6px;
  min-width: 180px;
  z-index: 999;
  list-style: none;
  padding: 0;
  margin: 0;
}

.dropdown-menu li a {
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

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

/* ------------------ Main ------------------ */
main {
  max-width: 1000px;
  margin: 120px auto 2rem auto; /* center horizontally */
  padding: 0rem; /*distance to banner on all pages*/
}


main h2 {
  margin-top: 3rem;
  border-bottom: 2px solid #ccc;
  padding-bottom: 0.5rem;
  font-size: 1.5rem;
}

/* ------------------ Footer ------------------ */
footer {
  text-align: center;
  padding: 1rem;
  background: #eee;
  margin-top: 2rem;
}

/* ------------------ Hero Slider ------------------ */
.hero-slider {
  position: relative;
  width: 100%;
  height: 400px;
  overflow: hidden;
}

.slide {
  position: absolute;
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;
  animation-duration: 16s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-fill-mode: both;
}

.slide-left {
  animation-name: fadeInOutLeft;
}

.slide-right {
  animation-name: fadeInOutRight;
}

@keyframes fadeInOutLeft {
  0%, 33.3% { opacity: 0; transform: translateX(-20px); }
  8.3%, 25%  { opacity: 1; transform: translateX(0); }
  33.4%, 100% { opacity: 0; transform: translateX(20px); }
}

@keyframes fadeInOutRight {
  0%, 33.3% { opacity: 0; transform: translateX(20px); }
  8.3%, 25%  { opacity: 1; transform: translateX(0); }
  33.4%, 100% { opacity: 0; transform: translateX(-20px); }
}

/* ------------------ Publications ------------------ */
.publication-item {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

.pub-image-container {
  position: relative;
  width: 200px;
  flex-shrink: 0;
}

.pub-image {
  width: 100%;
  display: block;
  border-radius: 8px;
  transition: opacity 0.3s ease;
}

.image-summary {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  color: white;
  background-color: rgba(0, 0, 0, 0.65);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  opacity: 0;
  text-align: center;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: opacity 0.3s ease;
}

.pub-image-container:hover .pub-image {
  opacity: 0.3;
}

.pub-image-container:hover .image-summary {
  opacity: 1;
}

/* Hover text summary link */
.summary-hover {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.hover-trigger {
  font-size: 1rem;
  padding-left: 0.5rem;
}

.hover-summary {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 125%;
  left: 0;
  background-color: #333;
  color: #fff;
  padding: 0.5rem;
  border-radius: 6px;
  width: 200px;
  font-size: 0.875rem;
  transition: opacity 0.3s;
  z-index: 10;
}

.summary-hover:hover .hover-summary {
  visibility: visible;
  opacity: 1;
}

/* ------------------ Team Section ------------------ */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  justify-content: center;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.team-member {
  text-align: center;
  cursor: pointer;
  padding: 1rem;
  border-radius: 12px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  max-width: 300px;
}

.team-member:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background-color: #f9f9f9;
}

.team-photo {
  width: 150px;
  height: 150px;
  object-fit: contain;
  border-radius: 50%;
  background-color: #f0f0f0;
  margin-bottom: 1rem;
}

.role {
  font-style: italic;
  color: #666;
  margin-bottom: 0.5rem;
}

.bio {
  font-size: 0.95rem;
}

.social-links {
  margin-top: 0.5rem;
}

.social-links a {
  margin-right: 0.5rem;
  display: inline-block;
}

.social-icon {
  width: 24px;
  height: 24px;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.social-icon:hover {
  opacity: 1;
}

.cv-link {
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #444;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.3s;
  vertical-align: top; /* Key fix */
  line-height: 24px;       /* Match the icon height for better vertical centering */
}

.cv-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ---- Collapsed Alumni Section within Team Section ----- */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  margin-top: 3rem;
}

.collapsible-header:hover {
  color: #a3002f;
}

#alumni-arrow {
  margin-left: .5rem;
  transition: transform .3s ease;
}

.collapsed {
  display: none;
}

.collapsed.open {
  display: block;
}

.collapsed.open + #alumni-arrow {
  transform: rotate(180deg);
}

/* ------------------ Research Section ------------------ */
.research-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.research-image {
  width: 300px;
  border-radius: 8px;
  flex-shrink: 0;
  max-width: 100%;
}

.research-text {
  flex: 1;
}

/* ------------------ News Section ------------------ */
.news-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

.news-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: flex-start;
  border-bottom: 1px solid #ddd;
  padding-bottom: 1rem;
}

.news-image {
  width: 150px;
  object-fit: cover;
  border-radius: 8px;
}

.news-content {
  flex: 1;
}

.news-date {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.news-entry {
  background: #ffffff;
  padding: 1rem 1.2rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.news-entry:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}

.news-entry h3 {
  margin: 0.2rem 0;
  font-size: 1.2rem;
}

.news-entry .news-date {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.2rem;
}

.news-entry p {
  margin: 0.5rem 0 0 0;
  line-height: 1.4;
}

.news-entry img {
  max-width: 100%;
  margin: 0.5rem 0;
  border-radius: 4px;
}

/* =========================
   Collapsible News Years
========================= */

.news-year-section {
  margin-bottom: 2rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 1rem;
}

.news-year-heading {
  font-size: 2rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  margin-bottom: 1rem;
  padding: 0.3rem 0;
  transition: color 0.2s ease;
}

.news-year-heading:hover {
  color: #555;
}

/* Remove default browser arrow */
.news-year-heading::-webkit-details-marker {
  display: none;
}

/* Custom arrow */
.news-year-heading::before {
  content: "▶";
  display: inline-block;
  margin-right: 0.6rem;
  transition: transform 0.2s ease;
  font-size: 1rem;
}

/* Rotate arrow when open */
.news-year-section[open] .news-year-heading::before {
  transform: rotate(90deg);
}

.news-year-section {
  margin-bottom: 2rem;
}

.news-year-heading {
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 1rem;
}

.news-year-heading:hover {
  opacity: 0.7;
}

/* ------------------ Modal ------------------ */
.modal {
  position: fixed;
  z-index: 9999 !important; /* Ensure modals appear above everything */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow: auto;
}

.modal.show {
  opacity: 1;
  pointer-events: auto;
  display: flex;
}

.close{
  float: right;
  font-size: 30px;
  cursor: pointer;
}

.modal-content {
  background-color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 5% auto;
}

.modal-photo {
  width: 120px; /* Scale down team photo in modal */
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 1rem auto;
  display: block;
}

/* Match your existing modal content */
.news-modal-content {
  background: white;
  margin: 5% auto;
  padding: 2rem;
  max-width: 700px;
  border-radius: 12px;
  text-align: center;
}

/* Image gallery layout */
.news-modal-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin-top: 1rem;
}

.news-modal-image {
  width: calc(50% - 0.5rem);
  height: auto;
  border-radius: 8px;
  display: block;
  object-fit: contain;
}

/* ------------------ Responsive ------------------ */
@media (max-width: 768px) {
  main {
    margin-top: 100px; /* ensures content clears header */
  }

  /*2 per row on medium screens and 3 on larger one*/
  @media (min-width: 600px) {
    .team-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  @media (min-width: 900px) {
    .team-grid {
      grid-template-columns: repeat(3, 1fr);
    }
  }

@media (max-width: 768px) {
  .logo-container {
    display: block;
  }

  .lab-logo {
    max-width: 150px;
  }
}

/*Fades the logo when the menu opens*/
.header .lab-logo {
  transition: opacity 0.3s ease;
}

.header.menu-open .lab-logo {
  opacity: 0.15;
}


  header {
    padding: 1rem;
  }
  header h1 {
    font-size: 1.2rem;
  }
  .header-top p {
    font-size: 0.9rem;
  }
  .research-section {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }
  nav ul li {
    margin: 0;
  }
  nav a {
    display: block;
    padding: 0.5rem 0;
  }
  header h1 {
    font-size: 1.5rem;
  }
  main {
    padding: 1rem;
  }
}

/* Mobile-only: center publications section */
@media (max-width: 768px) {
  /* Center the whole list on mobile */
  ul.publications {
    margin: 0 auto;
    padding: 0 1rem;
    text-align: center; /* centers text inside */
  }

  /* Stack image above text */
  .publication-item {
    display: flex;
    flex-direction: column;
    align-items: center; /* centers image + text block */
    margin-bottom: 1.5rem;
  }

  /* Center the image container */
  .pub-image-container {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 0.75rem;
  }

  /* Make sure the text spans full width underneath */
  .publication-text {
    width: 100%;
    text-align: center; /* centers authors/title/etc */
  }
}


