/*
 * KeyHog docs theme - clean, minimal, B&W. Not too serious.
 *
 * Loaded by mdBook on top of the default light theme. Overrides
 * colors, typography, and the chrome that makes the default mdBook
 * look... a lot like every other mdBook.
 */

:root {
    /* B&W palette. Greys for hierarchy, no accent color elsewhere. */
    --ink: #0a0a0a;
    --ink-soft: #1a1a1a;
    --grey-9: #2d2d2d;
    --grey-7: #4a4a4a;
    --grey-5: #767676;
    --grey-3: #b8b8b8;
    --grey-1: #e5e5e5;
    --grey-0: #f4f4f4;
    --paper: #fafafa;
    --paper-pure: #ffffff;

    /* Just one accent: a faint underline color for links. Keeps the
     * page from being all grey. */
    --rule: #d0d0d0;
    --accent-link: #0a0a0a;
    --accent-link-hover: #555555;

    /* Type. System font stack - fast, native feel. Mono for code. */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", "Menlo", "Monaco",
                 "Consolas", "Liberation Mono", "Courier New", monospace;
}

.keyhog {
    --bg: var(--paper-pure);
    --fg: var(--ink);
    --sidebar-bg: var(--paper);
    --sidebar-fg: var(--grey-7);
    --sidebar-non-existant: var(--grey-3);
    --sidebar-active: var(--ink);
    --sidebar-spacer: var(--rule);
    --scrollbar: var(--grey-3);

    --icons: var(--grey-7);
    --icons-hover: var(--ink);
    --links: var(--accent-link);
    --inline-code-color: var(--ink);
    --theme-popup-bg: var(--paper-pure);
    --theme-popup-border: var(--grey-3);
    --theme-hover: var(--grey-0);
    --quote-bg: var(--paper);
    --quote-border: var(--grey-7);
    --table-border-color: var(--rule);
    --table-header-bg: var(--paper);
    --table-alternate-bg: var(--paper);
    --searchbar-border-color: var(--grey-3);
    --searchbar-bg: var(--paper-pure);
    --searchbar-fg: var(--ink);
    --searchbar-shadow-color: var(--grey-3);
    --searchresults-header-fg: var(--grey-7);
    --searchresults-border-color: var(--grey-1);
    --searchresults-li-bg: var(--paper);
    --search-mark-bg: var(--grey-1);
}

/* Typography */
body, html {
    font-family: var(--font-sans);
    font-feature-settings: "ss01", "cv11";
}

.chapter, .content, .content main {
    line-height: 1.65;
    color: var(--fg);
}

.content h1,
.content h2,
.content h3,
.content h4,
.content h5,
.content h6 {
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.content h1 {
    font-size: 2rem;
    margin-top: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
}

.content h2 {
    font-size: 1.4rem;
    margin-top: 2.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--grey-1);
}

.content h3 {
    font-size: 1.15rem;
    margin-top: 2rem;
}

/* Links - black with a thin underline. Hover lightens the underline,
 * doesn't change the text. Avoids the typical bright-blue-everywhere
 * look. */
.content a:link,
.content a:visited {
    color: var(--accent-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--grey-3);
}

.content a:hover,
.content a:focus {
    color: var(--accent-link-hover);
    text-decoration-color: var(--ink);
}

/* Inline code - slightly off-white background, no border. */
.content code {
    background: var(--grey-0);
    color: var(--ink);
    padding: 0.1em 0.35em;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: var(--font-mono);
}

/* Code blocks - no syntax highlighting color riot. Mono + grey only. */
.content pre {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1em 1.2em;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.55;
}

.content pre > code {
    background: transparent;
    padding: 0;
    font-family: var(--font-mono);
    color: var(--ink);
}

/* Override the default syntax highlighting palette - everything stays
 * in grey-scale. Comments lighter, strings italic, keywords bold. */
.hljs {
    background: transparent !important;
    color: var(--ink) !important;
}
.hljs-comment, .hljs-quote {
    color: var(--grey-5);
    font-style: italic;
}
.hljs-keyword, .hljs-built_in, .hljs-type {
    color: var(--ink);
    font-weight: 600;
}
.hljs-string, .hljs-symbol, .hljs-attr {
    color: var(--grey-7);
    font-style: italic;
}
.hljs-number, .hljs-literal {
    color: var(--ink);
}
.hljs-function .hljs-title, .hljs-title.function_ {
    color: var(--ink);
    font-weight: 500;
}

/* Sidebar - minimal, sans-serif, no bullets, no clutter. */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--rule);
}

.sidebar .sidebar-scrollbox {
    padding: 1.5em 1em;
}

.chapter li > a {
    color: var(--sidebar-fg);
    padding: 0.3em 0.5em;
    border-radius: 3px;
    text-decoration: none;
}

.chapter li > a:hover {
    color: var(--ink);
    background: var(--grey-0);
}

.chapter li.chapter-item {
    line-height: 1.5;
    margin: 0.15em 0;
}

.chapter li.active > a {
    color: var(--sidebar-active);
    font-weight: 500;
}

.sidebar .sidebar-resize-handle {
    background: var(--rule);
}

/* Top nav - flatten the icon row. */
.menu-title {
    font-weight: 600;
    color: var(--ink);
}

#menu-bar {
    background: var(--paper-pure);
    border-bottom: 1px solid var(--rule);
}

.icon-button {
    color: var(--icons);
}
.icon-button:hover {
    color: var(--icons-hover);
}

/* Tables - borderless inside, single rule above and below. */
.content table {
    border-collapse: collapse;
    margin: 1.5em 0;
    width: 100%;
    font-size: 0.95em;
}

.content table th,
.content table td {
    border: none;
    padding: 0.5em 0.8em;
    text-align: left;
    vertical-align: top;
}

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

.content table tbody tr {
    border-bottom: 1px solid var(--grey-1);
}

.content table tbody tr:last-child {
    border-bottom: 1px solid var(--rule);
}

/* Blockquotes - left rule, no italics, just inset prose. */
.content blockquote {
    border-left: 3px solid var(--ink);
    padding: 0.6em 1em;
    margin: 1.2em 0;
    background: var(--paper);
    color: var(--grey-9);
}

.content blockquote p:first-child {
    margin-top: 0;
}
.content blockquote p:last-child {
    margin-bottom: 0;
}

/* Horizontal rule - almost invisible. */
.content hr {
    border: none;
    border-top: 1px solid var(--rule);
    margin: 2.5em 0;
}

/* Page nav (prev/next chapter) */
.nav-chapters {
    color: var(--icons);
    border-color: var(--rule);
}
.nav-chapters:hover {
    color: var(--ink);
    background: var(--grey-0);
}

/* Search */
#searchresults a {
    border-bottom: 1px solid var(--grey-1);
}
#searchresults a:hover {
    background: var(--grey-0);
}

mark {
    background: var(--search-mark-bg);
    color: var(--ink);
    padding: 0 2px;
    border-radius: 2px;
}

/* Print - clean white with full-bleed text. */
@media print {
    .sidebar, #menu-bar, .nav-chapters { display: none; }
    .page-wrapper { margin-left: 0; }
}
