* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #fafafa;
  --bg-secondary: #ffffff;
  --fg: #1a1a1a;
  --fg-secondary: #666666;
  --fg-tertiary: #999999;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  --font-mono: 'Menlo', 'Monaco', 'Courier New', monospace;
}

body.light-mode {
  --bg: #fafafa;
  --bg-secondary: #ffffff;
  --fg: #1a1a1a;
  --fg-secondary: #666666;
  --fg-tertiary: #999999;
  --accent: #2563eb;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
}

body.dark-mode {
  --bg: #0f1419;
  --bg-secondary: #1a1f2b;
  --fg: #f0f0f0;
  --fg-secondary: #b0b0b0;
  --fg-tertiary: #808080;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --border: #2a2f3a;
  --border-light: #252b36;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
}

html, body {
  height: 100%;
}

body {
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg) 100%);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.dark-mode-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}

.dark-mode-toggle:hover {
  background: var(--border-light);
  box-shadow: var(--shadow-md);
  transform: scale(1.05);
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

body.dark-mode .header {
  background-color: rgba(26, 31, 43, 0.95);
}

.navbar {
  padding: 16px 0;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
}

.nav-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  flex-shrink: 0;
}

.site-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--fg);
}

.site-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.site-title a:hover {
  color: var(--accent);
}

