/* CSS Variables for Theme Support */
:root {
  --bg-color: #ffffff;
  --text-color: #333333;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --link-color: #0066cc;
  --link-hover: #0052a3;
  --card-bg: #f9f9f9;
  --card-border: #e0e0e0;
  --accent-color: #0066cc;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --text-color: #e0e0e0;
    --text-secondary: #b0b0b0;
    --border-color: #404040;
    --link-color: #4da6ff;
    --link-hover: #66b3ff;
    --card-bg: #2a2a2a;
    --card-border: #404040;
    --accent-color: #4da6ff;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.4);
  }
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.4;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s ease, color 0.3s ease;
  font-size: 16px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

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

a:hover, a:focus {
  color: var(--link-hover);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-color);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-color);
  text-decoration: none;
}

.site-title:hover {
  text-decoration: none;
  color: var(--link-color);
}

/* Navigation */
.site-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2rem;
  width: 100%;
  justify-content: center;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  gap: 4px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background-color: var(--text-color);
  transition: all 0.3s ease;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-menu a {
  color: var(--text-color);
  font-weight: 400;
  padding: 0.5rem 0;
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-menu a:hover,
.nav-menu a:focus {
  color: var(--link-color);
  text-decoration: underline;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  color: var(--text-color);
  transition: transform 0.2s ease;
}

.theme-toggle:hover,
.theme-toggle:focus {
  transform: rotate(90deg);
  outline: none;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }
  
  .nav-menu {
    position: absolute;
    top: 100%;
    right: 0;
    flex-direction: column;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1rem;
    min-width: 200px;
    box-shadow: var(--shadow);
    display: none;
    gap: 0.5rem;
  }
  
  .nav-menu.active {
    display: flex;
  }
}

/* Page Wrapper */
.page-wrapper {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  gap: 2rem;
  padding: 1.5rem 1.5rem;
  min-height: calc(100vh - 200px);
}

@media (max-width: 1024px) {
  .page-wrapper {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem 1rem;
  }
}

/* Sidebar */
.sidebar {
  flex: 0 0 260px;
  position: sticky;
  top: 80px;
  height: fit-content;
}

@media (max-width: 1024px) {
  .sidebar {
    position: static;
    flex: 1;
    width: 100%;
  }
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.avatar-container {
  margin-bottom: 1rem;
}

.avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-color);
}

.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--card-bg);
  color: var(--text-secondary);
  font-size: 4rem;
  font-weight: 600;
  border: 3px solid var(--border-color);
}

.avatar-placeholder span {
  line-height: 1;
}

.sidebar-name {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

.sidebar-greeting {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-style: italic;
}

.sidebar-title {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  align-items: flex-start;
}

.sidebar-link-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-color);
  width: 100%;
}

.sidebar-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link-item a {
  color: var(--link-color);
  text-decoration: none;
}

.sidebar-link-item a:hover,
.sidebar-link-item a:focus {
  text-decoration: underline;
}

/* Main Content */
#main-content {
  flex: 1;
  max-width: 900px;
}

#main-content.with-sidebar {
  padding: 0;
}

@media (min-width: 1025px) {
  #main-content.with-sidebar {
    padding-left: 0;
  }
}

/* Home Page */
.home-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}


.about-section {
  margin-bottom: 0.35rem;
}

.about-section h2,
.research-interests-section h2,
.research-trajectory-section h2,
.publications-section h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: var(--text-color);
}

.bio {
  margin-bottom: 0;
  line-height: 1.4;
  text-align: justify;
}

.bio p {
  margin-bottom: 0.25rem;
  text-align: justify;
}

.research-interests-section,
.research-trajectory-section {
  margin-bottom: 0.35rem;
}

.research-interests,
.research-trajectory {
  line-height: 1.4;
  text-align: justify;
}

.research-interests h3,
.research-trajectory h3 {
  font-size: 1.1rem;
  margin-top: 0.35rem;
  margin-bottom: 0.15rem;
  font-weight: 600;
}

.research-interests ul {
  margin-left: 1.5rem;
  margin-bottom: 0.25rem;
}

.research-interests li {
  margin-bottom: 0.15rem;
  line-height: 1.4;
  text-align: justify;
}

.research-interests p {
  text-align: justify;
}

.interests {
  margin-top: 2rem;
}

.interest-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
}

.interest-list li {
  padding: 0.5rem 1rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.9rem;
}

/* News Section */
.news-section,

.news-section {
  margin-bottom: 0.35rem;
}

.news-section h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: var(--text-color);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

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

.news-date {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 100px;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.news-text {
  flex: 1;
  line-height: 1.4;
  text-align: justify;
}

/* Publications */
.publications-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-align: justify;
}

.publications-list.numbered {
  list-style: decimal;
  padding-left: 1.5rem;
  margin-bottom: 0;
  text-align: justify;
}

.publication-item {
  margin-bottom: 0.4rem;
  line-height: 1.3;
  padding-left: 0.5rem;
  text-align: justify;
}

.publication-item strong {
  font-weight: 600;
  color: var(--text-color);
}

.publication-item em {
  font-style: italic;
  color: var(--text-secondary);
}

.publication-item br {
  margin-bottom: 0.05rem;
}

.pub-links {
  display: inline;
  margin-left: 0.5rem;
}

.pub-links a {
  color: var(--link-color);
  text-decoration: none;
  margin-right: 0.5rem;
}

.pub-links a:hover,
.pub-links a:focus {
  text-decoration: underline;
}

