*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #f4f6f9;
  --sidebar-bg: #ffffff;
  --content-bg: #ffffff;
  --text: #1a2332;
  --text-muted: #5a6578;
  --accent: #1e3a5f;
  --accent-light: #2d5a87;
  --accent-soft: #e8eef5;
  --border: #e2e8f0;
  --tag-bg: #edf2f7;
  --tag-text: #2d3748;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --sidebar-width: 280px;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

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

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

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 200;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--sidebar-bg);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.4);
}

.overlay.visible {
  display: block;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 100;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem 1.5rem;
  min-height: 100%;
}

.cv-btn {
  display: inline-block;
  width: 100%;
  padding: 0.6rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.cv-btn:hover {
  background: var(--accent-light);
  color: #fff;
  text-decoration: none;
}

.profile-img {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 3px solid var(--accent-soft);
}

.sidebar-name {
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.sidebar-contact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.sidebar-contact > a {
  color: var(--text-muted);
}

.sidebar-contact > a:hover {
  color: var(--accent);
}

.social-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: 0.35rem 0;
}

.social-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.social-icons a:hover {
  opacity: 1;
  transform: translateY(-1px);
  text-decoration: none;
}

.social-icons img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: brightness(0);
}

.sidebar-nav {
  width: 100%;
  flex: 1;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav li {
  margin-bottom: 0.15rem;
}

.nav-link {
  display: block;
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-footer {
  width: 100%;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-footer p {
  margin: 0.15rem 0;
}

.muted {
  opacity: 0.75;
}

/* Main content */
.content {
  margin-left: var(--sidebar-width);
  padding: 2.5rem 3rem 3rem;
  max-width: 900px;
}

.section {
  margin-bottom: 3rem;
  scroll-margin-top: 2rem;
}

.section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
  color: var(--text);
}

.section-note {
  margin: -0.75rem 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

.subsection-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: var(--text);
}

.prose {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.75;
}

.prose p {
  margin: 0 0 1rem;
  color: var(--text);
}

/* News */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.news-list li {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

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

.news-date {
  flex-shrink: 0;
  width: 5.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.news-text {
  font-size: 0.95rem;
  color: var(--text);
}

/* Timeline entries */
.timeline-entry {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.timeline-entry:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.timeline-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.4;
  flex: 1;
}

.timeline-date {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 0.15rem;
}

.institution {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.meta {
  margin: 0.15rem 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.venue {
  margin: 0.25rem 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent-light);
}

.pub-entry {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.pub-entry:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.pub-entry h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  line-height: 1.45;
}

ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
  color: var(--text);
}

.bullet-list {
  list-style: disc;
  padding-left: 1.25rem;
}

.bullet-list li {
  margin-bottom: 0.5rem;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.project-card {
  display: block;
  padding: 1.1rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.project-card:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
}

.project-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--accent);
}

.project-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.link-list li {
  margin-bottom: 0.5rem;
}

.link-list a {
  font-size: 0.92rem;
  font-weight: 500;
}

/* Skill tags */
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tag-text);
  background: var(--tag-bg);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.content-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.content-footer p {
  margin: 0;
}

/* Responsive */
@media (max-width: 900px) {
  .menu-toggle {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    padding: 4.5rem 1.25rem 2.5rem;
  }

  .timeline-header {
    flex-direction: column;
    gap: 0.25rem;
  }

  .timeline-date {
    padding-top: 0;
  }

  .news-list li {
    flex-direction: column;
    gap: 0.25rem;
  }

  .news-date {
    width: auto;
  }
}

@media print {
  .menu-toggle,
  .overlay,
  .sidebar {
    display: none;
  }

  .content {
    margin-left: 0;
    padding: 0;
    max-width: 100%;
  }

  a {
    color: var(--text);
    text-decoration: none;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
    word-break: break-all;
  }
}
