/* AI Infra Book - Custom Styles */
/* 基于 modern-polars 风格，浅灰背景 + cosmo 主题 */

/* Typography */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: #343a40;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2em;
  border-bottom: 2px solid #dee2e6;
  padding-bottom: 0.3em;
}

h2 {
  font-size: 1.5em;
  border-bottom: 1px solid #e9ecef;
  padding-bottom: 0.2em;
}

/* Code blocks */
pre {
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
}

code {
  font-family: "SF Mono", "Fira Code", "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* Inline code */
p code, li code {
  background-color: rgba(175, 184, 193, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
}

/* Callouts */
.callout {
  border-radius: 8px;
  margin: 1em 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

th, td {
  border: 1px solid #dee2e6;
  padding: 8px 12px;
  text-align: left;
}

th {
  background-color: #f8f9fa;
  font-weight: 600;
}

tr:nth-child(even) {
  background-color: #fafbfc;
}

tbody tr:hover {
  background: rgba(66, 165, 245, 0.2);
}

/* Figure captions */
figcaption {
  font-size: 0.9em;
  color: #6c757d;
  text-align: center;
  margin-top: 0.5em;
}

/* Blockquotes */
blockquote {
  border-left: 4px solid #4CAF50;
  margin: 1em 0;
  padding: 0.5em 1em;
  background-color: #f9f9f9;
  color: #495057;
}

/* Sidebar */
.sidebar-item {
  font-size: 0.95em;
}

/* Search */
#quarto-search {
  border-radius: 8px;
}

/* Dataframe (for any table displays) */
.dataframe {
  display: inline-block;
}
.dataframe td {
  vertical-align: middle;
  text-align: right;
}

/* Mermaid: remove pre grey background */
pre.mermaid-js,
figure:has(svg.mermaid-js) pre {
  background-color: transparent !important;
  padding: 0 !important;
}
