/* blockwatcher wiki — custom theme tweaks on top of mdBook's default CSS.
 *
 * Goals:
 *   1. Readability: system font stack, larger base size, taller line-height,
 *      a comfortable measure, and calmer dark-theme contrast/accents.
 *   2. Hide the auto chapter numbers in the sidebar (titles only).
 *   3. Let tables and mermaid diagrams use the full content width.
 *
 * Written against CSS variables from css/variables.css rather than
 * hardcoding per-element colors, so the theme switcher keeps working.
 */

/* -------------------------------------------------------------------- *
 * 1. Typography
 * -------------------------------------------------------------------- */

:root {
    /* mdBook's default is 750px; a touch wider keeps the larger base size
       below from feeling cramped while staying a comfortable measure. */
    --content-max-width: 800px;
}

html {
    /* System font stack only — no external/webfont fetches. Code keeps
       mdBook's --mono-font (Source Code Pro, falling back to system
       monospace fonts) untouched. */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

body {
    /* mdBook sets the root font-size to 62.5% so 1rem = 10px; 1.6rem (16px)
       was the default body size. Bump it slightly for a comfortable read. */
    font-size: 1.75rem;
}

.content p,
.content li,
.content ol,
.content ul,
.content dd {
    line-height: 1.6;
}

.chapter-link-wrapper,
.sidebar {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

/* -------------------------------------------------------------------- *
 * 1b. Dark theme (navy) contrast + accent tuning
 *
 * mdBook's dark default here is the "navy" theme. Raise the foreground/
 * background contrast a little and mute the more saturated accent colors
 * (blockquote tags, links, sidebar highlight) so the page is easier to
 * focus on for long reads. Light theme is left as-is — it already reads
 * fine at full black-on-white contrast.
 * -------------------------------------------------------------------- */

.navy {
    --bg: hsl(224, 28%, 9%);
    --fg: #dadce6;

    --sidebar-bg: #1c2030;
    --sidebar-fg: #d6d8e6;

    --links: #6fa8dc;
    --sidebar-active: #7fb4e0;

    --inline-code-color: #e3c893;

    --quote-bg: hsl(224, 20%, 15%);
    --quote-border: hsl(224, 20%, 24%);

    /* Muted blockquote-tag accents instead of the default's saturated hues. */
    --blockquote-note-color: #6fa8dc;
    --blockquote-tip-color: #6fcf8e;
    --blockquote-important-color: #b79ef0;
    --blockquote-warning-color: #e0b563;
    --blockquote-caution-color: #e0847f;
}

/* -------------------------------------------------------------------- *
 * 2. Sidebar: hide the auto chapter numbers, keep titles.
 *
 * mdBook wraps each chapter number in <strong aria-hidden="true">N.</strong>
 * inside the chapter link (both the JS-rendered live sidebar and the
 * no-JS/print toc.html fallback use the same markup). Hiding it visually
 * is safe since it is already aria-hidden for assistive tech.
 * -------------------------------------------------------------------- */

.chapter .chapter-link-wrapper a strong[aria-hidden="true"] {
    display: none;
}

/* -------------------------------------------------------------------- *
 * 3. Full-width tables and mermaid diagrams
 * -------------------------------------------------------------------- */

.content main table {
    width: 100%;
    max-width: 100%;
    margin: 1.5em 0;
}

.content main table th,
.content main table td {
    text-align: left;
}

/* Identifiers in table cells (metric names, config keys) stay unbroken:
   mid-word wraps like "blockwatcher_ events_d ecoded_t otal" are worse than a
   wide column. The last-column floor below keeps the prose column from
   being starved by them. */
.content main table code {
    white-space: nowrap;
}

/* Give prose-bearing final columns room to breathe relative to the
   identifier columns that precede them. */
.content main table td:last-child {
    min-width: 18em;
}

.mermaid,
pre.mermaid {
    width: 100%;
}

.mermaid svg {
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
}

/*
 * 4. The benchmarks results table
 *
 * Every cell reads as a single line: each column is a short measurement
 * or name, so wrapping only hurts. Scoped by the marker div the
 * benchmarks page places directly above its results table.
 */
.bench-table + .table-wrapper table th,
.bench-table + .table-wrapper table td {
    white-space: nowrap;
}
