/* ============================================
   Theme A: "Claude Warmth" — 温暖两栏风格
   Claude warm terracotta palette + two-column layout
   ============================================ */

:root {
  --claude-bg: #FAF9F7;
  --claude-text: #3D3929;
  --claude-accent: #C2714F;
  --claude-secondary: #8C8577;
  --claude-sidebar-bg: transparent;
  --claude-card-shadow: rgba(194, 113, 79, 0.15);
  --claude-border: rgba(194, 113, 79, 0.2);
  --claude-social-bg: #FFFFFF;
  --claude-social-text: #8B7355;
  --claude-footer-border: rgba(194, 113, 79, 0.15);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --claude-bg: #1A1917;
    --claude-text: #D1CEC7;
    --claude-accent: #E28A67;
    --claude-secondary: #9B9488;
    --claude-sidebar-bg: transparent;
    --claude-card-shadow: rgba(0, 0, 0, 0.3);
    --claude-border: rgba(226, 138, 103, 0.2);
    --claude-social-bg: #22211E;
    --claude-social-text: #D1CEC7;
    --claude-footer-border: rgba(226, 138, 103, 0.15);
  }
}

/* 手动切换支持 */
[data-theme="dark"] {
  --claude-bg: #1A1917;
  --claude-text: #D1CEC7;
  --claude-accent: #E28A67;
  --claude-secondary: #9B9488;
  --claude-sidebar-bg: transparent;
  --claude-card-shadow: rgba(0, 0, 0, 0.3);
  --claude-border: rgba(226, 138, 103, 0.2);
  --claude-social-bg: #22211E;
  --claude-social-text: #D1CEC7;
  --claude-footer-border: rgba(226, 138, 103, 0.15);
}

/* 强制浅色模式变量 */
[data-theme="light"] {
  --claude-bg: #FAF9F7;
  --claude-text: #3D3929;
  --claude-accent: #C2714F;
  --claude-secondary: #8C8577;
  --claude-sidebar-bg: transparent;
  --claude-card-shadow: rgba(194, 113, 79, 0.15);
  --claude-border: rgba(194, 113, 79, 0.2);
  --claude-social-bg: #FFFFFF;
  --claude-social-text: #8B7355;
  --claude-footer-border: rgba(194, 113, 79, 0.15);
}

body.theme-claude {
  background-color: var(--claude-bg);
  color: var(--claude-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  font-weight: 400;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Top Navigation Bar --- */
body.theme-claude .top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--claude-bg);
  border-bottom: 1px solid var(--claude-footer-border);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: all 0.3s ease;
}

body.theme-claude .nav-container {
  max-width: 1120px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  box-sizing: border-box;
}

body.theme-claude .nav-left a {
  font-weight: 600;
  font-size: 18px;
  color: var(--claude-text);
  text-decoration: none;
  transition: color 0.2s ease;
}

body.theme-claude .nav-left a:not(:first-child) {
  font-size: 14px;
  font-weight: 500;
  margin-left: 6px;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--claude-secondary);
}

body.theme-claude .nav-left a:hover {
  color: var(--claude-accent);
}

body.theme-claude .nav-left a:not(:first-child):hover {
  background: rgba(194, 113, 79, 0.08);
  color: var(--claude-accent);
}

body.theme-claude .nav-left a.nav-active {
  color: var(--claude-accent);
  background: rgba(194, 113, 79, 0.1);
}


body.theme-claude .nav-right .theme-toggle {
  background: none;
  border: none;
  color: var(--claude-text);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

body.theme-claude .nav-right .theme-toggle:hover {
  background-color: var(--claude-border);
  color: var(--claude-accent);
}

/* --- Theme Switcher --- */
body.theme-claude .theme-switcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  background: #FFFFFF;
  padding: 8px 12px;
  border-radius: 50px;
  box-shadow: 0 2px 12px rgba(61, 57, 41, 0.12);
}

body.theme-claude .theme-btn {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease;
}

body.theme-claude .theme-btn.active {
  border-color: #C2714F;
}

body.theme-claude .theme-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: block;
}

