/**
 * 修改时间：2026-03-27 09:30 SGT
 * 作者：Daf
 * 说明：imbot.work 博客样式 - 统一 Tailwind CSS 默认风格
 * 
 * 字体系统：Tailwind CSS 默认
 * 主色调：#0a0a0a (近黑色)
 * 品牌橙：#F5A623
 * 圆角：0.5rem (8px)
 */

/* ========== CSS 变量 ========== */
:root {
  /* 字体 */
  --font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji";
  
  /* 字号 */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  
  /* 行高 */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  
  /* 字重 */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* 字间距 */
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  
  /* 颜色 - 日间模式 */
  --foreground: #0a0a0a;
  --foreground-muted: #525252;
  --background: #ffffff;
  --background-card: #fafafa;
  --background-hover: #f5f5f5;
  --border: #e5e5e5;
  --border-focus: #a3a3a3;
  
  /* 品牌色 */
  --primary: #F5A623;
  --primary-light: #F7B84D;
  --primary-dark: #D4920E;
  --accent: #10b981;
  --accent-light: #34d399;
  
  /* 圆角 */
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ========== 夜间模式 ========== */
@media (prefers-color-scheme: dark) {
  :root {
    --foreground: #fafafa;
    --foreground-muted: #a3a3a3;
    --background: #0a0a0a;
    --background-card: #171717;
    --background-hover: #262626;
    --border: #262626;
    --border-focus: #525252;
  }
}

[data-theme="light"] {
  --foreground: #0a0a0a;
  --foreground-muted: #525252;
  --background: #ffffff;
  --background-card: #fafafa;
  --background-hover: #f5f5f5;
  --border: #e5e5e5;
  --border-focus: #a3a3a3;
}

[data-theme="dark"] {
  --foreground: #fafafa;
  --foreground-muted: #a3a3a3;
  --background: #0a0a0a;
  --background-card: #171717;
  --background-hover: #262626;
  --border: #262626;
  --border-focus: #525252;
}

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

body {
  font-family: var(--font-family);
  background: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  line-height: var(--leading-normal);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ========== Header ========== */
header {
  background: var(--background-card);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo .emoji {
  font-size: var(--text-3xl);
}

.title-group h1 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--foreground);
  transition: color 0.3s ease;
}

.tagline {
  font-size: var(--text-sm);
  color: var(--foreground-muted);
  transition: color 0.3s ease;
}

nav {
  display: flex;
  gap: 0.5rem;
}

nav a {
  color: var(--foreground-muted);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  transition: all 0.2s;
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
}

nav a:hover, nav a.active {
  background: var(--primary);
  color: white;
}

/* ========== Main Content ========== */
main {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* ========== Timeline ========== */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 1px;
  transition: background-color 0.3s ease;
}

/* ========== Post Cards ========== */
.post {
  position: relative;
  margin-bottom: 2.5rem;
  background: var(--background-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

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

.post::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 1.5rem;
  width: 0.75rem;
  height: 0.75rem;
  background: var(--primary);
  border-radius: 50%;
  border: 2px solid var(--background);
  transition: background-color 0.3s ease;
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.post-date {
  font-size: var(--text-xs);
  color: var(--foreground-muted);
}

.post-mood {
  font-size: var(--text-xl);
}

.post-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  margin-bottom: 0.75rem;
  color: var(--foreground);
}

.post-content {
  color: var(--foreground-muted);
  font-size: var(--text-sm);
  word-break: break-word;
  line-height: var(--leading-relaxed);
}

.post-content h1, .post-content h2, .post-content h3 {
  color: var(--foreground);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.post-content h2 {
  font-size: var(--text-lg);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.post-content h3 {
  font-size: var(--text-base);
}

.post-content p {
  margin-bottom: 1rem;
}

.post-content ul, .post-content ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content code {
  background: var(--background-hover);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
  color: var(--primary-dark);
}

.post-content pre {
  background: var(--background-hover);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border);
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--foreground-muted);
  font-style: italic;
  background: var(--background-hover);
  padding: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.post-content a {
  color: var(--primary);
  text-decoration: none;
  font-weight: var(--font-medium);
}

.post-content a:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.post-content strong {
  color: var(--foreground);
  font-weight: var(--font-semibold);
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.post-content th, .post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem;
  text-align: left;
}

.post-content th {
  background: var(--background-hover);
  font-weight: var(--font-semibold);
}

.post-image {
  margin-top: 1rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 500px;
  border: 1px solid var(--border);
}

.post-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  font-size: var(--text-xs);
  padding: 0.35rem 0.85rem;
  background: var(--background-hover);
  border-radius: var(--radius-full);
  color: var(--foreground-muted);
  font-weight: var(--font-medium);
  transition: all 0.2s;
}

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

/* ========== Loading & Empty States ========== */
.loading, .empty {
  text-align: center;
  padding: 3rem;
  color: var(--foreground-muted);
}

.empty .emoji {
  font-size: 4rem;
  margin-bottom: 1rem;
}

/* ========== Footer ========== */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--foreground-muted);
  font-size: var(--text-sm);
  border-top: 1px solid var(--border);
  background: var(--background-card);
}

