/* Pi Deep Dive — quiet, editorial, minimal. Overrides mdBook's light + dark themes. */

:root {
    --content-max-width: 780px;
    --sidebar-target-width: 280px;
    --page-padding: 20px;
    --body-font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC",
        "Microsoft YaHei", "Segoe UI", Helvetica, Arial, sans-serif;
    --mono-font: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
    --code-font-size: 0.86em;
    --accent: #b4532a;
    --rule: rgba(31, 35, 40, 0.10);
    --code-bg: #f5f4f0;
    --muted: #5f6670;
}

.light, html:not(.js) {
    --bg: #fcfcfa;
    --fg: #22262b;
    --sidebar-bg: #f5f4f0;
    --sidebar-fg: #4a4f57;
    --sidebar-non-existant: #a7a9ad;
    --sidebar-active: #b4532a;
    --sidebar-spacer: #e7e5df;
    --sidebar-header-border-color: #b4532a;
    --scrollbar: #c9c7c0;
    --icons: #8a8d92;
    --icons-hover: #22262b;
    --links: #9a4420;
    --inline-code-color: #22262b;
    --theme-popup-bg: #fcfcfa;
    --theme-popup-border: #e2e0da;
    --theme-hover: #efeee9;
    --quote-bg: transparent;
    --quote-border: #e2e0da;
    --table-border-color: #e7e5df;
    --table-header-bg: #f5f4f0;
    --table-alternate-bg: #fafaf7;
    --searchbar-border-color: #dcdad3;
    --searchbar-bg: #ffffff;
    --searchresults-li-bg: #f5f4f0;
    --search-mark-bg: #f3d9c9;
    --accent: #b4532a;
    --rule: rgba(31, 35, 40, 0.10);
    --code-bg: #f5f4f0;
    --muted: #5f6670;
}

.navy, .coal {
    --bg: #17191d;
    --fg: #d7d9dc;
    --sidebar-bg: #121417;
    --sidebar-fg: #a9adb3;
    --sidebar-non-existant: #5d6168;
    --sidebar-active: #e3895f;
    --sidebar-spacer: #24272c;
    --sidebar-header-border-color: #e3895f;
    --scrollbar: #3a3e45;
    --icons: #7d8188;
    --icons-hover: #e6e7e9;
    --links: #e7956d;
    --inline-code-color: #e6e7e9;
    --theme-popup-bg: #1d2024;
    --theme-popup-border: #2e3238;
    --theme-hover: #24272c;
    --quote-bg: transparent;
    --quote-border: #33373d;
    --table-border-color: #2a2d33;
    --table-header-bg: #1f2226;
    --table-alternate-bg: #1b1d21;
    --searchbar-border-color: #33373d;
    --searchbar-bg: #1d2024;
    --searchbar-fg: #e6e7e9;
    --searchresults-li-bg: #1f2226;
    --search-mark-bg: #7a4a33;
    --accent: #e3895f;
    --rule: rgba(255, 255, 255, 0.09);
    --code-bg: #1f2226;
    --muted: #9ba0a7;
}

html {
    font-family: var(--body-font);
    -webkit-font-smoothing: antialiased;
}

body {
    font-size: 1.6rem;
}

.content main {
    line-height: 1.85;
    letter-spacing: 0.01em;
}

.content p {
    margin: 0.9em 0;
}

/* Headings */
.content h1,
.content h2,
.content h3,
.content h4 {
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: 0;
    color: var(--fg);
}

.content h1 {
    font-size: 2.05em;
    margin-block-start: 0.6em;
    margin-block-end: 0.8em;
}

.content h2 {
    font-size: 1.45em;
    margin-block-start: 2.4em;
    padding-block-start: 1.1em;
    border-top: 1px solid var(--rule);
}

.content h3 {
    font-size: 1.15em;
    margin-block-start: 1.9em;
}

.content h4 {
    font-size: 1em;
    color: var(--muted);
}

.content a,
.content a:visited {
    color: var(--links);
    text-decoration: none;
    border-bottom: 1px solid color-mix(in srgb, var(--links) 30%, transparent);
}

.content a:hover {
    border-bottom-color: var(--links);
}

.content .header,
.content .header:visited,
.content h1 a,
.content h2 a,
.content h3 a {
    color: inherit;
    border-bottom: none;
}

/* Blockquote — used for TL;DR and 一句话 */
.content blockquote {
    margin: 1.4em 0;
    padding: 0.2em 1.1em;
    background: transparent;
    border: none;
    border-inline-start: 3px solid var(--accent);
    color: var(--fg);
}

.content main > blockquote:first-of-type {
    padding: 0.7em 1.2em;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-radius: 0 6px 6px 0;
}

.content blockquote strong {
    color: var(--accent);
}

/* Code */
.content code {
    font-family: var(--mono-font);
}

.content :not(pre) > code {
    padding: 0.12em 0.36em;
    border-radius: 4px;
    background: var(--code-bg);
    font-size: 0.86em;
}

.content pre {
    border-radius: 6px;
    border: 1px solid var(--rule);
}

.content pre > code.hljs,
.content pre > code {
    background: var(--code-bg);
    line-height: 1.6;
    padding: 1em 1.2em;
}

/* Tables */
.content table {
    margin: 1.4em auto;
    border-collapse: collapse;
    font-size: 0.94em;
}

.content table td,
.content table th {
    padding: 0.5em 0.9em;
    border: none;
    border-bottom: 1px solid var(--table-border-color);
}

.content table thead {
    background: transparent;
}

.content table thead th {
    font-weight: 600;
    border-bottom: 1.5px solid var(--fg);
}

.content table tbody tr:nth-child(2n) {
    background: transparent;
}

/* Images */
.content img {
    display: block;
    max-width: 100%;
    margin: 1.6em auto;
    border-radius: 6px;
}

.content hr {
    border: none;
    border-top: 1px solid var(--rule);
}

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

.sidebar .sidebar-scrollbox {
    padding: 14px 12px;
}

.chapter li.chapter-item {
    line-height: 1.6;
    margin-block-start: 0.45em;
}

.chapter li a {
    border-radius: 5px;
    padding: 2px 6px;
}

.chapter li a.active {
    font-weight: 600;
}

.chapter li.part-title {
    margin-block-start: 1.4em;
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.chapter li.spacer {
    background: transparent;
    height: 0.5em;
}

/* Menu bar */
#menu-bar,
#menu-bar.bordered {
    border-block-end-color: var(--rule);
}

.menu-title {
    font-weight: 600;
    font-size: 1.05em;
    letter-spacing: 0.02em;
}

/* Prev / next */
.nav-chapters {
    font-size: 1.8em;
    opacity: 0.5;
}

.nav-chapters:hover {
    opacity: 1;
    background: transparent;
}
