/* ============================
   CSS Custom Properties
   ============================ */
:root {
  --bg: #ffffff;
  --surface: #f6f8fa;
  --text: #24292f;
  --text-secondary: #57606a;
  --accent: #0969da;
  --accent-dark: #0550ae;
  --accent-warm: #9a6700;
  --border: #d0d7de;
  --border-light: #e8ebef;
  --tag-bg: #ddf4ff;
  --font-display: 'Crimson Pro', Georgia, serif;
  --font-body: 'Crimson Pro', Georgia, serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --max-width: 1100px;
  --max-width-narrow: 900px;
  --nav-height: 56px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

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

/* ============================
   Navigation
   ============================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  z-index: 100;
  transition: box-shadow 0.3s ease;
}

.nav--scrolled {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.nav__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav__logo:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav__links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav__links a {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--text);
  text-decoration: none;
}

.nav__links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
  border-radius: 1px;
}

.nav__links a:hover::after,
.nav__links a.active::after {
  width: 100%;
}

/* Hamburger */
.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: all 0.3s ease;
  border-radius: 2px;
}

.nav__toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav__toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav__toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================
   Hero / About
   ============================ */
.hero {
  position: relative;
  padding: clamp(80px, 10vh, 120px) 2rem clamp(48px, 6vh, 72px);
  margin-top: var(--nav-height);
}

.hero__bg {
  display: none;
}

.hero__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: flex-start;
  position: relative;
}

.hero__left {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.avatar {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border-light);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.social-icons {
  display: flex;
  gap: 0.7rem;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border-light);
  font-size: 1.1rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.social-icons a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--tag-bg);
}

.hero__right {
  flex: 1;
  min-width: 0;
}

.hero__name {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.hero__role {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  font-weight: 400;
  line-height: 1.4;
}

.hero__advisor {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  line-height: 1.4;
}

.hero__advisor a {
  text-decoration: none;
}

.hero__advisor a:hover {
  text-decoration: underline;
}

.hero__divider {
  width: 40px;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  margin: 1rem 0;
}

.hero__bio {
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text);
}

.hero__bio p {
  margin-bottom: 0.75rem;
}

.hero__bio p:last-child {
  margin-bottom: 0;
}

.hero__bio strong {
  font-weight: 600;
}

.hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  padding: 0.3rem 0.7rem;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  white-space: nowrap;
  line-height: 1.4;
}

/* ============================
   Sections (shared)
   ============================ */
.section {
  padding: clamp(2.5rem, 5vh, 4rem) 2rem;
}

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

.section__inner {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
}

.section__inner--wide {
  max-width: 90%;
}

.section__title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.3;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-light);
}

.section__title::after {
  display: none;
}

.section__subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
}

/* ============================
   News
   ============================ */
.news-list {
  margin-top: 1.25rem;
}

.news-year {
  margin: 1.6rem 0 0.3rem;
  font-family: var(--font-body);
}

.news-list > .news-year:first-child {
  margin-top: 0.25rem;
}

.news-year.hidden {
  display: none;
}

.news-year__line {
  display: none;
}

.news-year__label {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.news-item {
  display: flex;
  gap: 1.25rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-light);
  align-items: baseline;
}

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

.news-item.hidden {
  display: none;
}