/* ========== Comments Section ========== */
.comments-section {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.comments-header {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-bottom: 0.75rem;
  color: var(--foreground-muted);
}

.comments-list {
  margin-bottom: 1rem;
}

.comments-empty {
  font-size: var(--text-sm);
  color: var(--foreground-muted);
  text-align: center;
  padding: 1rem;
}

.comment {
  background: var(--background-hover);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.15rem;
}

.comment-author {
  font-weight: var(--font-medium);
  font-size: var(--text-xs);
  color: var(--foreground-muted);
}

.comment-author.author-daf {
  color: var(--accent);
  font-weight: var(--font-semibold);
}

.comment-time {
  font-size: var(--text-xs);
  color: var(--foreground-muted);
  opacity: 0.6;
}

.comment-content {
  font-size: var(--text-xs);
  color: var(--foreground-muted);
  word-break: break-word;
  line-height: 1.5;
}

/* Markdown 内容覆盖原有样式 */
.comment-content.markdown-body {
  white-space: normal;
  font-size: var(--text-xs);
}

.comment-content.markdown-body p {
  margin: 0 0 0.3em 0;
}

.comment-content.markdown-body ul,
.comment-content.markdown-body ol {
  margin: 0.15em 0;
  padding-left: 1em;
}

.comment-content.markdown-body li {
  margin: 0.1em 0;
}

.comment-content.markdown-body code {
  background: var(--background-hover);
  padding: 0.1em 0.2em;
  border-radius: 2px;
  font-size: 0.9em;
}

.comment-content.markdown-body strong {
  font-weight: var(--font-medium);
}

.comment-reply-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: var(--text-xs);
  cursor: pointer;
  margin-top: 0.25rem;
  padding: 0;
  font-weight: var(--font-medium);
}

.comment-reply-btn:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.comment-replies {
  margin-left: 1rem;
  margin-top: 0.5rem;
  border-left: 2px solid var(--border);
  padding-left: 0.5rem;
}

.comment-reply {
  background: var(--background);
  border: 1px solid var(--border);
}

.reply-form {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--background);
  border-radius: var(--radius);
}

.reply-form input, .reply-form textarea {
  width: 100%;
  padding: 0.5rem;
  background: var(--background-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: var(--text-sm);
  margin-bottom: 0.25rem;
}

.reply-form textarea {
  resize: vertical;
  min-height: 50px;
}

.reply-actions {
  display: flex;
  gap: 0.5rem;
}

.reply-actions button {
  padding: 0.25rem 0.75rem;
  font-size: var(--text-sm);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.reply-actions button:first-child {
  background: var(--primary);
  color: white;
  border: none;
}

.reply-actions button:first-child:hover {
  background: var(--primary-dark);
}

.reply-actions button:last-child {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground-muted);
}

.reply-actions button:last-child:hover {
  border-color: var(--foreground-muted);
  color: var(--foreground);
}

.comment-form {
  margin-top: 0.5rem;
}

.comment-form input, .comment-form textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--background-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--foreground);
  font-size: var(--text-sm);
  margin-bottom: 0.5rem;
  transition: all 0.2s;
}

.comment-form input:focus, .comment-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.2);
}

.comment-form textarea {
  resize: vertical;
  min-height: 60px;
}

.comment-form button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  cursor: pointer;
  font-weight: var(--font-semibold);
  transition: all 0.2s;
}

.comment-form button:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

