/* CJK Typography Optimization for Quarto Book Website */

/* 1. 全局字體與基本樣式設定 */
body {
  font-family: "Noto Sans TC", "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei", "Heiti TC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.85; /* 最舒適的中文行高 */
  color: #2d3748; /* 深灰色字體，比純黑溫和 */
  background-color: #ffffff;
}

/* 2. 段落與對齊優化 */
p {
  margin-top: 0;
  margin-bottom: 1.4em; /* 加寬段落間距 */
  text-align: justify; /* 兩端對齊，讓中文字型邊緣整齊美觀 */
  text-justify: inter-word;
  word-break: break-word; /* 避免中英混雜時溢出 */
}

/* 3. 標題層級優化 */
h1, h2, h3, h4, h5, h6 {
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-weight: 700;
  color: #1a202c;
  line-height: 1.4;
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  letter-spacing: -0.02em;
}

h1 {
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.3em;
}

/* 4. 引用區塊 (Blockquote) 與提示框樣式美化 */
blockquote {
  font-size: 0.98em;
  margin: 1.6em 0;
  padding: 0.9em 1.3em;
  border-left: 4px solid #3182ce; /* 典雅藍邊 */
  background-color: #ebf8ff; /* 淺藍底色 */
  color: #2d3748;
  border-radius: 0 8px 8px 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* 特別優化提示圖示的段落 */
blockquote strong {
  color: #2b6cb0;
}

/* 5. 程式碼區塊 (Code Blocks)
   Keep Quarto/Cosmo's default code typography, matching the reference book. */

/* 6. 表格樣式優化 */
table, .table {
  width: 100%;
  margin: 1.8em 0;
  border-collapse: collapse;
  line-height: 1.6;
}

th {
  background-color: #edf2f7;
  color: #2d3748;
  font-weight: 700;
  border-bottom: 2px solid #cbd5e0;
  padding: 0.75em 1em;
}

td {
  padding: 0.75em 1em;
  border-bottom: 1px solid #e2e8f0;
}

tr:hover {
  background-color: #f7fafc;
}

/* 7. Quarto Book 導覽列與側邊欄美化 */
.sidebar {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 0.95em;
  line-height: 1.6;
}

.sidebar nav[role="navigation"] {
  padding-top: 1.5em;
}

/* 目錄 (TOC) 優化 */
#TOC {
  font-size: 0.9em;
  line-height: 1.6;
  border-left: 1px solid #edf2f7;
  padding-left: 1em;
}