body.theme-claude .dot-claude { background: #C2714F; }
body.theme-claude .dot-apple  { background: #0071E3; }
body.theme-claude .dot-fusion { background: #B5654A; }

/* --- Wrapper: two-column layout --- */
body.theme-claude .wrapper {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  min-height: 100vh;
}

/* --- Sidebar: fixed, top-aligned --- */
body.theme-claude .sidebar {
  width: 320px;
  flex-shrink: 0;
  position: fixed; /* 从 sticky 改为 fixed，确保完全固定 */
  left: calc(50% - 560px); /* 560px 是 wrapper 1120px 的一半 */
  top: 60px; /* 为顶栏留出空间 */
  height: calc(100vh - 60px);
  overflow-y: auto;
  text-align: center;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-top: 60px; /* 进一步往下挪 */
  z-index: 100;
}

body.theme-claude .profile-card {
  padding: 0 20px;
  width: 100%;
  box-sizing: border-box;
}

body.theme-claude .image.avatar {
  margin: 0 auto 32px;
  display: block;
}

body.theme-claude .image.avatar img {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  padding: 0;
  box-shadow: 0 6px 24px var(--claude-card-shadow);
  object-fit: cover;
}

body.theme-claude .site-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--claude-text);
  margin: 0 0 4px;
  line-height: 1.2;
}

body.theme-claude .site-name-cn {
  font-size: 18px;
  font-weight: 500;
  color: var(--claude-text);
  margin: 0 0 12px;
  line-height: 1.2;
  letter-spacing: 2px;
}

body.theme-claude .site-email {
  font-size: 13px;
  color: var(--claude-secondary);
  font-family: "Ubuntu Mono", "SF Mono", monospace;
  margin: 0 0 24px;
  word-break: break-all;
}

/* --- Social Icons: single row --- */
body.theme-claude .social-icons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 0;
  flex-wrap: wrap;
}

/* --- Sidebar visitor map --- */
body.theme-claude .sidebar-map {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 48px auto 0;
  width: 240px; /* 调整宽度以对齐文字边缘 */
  background-color: transparent;
  border: none; /* 移除边框 */
  border-radius: 12px;
  box-shadow: none; /* 移除阴影 */
  transition: all 0.3s ease;
  box-sizing: border-box;
  overflow: hidden;
  line-height: 0;
}

body.theme-claude .sidebar-map:hover {
  transform: translateY(-4px);
  /* 悬浮时可以保留轻微的阴影或不加，这里先移除以保持极简 */
}

body.theme-claude .sidebar-map img,
body.theme-claude .sidebar-map canvas {
  max-width: 100%;
  width: 100%;
  height: auto !important;
  display: block;
  border: none;
}

/* Hide footer map for Claude theme */
body.theme-claude .site-footer .visitor-map {
  display: none;
}

body.theme-claude .social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--claude-social-bg);
  color: var(--claude-social-text) !important;
  font-size: 1.1rem;
  line-height: 1;
  margin: 0;
  box-shadow: 0 2px 8px rgba(61, 57, 41, 0.08);
  transition: all 0.2s ease;
}

body.theme-claude .social-icons a:hover {
  background: var(--claude-accent);
  color: #FFFFFF !important;
  transform: translateY(-3px);
  box-shadow: 0 6px 16px var(--claude-card-shadow);
}

body.theme-claude .social-icons a i {
  font-size: 1.2rem;
}

/* --- Main Content: right column --- */
body.theme-claude .content {
  flex: 1;
  min-width: 0;
  padding: 120px 40px 80px 60px; /* 顶部增加 padding 往下挪 */
  box-sizing: border-box;
  margin-left: 320px; /* 为左侧固定栏留出空间 */
}

/* --- Sections --- */
body.theme-claude .section {
  margin-bottom: 44px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

body.theme-claude .section.visible {
  opacity: 1;
  transform: translateY(0);
}

body.theme-claude .section-title {
  font-size: 19px;
  font-weight: 600;
  color: var(--claude-accent);
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--claude-accent);
  display: inline-block;
}

body.theme-claude .section-body {
  color: var(--claude-text);
}

body.theme-claude .section-body p {
  margin: 0 0 14px;
}

body.theme-claude .section-body a {
  color: var(--claude-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

body.theme-claude .section-body a:hover {
  color: var(--claude-accent);
  filter: brightness(1.2);
}

/* --- Cards: no background, clean --- */
body.theme-claude .card {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
  box-shadow: none;
}

/* --- Timeline items (Education & Experience) --- */
body.theme-claude .timeline-item {
  position: relative;
  margin-left: 20px;
  padding-left: 8px;
  padding-bottom: 20px;
}

body.theme-claude .timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--claude-accent), rgba(194, 113, 79, 0.12));
}

body.theme-claude .timeline-item:last-child::before {
  bottom: 50%;
}

body.theme-claude .timeline-item::after {
  content: '';
  position: absolute;
  left: -25px;
  top: 22px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--claude-accent);
  border: 2px solid var(--claude-bg);
}

body.theme-claude .experience-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0;
  padding-bottom: 4px;
}

body.theme-claude .institution-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-right: 16px;
  flex-shrink: 0;
  background-color: #ffffff;
  border-radius: 8px;
  padding: 6px;
  box-sizing: border-box;
  box-shadow: 0 2px 6px rgba(194, 113, 79, 0.1);
  border: 1px solid var(--claude-border);
}