.site-subtitle {
  font-size: 12px;
  color: var(--fg-secondary);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-center {
  flex: 1;
  max-width: 300px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.search-input::placeholder {
  color: var(--fg-tertiary);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 32px;
  align-items: center;
}

.nav-link {
  color: var(--fg-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: color 0.2s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--accent);
}

.search-results {
  position: absolute;
  top: 70px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-width: 350px;
  max-height: 400px;
  overflow-y: auto;
  z-index: 999;
  box-shadow: var(--shadow-lg);
}

.search-results.hidden {
  display: none;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: block;
  text-decoration: none;
  color: inherit;
}

.search-result-item:hover {
  background: var(--border-light);
}

.search-result-item h4 {
  color: var(--accent);
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
}

.search-result-item small {
  color: var(--fg-secondary);
  font-size: 12px;
}

main {
  padding: 48px 0;
  min-height: calc(100vh - 200px);
}

.blog-index {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.post-preview {
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  cursor: pointer;
}

.post-preview:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.post-title {
  font-size: 20px;
  margin-bottom: 12px;
  font-weight: 700;
}

.post-title a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-title a:hover {
  color: var(--accent);
}

.post-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--fg-secondary);
  margin-bottom: 12px;
}

.post-meta time {
  font-weight: 600;
  color: var(--fg-secondary);
}

.categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.category-tag {
  background: var(--border-light);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 600;
}

.category-tag:hover {
  background: var(--accent);
  color: white;
}

.post-excerpt {
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.7;
  color: var(--fg-secondary);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.tag {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.tag:hover {
  text-decoration: underline;
}

.read-more {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  display: inline-block;
}

.read-more:hover {
  margin-left: 6px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.pagination a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
}

.pagination a:hover {
  color: var(--accent-hover);
}

.page-info {
  color: var(--fg-secondary);
  font-size: 14px;
  font-weight: 500;
}

.post-single {
  background: var(--bg-secondary);
  padding: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 32px;
  box-shadow: var(--shadow);
}

.post-header {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
}

.post-header .post-title {
  font-size: 32px;
  margin-bottom: 16px;
  line-height: 1.3;
}

.post-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--fg);
}

.post-content h1 {
  font-size: 28px;
  margin: 32px 0 16px;
  font-weight: 700;
  color: var(--fg);
}

.post-content h2 {
  font-size: 24px;
  margin: 28px 0 14px;
  font-weight: 700;
  color: var(--fg);
}

.post-content h3 {
  font-size: 20px;
  margin: 24px 0 12px;
  font-weight: 700;
  color: var(--fg);
}

.post-content code {
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
}

.post-content pre {
  background: var(--border-light);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 20px 0;
  border-left: 3px solid var(--accent);
}

.post-content pre code {
  background: none;
  padding: 0;
  border: none;
  color: inherit;
  font-size: 13px;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 20px 0;
  opacity: 0.9;
  color: var(--fg-secondary);
}

.post-content ul, .post-content ol {
  margin: 16px 0 16px 24px;
}

.post-content li {
  margin-bottom: 8px;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.post-content a:hover {
  color: var(--accent-hover);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.related-posts {
  background: var(--bg-secondary);
  padding: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 28px;
}

.related-posts h3 {
  margin-bottom: 20px;
  color: var(--fg);
  font-size: 18px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.related-item {
  padding: 16px;
  background: var(--border-light);
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.related-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.related-item h4 {
  margin-bottom: 8px;
  color: var(--fg);
  font-size: 14px;
}

.related-item a {
  color: var(--accent);
  text-decoration: none;
}

.related-item a:hover {
  text-decoration: underline;
}

.related-item time {
  font-size: 12px;
  color: var(--fg-tertiary);
}

.about-page, .cv-page, .publications-page {
  width: 100%;
}

.about-header, .cv-header, .publications-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 32px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.about-header h1, .cv-header h1, .publications-header h1 {
  font-size: 32px;
  margin-bottom: 8px;
  font-weight: 700;
}

.subtitle {
  font-size: 16px;
  color: var(--fg-secondary);
  font-weight: 500;
}

.about-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.intro-card {
  padding: 28px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.intro-card h2 {
  color: var(--fg);
  margin-bottom: 16px;
  font-size: 20px;
}

.intro-card p {
  line-height: 1.8;
  font-size: 15px;
}

.expertise-grid {
  margin-bottom: 28px;
}

.expertise-grid h2 {
  color: var(--fg);
  margin-bottom: 24px;
  font-size: 20px;
  font-weight: 700;
}

.expertise-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.expertise-item {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.expertise-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.expertise-item h3 {
  color: var(--accent);
  margin-bottom: 12px;
  font-size: 16px;
}

.expertise-item ul {
  list-style: none;
  padding: 0;
}

.expertise-item li {
  padding: 6px 0;
  font-size: 14px;
  color: var(--fg-secondary);
  position: relative;
  padding-left: 20px;
}

.expertise-item li:before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

.about-journey {
  padding: 28px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.about-journey h2 {
  color: var(--fg);
  margin-bottom: 16px;
  font-size: 20px;
}

.about-journey p {
  line-height: 1.8;
  margin-bottom: 12px;
  font-size: 15px;
}

.cv-section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 20px;
  color: var(--fg);
  margin-bottom: 24px;
  font-weight: 700;
}

.timeline {
  position: relative;
}

.timeline-item {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-left: 2px solid var(--border);
  padding-left: 20px;
  margin-left: 0;
  position: relative;
  transition: all 0.2s ease;
}

.timeline-item:hover {
  padding-left: 24px;
  border-left-color: var(--accent);
}

.timeline-marker {
  position: absolute;
  left: -9px;
  top: 0;
  width: 16px;
  height: 16px;
  background: var(--bg-secondary);
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg);
}

.timeline-content h3 {
  color: var(--fg);
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 700;
}

.timeline-content .company {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

.timeline-content .institution {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

.timeline-content .description {
  color: var(--fg-secondary);
  margin: 6px 0;
  font-size: 14px;
}

.timeline-content .supervisor {
  font-size: 13px;
  color: var(--fg-tertiary);
  margin-top: 6px;
  font-style: italic;
}

.timeline-content .date {
  font-size: 13px;
  color: var(--fg-tertiary);
  margin-top: 6px;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.skill-group {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.skill-group:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.skill-group h4 {
  color: var(--fg);
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  background: var(--border-light);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.2s ease;
  font-weight: 600;
}

.skill-tag:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.publications-content {
  margin-top: 24px;
}

.publications-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.publication-item {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.publication-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.publication-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.publication-details {
  flex: 1;
}

.publication-title {
  color: var(--accent);
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
}

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

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

.publication-venue,
.publication-date {
  font-size: 13px;
  color: var(--fg-secondary);
  margin: 4px 0;
}

.publication-citation {
  margin-top: 12px;
  padding: 12px;
  background: var(--border-light);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.publication-citation summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
}

.publication-citation summary:hover {
  color: var(--accent-hover);
}

.publication-citation pre {
  margin-top: 8px;
  font-size: 12px;
  overflow-x: auto;
}

.publication-links {
  margin-top: 12px;
}

.pub-link {
  display: inline-block;
  padding: 6px 14px;
  background: var(--accent);
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s ease;
}

.pub-link:hover {
  background: var(--accent-hover);
}

.category-page h1, .tag-page h1 {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--fg);
  font-weight: 700;
}

.count {
  color: var(--fg-secondary);
  margin-bottom: 32px;
  font-size: 14px;
}

.posts-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.archives-page h1 {
  font-size: 28px;
  margin-bottom: 32px;
  color: var(--fg);
  font-weight: 700;
}

.year-section {
  margin-bottom: 28px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.year-section:hover {
  box-shadow: var(--shadow-md);
}

.year-header {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--accent);
  font-weight: 700;
}

.posts-by-year {
  list-style: none;
}

.posts-by-year li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: 12px;
  align-items: center;
  transition: all 0.2s ease;
}

.posts-by-year li:hover {
  padding-left: 4px;
}

.posts-by-year li:last-child {
  border-bottom: none;
}

.archive-date {
  color: var(--fg-secondary);
  min-width: 100px;
  display: inline-block;
  font-weight: 600;
  font-size: 13px;
}

.posts-by-year a {
  color: var(--fg);
  text-decoration: none;
  flex: 1;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 15px;
}

.posts-by-year a:hover {
  color: var(--accent);
}

.not-found {
  text-align: center;
  padding: 48px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.not-found h1 {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--accent);
  font-weight: 700;
}

.not-found p {
  font-size: 16px;
  margin-bottom: 32px;
  color: var(--fg-secondary);
}

.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
  margin-top: 80px;
  color: var(--fg);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px 32px;
  border-bottom: 1px solid var(--border);
}

.footer-section h3, .footer-section h4 {
  color: var(--fg);
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 700;
}

.footer-section p {
  font-size: 13px;
  color: var(--fg-secondary);
  line-height: 1.7;
}

.footer-section ul {
  list-style: none;
}

.footer-section a {
  color: var(--fg-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  font-size: 13px;
  display: block;
  margin: 8px 0;
  font-weight: 500;
}

.footer-section a:hover {
  color: var(--accent);
}

.footer-bottom {
  text-align: center;
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
  font-size: 13px;
  color: var(--fg-secondary);
}

@media (max-width: 768px) {
  .navbar .container {
    flex-direction: column;
    gap: 16px;
  }

  .nav-center {
    width: 100%;
    max-width: 100%;
  }

  .nav-links {
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .site-title {
    font-size: 16px;
  }

  .post-title {
    font-size: 18px;
  }

  .post-header .post-title {
    font-size: 24px;
  }

  .expertise-list,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  main {
    padding: 32px 0;
  }

  .pagination {
    flex-direction: column;
    gap: 16px;
  }

  .publication-item {
    flex-direction: column;
  }

  .publication-number {
    order: -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
