:root {
  --bg-1: #0e2a47;   /* deep navy */
  --bg-2: #163c63;   /* ocean blue */
  --bg-3: #0b223a;   /* darker section */
  --accent-1: #4fd1ff; /* cyan */
  --accent-2: #ff7a59; /* coral */
  --text: #ffffff;
  --muted: #d6e2f0;
  --link: #71d7ff;   /* light cyan */
  --link-hover: #a6e8ff; /* brighter cyan */
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-1);
  color: var(--text);
  font-size: 18px;
}

/* Global link color for dark backgrounds */
a { color: var(--link); text-decoration: underline; }
a:hover { color: var(--link-hover); }
header {
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--header-height, 400px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 1000;
  transition: background 300ms ease;
  box-sizing: border-box;
}
.logo-container { display: flex; align-items: center; gap: 20px; }
.large-logo { height: var(--logo-size, 110px); width: var(--logo-size, 110px); object-fit: cover; border-radius: 8px; background: rgba(0,0,0,0.15); will-change: transform; }
.title-container { display: flex; flex-direction: column; align-items: flex-start; }
.university-logo { height: var(--uni-logo-height, 56px); margin-top: 8px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3)); }
header video {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; z-index: -1; opacity: var(--video-opacity, 1);
}
/* Dark overlay to enhance title readability */
header::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0.35) 50%, rgba(0,0,0,0.2));
  z-index: 0;
}
header > * { position: relative; z-index: 1; }
/* When compact, remove transparency and rely on solid background */
header.compact { background: #0c223a; }
header.compact::after { background: none; }
/* Make header static and compact for non-home pages */
header.static { position: static; height: 110px !important; }
header h1 { margin: 0; font-size: clamp(1.6rem, 5vw, var(--title-size, 3rem)); line-height: 1.05; color: var(--accent-1); text-shadow: 0 2px 8px rgba(0,0,0,0.35); }
header h1 a { color: white; text-decoration: none; }
nav { margin-left: auto; max-width: 50%; }
nav ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 15px; justify-content: flex-end; flex-wrap: wrap; }
nav ul li { display: inline; }
nav ul li a { color: white; text-decoration: none; font-weight: 600; white-space: nowrap; padding-bottom: 2px; border-bottom: 2px solid transparent; }
nav ul li a:hover { color: var(--accent-1); }
nav ul li a.active { color: var(--accent-1); border-bottom-color: var(--accent-1); }
/* Home icon spacing */
.nav-home a { display: inline-flex; align-items: center; padding-bottom: 2px; border-bottom: 2px solid transparent; opacity: 0.95; }
.nav-home a:hover { color: var(--accent-1); opacity: 1; }