.publication-note {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

.project-card {
  padding: 1.5rem;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.project-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.project-image {
  margin-bottom: 1rem;
  border-radius: 4px;
  overflow: hidden;
}

.project-image img {
  width: 100%;
  height: auto;
  display: block;
}

.project-title {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.project-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  flex: 1;
}

.project-highlights {
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}

.project-highlights li {
  padding: 0.25rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.project-highlights li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent-color);
}

.project-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.project-links a {
  padding: 0.5rem 1rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.project-links a:hover,
.project-links a:focus {
  background-color: var(--accent-color);
  color: white;
  text-decoration: none;
  border-color: var(--accent-color);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--accent-color);
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}

.btn:hover,
.btn:focus {
  background-color: var(--link-hover);
  color: white;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Page Layout */
.page-content {
  max-width: 900px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0;
}

.page-header .subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

.page-body {
  line-height: 1.4;
}

/* Publications Page */
.publications-page {
  max-width: 1000px;
}

.publications-page h2.publications-page {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid var(--border-color);
}

.filter-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1.5rem;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.filter-btn:hover,
.filter-btn:focus {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.filter-btn.active {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.publication-year-section,
.review-section {
  margin-bottom: 0.5rem;
}

.year-header {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  padding-bottom: 0.1rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.review-section .year-header {
  margin-top: 1rem;
  font-size: 1.5rem;
}

.review-category {
  margin-bottom: 0.5rem;
}

.review-category-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  margin-top: 0.5rem;
  color: var(--text-color);
}

.review-category:first-child .review-category-title {
  margin-top: 0;
}

.publication-card {
  padding: 0.15rem 0;
  border-bottom: none;
  margin-bottom: 0.15rem;
  text-align: justify;
}

.publication-card:last-child {
  border-bottom: none;
}

.pub-title {
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 0.05rem;
  line-height: 1.3;
  color: var(--text-color);
  text-align: justify;
}

.pub-authors {
  margin-bottom: 0.05rem;
  line-height: 1.3;
  color: var(--text-color);
  text-align: justify;
}

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

.pub-venue {
  margin-bottom: 0.05rem;
  color: var(--text-secondary);
  line-height: 1.3;
  text-align: justify;
}

.publication-card .pub-links {
  margin-top: 0.05rem;
  display: inline-block;
}

/* Projects Page */
.projects-page {
  max-width: 1200px;
}

/* Teaching Page */
.teaching-page {
  max-width: 900px;
}

.teaching-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.teaching-item {
  padding: 0.15rem 0;
  border-bottom: none;
  margin-bottom: 0.15rem;
}

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

.teaching-item h3 {
  font-size: 1rem;
  margin-bottom: 0;
  font-weight: 400;
  text-align: justify;
}

.teaching-role {
  color: var(--text-secondary);
  margin-bottom: 0.05rem;
  font-weight: 400;
  line-height: 1.3;
}

.teaching-period {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.05rem;
  line-height: 1.3;
}

.teaching-description {
  line-height: 1.3;
  margin-bottom: 0.05rem;
}

/* Talks Page */
.talks-page {
  max-width: 900px;
}

.talks-section {
  margin-bottom: 1.5rem;
}

.talks-section h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-color);
}

.talks-list {
  padding-left: 1.25rem;
  line-height: 1.4;
}

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

/* CV Page / Reviews Page */
.cv-page {
  max-width: 900px;
}

.cv-page h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.reviews-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  list-style: none;
  padding-left: 0;
}

.review-item {
  padding: 0.15rem 0;
  padding-left: 1.5rem;
  border-bottom: none;
  position: relative;
}

.review-item::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--text-color);
}

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

.review-name {
  font-size: 1rem;
  margin-bottom: 0.05rem;
  line-height: 1.3;
  text-align: justify;
}

.review-name strong {
  font-weight: 400;
  color: var(--text-color);
}

.review-years {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.3;
  text-align: justify;
}

/* Blog Page */
.blog-page {
  max-width: 800px;
}

/* Post Layout */
.post-content {
  max-width: 800px;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.post-header time {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.post-body {
  line-height: 1.4;
}

.post-body h2,
.post-body h3,
.post-body h4 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.post-body p {
  margin-bottom: 1.5rem;
}

.post-body ul,
.post-body ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.post-body code {
  background-color: var(--card-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9em;
}

.post-body pre {
  background-color: var(--card-bg);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.post-body pre code {
  background-color: transparent;
  padding: 0;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.blog-list {
  list-style: none;
  padding: 0;
}

.blog-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

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

.blog-item h2 {
  margin-bottom: 0.5rem;
}

.blog-item time {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.excerpt {
  color: var(--text-secondary);
  line-height: 1.6;
}

.no-posts {
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem 0;
}

/* Error Page */
.error-page {
  text-align: center;
  padding: 4rem 2rem;
}

.error-page h1 {
  font-size: 6rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.error-page p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Footer */
.site-footer {
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
}

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

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-content p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.footer-content .last-updated {
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.footer-label {
  font-weight: 600;
  color: var(--text-color);
}

.footer-links a {
  color: var(--link-color);
  font-size: 0.9rem;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links a:focus {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.25rem; }
  
  .name {
    font-size: 2rem;
  }
  
  #main-content {
    padding: 1.5rem 1rem;
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-container {
    flex-direction: column;
    text-align: center;
  }
  
  .news-item {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .news-date {
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .contact-links {
    flex-direction: column;
  }
  
  .contact-links a {
    width: 100%;
    justify-content: center;
  }
}

/* Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 1000;
}

.skip-link:focus {
  top: 0;
}

/* Print Styles */
@media print {
  .site-header,
  .site-footer,
  .nav-menu,
  .filter-controls,
  .btn {
    display: none;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
  }
  
  .publication-card,
  .project-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
