/*
 * Netzschleuder theme on top of Bootstrap 5.3.
 *
 * All colours are defined as variables in the palette section below, with
 * a light and a dark set. Load this file after bootstrap.min.css.
 */

/* ------------------------------------------------------------------ */
/* Web fonts (self-hosted, SIL Open Font License; see static/fonts/)   */
/* ------------------------------------------------------------------ */

@font-face {
    font-family: 'Ovo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(../fonts/ovo-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'PT Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(../fonts/pt-serif-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'PT Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url(../fonts/pt-serif-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


/* ------------------------------------------------------------------ */
/* Palette and typography                                             */
/* ------------------------------------------------------------------ */

:root {
    /* Base size: 1rem == 15px. Everything else (text, spacing, Bootstrap's
       rem-based components) scales from it. */
    font-size: 15px;

    /* Light palette. Every colour used by the theme is defined here and
       redefined for dark mode below. */

    /* Surfaces: a mid-grey page with white panels on top */
    --ns-bg: #e6e9ec;
    --ns-surface: #ffffff;
    --ns-surface-alt: #f5f7f9;
    --ns-border: #cfd5db;
    --ns-rule: #e3e7eb;

    /* Text */
    --ns-text: #1d2125;
    --ns-heading: #14181b;
    --ns-muted: #4f5861;

    /* Primary accent (petrol) for links and actions */
    --ns-accent: #0b4f6c;
    --ns-accent-hover: #083a50;
    --ns-accent-soft: #dcebf2;
    --ns-row-hover: #eaf3f7;

    /* Secondary accent (wine, from the logo's nodes), used sparingly */
    --ns-wine: #8a1c1c;
    --ns-wine-bright: #e0625b;

    /* Dark band: header and API signatures */
    --ns-ink: #17262e;
    --ns-ink-border: #17262e;
    --ns-ink-text: #ffffff;
    --ns-ink-muted: #b8c4cc;
    --ns-ink-code: #e8edf0;
    --ns-ink-var: #9fd0e6;
    --ns-ink-method: #ff9b8f;

    /* Tables */
    --ns-thead-bg: #dfe5ea;
    --ns-thead-text: #1d2a33;
    --ns-zebra: #f5f7f9;

    /* Soft status colours (pale fill, dark text of the same hue) */
    --ns-tag-bg: #e3e8ec;
    --ns-tag-text: #26333d;
    --ns-ok-bg: #d7ecd9;
    --ns-ok-text: #1f5a25;
    --ns-bad-bg: #f8dcd8;
    --ns-bad-text: #8f2216;

    --ns-code-bg: #f1f4f6;
    --ns-footer-bg: #dde2e6;
    --ns-control-border: #b9c1c9;
    --ns-radius: 8px;

    --ns-font-body: 'Ovo', serif;
    --ns-font-heading: 'PT Serif', serif;
    /* Interface elements (navigation, tables, labels, buttons) */
    --ns-font-ui: system-ui, -apple-system, 'Segoe UI', Roboto,
                  'Helvetica Neue', Arial, sans-serif;

    --bs-body-font-family: var(--ns-font-body);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.5;
    --bs-body-color: var(--ns-text);
    --bs-body-color-rgb: 29, 33, 37;
    --bs-body-bg: var(--ns-bg);
    --bs-body-bg-rgb: 230, 233, 236;
    --bs-heading-color: var(--ns-heading);
    --bs-font-monospace: ui-monospace, 'SF Mono', Menlo, Consolas,
                         'Liberation Mono', monospace;
    --bs-code-color: inherit;
    --bs-border-color: var(--ns-border);

    --bs-link-color: var(--ns-accent);
    --bs-link-color-rgb: 11, 79, 108;
    --bs-link-hover-color: var(--ns-accent-hover);
    --bs-link-hover-color-rgb: 8, 58, 80;
    --bs-link-decoration: none;

    --bs-border-radius: 6px;
    --bs-border-radius-sm: 4px;
    --bs-border-radius-lg: var(--ns-radius);
}

/* Dark mode. The attribute is set before the page renders by the script
   in base.html: from the visitor's choice if they made one, otherwise from
   the operating system preference. Bootstrap uses the same attribute for
   its own components. */
:root[data-bs-theme="dark"] {
    color-scheme: dark;

    --ns-bg: #12171b;
    --ns-surface: #1b2228;
    --ns-surface-alt: #212930;
    --ns-border: #34404a;
    --ns-rule: #2a333b;

    --ns-text: #dde3e8;
    --ns-heading: #f0f3f5;
    --ns-muted: #9eaab4;

    --ns-accent: #6cb6d9;
    --ns-accent-hover: #9ccfe8;
    --ns-accent-soft: #1a3541;
    --ns-row-hover: #22333d;

    --ns-wine: #d0605a;
    --ns-wine-bright: #e0625b;

    --ns-ink: #0b1115;
    --ns-ink-border: #2a333b;

    --ns-thead-bg: #26303a;
    --ns-thead-text: #e2e8ec;
    --ns-zebra: #1f262d;

    --ns-tag-bg: #2a343d;
    --ns-tag-text: #cdd6dd;
    --ns-ok-bg: #1e3a24;
    --ns-ok-text: #93d39d;
    --ns-bad-bg: #45211e;
    --ns-bad-text: #f2a097;

    --ns-code-bg: #161d22;
    --ns-footer-bg: #161c21;
    --ns-control-border: #4a5661;

    --bs-body-color-rgb: 221, 227, 232;
    --bs-body-bg-rgb: 18, 23, 27;
    --bs-link-color-rgb: 108, 182, 217;
    --bs-link-hover-color-rgb: 156, 207, 232;
}

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

p {
    line-height: 1.5em;
    margin-bottom: 1em;
}

li, dd {
    line-height: 1.5em;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--ns-font-heading);
    font-weight: normal;
    line-height: 1.2;
    margin: 1.6em 0 .5em;
    padding: 0;
}

h1 { font-size: 2em; }
h2 { font-size: 1.45em; }
h3 { font-size: 1.3em; }
h4 { font-size: 1.15em; }
h5, h6 { font-size: 1.05em; }

small, .small {
    font-size: 80%;
    color: var(--ns-muted);
}

:where(ul, ol) {
    margin: 1em 0;
    padding-left: 1.45em;
}

dl {
    margin: 1em 0;
}

/* Field labels (Description, Tags, ...): small caps with a wine marker */
dt {
    margin: 1.1em 0 .65em;
    font-family: var(--ns-font-ui);
    font-size: .78em;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ns-muted);
    border-left: 3px solid var(--ns-wine);
    padding-left: 7px;
    line-height: 1.3;
}

