@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600;700&family=Nunito:ital,wght@0,300;0,400;0,600;0,700;1,400&display=swap');

/* ── Design tokens ─────────────────────────────────────── */
:root {
  /* Backgrounds — very light mint green base */
  --bg:           #edf7f2;
  --surface:      #ffffff;
  --surface2:     #f4fbf7;

  /* Accent palette — yellow / blue / red / purple / mint */
  --mint:         #a7f3d0;
  --mint-dark:    #059669;
  --mint-light:   #d1fae5;

  --yellow:       #fef9c3;
  --yellow-dark:  #d97706;

  --blue:         #dbeafe;
  --blue-dark:    #1d4ed8;

  --red:          #fee2e2;
  --red-dark:     #b91c1c;

  --purple:       #ede9fe;
  --purple-dark:  #6d28d9;

  /* Project tag palette (distinct from venue badges) */
  --orange:         #ffedd5;
  --orange-dark:    #c2410c;

  --indigo:         #e0e7ff;
  --indigo-dark:    #4338ca;

  --lime:           #ecfccb;
  --lime-dark:      #4d7c0f;

  --sky:            #e0f2fe;
  --sky-dark:       #0369a1;

  /* Text */
  --text:         #14342a;
  --text-muted:   #5c7d6e;

  /* Border & shadow */
  --border:       #bbf0d4;
  --shadow:       4px 5px 0 #a7f3d0;

  --r-card: 8px 14px 10px 16px / 12px 8px 16px 10px;
  --r-pill: 20px;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
}

a { color: var(--mint-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 0;
}

.nav-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 3px;
}
.nav-brand-name {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}
.nav-brand-slogan {
  font-family: 'Nunito', sans-serif;
  font-size: 0.58rem;
  font-weight: 400;
  color: #a8c8b8;
  font-style: italic;
  white-space: nowrap;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.nav-right { display: flex; align-items: center; gap: 0.15rem; }

.nav-link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border-radius: var(--r-pill);
  transition: background 0.18s, color 0.18s;
  text-decoration: none;
}
.nav-link:hover { background: var(--mint-light); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--mint); color: var(--text); }

.nav-divider { width: 2px; height: 20px; background: var(--border); border-radius: 2px; margin: 0 0.4rem; }

.icon-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 1rem;
  transition: background 0.18s, color 0.18s;
  border: 1.5px solid transparent;
  text-decoration: none;
}
.icon-btn:hover { background: var(--mint-light); color: var(--mint-dark); border-color: var(--mint); text-decoration: none; }

/* ── Layout ───────────────────────────────────────────── */
.main { max-width: 900px; margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }

/* ── Section title ────────────────────────────────────── */
.section-title {
  font-family: 'Caveat', cursive;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 2.5rem 0 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-title .star { color: var(--mint-dark); font-size: 1rem; }

/* ── Profile card ─────────────────────────────────────── */
.profile-card {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-top: 1rem;
}

.profile-pic-wrap { flex-shrink: 0; }

.profile-pic {
  width: 150px;
  height: auto;
  border-radius: 12px 16px 14px 18px / 14px 12px 18px 14px;
  border: 3px solid var(--mint);
  box-shadow: 3px 3px 0 var(--mint-dark);
  display: block;
}

.profile-pic-placeholder {
  width: 148px; height: 148px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--mint-light) 0%, var(--blue) 100%);
  border: 3px solid var(--mint-dark);
  box-shadow: 3px 3px 0 var(--mint);
  display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem;
}

.profile-bio h1 {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.25rem;
}

.profile-bio .affil { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; }
.profile-bio p { font-size: 0.93rem; margin-bottom: 0.65rem; }

/* Highlight phrase */
.highlight-phrase {
  font-family: 'Caveat', cursive;
  font-size: 1.12em;
  font-weight: 700;
  color: var(--yellow-dark);
  letter-spacing: 0.01em;
}

/* Nav logo image */
.nav-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── News ─────────────────────────────────────────────── */
.news-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}

.news-item {
  display: flex; gap: 1rem; align-items: baseline;
  padding: 0.6rem 0; border-bottom: 1.5px dashed var(--border); font-size: 0.92rem;
}
.news-item:last-child { border-bottom: none; }