.news-icon {
  flex: 0 0 1.4rem;
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.65;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.news-date {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  white-space: nowrap;
  flex: 0 0 100px;
  font-weight: 700;
}

.news-text {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
}

.news-text a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.show-all-btn {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem 0;
  transition: opacity 0.2s;
}

.show-all-btn:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* ============================
   Publications
   ============================ */
.pub-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.pub-filter {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
}

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

.pub-filter.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pub-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.pub-card {
  display: flex;
  gap: 1.75rem;
  padding: 1.5rem;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  transition: all 0.2s ease;
  align-items: flex-start;
}

.pub-card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

/* Thumbnail: gradient placeholder */
.pub-thumb {
  flex: 0 0 40%;
  min-height: 120px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
  aspect-ratio: 16 / 10;
}

.pub-thumb--gradient-0 { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.pub-thumb--gradient-1 { background: linear-gradient(135deg, #6366f1, #4338ca); }
.pub-thumb--gradient-2 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.pub-thumb--gradient-3 { background: linear-gradient(135deg, #f59e0b, #d97706); }
.pub-thumb--gradient-4 { background: linear-gradient(135deg, #10b981, #059669); }

.pub-thumb__label {
  text-align: center;
  padding: 0.75rem;
  line-height: 1.3;
  font-weight: 500;
}

/* Thumbnail: real image */
.pub-thumb-img {
  flex: 0 0 40%;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.pub-thumb-img img {
  width: 100%;
  height: auto;
  display: block;
}

.pub-info {
  flex: 1;
  min-width: 0;
}

.pub-title {
  font-family: var(--font-body);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.pub-title a {
  color: inherit;
  text-decoration: none;
}

.pub-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.pub-authors {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.pub-authors .me {
  color: var(--text);
  font-weight: 600;
}

.pub-venue {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.pub-venue--published {
  background: #fff8c5;
  color: var(--accent-warm);
}

.pub-venue--preprint {
  background: var(--tag-bg);
  color: var(--accent);
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.3rem;
  align-items: center;
}

.pub-link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--accent);
  transition: all 0.2s ease;
  text-decoration: none;
  line-height: 1.4;
}

.pub-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

/* Abstract toggle — standalone line with arrow */
.pub-abstract-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  background: none;
  border: none;
  border-top: 1px solid var(--border-light);
  cursor: pointer;
  padding: 0.6rem 0 0.1rem;
  margin-top: 0.6rem;
  text-align: left;
  transition: color 0.2s ease;
  line-height: 1.4;
}

.pub-abstract-toggle:hover {
  color: var(--text);
}

.pub-abstract-toggle .arrow {
  display: inline-block;
  margin-left: 0.3rem;
  transition: transform 0.3s ease;
  font-size: 0.75rem;
}

.pub-abstract-toggle.expanded .arrow {
  transform: rotate(180deg);
}

.pub-abstract {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-top: 0;
  padding-top: 0.4rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
}

.pub-abstract.expanded {
  max-height: 500px;
  opacity: 1;
}

/* ============================
   Timeline (Experience)
   ============================ */
.timeline {
  margin-top: 1.5rem;
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-light);
}

.timeline__item {
  position: relative;
  padding-bottom: 1.75rem;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__dot {
  position: absolute;
  left: -28px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  z-index: 1;
}

.timeline__row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.timeline__logo {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
  border: 1px solid var(--border-light);
  margin-top: 6px;
}

.timeline__date {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.timeline__role {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 0.1rem;
  line-height: 1.35;
}

.timeline__org {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-top: 0.05rem;
  line-height: 1.35;
}

.timeline__desc {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  line-height: 1.65;
}

/* ============================
   Education
   ============================ */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.edu-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}

.edu-card:hover {
  border-color: var(--border);
}

.edu-card__school {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.35;
}

.edu-card__degree {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.edu-card__date {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 0.45rem;
  font-weight: 500;
}

.edu-card__note {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.45rem;
  font-style: italic;
  line-height: 1.5;
}

/* ============================
   Footer
   ============================ */
.footer {
  padding: clamp(2.5rem, 5vh, 4rem) 2rem;
  text-align: center;
  background: var(--surface);
  border-top: 1px solid var(--border-light);
  color: var(--text);
}

.footer .section__title {
  color: var(--text);
  border-bottom: none;
}

.footer__inner {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
}

.footer__email {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--accent);
  margin-top: 0.75rem;
  padding: 0.45rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.footer__email:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

.footer__icons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.footer__icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  font-size: 1.2rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.footer__icons a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--tag-bg);
  text-decoration: none;
}

.footer__updated {
  margin-top: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ============================
   Scroll Animations
   ============================ */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* ============================
   Responsive
   ============================ */

/* Tablet */
@media (max-width: 1024px) {
  .edu-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pub-thumb,
  .pub-thumb-img {
    flex: 0 0 40%;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .nav__toggle {
    display: flex;
  }

  .nav__links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0;
    gap: 0;
    border-bottom: 1px solid var(--border-light);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
  }

  .nav__links.open {
    max-height: 400px;
    padding: 0.75rem 0;
  }

  .nav__links li {
    text-align: center;
  }

  .nav__links a {
    display: block;
    padding: 0.6rem 2rem;
    font-size: 1.05rem;
  }

  .nav__links a::after {
    display: none;
  }

  .hero__inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .hero__left {
    align-items: center;
  }

  .hero__right {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero__bio {
    text-align: left;
  }

  .hero__tags {
    justify-content: center;
  }

  .avatar {
    width: 170px;
    height: 170px;
  }

  .news-item {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon date"
      "text text";
    column-gap: 0.5rem;
    row-gap: 0.2rem;
  }

  .news-icon {
    grid-area: icon;
    flex: none;
  }

  .news-date {
    grid-area: date;
    flex: none;
  }

  .news-text {
    grid-area: text;
  }

  .pub-card {
    flex-direction: column;
  }

  .pub-thumb,
  .pub-thumb-img {
    flex: none;
    width: 100%;
  }

  .edu-grid {
    grid-template-columns: 1fr;
  }

  .timeline {
    padding-left: 0;
  }

  .timeline::before {
    display: none;
  }

  .timeline__dot {
    display: none;
  }

  .timeline__item {
    padding-left: 0;
    padding-bottom: 1.25rem;
    border-left: 2px solid var(--accent);
    padding-left: 1rem;
  }
}
