/* 全站主题：默认浅色，data-theme="dark" 为深色 */

/* 中文排版：略放大根字号，提升行高与可读性 */
html {
  color-scheme: light;
  font-size: 106.25%; /* 约 17px（相对浏览器 16px） */
}
@media (min-width: 640px) {
  html {
    font-size: 112.5%; /* 约 18px */
  }
}
html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"],
html:not([data-theme]) {
  --c-bg: #ffffff;
  --c-ink: #1a1a1a;
  --c-muted: #6b6b6b;
  --c-line: #e8e8e8;
  --c-paper: #fafafa;
  --c-quote: #f5f5f4;
  --c-accent: #1a1a1a;
  --c-hover-strong: #000000;
  --c-card-shadow: rgba(0, 0, 0, 0.08);
  --c-btn-on-text: #ffffff;
  --c-news-item-bg: rgba(0, 0, 0, 0.03);
  --c-news-item-border: rgba(0, 0, 0, 0.1);
  --c-news-flow: rgba(26, 26, 26, 0.92);
  --c-news-label: #1a1a1a;
  --c-news-sep: #9a9a9a;
  --c-news-source: rgba(26, 26, 26, 0.65);
  --c-news-source-label: rgba(26, 26, 26, 0.75);
  --c-news-link: #1a1a1a;
  --c-news-link-underline: #b0b0b0;
  --c-news-link-hover: #000000;
  --c-news-link-underline-hover: #666666;
  --c-toggle-bg: #fafafa;
  --c-toggle-border: #e8e8e8;
}

html[data-theme="dark"] {
  --c-bg: #000000;
  --c-ink: #e8e8e8;
  --c-muted: #8a8a8a;
  --c-line: #2a2a2a;
  --c-paper: #141414;
  --c-quote: #1a1a1a;
  --c-accent: #f0f0f0;
  --c-hover-strong: #ffffff;
  --c-card-shadow: rgba(0, 0, 0, 0.3);
  --c-btn-on-text: #000000;
  --c-news-item-bg: rgba(0, 0, 0, 0.2);
  --c-news-item-border: rgba(42, 42, 42, 0.8);
  --c-news-flow: rgba(232, 232, 232, 0.92);
  --c-news-label: #f0f0f0;
  --c-news-sep: #6a6a6a;
  --c-news-source: rgba(232, 232, 232, 0.62);
  --c-news-source-label: rgba(240, 240, 240, 0.72);
  --c-news-link: #f0f0f0;
  --c-news-link-underline: #5a5a5a;
  --c-news-link-hover: #ffffff;
  --c-news-link-underline-hover: #8a8a8a;
  --c-toggle-bg: #141414;
  --c-toggle-border: #2a2a2a;
}

.site-body {
  background-color: var(--c-bg);
  min-height: 100vh;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.site-body.font-serif {
  line-height: 1.8;
  letter-spacing: 0.02em;
}

.site-body .font-sans,
.font-sans {
  letter-spacing: 0.025em;
  line-height: 1.65;
}

/* 正文与辅助文字（覆盖 Tailwind 偏小字号） */
.site-body .text-xs {
  font-size: 0.8125rem;
  line-height: 1.55;
}
.site-body .text-sm {
  font-size: 0.9375rem;
  line-height: 1.65;
}
.site-body .text-base {
  font-size: 1.0625rem;
  line-height: 1.7;
}
.site-body .text-lg {
  font-size: 1.1875rem;
  line-height: 1.75;
}
.site-body .text-xl {
  font-size: 1.375rem;
  line-height: 1.65;
}
.site-body .text-2xl {
  font-size: 1.625rem;
  line-height: 1.45;
}
.site-body .text-3xl {
  font-size: 2rem;
  line-height: 1.35;
}

/* 书籍列表卡片 */
.book-card h2 {
  font-size: 0.9375rem !important;
  line-height: 1.55 !important;
}
.book-card .text-xs,
.book-card span.text-xs {
  font-size: 0.8125rem !important;
}

/* 简报正文 */
.daily-brief-container {
  font-size: 1.0625rem !important;
  line-height: 1.75 !important;
}
@media (min-width: 640px) {
  .daily-brief-container {
    font-size: 1.125rem !important;
    line-height: 1.8 !important;
  }
}
.daily-brief-container h3 {
  font-size: 1.3125rem !important;
}
.daily-brief-container h4 {
  font-size: 1.125rem !important;
}

/* 单书笔记正文 */
.site-body main blockquote {
  font-size: 1.05em;
  line-height: 1.85;
}
.site-body main blockquote p {
  line-height: 1.85;
}
.site-body main h1 {
  letter-spacing: 0.02em;
}
.site-body main h2 {
  font-size: 1.3125rem;
  line-height: 1.55;
}
.site-body input[type="search"] {
  font-size: 0.9375rem !important;
}

/* 读书概览列表 */
.reading-row h2 {
  font-size: 1.0625rem !important;
  line-height: 1.5 !important;
}
.reading-row .text-\[11px\] {
  font-size: 0.8125rem !important;
}
.reading-row dl {
  font-size: 0.875rem !important;
}
@media (min-width: 640px) {
  .reading-row dl {
    font-size: 0.9375rem !important;
  }
}

/* 简报区块 */
.news-item {
  border-color: var(--c-news-item-border) !important;
  background: var(--c-news-item-bg) !important;
}
.news-flow {
  color: var(--c-news-flow) !important;
}
.news-flow .nf b {
  color: var(--c-news-label) !important;
}
.news-flow .nf + .nf::before {
  color: var(--c-news-sep) !important;
}
.news-source {
  color: var(--c-news-source) !important;
}
.news-source .nf b {
  color: var(--c-news-source-label) !important;
}
.news-flow a,
.news-source a {
  color: var(--c-news-link) !important;
  text-decoration-color: var(--c-news-link-underline) !important;
}
.news-flow a:hover,
.news-source a:hover {
  color: var(--c-news-link-hover) !important;
  text-decoration-color: var(--c-news-link-underline-hover) !important;
}

/* 筛选按钮激活态 */
.filter-btn.is-active,
.reading-filter-btn.is-active {
  border-color: var(--c-accent) !important;
  background-color: var(--c-accent) !important;
  color: var(--c-btn-on-text) !important;
}

/* 主题切换按钮 */
#site-theme-toggle {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-family: "Noto Sans SC", system-ui, sans-serif;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--c-ink);
  background: var(--c-toggle-bg);
  border: 1px solid var(--c-toggle-border);
  border-radius: 9999px;
  box-shadow: 0 4px 14px var(--c-card-shadow);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s;
}
#site-theme-toggle:hover {
  border-color: var(--c-muted);
}
#site-theme-toggle input {
  width: 0.9rem;
  height: 0.9rem;
  accent-color: var(--c-accent);
  cursor: pointer;
}
#site-theme-toggle .theme-toggle-label {
  white-space: nowrap;
}

@media (min-width: 640px) {
  #site-theme-toggle {
    right: 1.25rem;
    bottom: 1.25rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.875rem;
  }
}