dd {
    margin: 0 0 .5em;
}

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

blockquote {
    border-left: 3px solid var(--ns-border);
    padding-left: 1.2em;
    margin: 1em 0;
    color: var(--ns-muted);
}

code {
    font-size: .9em;
    background: var(--ns-code-bg);
    border: 1px solid var(--ns-rule);
    border-radius: 4px;
    padding: 0 .3em;
}

pre {
    font-size: .9em;
    margin: 1em 0;
}

pre code {
    background: none;
    border: 0;
    padding: 0;
}

.highlight pre {
    background: var(--ns-code-bg);
    border: 1px solid var(--ns-border);
    border-radius: var(--bs-border-radius);
    padding: .6em .9em;
}

hr {
    color: var(--ns-border);
    opacity: 1;
    margin: 1em 0;
}

.code, .mono {
    font-family: var(--bs-font-monospace);
    font-size: .9em;
}

/* ------------------------------------------------------------------ */
/* Page frame: container, header, navigation and footer               */
/* ------------------------------------------------------------------ */

.ns-container {
    max-width: 1800px;
    padding-left: 1.6rem;
    padding-right: 1.6rem;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 575.98px) {
    .ns-container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Full-width dark band with the logo and the navigation */
.ns-header {
    background: var(--ns-ink);
    border-bottom: 1px solid var(--ns-ink-border);
}

.ns-logo a {
    color: var(--ns-ink-text);
}

.ns-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 1.5em;
    row-gap: .4em;
    padding-top: .9rem;
    padding-bottom: .9rem;
}

/* Logo and nav keep their size; if they do not fit side by side the nav
   moves to its own line, right-aligned. */
.ns-header-inner > * {
    flex: none;
    max-width: 100%;
}

.ns-header-inner > nav {
    margin-left: auto;
}

.ns-logo {
    font-size: 1.85em;
    margin: 0;
}