.news-date {
  font-family: 'Caveat', cursive; font-size: 0.95rem; font-weight: 700;
  color: var(--mint-dark); white-space: nowrap; min-width: 85px;
}

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  padding: 0.1rem 0.55rem; border-radius: var(--r-pill);
}
.badge-mint   { background: var(--mint-light); color: var(--mint-dark); }
.badge-yellow { background: var(--yellow);     color: var(--yellow-dark); }
.badge-blue   { background: var(--blue);       color: var(--blue-dark); }
.badge-red    { background: var(--red);        color: var(--red-dark); }
.badge-purple { background: var(--purple);     color: var(--purple-dark); }

/* Project tag badges */
.badge-pathology     { background: var(--orange); color: var(--orange-dark); }
.badge-large-models  { background: var(--indigo); color: var(--indigo-dark); }
.badge-agents        { background: var(--lime);   color: var(--lime-dark); }
.badge-applications  { background: var(--sky);    color: var(--sky-dark); }

/* ── Publication cards ────────────────────────────────── */
.pub-card {
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 10px 16px 12px 14px / 14px 10px 16px 12px;
  box-shadow: 3px 4px 0 var(--border);
  padding: 1.1rem 1.3rem; margin-bottom: 0.9rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pub-card:hover { transform: translateY(-2px); box-shadow: 4px 6px 0 var(--mint); }

.pub-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.45rem; }

.pub-title { font-weight: 700; font-size: 0.94rem; margin-bottom: 0.25rem; color: var(--text); }
.pub-title a { color: inherit; }
.pub-title a:hover { color: var(--mint-dark); text-decoration: underline; }

.pub-authors { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 0.35rem; }
.pub-authors strong { color: var(--text); }

.pub-venue-line { font-size: 0.83rem; color: var(--text-muted); font-style: italic; margin-bottom: 0.35rem; }

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

.pub-link {
  font-size: 0.78rem; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--border);
  color: var(--text); padding: 0.1rem 0.55rem; border-radius: 6px;
  transition: background 0.15s; text-decoration: none;
}
.pub-link:hover { background: var(--mint-light); border-color: var(--mint-dark); text-decoration: none; }

.year-heading {
  font-family: 'Caveat', cursive; font-size: 1.5rem; color: var(--text-muted);
  margin: 2rem 0 0.8rem; border-bottom: 2px dashed var(--border); padding-bottom: 0.3rem;
}