/* Mobile nav toggle (hamburger) */
.nav-toggle { display: none; margin-left: 12px; width: 36px; height: 28px; background: transparent; border: 0; cursor: pointer; align-items: center; justify-content: center; flex-direction: column; }
.nav-toggle .bar { display: block; width: 100%; height: 4px; background: #fff; margin: 3px 0; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,0.05); }

/* Mobile menu drawer */
.mobile-menu { position: fixed; top: var(--header-height, 110px); left: 0; right: 0; background: #0c223a; border-top: 1px solid rgba(255,255,255,0.1); box-shadow: 0 8px 24px rgba(0,0,0,0.35); z-index: 1500; padding: 12px 20px; max-height: 70vh; overflow: auto; }
.mobile-menu nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; justify-items: center; }
.mobile-menu nav a { color: #fff; text-decoration: none; font-weight: 600; font-size: 1rem; padding: 6px 0; display: inline-block; text-align: center; }

/* Responsive behavior for small screens */
@media (max-width: 640px) {
  /* Hide big title and desktop nav; show hamburger */
  header h1 { display: none; }
  .university-logo { display: none; }
  header > nav { display: none; }
  .nav-toggle { display: inline-flex; }
  header { height: 64px !important; padding: 0 16px; position: fixed; top: 0; left: 0; right: 0; }
  .large-logo { height: 40px; width: 40px; }
  header::after { background: none; }
  header video { display: none; }
  /* Push content appropriately for compact header */
  #about { margin-top: 64px; scroll-margin-top: 64px; }
  /* Ensure mobile menu aligns to compact header */
  .mobile-menu { top: 64px !important; }
}

/* When mobile menu open */
body.menu-open #mobile-menu { display: block; }
body.menu-open #mobile-menu[hidden] { display: block; }
@media (max-width: 640px) {
  body.menu-open::before { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1400; }
}
main { display: block; }
section { padding: 64px 50px; margin: 0; scroll-margin-top: 110px; }
#about { margin-top: 410px; scroll-margin-top: 110px; }

/* About section layout */
#about .notice { background: rgba(255,255,255,0.08); color: var(--muted); padding: 8px 12px; border-left: 3px solid var(--accent-1); border-radius: 6px; margin: 8px 0 16px; }
#about .about-content { display: flex; align-items: center; gap: 24px; }
#about .about-text { flex: 1 1 50%; font-size: 1.1rem; line-height: 1.7; }
#about .about-hero { flex: 0 0 40%; max-width: 520px; width: 100%; height: auto; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.25); }
@media (max-width: 900px) {
  #about .about-content { flex-direction: column; }
  #about .about-hero { max-width: 100%; }
}

/* Alternating section backgrounds */
section:nth-of-type(odd) { background: var(--bg-1); }
section:nth-of-type(even) { background: var(--bg-2); }

/* Section headings */
section h2 { margin-top: 0; font-weight: 700; letter-spacing: 0.3px; font-size: 2.2rem; }
section:nth-of-type(odd) h2 { color: var(--accent-1); }
section:nth-of-type(even) h2 { color: var(--accent-2); }
.research-container { display: flex; flex-direction: column; gap: 20px; }
.research-panel { display: flex; align-items: stretch; gap: 20px; padding: 28px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.research-hero { flex: 0 0 35%; max-width: 420px; height: auto; object-fit: cover; border-radius: 8px; }
.research-text { flex: 1 1 40%; max-width: 52ch; }
.research-text h3 { font-size: 1.6rem; margin: 0 0 8px 0; color: var(--text); }
.research-text p { font-size: 1.1rem; line-height: 1.6; }
.gallery-side { flex: 0 0 25%; display: grid; grid-template-columns: 1fr; gap: 8px; }
.gallery-side .gallery-item { display: block; position: relative; overflow: hidden; border-radius: 6px; }
.gallery-side .gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1); transition: transform 200ms ease; }
.gallery-side .gallery-item:hover img { transform: scale(1.05); }
.research-panel.reverse .research-hero { order: 3; }
.research-panel.reverse .gallery-side { order: 1; }
.research-panel.reverse .research-text { order: 2; }

@media (max-width: 900px) {
  .research-panel { flex-direction: column; }
  .research-hero, .research-text, .gallery-side { flex: 1 1 auto; max-width: 100%; }
  .gallery-side { grid-template-columns: repeat(2, 1fr); }
}
.people-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px;
  align-items: stretch;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
}

/* Alumni grid tweaks: smaller tiles and tighter overlay text */
.people-alumni { gap: 12px; }
.people-alumni .person-name { font-size: 0.9rem; }
.people-alumni .person-role { font-size: 0.8rem; }
.people-alumni .person-overlay { padding: 6px; }

/* Card and image */
.person-card { position: relative; width: 100%; outline: none; }
.person-image { position: relative; width: 100%; padding-top: 100%; overflow: hidden; border-radius: 8px; }
.person-image img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 220ms ease; }

