/* ============================================
   Academic Minimalist Theme
   Inspired by academic personal homepages
   ============================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,500;1,8..60,300;1,8..60,400&display=swap');

/* ---------- CSS Custom Properties (Academic Style) ---------- */
:root {
  --bg: #ffffff;
  --text: #000000;
  --muted: #6e6e6e;
  --border: #e5e5e5;
  --hover-bg: #f5f5f5;
  --avatar-bg: #f0f0f0;
  --max-width: 1200px;
  --font-body: 'Source Serif 4', Georgia, Cambria, 'Times New Roman', Times, serif;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #e0e0e0;
  --muted: #999999;
  --border: #333333;
  --hover-bg: #2a2a2a;
  --avatar-bg: #2a2a2a;
}

/* ---------- Global Reset ---------- */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
}

#container {
  background: var(--bg);
}

#wrap {
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  opacity: 0.7;
}

/* ---------- Header / Navigation ---------- */
#header {
  display: none;
}

/* ---------- Theme Toggle Button ---------- */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  border-radius: 8px;
  font-size: 18px;
  font-family: var(--font-body);
  line-height: 1;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--hover-bg);
}

/* ---------- Content Layout ---------- */
.outer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

#main {
  width: 100%;
  float: none;
}

/* ---------- Article Cards ---------- */
.article {
  margin: 0 0 40px 0;
}

.article-inner {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  transition: none;
}

.article-inner:hover {
  box-shadow: none;
  transform: none;
}

.article-header {
  padding: 24px 24px 0;
}

.article-title {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.4;
  text-decoration: none;
}

a.article-title:hover {
  opacity: 0.7;
  color: var(--text);
}

.article-meta {
  padding: 4px 24px 0;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--muted);
}

.article-meta a {
  color: var(--muted);
  text-decoration: none;
}

.article-meta a:hover {
  opacity: 0.7;
}

.article-date {
  color: var(--muted);
}

.article-category {
  color: var(--muted);
}

.article-entry {
  padding: 0 24px 24px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--text);
}

.article-entry p,
.article-entry table {
  line-height: 1.7;
  margin: 1em 0;
}

.article-entry a {
  color: var(--text);
  border-bottom: 1px solid var(--text);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.article-entry a:hover {
  opacity: 0.7;
  border-bottom-color: var(--text);
}

.article-entry h1, .article-entry h2, .article-entry h3,
.article-entry h4, .article-entry h5, .article-entry h6 {
  font-family: var(--font-body);
  color: var(--text);
  border-bottom: none;
}

.article-entry h1 {
  font-size: 2em;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.article-entry h2 {
  font-size: 1.5em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.article-entry h3 {
  font-size: 1.25em;
  font-weight: 600;
}

/* ---------- Code Blocks ---------- */
.article-entry pre,
.article-entry .highlight {
  background: #f7f7f7;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1.2em 0;
  padding: 16px 20px;
  box-shadow: none;
}

.article-entry code {
  background: #f5f5f5;
  color: var(--text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Courier New', monospace;
}

.article-entry pre code {
  background: none;
  color: var(--text);
  padding: 0;
}

/* ---------- Blockquote ---------- */
.article-entry blockquote {
  font-family: var(--font-body);
  margin: 1.6em 0;
  padding: 16px 24px;
  background: var(--bg);
  border-left: 3px solid var(--text);
  border-radius: 0;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Read More Button ---------- */
.article-more-link {
  text-align: left;
}

.article-more-link a {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border);
  padding: 6px 16px;
  border-radius: 6px;
  text-shadow: none;
  text-decoration: none;
  box-shadow: none;
  transition: all 0.2s ease;
}

.article-more-link a:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  box-shadow: none;
  transform: none;
}

.article-footer {
  display: none;
}

/* ---------- Sidebar ---------- */
#sidebar {
  width: 300px;
  float: right;
}

.widget-wrap {
  margin: 0 0 30px 0;
}

.widget {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 20px;
  box-shadow: none;
  color: var(--text);
}

.widget-title {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
  margin-bottom: 16px;
  text-shadow: none;
}

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

.widget a:hover {
  opacity: 0.6;
}

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

.widget ul li {
  padding: 6px 0;
  border-bottom: none;
  font-size: 14px;
}

.widget ul li:last-child {
  border-bottom: none;
}

.widget .category-list-link,
.widget .tag-list-link,
.widget .archive-list-link {
  transition: none;
}

.widget .category-list-link:hover,
.widget .tag-list-link:hover,
.widget .archive-list-link:hover {
  padding-left: 0;
}

.widget .category-list-count,
.widget .archive-list-count {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Tag Cloud ---------- */
.widget .tagcloud a {
  display: inline-block;
  margin: 0 8px 8px 0;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px !important;
  transition: all 0.2s ease;
}

.widget .tagcloud a:hover {
  background: var(--text);
  color: var(--bg);
  opacity: 1;
}

/* ---------- Footer ---------- */
#footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 40px 0;
  color: var(--muted);
}

#footer .outer {
  max-width: var(--max-width);
}

#footer-info {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  line-height: 2;
}

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

#footer a:hover {
  color: var(--text);
  opacity: 1;
}

/* ---------- Archive Page ---------- */
.archive-article-inner {
  background: var(--bg);
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  padding: 20px 0;
  transition: none;
}

.archive-article-inner:hover {
  box-shadow: none;
  transform: none;
}

.archive-article-header {
  padding: 0;
}

.archive-article-title {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.archive-article-title:hover {
  opacity: 0.6;
  color: var(--text);
}

.archive-article-date {
  font-size: 14px;
  color: var(--muted);
}

/* ---------- Pagination ---------- */
#page-nav {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
  padding: 20px 0;
  margin: 0;
}