@media (min-width: 576px) {
    .ns-logo {
        white-space: nowrap;
    }
}

.ns-logo small {
    color: var(--ns-ink-muted);
    font-size: .5em;
    line-height: 1;
}

@media (max-width: 575.98px) {
    .ns-subtitle {
        display: block;
        margin-top: .4em;
    }
}

.ns-logo .ns-title {
    margin-right: .5em;
}

.ns-logo img {
    height: 42px;
    vertical-align: text-bottom;
    margin-bottom: -.08em;
}

/* Navigation: plain text links, the active one underlined */
.ns-nav {
    margin: 0;
    font-family: var(--ns-font-ui);
    font-size: .95rem;
    --bs-nav-link-padding-x: .75em;
    --bs-nav-link-padding-y: .4em;
    --bs-nav-link-font-weight: 400;
    --bs-nav-link-color: var(--ns-ink-muted);
    --bs-nav-link-hover-color: var(--ns-ink-text);
}

.ns-nav .nav-link {
    border-bottom: 2px solid transparent;
}

.ns-nav .nav-link:hover {
    text-decoration: none;
}

.ns-nav .nav-link.active {
    color: var(--ns-ink-text);
    border-bottom-color: var(--ns-wine-bright);
}

/* Light/dark mode switch, at the end of the navigation */
.ns-theme-toggle {
    display: flex;
    align-items: center;
    /* Same box as the nav links (including their 2px underline space), so
       the icon is centred on the link text */
    height: 100%;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--ns-ink-muted);
    padding: .4em .75em;
    cursor: pointer;
}

.ns-theme-toggle:hover {
    color: var(--ns-ink-text);
}

.ns-theme-toggle:focus-visible {
    outline: 2px solid var(--ns-ink-muted);
    outline-offset: -2px;
    border-radius: 4px;
}

.ns-theme-toggle svg {
    width: 1.1em;
    height: 1.1em;
}

/* Show the icon for the mode the button switches to */
.ns-theme-toggle .ns-icon-sun,
[data-bs-theme="dark"] .ns-theme-toggle .ns-icon-moon {
    display: none;
}

[data-bs-theme="dark"] .ns-theme-toggle .ns-icon-sun {
    display: inline;
}

@media (max-width: 991.98px) {
    /* Stacked header: room between the logo line and the navigation */
    .ns-header-inner {
        row-gap: 14px;
    }
    .ns-header-inner > nav {
        margin-left: -.75em;
    }
}

.ns-main {
    padding-top: 1.5rem;
    padding-bottom: 1rem;
}

.ns-footer {
    background: var(--ns-footer-bg);
    border-top: 1px solid var(--ns-border);
    font-family: var(--ns-font-ui);
    font-size: .9em;
    color: var(--ns-muted);
}

.ns-footer p {
    padding: .6em 1.2em .6em 0;
    margin: 0;
}

.ns-footer img {
    height: 30px;
    vertical-align: middle;
    margin-right: 8px;
    margin-left: 2px;
}

/* The footer images are dark-on-light; give them a light backing in
   dark mode so they stay legible. */
[data-bs-theme="dark"] .ns-footer img {
    background: #fff;
    border-radius: 4px;
    padding: 2px;
}

/* White content panels on the grey page */
.ns-panel,
.api-endpoint {
    background: var(--ns-surface);
    border: 1px solid var(--ns-border);
    border-radius: var(--ns-radius);
    padding: 1.25rem 1.2rem;
}

.ns-panel > :first-child,
.api-endpoint > :first-child {
    margin-top: 0;
}

/* The page title inside a panel gets a thin rule underneath */
.ns-panel h1 {
    padding-bottom: .35em;
    border-bottom: 1px solid var(--ns-rule);
}

@media (max-width: 575.98px) {
    .ns-panel,
    .api-endpoint {
        padding: 1rem;
    }
}

/* ------------------------------------------------------------------ */
/* Components                                                         */
/* ------------------------------------------------------------------ */

/* Data tables */
.table {
    --bs-table-bg: var(--ns-surface);
    --bs-table-color: var(--ns-text);
    --bs-table-border-color: var(--ns-rule);
    --bs-table-hover-bg: var(--ns-row-hover);
    --bs-table-hover-color: var(--ns-text);
    font-family: var(--ns-font-ui);
    /* Slightly smaller than the text, so the wide tables stay compact */
    font-size: .9em;
    font-variant-numeric: tabular-nums;
    margin-bottom: 1em;
}