/* 移除深色模式下的 Logo 滤镜，保持彩色 */
@media (prefers-color-scheme: dark) {
  body.theme-claude .institution-logo {
    filter: none;
  }
}

body.theme-claude .experience-content {
  flex: 1;
}

body.theme-claude .experience-content p {
  margin: 0 0 2px;
}

body.theme-claude .exp-title {
  font-size: 15px;
  color: var(--claude-text);
}

body.theme-claude .exp-detail {
  font-size: 14px;
  color: var(--claude-secondary);
}

body.theme-claude .exp-period {
  font-size: 13px;
  color: var(--claude-accent);
  font-weight: 500;
}

/* --- Action links (Report / Slides) --- */
body.theme-claude .action-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

body.theme-claude .action-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--claude-border);
  background: rgba(194, 113, 79, 0.06);
  color: var(--claude-text);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

body.theme-claude .action-links a i {
  color: var(--claude-accent);
}

body.theme-claude .action-links a:hover {
  transform: translateY(-1px);
  background: rgba(194, 113, 79, 0.10);
  border-color: rgba(194, 113, 79, 0.35);
}

body.theme-claude .action-links a:active {
  transform: translateY(0);
}

/* --- Project card --- */
body.theme-claude .project-card {
  font-size: 15px;
  line-height: 1.6;
}

/* --- Publications --- */
body.theme-claude .publications {
  margin-top: 0;
}

body.theme-claude .publications ol.bibliography {
  list-style: none;
  padding: 0;
  margin: 0;
}

body.theme-claude .publications ol.bibliography li {
  padding: 15px 0 15px 16px;
  border-left: 3px solid var(--claude-accent);
  margin-bottom: 14px;
  min-height: auto;
}

body.theme-claude .pub-row {
  display: block;
}

body.theme-claude .pub-content {
  padding: 0;
}

body.theme-claude .publications ol.bibliography li .title {
  font-weight: 600;
  font-size: 15px;
  color: var(--claude-text);
  margin-bottom: 4px;
}

body.theme-claude .publications ol.bibliography li .author {
  font-size: 14px;
  color: var(--claude-secondary);
  margin-bottom: 4px;
}

body.theme-claude .publications ol.bibliography li .periodical {
  font-size: 14px;
  color: var(--claude-accent);
  margin-bottom: 6px;
}

body.theme-claude .publications ol.bibliography li .links a {
  color: var(--claude-accent);
  font-size: 13px;
  font-weight: 500;
}

body.theme-claude .publications ol.bibliography li .links a:hover {
  filter: brightness(1.2);
}

/* --- Awards --- */
body.theme-claude .awards-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

body.theme-claude .award-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  padding: 4px 0;
}

body.theme-claude .award-icon {
  font-size: 20px;
  flex-shrink: 0;
}

body.theme-claude .award-text {
  font-size: 14px;
  color: var(--claude-text);
}

body.theme-claude .award-text a {
  color: var(--claude-accent);
}

/* --- Footer --- */
body.theme-claude .site-footer {
  position: static !important;
  float: none !important;
  width: 100%;
  flex-basis: 100%;
  text-align: center;
  padding: 32px 24px 40px 380px; /* 增加左边距以避开固定侧边栏 */
  box-sizing: border-box;
  border-top: none !important; /* 强制移除可能继承的边框 */
}

body.theme-claude .site-footer p {
  font-size: 13px;
  color: var(--claude-secondary);
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid var(--claude-footer-border) !important;
  display: block; /* 恢复为块级元素以覆盖整个右侧宽度 */
}

body.theme-claude .visitor-map {
  margin-bottom: 16px;
}

body.theme-claude .visitor-map img {
  max-width: 240px;
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(194, 113, 79, 0.12);
  transition: box-shadow 0.2s ease;
}

body.theme-claude .visitor-map img:hover {
  box-shadow: 0 4px 16px rgba(194, 113, 79, 0.2);
}

/* --- Headings override --- */
body.theme-claude h1,
body.theme-claude h2,
body.theme-claude h3,
body.theme-claude h4 {
  color: var(--claude-text);
}

body.theme-claude strong {
  color: var(--claude-text);
}