.pub-loading { text-align: center; padding: 3rem 1rem; color: var(--text-muted); font-size: 0.95rem; }
.pub-loading .spinner {
  display: inline-block; width: 28px; height: 28px;
  border: 3px solid var(--border); border-top-color: var(--mint-dark);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 0.75rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pub-error {
  background: var(--red); border: 2px solid #fca5a5;
  border-radius: 8px; padding: 1.2rem 1.5rem; color: var(--red-dark); font-size: 0.9rem;
}

/* ── Projects ─────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.4rem; margin-top: 0.5rem;
}

.project-card {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 10px 16px 12px 14px / 14px 10px 16px 12px;
  box-shadow: 3px 4px 0 var(--border);
  padding: 0; overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none; color: inherit; display: block;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 5px 7px 0 var(--yellow); text-decoration: none; }
.project-card > .badge,
.project-card > .project-title,
.project-card > .project-desc { margin-left: 1.3rem; margin-right: 1.3rem; }
.project-card > .badge { margin-top: 1rem; display: inline-block; }
.project-card > .project-desc { margin-bottom: 1.3rem; }

.project-thumb {
  width: 100%; aspect-ratio: 16/9; overflow: hidden;
  background: var(--surface2); border-bottom: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.project-thumb-empty::after {
  content: '🖼'; font-size: 2.5rem; opacity: 0.3;
}

.project-title {
  font-family: 'Caveat', cursive; font-size: 1.2rem; font-weight: 700;
  margin: 0.5rem 0 0.4rem; color: var(--text);
}
.project-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.55; }

/* ── Project detail page ──────────────────────────────── */
.project-overview-fig {
  margin-bottom: 2rem;
  border: 2px solid var(--border); border-radius: var(--r-card);
  overflow: hidden; box-shadow: var(--shadow);
}
.project-overview-fig img { width: 100%; display: block; }

.paper-group-heading {
  font-family: 'Caveat', cursive; font-size: 1.3rem; font-weight: 700;
  color: var(--text-muted); margin: 2rem 0 0.8rem;
  border-bottom: 2px dashed var(--border); padding-bottom: 0.3rem;
}

.project-back {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
  text-decoration: none; margin-bottom: 0.5rem;
  transition: color 0.15s;
}
.project-back:hover { color: var(--mint-dark); text-decoration: none; }

.project-overview {
  font-size: 0.95rem; color: var(--text-muted); line-height: 1.7;
  margin-bottom: 2rem; max-width: 720px;
}

.paper-entry {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 10px 16px 12px 14px / 14px 10px 16px 12px;
  box-shadow: 3px 4px 0 var(--border);
  overflow: hidden; margin-bottom: 1.2rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.paper-entry:hover { transform: translateY(-2px); box-shadow: 4px 6px 0 var(--mint); }

.paper-figure {
  display: block;
  width: auto; max-width: 100%; max-height: 360px;
  object-fit: contain;
  margin: 1.2rem auto 0;
  padding: 0 1.4rem;
  border-bottom: none;
}

.paper-content { padding: 1rem 1.4rem 1.2rem; border-top: 2px dashed var(--border); margin-top: 1rem; }

.paper-entry-title {
  font-weight: 700; font-size: 0.95rem; margin-bottom: 0.3rem; color: var(--text);
}
.paper-entry-title a { color: inherit; }
.paper-entry-title a:hover { color: var(--mint-dark); text-decoration: underline; }

.paper-entry-authors { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.paper-entry-desc { font-size: 0.87rem; color: var(--text-muted); line-height: 1.6; }

@media (max-width: 640px) {
  .paper-figure { max-height: 200px; }
}

/* ── Project closing note ─────────────────────────────── */
.project-note {
  font-family: 'Caveat', cursive;
  font-size: 1.05rem; font-weight: 600;
  color: var(--mint-dark);
  background: var(--mint-light);
  border: 2px dashed var(--mint);
  border-radius: 10px 16px 12px 14px / 14px 10px 16px 12px;
  padding: 0.75rem 1.2rem;
  margin-top: 2rem;
  line-height: 1.6;
}
.project-note a { color: var(--mint-dark); text-decoration: underline; }

/* ── Teaching ─────────────────────────────────────────── */
.teaching-block {
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 1.5rem 1.8rem; margin-bottom: 1.5rem;
}

.teaching-block h3 {
  font-family: 'Caveat', cursive; font-size: 1.4rem; font-weight: 700;
  margin-bottom: 0.9rem; color: var(--text);
}

.course-item {
  padding: 0.65rem 0; border-bottom: 1.5px dashed var(--border);
  font-size: 0.93rem; display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap;
}
.course-item:last-child { border-bottom: none; }

.course-code {
  font-size: 0.78rem; font-weight: 700;
  padding: 0.1rem 0.5rem; border-radius: 5px; white-space: nowrap;
}
.course-ap  { background: var(--blue);       color: var(--blue-dark); }
.course-ai  { background: var(--mint-light);  color: var(--mint-dark); }
.course-mem { background: var(--yellow);      color: var(--yellow-dark); }

.course-name { flex: 1; }

.course-term {
  font-size: 0.75rem; font-weight: 700;
  padding: 0.1rem 0.5rem; border-radius: 5px; white-space: nowrap;
  background: var(--surface2); color: var(--text-muted);
  border: 1.5px solid var(--border);
}

/* ── News expand button ───────────────────────────────── */
.news-expand-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--mint); border: 2px solid var(--mint-dark);
  color: var(--mint-dark); font-size: 0.8rem;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 2px 2px 0 var(--mint-dark);
  transition: background 0.18s, box-shadow 0.15s, transform 0.15s;
}
.news-expand-btn:hover { background: var(--mint-dark); color: #fff; transform: translateY(-1px); box-shadow: 3px 3px 0 var(--text); }

/* ── Footer ───────────────────────────────────────────── */
footer {
  text-align: center; padding: 2rem 1rem;
  color: var(--text-muted); font-size: 0.83rem;
  border-top: 2px dashed var(--border); margin-top: 3rem;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .profile-card { flex-direction: column; align-items: center; text-align: center; }
  .nav-link { padding: 0.25rem 0.45rem; font-size: 0.82rem; }
  .projects-grid { grid-template-columns: 1fr; }
  .nav-brand-slogan { display: none; }
}