.table > :not(caption) > * > * {
    padding: 6px 7px;
    line-height: 1.35;
}

.table > thead > tr > th {
    --bs-table-bg: var(--ns-thead-bg);
    color: var(--ns-thead-text);
    font-weight: 600;
    font-size: .92em;
    border-bottom-color: var(--ns-border);
}

/* Light zebra striping, to follow rows across many columns */
.table > tbody > tr:nth-child(even) > * {
    --bs-table-bg-type: var(--ns-zebra);
}

.table > tbody > tr:last-child > * {
    border-bottom-width: 0;
}

/* Keep the first column (the name) visible while scrolling sideways */
.table-responsive > .table > :not(caption) > tr > :first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    box-shadow: inset -1px 0 0 var(--ns-border), inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, transparent));
}

/* Tables are framed like a panel of their own */
.table-responsive {
    border: 1px solid var(--ns-border);
    border-radius: var(--bs-border-radius);
    margin-bottom: 1em;
}

.table-responsive > .table {
    margin-bottom: 0;
}

/* Columns marked .ns-opt are hidden on small screens unless requested */
@media (max-width: 767.98px) {
    .table:not(.ns-show-all) .ns-opt {
        display: none;
    }
}

/* Sortable headers: the button looks like the plain header text */
.sort-button {
    font: inherit;
    color: inherit;
    text-align: inherit;
    line-height: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.sort-button:hover {
    color: var(--ns-accent);
}

.sort-button:focus-visible {
    outline: 2px solid var(--ns-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

th[aria-sort] .sort-button {
    color: var(--ns-accent);
}

th[aria-sort] .sort-button::after {
    content: " \25B4";
    font-size: .8em;
}

th[aria-sort="descending"] .sort-button::after {
    content: " \25BE";
}

/* Column legend and toggle above the network tables */
.ns-table-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .5em 1em;
    margin-bottom: .6em;
    font-family: var(--ns-font-ui);
}

.ns-legend {
    font-size: .9em;
}

.ns-legend summary {
    color: var(--ns-accent);
    cursor: pointer;
}

.ns-legend dl {
    display: grid;
    grid-template-columns: max-content auto;
    gap: .2em 1em;
    margin: .5em 0 0 1em;
}

.ns-legend dt, .ns-legend dd {
    margin: 0;
    font-size: 1em;
    font-weight: normal;
    color: var(--ns-text);
}

/* The legend lists symbols, not field labels: undo the label styling */
.ns-legend dt {
    text-transform: none;
    letter-spacing: normal;
    border-left: 0;
    padding-left: 0;
}

.ns-tip {
    font-family: var(--ns-font-ui);
    font-size: .85em;
    color: var(--ns-muted);
}

th.tight {
    width: 1px;
    white-space: nowrap;
}

/* Labels: soft pills */
.badge {
    --bs-badge-padding-x: .6em;
    --bs-badge-padding-y: .15em;
    --bs-badge-font-size: .82em;
    --bs-badge-font-weight: 500;
    --bs-badge-border-radius: 999px;
    font-family: var(--ns-font-ui);
    line-height: 1.35;
    margin: .1em 0;
}

.badge.text-bg-secondary {
    background-color: var(--ns-tag-bg) !important;
    color: var(--ns-tag-text) !important;
}

.badge.text-bg-success {
    background-color: var(--ns-ok-bg) !important;
    color: var(--ns-ok-text) !important;
}

.badge.text-bg-danger {
    background-color: var(--ns-bad-bg) !important;
    color: var(--ns-bad-text) !important;
}

/* Download sizes are actions, so they carry the accent tint */
.badge.ns-dl {
    background-color: var(--ns-accent-soft) !important;
    color: var(--ns-accent) !important;
}

.badge.ns-dl {
    display: inline-flex;
    align-items: center;
    gap: .2em;
    padding-left: .35em;
    padding-right: .5em;
}

/* Download cells: a little tighter, so the icons do not widen the table */
.table td:has(> a > .ns-dl),
.table th:has(> a) {
    padding-left: 4px;
    padding-right: 4px;
}

.badge.ns-dl .ns-icon {
    width: 1.05em;
    height: 1.05em;
}

a:hover > .badge.text-bg-secondary {
    background-color: color-mix(in srgb, var(--ns-tag-bg), var(--ns-text) 8%) !important;
}

a:hover > .badge.ns-dl {
    background-color: color-mix(in srgb, var(--ns-accent-soft), var(--ns-accent) 12%) !important;
}

@media (max-width: 767.98px) {
    /* Larger tap targets for tag links on touch screens */
    a > .badge {
        padding: .35em .7em;
    }

    /* Give text columns room instead of squeezing them; the table
       scrolls sideways within its box. */
    .table-responsive .table th.text-start:not(:first-child),
    .table-responsive .table td:not(.text-end):not(.text-center):not(:first-child) {
        min-width: 12em;
    }
}

/* Citations with link chips (network page) */
.ns-citations li {
    margin-bottom: .6em;
}

.ns-link-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .3em;
    vertical-align: baseline;
    margin-left: .25em;
}

.ns-link-chip {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    padding: .1em .6em .1em .35em;
    border-radius: 999px;
    background: var(--ns-accent-soft);
    color: var(--ns-accent);
    font-family: var(--ns-font-ui);
    font-size: .82em;
    line-height: 1.5;
    white-space: nowrap;
    max-width: 100%;
}

.ns-link-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.ns-link-chip:hover {
    background: color-mix(in srgb, var(--ns-accent-soft), var(--ns-accent) 12%);
    text-decoration: none;
}

.ns-icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
}