/* --- Responsive --- */
  @media (max-width: 1080px) {
    body.theme-claude .wrapper {
      width: 100%;
      flex-direction: column;
      padding: 0 20px;
      box-sizing: border-box;
    }

    body.theme-claude .sidebar {
      width: 100%;
      position: static;
      height: auto;
      padding: 48px 0 24px;
      overflow: visible;
    }

    body.theme-claude .content {
      padding: 32px 0 48px;
      margin-left: 0;
    }

    body.theme-claude .site-footer {
      padding: 32px 0;
    }

    body.theme-claude .site-footer p {
      border-top: none;
      padding-top: 0;
    }

    body.theme-claude .image.avatar img {
      width: 140px;
      height: 140px;
    }

    body.theme-claude .theme-switcher {
      bottom: 16px;
      right: 16px;
    }
  }

  @media (max-width: 768px) {
    body.theme-claude .nav-container {
      padding: 0 16px;
    }

    body.theme-claude .nav-left {
      display: flex;
      align-items: center;
      overflow-x: auto;
      white-space: nowrap;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
      flex: 1;
    }

    body.theme-claude .nav-left::-webkit-scrollbar {
      display: none;
    }

    body.theme-claude .nav-left a {
      flex-shrink: 0;
    }

    body.theme-claude .nav-right {
      flex-shrink: 0;
      margin-left: 10px;
    }
    
    body.theme-claude .page-wrapper {
      padding: 0 20px;
    }

    body.theme-claude .exp-card {
      padding: 20px;
    }
  }

/* --- Empty State Card --- */
body.theme-claude .empty-state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  margin: 40px auto;
  background: var(--claude-bg);
  border: 1px dashed var(--claude-border);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.02);
  transition: border-color 0.3s;
  max-width: 600px;
}
body.theme-claude .empty-state-card:hover {
  border-color: var(--claude-accent);
}
body[data-theme="dark"].theme-claude .empty-state-card {
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
body.theme-claude .empty-state-icon {
  font-size: 48px;
  color: var(--claude-border);
  margin-bottom: 24px;
  transition: color 0.3s;
}
body.theme-claude .empty-state-card:hover .empty-state-icon {
  color: var(--claude-accent);
}
body.theme-claude .empty-state-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--claude-text);
  margin-bottom: 12px;
}
body.theme-claude .empty-state-desc {
  font-size: 15px;
  color: var(--claude-secondary);
  line-height: 1.6;
}

/* --- Experience Card / Teaching --- */
body.theme-claude .experience-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
}
body.theme-claude .exp-card {
  background: var(--claude-bg);
  border: 1px solid var(--claude-border);
  border-radius: 16px;
  padding: 28px 32px;
  box-shadow: 0 4px 12px var(--claude-card-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
body.theme-claude .exp-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--claude-card-shadow);
}
body.theme-claude .exp-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
  background: var(--claude-accent);
}
body.theme-claude .exp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
body.theme-claude .exp-title-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
body.theme-claude .exp-role {
  font-size: 18px;
  font-weight: 700;
  color: var(--claude-text);
}
body.theme-claude .exp-org {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--claude-accent);
}
body.theme-claude .exp-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--claude-secondary);
  background: rgba(194,113,79, 0.08);
  padding: 6px 12px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
body.theme-claude .exp-details {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
body.theme-claude .exp-details li {
  position: relative;
  padding-left: 20px;
  font-size: 15px;
  color: var(--claude-text);
  line-height: 1.6;
}
body.theme-claude .exp-details li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--claude-accent);
  font-weight: 800;
}

@media (max-width: 480px) {
  body.theme-claude .card {
    padding: 14px 16px;
  }

  body.theme-claude .section {
    margin-bottom: 32px;
  }
}

/* --- Page layout (no sidebar: talks, teaching, pub) --- */
body.theme-claude .page-wrapper {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 0 40px;
  box-sizing: border-box;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.theme-claude .page-main {
  flex: 1;
  padding-top: 100px;
  padding-bottom: 60px;
}

body.theme-claude .page-wrapper .site-footer {
  padding: 0;
  text-align: center;
}

body.theme-claude .page-wrapper .site-footer p {
  border-top: 1px solid var(--claude-footer-border) !important;
  padding-top: 20px;
}

@media (max-width: 640px) {
  body.theme-claude .page-wrapper {
    padding: 0 20px;
  }
  body.theme-claude .page-main {
    padding-top: 80px;
  }
}

/* --- Floating Math Symbols (global) --- */
.math-float-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.math-sym {
  position: absolute;
  font-family: "STIX Two Math", "Latin Modern Math", "Cambria Math", Georgia, serif;
  font-style: italic;
  color: var(--claude-accent, #C2714F);
  opacity: 0;
  user-select: none;
  pointer-events: none;
  will-change: transform, opacity;
  animation: math-float-up linear infinite;
}

@keyframes math-float-up {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 0;
  }
  8% {
    opacity: var(--sym-opacity, 0.18);
  }
  90% {
    opacity: var(--sym-opacity, 0.18);
  }
  100% {
    transform: translateY(-100vh) rotate(var(--sym-rot, 20deg)) scale(var(--sym-scale, 1.1));
    opacity: 0;
  }
}