#page-nav a, #page-nav span {
  font-family: var(--font-body);
  font-size: 14px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0 4px;
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s ease;
}

#page-nav a:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

#page-nav .page-number.current {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ---------- Tables ---------- */
.article-entry table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  border: 1px solid var(--border);
}

.article-entry th {
  background: #fafafa;
  color: var(--text);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
  font-size: 14px;
}

.article-entry td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* ============================================
   About Page - Academic Homepage Style
   ============================================ */

/* Override article styling for About page (uses :has() to detect about-container) */
/* Hide sidebar on about page */
body:has(.about-container) #sidebar {
  display: none;
}

body:has(.about-container) #main {
  width: 100%;
}

.h-entry:has(.about-container) {
  margin: 0;
}

.h-entry:has(.about-container) .article-inner {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.h-entry:has(.about-container) .article-meta {
  display: none;
}

.h-entry:has(.about-container) .article-header {
  display: none;
}

.h-entry:has(.about-container) .article-entry {
  padding: 0;
}

.about-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero Section */
.about-hero {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 60px;
  align-items: center;
  padding: 40px 0 80px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.about-hero-text h1 {
  font-family: var(--font-body);
  font-size: 48px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0 0 12px 0;
  padding: 0;
  border: none;
}

.about-hero-text .subtitle {
  font-family: var(--font-body);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
  max-width: 500px;
  margin: 0 0 24px 0;
}

.about-hero-text .social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 0;
}

.about-hero-text .social-links a {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--text);
  padding-bottom: 2px;
  transition: opacity 0.2s ease;
}

.about-hero-text .social-links a:hover {
  opacity: 0.6;
}

.about-hero-text .email-link {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  display: inline-block;
  margin-top: 16px;
}

.about-hero-text .email-link:hover {
  opacity: 0.6;
}

/* Avatar */
.about-avatar-container {
  width: 100%;
  padding-bottom: 100%;
  position: relative;
  background: var(--avatar-bg);
  border-radius: 12px;
  overflow: hidden;
}

.about-avatar-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* About Section */
.about-section-wrapper {
  display: grid;
  grid-template-columns: 3fr 1.5fr;
  gap: 60px;
  padding: 60px 0;
  max-width: var(--max-width);
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.about-section {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin-bottom: 0;
}

.about-section h2 {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 32px 0;
  padding-bottom: 0;
  border-bottom: none;
}

.about-section h2:first-child {
  margin-top: 0;
}

.about-section p {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 1em 0;
}

.about-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.about-section ul li {
  padding: 8px 0;
  border-bottom: none;
  display: block;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}

.about-section ul li::before {
  content: none;
}

/* About image */
.about-image-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.about-image-wrapper img {
  width: 100%;
  border-radius: 12px;
  display: block;
}

.about-image-wrapper .caption {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
}

/* Publications Section */
.about-publications {
  padding: 60px 0;
  max-width: var(--max-width);
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.about-publications h2 {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0 0 40px 0;
}

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

.publication-item {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
  padding: 24px;
  border-radius: 12px;
  transition: background-color 0.2s ease;
}

.publication-item:hover {
  background-color: var(--hover-bg);
}

.publication-item .pub-img {
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #f7f7f7;
}

.publication-item .pub-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.publication-item:hover .pub-img img {
  transform: scale(1.03);
}

.publication-item .pub-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.publication-item .pub-title {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--text);
  margin: 0 0 8px 0;
}

.publication-item .pub-authors {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 4px 0;
}

.publication-item .pub-venue {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 12px 0;
}

.publication-item .pub-links {
  display: flex;
  gap: 16px;
}

.publication-item .pub-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.publication-item .pub-links a::after {
  content: " ↗";
  font-size: 12px;
}

.publication-item .pub-links a:hover {
  opacity: 0.6;
  text-decoration: underline;
}

/* Skills Tags */
.about-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.about-skills span {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.about-skills span:hover {
  background: var(--text);
  color: var(--bg);
  transform: none;
}

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

@media screen and (max-width: 768px) {
  /* About page grids collapse */
  .about-hero {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 24px 0 60px;
  }

  .about-hero-text h1 {
    font-size: 36px;
  }

  .about-hero-text .subtitle {
    font-size: 18px;
  }

  .about-section-wrapper {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 40px 0;
  }

  .about-section p {
    font-size: 16px;
  }

  .publication-item {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px;
  }

  .about-hero-text .social-links {
    gap: 16px;
  }

  /* Header responsive */
  #header-outer {
    padding: 16px;
  }

  #main-nav {
    gap: 20px;
  }

  /* Sidebar below content */
  #sidebar {
    width: 100%;
    float: none;
    margin-top: 40px;
  }

  #main {
    width: 100%;
  }

  /* Article padding */
  .article-header {
    padding: 20px 20px 0;
  }

  .article-entry {
    padding: 0 20px 20px;
  }

  .article-meta {
    padding: 4px 20px 0;
  }

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

@media screen and (max-width: 479px) {
  #header-outer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  #header-inner {
    width: 100%;
    justify-content: flex-start;
  }

  #main-nav {
    flex-wrap: wrap;
    gap: 16px;
  }

  .about-hero {
    padding: 16px 0 40px;
  }

  .about-hero-text h1 {
    font-size: 28px;
  }

  .about-section h2 {
    font-size: 20px;
  }

  .about-publications h2 {
    font-size: 20px;
  }

  .publication-item .pub-title {
    font-size: 18px;
  }
}