/* ===== Variables ===== */
:root {
  --bg: #f0ebe5;
  --bg-warm: #ebe5de;
  --accent: #d97757;
  --accent-light: rgba(217, 119, 87, 0.14);
  --accent-hover: #c4684a;
  --text: #1a1a1a;
  --text-secondary: #3a3533;
  --text-muted: #524943;
  --border: rgba(58, 53, 51, 0.22);
  --border-light: rgba(58, 53, 51, 0.14);
  --card-bg: #faf8f5;
  --card-bg-hover: #f3eee8;
  --nav-height: 56px;
  --sidebar-width: 300px;
  --radius: 12px;
  --radius-pill: 999px;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow-sm: 0 1px 3px rgba(58, 53, 51, 0.09);
  --shadow-md: 0 3px 12px rgba(58, 53, 51, 0.1);
  --shadow-card: 0 2px 6px rgba(58, 53, 51, 0.07), 0 0 0 1px rgba(58, 53, 51, 0.05);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.48;
  color: var(--text-secondary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  display: block;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(240, 235, 229, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.nav-logo:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 0.35rem;
}

.nav-link {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s, background 0.2s;
}

.nav-link:hover,
.nav-link.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--card-bg);
  box-shadow: var(--shadow-md);
}

.page-layout {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 1.75rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 0.75rem);
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.profile-photo {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 0.85rem;
}

.profile-name {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
  color: var(--text);
}

.profile-title {
  font-size: 1.0625rem;
  margin-bottom: 0.15rem;
}

.profile-title .accent {
  color: var(--accent);
  font-weight: 600;
}

.profile-affiliation {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.85rem;
}

.cv-button {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.85rem;
  transition: border-color 0.2s, background 0.2s;
  box-shadow: var(--shadow-sm);
}

.cv-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-md);
}

.contact-list {
  list-style: none;
  width: 100%;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.38;
}

.contact-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  color: var(--text-secondary);
}

.contact-icon svg {
  width: 100%;
  height: 100%;
}

.contact-item a {
  color: var(--text-secondary);
  white-space: nowrap;
}

.contact-item a:hover {
  color: var(--accent);
}

.main-content {
  min-width: 0;
}

.content-section {
  margin-bottom: 2.25rem;
  scroll-margin-top: calc(var(--nav-height) + 0.5rem);
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
  color: var(--text);
}

.subsection-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: var(--text);
}

.bio-text {
  color: var(--text-secondary);
  font-size: 1.0625rem;
  line-height: 1.5;
}

.bio-text strong {
  color: var(--text);
  font-weight: 600;
}

.bio-text a {
  color: var(--accent);
  font-weight: 500;
}

.bio-text a:hover {
  color: var(--accent-hover);
}

.bio-text .bio-highlight {
  color: #c0392b;
  font-weight: 600;
}

/* ===== Timeline — staggered left/right (pre overlap-fix version) ===== */
.timeline {
  position: relative;
  padding: 0;
  overflow: visible;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  width: 50%;
  padding-bottom: 0;
}

.timeline-item.timeline-right,
.timeline-item.timeline-left ~ .timeline-left {
  margin-top: -3rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 0.85rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  z-index: 1;
}

.timeline-left {
  left: 0;
  text-align: right;
  padding-right: 1.1rem;
}

.timeline-left::before {
  right: -4px;
}

.timeline-right {
  left: 50%;
  text-align: left;
  padding-left: 1.1rem;
}

.timeline-right::before {
  left: -4px;
}