/* Admonition-style side notes (network page) */
.ns-note {
    background: var(--ns-surface-alt);
    border: 1px solid var(--ns-border);
    border-radius: var(--bs-border-radius);
    padding: .7em 1em;
    margin: 0 0 1em;
    font-size: .9em;
}

.ns-note-title {
    font-family: var(--ns-font-ui);
    font-weight: 600;
    color: var(--ns-accent);
    font-size: .95em;
    margin: 0 0 .3em;
}

.ns-note .highlight pre {
    background: var(--ns-surface);
    margin: .5em 0;
}

@media (min-width: 992px) {
    .ns-aside {
        padding-left: 1.5em;
    }
}

/* Buttons and inputs */
.btn-ns {
    --bs-btn-bg: var(--ns-surface);
    --bs-btn-border-color: var(--ns-border);
    --bs-btn-color: var(--ns-text);
    --bs-btn-hover-bg: var(--ns-surface-alt);
    --bs-btn-hover-border-color: var(--ns-control-border);
    --bs-btn-hover-color: var(--ns-text);
    --bs-btn-active-bg: var(--ns-rule);
    --bs-btn-active-border-color: var(--ns-control-border);
    --bs-btn-active-color: var(--ns-text);
    --bs-btn-padding-x: 14px;
    --bs-btn-padding-y: 7px;
    --bs-btn-font-family: var(--ns-font-ui);
    --bs-btn-font-size: .95rem;
    --bs-btn-line-height: normal;
}

.btn-ns.btn-sm {
    --bs-btn-padding-y: .25em;
    --bs-btn-padding-x: .7em;
    --bs-btn-font-size: .85em;
}

.form-control {
    font-family: var(--ns-font-ui);
    color: var(--ns-text);
    background-color: var(--ns-surface);
    border-color: var(--ns-border);
    padding: 7px 10px;
    line-height: normal;
}

.form-control:focus {
    border-color: var(--ns-accent);
    box-shadow: 0 0 0 3px var(--ns-accent-soft);
}

/* ------------------------------------------------------------------ */
/* Page-specific                                                      */
/* ------------------------------------------------------------------ */

/* Main page: search box and legend */
@media (max-width: 991.98px) {
    .search-header {
        clear: both;
        width: 100%;
        display: inline;
    }
    .search-bar {
        width: 100%;
        margin-bottom: .6em;
    }
    .legend {
        position: relative;
    }
}

@media (min-width: 992px) {
    .search-header {
        clear: both;
        width: 100%;
        display: inline-block;
        position: relative;
        margin-bottom: .6em;
    }
    .search-bar {
        width: 30%;
    }
    .legend {
        position: absolute;
        bottom: 0;
        width: 70%;
    }
}

/* API documentation */
.api-doc {
    max-width: 62em;
}

.api-doc > h1 {
    margin-top: 0;
}

