/* ======================================================
   TRAIL Lab — Light Academic Theme
   ====================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --white: #ffffff;
  --bg-primary: #fafafa;
  --bg-alt: #f2f3f5;
  --bg-card: #ffffff;

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a68;
  --text-muted: #8888a0;

  --accent: #1e40af;
  /* classic academic blue */
  --accent-light: #3b82f6;
  --accent-bg: #eff6ff;
  --accent-border: #bfdbfe;

  --border: #e5e7eb;
  --border-hover: #cbd5e1;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);

  --font-serif: 'Source Serif 4', 'Georgia', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --container: 960px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

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

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

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

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

/* ======================================================
   NAVBAR
   ====================================================== */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  transition: box-shadow 0.3s;
}

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

.nav-inner {
  max-width: var(--container);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.logo-mark {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.logo-sub {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Tabs / Toggle */
.nav-tabs {
  position: relative;
  display: flex;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.tab-btn {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1.1rem;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.25s var(--ease);
}

.tab-btn svg {
  opacity: 0.5;
  transition: opacity 0.25s;
}

.tab-btn.active {
  color: var(--accent);
}

.tab-btn.active svg {
  opacity: 1;
  stroke: var(--accent);
}

.tab-btn:hover:not(.active) {
  color: var(--text-secondary);
}

.tab-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
  pointer-events: none;
}

/* External links */
.nav-ext {
  display: flex;
  gap: 1rem;
}

.nav-ext-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
}

.nav-ext-link:hover {
  color: var(--accent);
}

/* ======================================================
   PAGE TRANSITIONS
   ====================================================== */
.page {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s var(--ease), transform 0.45s var(--ease);
}

.page.active {
  display: block;
}

.page.active.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Iframe used in place of fetch() — loads pages/*.html directly */
.page-frame {
  display: block;
  width: 100%;
  min-height: 100vh;
  border: none;
  background: var(--bg-primary);
  /* Height is set dynamically by script.js via postMessage / contentDocument */
}

/* ======================================================
   HERO
   ====================================================== */
.hero {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8rem 2rem 5rem;
  background: url('NJP_1428.jpg') center/cover no-repeat;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.70) 0%,
      rgba(255, 255, 255, 0.85) 50%,
      rgba(250, 250, 250, 1) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.hero-title {
  margin-bottom: 1rem;
}

.hero-lab-name {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1.1;
}

.hero-lab-full {
  display: block;
  font-family: var(--font-sans);
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  letter-spacing: 0.02em;
}

.hero-affiliation {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  letter-spacing: 0.01em;
}

.hero-desc {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  animation: bounce 2.5s infinite;
  z-index: 2;
}

@keyframes bounce {

  0%,
  60%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  30% {
    transform: translateX(-50%) translateY(6px);
  }
}

/* ======================================================
   CONTENT SECTIONS
   ====================================================== */
.content-section {
  padding: 4.5rem 0;
}

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

.section-heading {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.section-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.subsection-heading {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.body-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 720px;
}

.about-container {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 3rem;
  align-items: stretch;
}

.about-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.news-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.news-scroll-area {
  max-height: 180px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Custom Scrollbar for news */
.news-scroll-area::-webkit-scrollbar {
  width: 6px;
}
.news-scroll-area::-webkit-scrollbar-track {
  background: transparent;
}
.news-scroll-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.news-scroll-area::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.news-list > li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
}

.news-list > li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-date {
  color: var(--accent);
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.news-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.news-items li {
  position: relative;
  padding-left: 0.85rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
  border-bottom: none;
  padding-bottom: 0;
}

.news-items li::before {
  content: "•";
  color: var(--accent-light);
  position: absolute;
  left: 0;
  top: 0;
  font-weight: bold;
}

.body-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* About block */
.about-block {
  border-left: 3px solid var(--accent);
  padding-left: 1.5rem;
}

/* ======================================================
   RESEARCH CARDS
   ====================================================== */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.25rem;
}

.research-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s, border-color 0.3s;
}

.research-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
}

.card-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-light);
  margin-bottom: 0.75rem;
}

.card-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 1rem;
}