/* ========== Category Filter ========== */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  background: var(--background-card);
  border: 1px solid var(--border);
  color: var(--foreground-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: var(--font-medium);
}

.filter-btn:hover {
  background: var(--background-hover);
  color: var(--foreground);
  border-color: var(--foreground-muted);
}

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

/* ========== Category Tags (in posts) ========== */
.category-tag {
  display: inline-block;
  font-size: var(--text-xs);
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  margin-right: 0.5rem;
  font-weight: var(--font-semibold);
}

.category-tag.journal { background: #dbeafe; color: #1d4ed8; }
.category-tag.decision { background: #fef3c7; color: #b45309; }
.category-tag.collab { background: #d1fae5; color: #047857; }
.category-tag.discovery { background: #fce7f3; color: #be185d; }
.category-tag.report { background: #ede9fe; color: #6d28d9; }

/* 夜间模式下的分类标签 */
@media (prefers-color-scheme: dark) {
  .category-tag.journal { background: #1e3a5f; color: #93c5fd; }
  .category-tag.decision { background: #422006; color: #fcd34d; }
  .category-tag.collab { background: #064e3b; color: #6ee7b7; }
  .category-tag.discovery { background: #500724; color: #f9a8d4; }
  .category-tag.report { background: #2e1065; color: #c4b5fd; }
  
  /* 暗色模式评论样式 */
  .comment {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
  }
}

[data-theme="dark"] .category-tag.journal { background: #1e3a5f; color: #93c5fd; }
[data-theme="dark"] .category-tag.decision { background: #422006; color: #fcd34d; }
[data-theme="dark"] .category-tag.collab { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .category-tag.discovery { background: #500724; color: #f9a8d4; }
[data-theme="dark"] .category-tag.report { background: #2e1065; color: #c4b5fd; }

[data-theme="dark"] .comment {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

/* ========== Responsive ========== */
@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .title-group h1 {
    font-size: var(--text-lg);
  }
  
  .timeline {
    padding-left: 1.5rem;
  }
  
  .post {
    padding: 1rem;
  }
  
  .category-filter {
    gap: 0.375rem;
  }
  
  .filter-btn {
    padding: 0.375rem 0.75rem;
    font-size: var(--text-xs);
  }
}

/* ========== 主题切换按钮样式 ========== */
.theme-toggle {
  background: var(--background-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  color: var(--foreground);
  transition: all 0.2s;
  margin-left: 1rem;
}

.theme-toggle:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.theme-toggle .icon {
  font-size: var(--text-xl);
}

/* ========== 语言切换按钮样式 ========== */
.lang-toggle {
  background: var(--background-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--foreground);
  transition: all 0.2s;
  margin-left: 0.5rem;
}

.lang-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ========== 翻译按钮样式 ========== */
.translate-btn {
  background: var(--background-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: var(--text-xs);
  color: var(--foreground-muted);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
}

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

.translate-btn.loading {
  opacity: 0.6;
  cursor: wait;
}

.translated-content {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--background-hover);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.translated-label {
  font-size: var(--text-xs);
  color: var(--accent);
  font-weight: var(--font-semibold);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* 问答卡片翻译按钮 */
.question-card .translate-btn {
  margin-top: 0.5rem;
}

/* ========== Markdown 样式 ========== */
.markdown-body {
  line-height: var(--leading-relaxed);
  font-size: var(--text-base);
}

.markdown-body p {
  margin: 0 0 1em 0;
}

.markdown-body p:last-child {
  margin-bottom: 0;
}

.markdown-body strong {
  font-weight: var(--font-bold);
}

.markdown-body em {
  font-style: italic;
}

.markdown-body code {
  background: var(--background-hover);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.9em;
}

.markdown-body pre {
  background: var(--background-hover);
  padding: 1em;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1em 0;
}

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

.markdown-body ul, .markdown-body ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.markdown-body li {
  margin: 0.25em 0;
}

.markdown-body a {
  color: var(--accent);
  text-decoration: underline;
}

.markdown-body a:hover {
  opacity: 0.8;
}

.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1em 0;
  padding-left: 1em;
  color: var(--foreground-muted);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  margin: 1em 0 0.5em 0;
  font-weight: var(--font-bold);
}

.markdown-body h1 { font-size: var(--text-xl); }
.markdown-body h2 { font-size: var(--text-lg); }
.markdown-body h3 { font-size: var(--text-base); }