/* Overlay */
.person-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  padding: 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0.15) 60%, rgba(0,0,0,0));
  opacity: 0;
  transition: opacity 200ms ease-in-out;
}
.person-card:hover .person-image img { transform: scale(1.05); }
.person-card:hover .person-overlay,
.person-card:focus .person-overlay,
.person-card:focus-within .person-overlay { opacity: 1; }

/* Touch devices: no hover — show overlay by default */
@media (hover: none) {
  .person-overlay { opacity: 1; }
}

.person-name { margin: 0; font-size: 1.05rem; }
.person-name a { color: #ffffff; text-decoration: none; }
.person-role { margin: 2px 0 6px 0; color: #e8eff7; font-size: 0.95rem; }

/* Social icons inside overlay */
.social-icons { margin: 0; }
.social-icons a { color: #e0e9f5; margin-right: 8px; display: inline-flex; align-items: center; }
.social-icons a:hover { color: #ffffff; }
/* (moved social-icons styles above for overlay context) */
.popup { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; color: black; padding: 20px; border-radius: 8px; box-shadow: 0px 0px 10px rgba(0,0,0,0.5); z-index: 1001; }
.popup-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 1000; }
footer { text-align: center; padding: 24px; background: var(--bg-3); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: none; align-items: center; justify-content: center; z-index: 2000; }
.lightbox.open { display: flex; }
.lightbox-inner { max-width: 90vw; max-height: 85vh; text-align: center; }
.lightbox-inner img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto 8px auto; border-radius: 6px; }
.lightbox .caption { color: #e0e9f5; font-size: 0.95rem; }

/* Publications */
.pub-list { list-style: none; padding: 0; margin: 0; }
.pub-item { margin: 0 0 12px 0; }
.pub-title a { color: #fff; text-decoration: underline; }
.pub-meta { display: block; color: #d6e2f0; font-size: 0.95em; }
.pub-meta strong { color: #ffffff; font-weight: 700; }
.pub-meta a { color: var(--link); text-decoration: underline; }
.pub-meta a:hover { color: var(--link-hover); }
/* Keep publications text sizing stable even as body size increases */
#publications { font-size: 17px; }

/* Alumni */
.alumni-list { list-style: none; padding: 0; margin: 8px 0 0 0; }
.alumni-item { margin: 4px 0; color: #d6e2f0; }
.alumni-item a { color: #fff; text-decoration: underline; }

/* Small-screen refinements */
@media (max-width: 640px) {
  nav ul { gap: 10px; }
  section { padding: 50px 20px; }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* News */
.news-layout { display: grid; grid-template-columns: 3fr 2fr; gap: 24px; align-items: start; }
.news-list { list-style: none; padding: 0; margin: 0; }
.news-list li { display: flex; align-items: baseline; gap: 8px; margin: 6px 0; }
.news-list .news-emoji { font-size: 1.2rem; }
.news-list a { color: #fff; text-decoration: underline; }
.news-list small { color: var(--muted); margin-left: 6px; }
.gallery-col { align-self: start; }
.gallery-title { margin: 0 0 8px 0; font-size: 1.25rem; color: var(--accent-1); }
.gallery-thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.gallery-thumbs a { position: relative; display: block; border-radius: 6px; overflow: hidden; }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 200ms ease; }
.gallery-thumbs a:hover img { transform: scale(1.03); }
.gallery-thumbs .thumb-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 0.85rem; color: #fff; background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0)); opacity: 0; transition: opacity 200ms ease; }
.gallery-thumbs a:hover .thumb-caption { opacity: 1; }
@media (max-width: 900px) { .news-layout { grid-template-columns: 1fr; } }

/* Join Us */
.join-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.join-card { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 14px 16px; box-shadow: 0 8px 18px rgba(0,0,0,0.15); }
.join-emoji { font-size: 1.6rem; margin-bottom: 6px; }
.join-title { margin: 4px 0 8px 0; font-size: 1.25rem; color: var(--accent-1); }
.join-body { color: var(--muted); line-height: 1.6; }
