/* ========== Theme Variables ========== */
:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f7;
  --text: #333333;
  --text-secondary: #777777;
  --link: #1772d0;
  --link-hover: #f09228;
  --border: #e4e4e4;
  --heading-color: #333333;
  --name-color: #111111;
  --tag-bg: #e8f4e8;
  --tag-text: #2d6a2d;
  --tag-bg-reading: #fff3e0;
  --tag-text-reading: #e65100;
  --tab-active-bg: var(--text);
  --tab-active-text: var(--bg);
  --tab-inactive-text: var(--text-secondary);
  --toggle-bg: #e4e4e4;
  --toggle-fg: #333;
  --pub-image-border: #ddd;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --text: #c9d1d9;
  --text-secondary: #8b949e;
  --link: #58a6ff;
  --link-hover: #f0983a;
  --border: #30363d;
  --heading-color: #e6edf3;
  --name-color: #f0f6fc;
  --tag-bg: #1a3a1a;
  --tag-text: #7ee87e;
  --tag-bg-reading: #3d2200;
  --tag-text-reading: #ffb74d;
  --tab-active-bg: #c9d1d9;
  --tab-active-text: #0d1117;
  --tab-inactive-text: #8b949e;
  --toggle-bg: #30363d;
  --toggle-fg: #c9d1d9;
  --pub-image-border: #30363d;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

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

body {
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.3s, color 0.3s;
}

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

strong { font-weight: 600; }

/* ========== Layout ========== */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

/* ========== Dark/Light Toggle ========== */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  background: var(--toggle-bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background 0.3s, border-color 0.3s;
  box-shadow: var(--shadow);
}
.theme-toggle:hover {
  opacity: 0.8;
}

/* ========== Header ========== */
.header {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.header-text {
  flex: 1;
}

.header-photo {
  flex-shrink: 0;
}

.header-photo img {
  width: 160px;
  border-radius: 10px;
}

.name {
  font-size: 32px;
  font-weight: 700;
  color: var(--name-color);
  margin-bottom: 2px;
}

.title-line {
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-size: 16px;
}

.links {
  margin-bottom: 14px;
  font-size: 16px;
}

.links a {
  margin-right: 4px;
}

.sep {
  color: var(--text-secondary);
  margin: 0 2px;
}

.bio {
  font-size: 16px;
  color: var(--text);
  line-height: 1.7;
}

.bio a { font-weight: 500; }

/* ========== Tab Navigation ========== */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  margin-top: 8px;
  padding-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  color: var(--tab-inactive-text);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  font-weight: 500;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--heading-color);
  border-bottom-color: var(--heading-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ========== Section Headings ========== */
.section-heading {
  font-size: 22px;
  font-weight: 600;
  color: var(--heading-color);
  margin-bottom: 16px;
  padding-bottom: 6px;
}

/* ========== Publication Entry ========== */
.pub-entry {
  display: flex;
  gap: 20px;
  margin-bottom: 26px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

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

.pub-image {
  flex-shrink: 0;
  width: 140px;
}

.pub-image img {
  width: 140px;
  border-radius: 6px;
  border: 1px solid var(--pub-image-border);
}

.pub-text {
  flex: 1;
}

.pub-title {
  font-weight: 600;
  color: var(--link);
  font-size: 16.5px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.pub-title a {
  color: var(--link);
}
.pub-title a:hover {
  color: var(--link-hover);
}

.pub-authors {
  font-size: 15.5px;
  color: var(--text);
  margin-bottom: 3px;
}

.pub-venue {
  font-size: 15.5px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 4px;
}

.pub-links {
  font-size: 15px;
  margin-bottom: 6px;
}

.pub-links a {
  margin-right: 3px;
}

.pub-desc {
  font-size: 15.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== Book Entry ========== */
.book-entry {
  display: flex;
  gap: 18px;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.book-entry:last-child {
  border-bottom: none;
}

.book-cover {
  flex-shrink: 0;
  width: 80px;
}

.book-cover img {
  width: 80px;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.book-info {
  flex: 1;
}

.book-title {
  font-weight: 600;
  color: var(--heading-color);
  font-size: 16.5px;
  margin-bottom: 2px;
}

.book-author {
  font-size: 15.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.tag {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.tag-finished {
  background: var(--tag-bg);
  color: var(--tag-text);
}

.tag-reading {
  background: var(--tag-bg-reading);
  color: var(--tag-text-reading);
}

/* ========== Hobby Entry ========== */
.hobby-entry {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.hobby-entry:last-child {
  border-bottom: none;
}

.hobby-title {
  font-weight: 600;
  color: var(--heading-color);
  font-size: 17px;
  margin-bottom: 4px;
}

.hobby-sub {
  font-size: 15.5px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.hobby-desc {
  font-size: 16px;
  color: var(--text);
  line-height: 1.6;
}

/* ========== Blog Entry (preview card) ========== */
.blog-entry {
  display: flex;
  gap: 18px;
  margin-bottom: 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  align-items: flex-start;
}

.blog-entry:hover {
  background: var(--bg-alt);
  box-shadow: var(--shadow);
}

.blog-thumb {
  flex-shrink: 0;
  width: 180px;
}

.blog-thumb img {
  width: 180px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--pub-image-border);
  background: var(--bg-alt);
}

.blog-preview {
  flex: 1;
}

.blog-title {
  font-weight: 600;
  color: var(--heading-color);
  font-size: 17px;
  line-height: 1.4;
  margin-bottom: 3px;
}

.blog-date {
  font-size: 14.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.blog-snippet {
  font-size: 15.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== Paper Summaries ========== */
.summaries-intro {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
}

.summaries-divider {
  font-size: 18px;
  font-weight: 600;
  color: var(--heading-color);
  margin-top: 32px;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ========== Blog Full Post ========== */
.blog-full {
  margin-bottom: 30px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
  animation: fadeIn 0.3s ease;
}

.blog-full article h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--heading-color);
  margin-bottom: 16px;
  line-height: 1.3;
}

.blog-full article h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--heading-color);
  margin-top: 22px;
  margin-bottom: 8px;
}

.blog-full article p {
  font-size: 16px;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 12px;
}

.blog-full article em {
  color: var(--text-secondary);
}

/* ========== Footer ========== */
.footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
  .header {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
  }
  .header-photo img {
    width: 120px;
  }
  .links {
    text-align: center;
  }
  .pub-entry {
    flex-direction: column;
    gap: 12px;
  }
  .pub-image {
    width: 100%;
  }
  .pub-image img {
    width: 100%;
    max-width: 200px;
  }
  .tabs {
    flex-wrap: wrap;
  }
  .tab-btn {
    padding: 6px 12px;
    font-size: 15px;
  }
}