.api-toc {
    display: flex;
    flex-wrap: wrap;
    gap: .2em 1.2em;
    margin-bottom: 1.2em;
    font-family: var(--ns-font-ui);
    font-size: .95em;
}

.api-endpoint {
    margin-bottom: 1rem;
    scroll-margin-top: 1rem;
}

.api-endpoint h2 {
    margin: 0 0 .6em;
    font-size: 1.35em;
}

.api-endpoint p {
    margin-bottom: .7em;
}

.api-sig {
    font-family: var(--bs-font-monospace);
    font-size: .95em;
    background: var(--ns-ink);
    color: var(--ns-ink-code);
    border-radius: var(--bs-border-radius);
    padding: .45em .8em;
    overflow-x: auto;
    white-space: nowrap;
}

.api-sig var {
    color: var(--ns-ink-var);
}

.api-method {
    font-weight: 600;
    color: var(--ns-ink-method);
    margin-right: .7em;
}

.api-params {
    margin: .4em 0 .9em;
}

.api-params td:first-child {
    white-space: nowrap;
}

.api-params td {
    font-family: var(--ns-font-body);
}

/* Ridiculogram thumbnails: fixed size, reflowing with the window */
.ns-drawings {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.ns-drawings figure {
    width: 360px;
    max-width: 100%;
    margin: 0;
}

.ns-drawings img {
    border-radius: var(--bs-border-radius);
}

.ns-drawings figcaption {
    font-family: var(--ns-font-ui);
    font-size: .9em;
    margin-top: .3em;
}

/* Footnotes (About page, and Markdown footnotes in descriptions) */
.footnote {
    font-size: .85em;
    color: var(--ns-muted);
}

.footnote hr {
    margin-top: .9em;
    margin-bottom: 0;
}

.footnote ol {
    margin-top: 0;
    margin-bottom: 0;
}

.footnote li p:last-child {
    margin-bottom: 0;
}

/* Admonition boxes (About page): a tinted box with an accent bar, an icon
   and a title. "info" uses the petrol accent, "caution" the wine one. */
.ns-admonition {
    --ns-adm-accent: var(--ns-accent);
    background: color-mix(in srgb, var(--ns-adm-accent) 6%, var(--ns-surface));
    border: 1px solid color-mix(in srgb, var(--ns-adm-accent) 25%, var(--ns-border));
    border-left: 4px solid var(--ns-adm-accent);
    border-radius: var(--bs-border-radius);
    padding: 1rem 1.3rem .3rem;
    margin: 1.5rem 0;
    line-height: 1.6;
}

.ns-admonition-caution {
    --ns-adm-accent: var(--ns-wine);
}

.ns-admonition-title {
    display: flex;
    align-items: center;
    gap: .45em;
    margin: 0 0 .7rem;
    font-family: var(--ns-font-ui);
    font-size: 1.05em;
    font-weight: 600;
    color: var(--ns-adm-accent);
}

.ns-admonition-title svg {
    width: 1.2em;
    height: 1.2em;
    flex: none;
}

.ns-admonition p {
    margin-bottom: .8rem;
}

.ns-admonition .footnote {
    border-top: 1px solid color-mix(in srgb, var(--ns-adm-accent) 20%, var(--ns-border));
    padding: .6rem 0 .8rem;
}

/* Numbered steps (Restricted page): a numbered circle and a rule
   connecting the steps */
.ns-steps {
    list-style: none;
    counter-reset: ns-step;
    padding: 0;
    margin: 1.2rem 0 0;
}

.ns-steps > li {
    counter-increment: ns-step;
    position: relative;
    padding: 0 0 .6rem 2.8rem;
}

.ns-steps > li::before {
    content: counter(ns-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    background: var(--ns-accent);
    color: var(--ns-surface);
    font-family: var(--ns-font-ui);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ns-steps > li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: calc(.95rem - 1px);
    top: 2.3rem;
    bottom: .2rem;
    border-left: 2px solid var(--ns-rule);
}

.ns-steps h2 {
    font-size: 1.2em;
    margin: .25rem 0 .5rem;
}

.ns-steps .highlight pre {
    margin: .3rem 0 .9rem;
}

/* A citation to copy, set apart from the surrounding text */
.ns-cite {
    background: var(--ns-surface);
    border: 1px solid var(--ns-border);
    border-radius: var(--bs-border-radius);
    padding: .8rem 1rem;
    margin: 0 0 .9rem;
}

.ns-cite blockquote {
    border: 0;
    padding: 0;
    margin: 0 0 .5rem;
    color: var(--ns-text);
    font-family: var(--ns-font-heading);
}

.ns-cite figcaption img {
    display: block;
}

/* Stats page: tag histogram. Each row is the tag chip, a bar on a pale
   track, and the count. */
.ns-hist-wrap {
    max-width: 72rem;
}

/* Two columns where there is room (ranked top to bottom, then the second
   column), one column on narrow screens */
.ns-hist {
    list-style: none;
    padding: 0;
    margin: .2em 0 0;
    columns: 2 24rem;
    column-gap: 3rem;
}

.ns-hist li {
    break-inside: avoid;
    display: grid;
    grid-template-columns: minmax(7em, 12em) minmax(0, 1fr) 3.2em;
    align-items: center;
    gap: .8em;
    padding: .12em 0;
}

.ns-hist-label {
    justify-self: end;
    text-align: right;
    min-width: 0;
}

.ns-hist-label .badge {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.ns-hist-track {
    display: block;
    height: .75em;
    background: var(--ns-tag-bg);
    border-radius: 999px;
    overflow: hidden;
}

.ns-hist-bar {
    display: block;
    height: 100%;
    min-width: .75em;
    background: var(--ns-accent);
    border-radius: 999px;
}

.ns-hist li:hover .ns-hist-bar {
    background: var(--ns-accent-hover);
}

.ns-hist-count {
    font-family: var(--ns-font-ui);
    font-size: .9em;
    font-variant-numeric: tabular-nums;
    color: var(--ns-muted);
    text-align: right;
}

/* Show all / show fewer, without JavaScript: the toggle below the list is
   a label around a visually hidden checkbox; :has() shows the extra rows
   while it is checked. */
.ns-toggle-input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.ns-hist-wrap:not(:has(.ns-toggle-input:checked)) .ns-hist-extra {
    display: none;
}

.ns-list-toggle {
    position: relative;
    display: block;
    width: fit-content;
    margin: .6em auto .2em;
    color: var(--ns-accent);
    font-family: var(--ns-font-ui);
    font-size: .9em;
    cursor: pointer;
    user-select: none;
}

.ns-list-toggle:hover {
    color: var(--ns-accent-hover);
    text-decoration: underline;
}

.ns-list-toggle:has(.ns-toggle-input:focus-visible) {
    outline: 2px solid var(--ns-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.ns-list-toggle::before {
    content: "\25BE";
    display: inline-block;
    margin-right: .35em;
}

.ns-list-toggle:has(.ns-toggle-input:checked)::before {
    transform: rotate(180deg);
}

.ns-list-toggle .ns-when-open,
.ns-list-toggle:has(.ns-toggle-input:checked) .ns-when-closed {
    display: none;
}

.ns-list-toggle:has(.ns-toggle-input:checked) .ns-when-open {
    display: inline;
}

@media (max-width: 575.98px) {
    .ns-hist li {
        grid-template-columns: minmax(6em, 9em) minmax(0, 1fr) 2.6em;
        gap: .5em;
    }
}

/* Stats page plot: the plot takes the room left beside the controls;
   the controls move below it when there is not enough space. */
.ns-plot-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.5em 2em;
}

.ns-plot {
    flex: 1 1 480px;
    min-width: 0;
    overflow: hidden;
}

.ns-plot svg {
    display: block;
}

.ns-plot-controls {
    flex: 0 1 22em;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .7em 1em;
    align-items: center;
    font-family: var(--ns-font-ui);
    font-size: .95em;
}

.ns-plot-controls label {
    color: var(--ns-muted);
}

.form-select {
    font-family: var(--ns-font-ui);
    background-color: var(--ns-surface);
    color: var(--ns-text);
    border-color: var(--ns-border);
}

.form-select:focus {
    border-color: var(--ns-accent);
    box-shadow: 0 0 0 3px var(--ns-accent-soft);
}

/* Stats page plot: axis labels and lines follow the text colour */
#scatter_area text {
    fill: var(--ns-text);
}

#scatter_area .domain,
#scatter_area .tick line {
    stroke: var(--ns-text);
}