.timeline-content {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  box-shadow: var(--shadow-card);
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.timeline-left .timeline-header {
  flex-direction: row-reverse;
}

.timeline-right .timeline-header {
  flex-direction: row;
}

.school-logo {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  object-fit: contain;
  display: block;
  background: transparent;
}

.timeline-period {
  font-size: 0.9375rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.3;
}

.timeline-degree {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.1rem;
  line-height: 1.32;
}

.timeline-supervisor {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.interest-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.interest-tag {
  padding: 0.28rem 0.7rem;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.interest-tag strong {
  color: var(--text);
  font-weight: 600;
}

.oss-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.oss-card {
  display: grid;
  grid-template-columns: minmax(320px, 42%) 1fr;
  gap: 1rem;
  padding: 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  color: inherit;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  align-items: center;
}

.oss-card:hover {
  background: var(--card-bg-hover);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
  color: inherit;
}

.oss-image {
  width: 100%;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: block;
}

.oss-title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.oss-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.4rem;
}

.oss-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
}

.pub-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pub-item {
  padding: 0.7rem 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.pub-entry {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.pub-index {
  color: var(--text-secondary);
  margin-right: 0.15rem;
}

.pub-authors-text {
  color: var(--text-secondary);
}

.pub-author-self {
  color: var(--accent);
  font-weight: 700;
}

.pub-title {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 400;
}

a.pub-title {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 400;
}

a.pub-title:hover {
  color: var(--text);
}

.pub-venue {
  color: var(--text);
  font-weight: 700;
  font-style: italic;
}

.pub-details {
  color: var(--text-secondary);
}

.pub-summary {
  color: var(--text-secondary);
  font-style: italic;
}

.pub-full-paper {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.pub-full-paper:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.pub-patent {
  color: var(--text);
  font-style: italic;
}

.pub-granted {
  color: var(--accent);
  font-weight: 700;
}

.pub-tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  margin-left: 0.25rem;
  font-size: 0.8125rem;
  font-style: normal;
  background: var(--bg-warm);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-weight: 500;
}

.author-highlight {
  color: var(--accent);
  font-weight: 600;
}

.work-card {
  margin-bottom: 1.5rem;
}

.work-card:last-child {
  margin-bottom: 0;
}

.work-header {
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.work-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.55rem;
}

.work-internship {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.55rem;
}

.work-keywords {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.work-keywords-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.work-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.work-image {
  width: 50%;
  max-width: 50%;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #f9f1ee;
  display: block;
}

.work-desc {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.work-papers {
  list-style: disc;
  padding-left: 1.15rem;
  margin-bottom: 0.6rem;
}

.work-papers li {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 0.2rem;
}

.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.keyword-tag {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.award-list {
  list-style: none;
}

.award-list li {
  display: flex;
  gap: 1rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 1rem;
}

.award-list li:last-child {
  border-bottom: none;
}

.award-year {
  flex-shrink: 0;
  width: 6.5rem;
  white-space: nowrap;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.9375rem;
}

.award-text {
  color: var(--text-secondary);
  line-height: 1.45;
}

.site-footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  background: var(--bg-warm);
  border-top: 1px solid var(--border);
}

@media (max-width: 900px) {
  .page-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1rem 1rem 2rem;
  }

  .sidebar {
    position: static;
  }

  .profile-card {
    align-items: center;
    text-align: center;
  }

  .profile-photo {
    max-width: 220px;
  }

  .contact-item {
    justify-content: center;
    text-align: left;
  }

  .contact-item a {
    white-space: normal;
  }

  .nav-inner {
    padding: 0 1rem;
  }

  .nav-links {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    white-space: nowrap;
    font-size: 0.9375rem;
    padding: 0.35rem 0.7rem;
  }

  .timeline::before {
    left: 50%;
    top: 12px;
    bottom: 12px;
    transform: translateX(-50%);
  }

  .timeline-item {
    width: 50%;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .timeline-item.timeline-right,
  .timeline-item.timeline-left ~ .timeline-left {
    margin-top: -3rem;
  }

  .timeline-left {
    left: 0;
    text-align: right;
    padding-right: 0.85rem !important;
  }

  .timeline-right {
    left: 50%;
    text-align: left;
    padding-left: 0.85rem !important;
  }

  .timeline-item::before {
    top: 0.85rem;
  }

  .timeline-left::before {
    right: -4px !important;
    left: auto !important;
  }

  .timeline-right::before {
    left: -4px !important;
    right: auto !important;
  }

  .timeline-left .timeline-header {
    flex-direction: row-reverse;
  }

  .oss-card {
    grid-template-columns: 1fr;
  }

  .oss-image {
    width: 100%;
    height: auto;
    max-height: none;
  }

  .work-body {
    gap: 0.85rem;
  }

  .work-image {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 600px) {
  .timeline-item.timeline-right,
  .timeline-item.timeline-left ~ .timeline-left {
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  .nav-logo {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  body {
    font-size: 16px;
  }
}