.card-topics {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.card-topics li {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 5px;
  border: 1px solid var(--accent-border);
}

/* ======================================================
   PUBLICATIONS
   ====================================================== */
.pub-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pub-item {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}

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

.pub-item:last-child {
  border-bottom: none;
}

.pub-year {
  flex-shrink: 0;
  width: 52px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  padding-top: 0.15rem;
}

.pub-body {
  flex: 1;
}

.pub-venue {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.pub-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.pub-authors {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.pub-authors em {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}

.pub-links {
  display: flex;
  gap: 0.75rem;
}

.pub-link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  background: var(--white);
  transition: background 0.2s, border-color 0.2s;
}

.pub-link:hover {
  background: var(--accent-bg);
  border-color: var(--accent-light);
}

/* ======================================================
   MEMBERS
   ====================================================== */
.members-header {
  padding: 7rem 0 1rem;
}

/* PI Card */
.pi-card {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.25rem;
  box-shadow: var(--shadow-sm);
}

.pi-card:hover {
  box-shadow: var(--shadow-md);
}

.avatar-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.pi-avatar {
  background: var(--accent);
  color: var(--white);
  font-size: 1.6rem;
}

.pi-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.pi-name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.pi-title {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.pi-bio {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.pi-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.text-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--accent);
  transition: opacity 0.2s;
}

.text-link:hover {
  opacity: 0.7;
}

.text-link.sm {
  font-size: 0.78rem;
}

/* Alumni Vertical List */
.alumni-list-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0 0 0;
  list-style: none;
  margin: 0;
}

.alumni-link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s;
}

.alumni-link:hover {
  color: var(--accent);
}

.alumni-link::before {
  content: "→";
  margin-right: 0.6rem;
  color: var(--accent);
  opacity: 0.7;
  font-size: 0.9rem;
  transition: transform 0.2s var(--ease);
}

.alumni-link:hover::before {
  transform: translateX(4px);
  opacity: 1;
}

/* Members Grid */
.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.25rem;
}

.member-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  text-align: center;
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}

.member-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.member-card .pi-photo img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  margin: 0 auto 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 3px solid var(--accent-bg);
}

.member-av {
  width: 72px;
  height: 72px;
  font-size: 1.1rem;
  margin: 0 auto 1rem;
}

.av-1 {
  background: #1e40af;
  color: white;
}

.av-2 {
  background: #7c3aed;
  color: white;
}

.av-3 {
  background: #0891b2;
  color: white;
}

.member-name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.member-role {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.member-interest {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.member-links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* ======================================================
   PUBLICATIONS PAGE
   ====================================================== */
.pub-page-header {
  padding: 7rem 0 1rem;
}

/* Dropdown filter */
.pub-filter {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: -0.5rem;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.select-wrapper {
  position: relative;
  display: inline-block;
}

.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 2.2rem 0.45rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.filter-select:hover {
  border-color: var(--border-hover);
}

.filter-select:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.select-chevron {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

/* Simple publication list */
.simple-pub-list {
  list-style: none;
  counter-reset: pub-counter;
  padding: 0;
}

.simple-pub {
  counter-increment: pub-counter;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0 1rem 2.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background 0.2s;
}

.simple-pub:last-child {
  border-bottom: none;
}

.simple-pub::before {
  content: counter(pub-counter) ".";
  position: absolute;
  left: 0;
  top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  width: 2rem;
  text-align: right;
}

.simple-pub-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
}

.simple-pub-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.simple-pub-meta strong {
  color: var(--accent);
  font-weight: 600;
}

/* Pub group visibility */
.pub-group {
  transition: opacity 0.3s var(--ease), max-height 0.4s var(--ease);
}

.pub-group.hidden {
  display: none;
}

.year-heading {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem 0;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid var(--border);
}

.year-heading:first-of-type {
  margin-top: 0;
}

/* ======================================================
   FOOTER
   ====================================================== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.footer-lab {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.footer-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ======================================================
   SCROLL REVEAL
   ====================================================== */
.reveal-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ======================================================
   RESPONSIVE
   ====================================================== */
@media (max-width: 768px) {
  #navbar {
    padding: 0 1rem;
    height: 56px;
  }

  .nav-ext {
    display: none;
  }

  .hero {
    min-height: 60vh;
    padding: 7rem 1.25rem 3.5rem;
  }

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

  .content-section {
    padding: 3rem 0;
  }

  .section-heading {
    font-size: 1.4rem;
  }

  .about-container,
  .research-grid,
  .members-grid {
    grid-template-columns: 1fr;
  }

  .pi-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.75rem 1.5rem;
  }

  .pi-links {
    justify-content: center;
  }

  .pub-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .pub-year {
    width: auto;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .tab-btn {
    padding: 0.35rem 0.8rem;
    font-size: 0.78rem;
  }
}