:root {
	/*  General.
     */
	--GW-body-background-color: #000;
	--GW-body-text-color: #fff;

	/*  Selection.
     */
	--GW-text-selection-background-color: #dcdcdc;
	--GW-text-selection-color: #000;

	/*	Links.
	 */
	--GW-body-link-color: #dcdcdc;
	--GW-body-link-hover-color: #999;
	--GW-body-link-visited-color: #b4b4b4;
	--GW-body-link-inverted-color: #333;
	--GW-body-link-inverted-hover-color: #5c5c5c;
	--GW-body-link-inverted-visited-color: #494949;

	/*  Blockquotes.
     */
	--GW-blockquote-border-color-level-one: #5c5c5c;
	--GW-blockquote-border-color-level-two: #646464;
	--GW-blockquote-border-color-level-three: #747474;
	--GW-blockquote-border-color-level-four: #7f7f7f;
	--GW-blockquote-background-color-level-one: #212121;
	--GW-blockquote-background-color-level-two: #3e3e3e;
	--GW-blockquote-background-color-level-three: #4f4f4f;

	/*  Abstracts.
     */
	--GW-abstract-border-color: #6c6c6c;

	/*	Block context highlighting.
	 */
	--GW-block-context-span-highlight-color: #494949;

	/*  Table of contents.
     */
	--GW-TOC-border-color: #5c5c5c;
	--GW-TOC-background-color: #212121;
	--GW-TOC-collapse-button-text-color: #5c5c5c;
	--GW-TOC-collapse-button-text-hover-color: #000;
	--GW-TOC-collapse-button-color: rgba(33, 33, 33, 0.8);
	--GW-TOC-collapse-button-hover-color: #494949;
	--GW-TOC-collapse-button-border-hover-color: #fff;
	--GW-TOC-link-hover-background-color: #363636;
	--GW-TOC-link-hover-color: #fff;
	--GW-TOC-link-hover-indicator-bar-color: #5c5c5c;
	--GW-TOC-number-color: #929292;
	--GW-TOC-number-hover-color: #ddd;

	/*  Collapse blocks.
        */
	--GW-collapse-abstract-blockquote-hover-color: #333;
	--GW-collapse-disclosure-button-color: #333;
	--GW-collapse-disclosure-button-hover-color: #494949;
	--GW-collapse-in-blockquote-disclosure-button-color: #494949;
	--GW-collapse-in-blockquote-disclosure-button-hover-color: #5c5c5c;
	--GW-collapse-disclosure-button-text-color: #6c6c6c;
	--GW-collapse-disclosure-button-text-hover-color: #000;
	--GW-collapse-in-blockquote-disclosure-button-text-color: #8b8b8b;
	--GW-collapse-in-blockquote-disclosure-button-text-hover-color: #999;

	/*	Inline collapses.
	 */
	--GW-collapse-inline-disclosure-button-text-color: #c1c1c1;
	--GW-collapse-inline-disclosure-button-text-hover-color: #8b8b8b;

	/*	Aux-links collapse blocks.
	 */
	--GW-aux-links-collapse-border-color: #646464;

	/*  Headings.
     */
	--GW-H1-border-color: #999;
	--GW-H2-border-color: #999;

	/*  Comments.
     */
	--GW-comment-section-top-border-color: #8b8b8b;

	/*  Lists.
     */
	--GW-bulleted-list-marker-color: #9f9f9f;

	/*  Figures.
     */
	--GW-figure-outline-color: #999;
	--GW-figure-caption-outline-color: #999;

	/*	Embeds.
	 */
	--GW-embed-border-color: #494949;

	/*  Epigraphs.
     */
	--GW-epigraph-quotation-mark-color: #9f9f9f;

	/*  Footnotes.
     */
	--GW-footnote-border-color: #7c7c7c;
	--GW-footnote-highlighted-border-color: #7c7c7c;
	--GW-footnotes-section-top-rule-color: #5c5c5c;
	--GW-footnote-backlink-border-color: #fff;
	--GW-footnote-backlink-border-hover-color: #8b8b8b;

	/*  Footnote references.
     */
	--GW-highlighted-link-outline-color: #8b8b8b;

	/*  Sidenotes.
     */
	--GW-sidenote-highlight-box-shadow-color: #7c7c7c;
	--GW-sidenote-border-color: #7c7c7c;
	--GW-sidenote-scrollbar-thumb-color: #7c7c7c;
	--GW-sidenote-scrollbar-thumb-hover-color: #8b8b8b;
	--GW-sidenote-self-link-border-color: #7c7c7c;

	/*	Annotations.
	 */
	--GW-section-highlighted-border-color: #b4b4b4;

	/*  Tables.
     */
	--GW-table-border-color: #fff;
	--GW-table-caption-border-color: #fff;
	--GW-table-row-horizontal-border-color: #fff;
	--GW-table-scrollbar-thumb-color: #7c7c7c;
	--GW-table-scrollbar-thumb-hover-color: #8b8b8b;
	--GW-table-scrollbar-border-color: #fff;
	--GW-table-column-heading-hover-background-color: #2b3637;
	--GW-table-sorted-column-heading-background-color: #216983;
	--GW-table-sorted-column-heading-text-color: #000;
	--GW-table-sorted-column-heading-text-shadow-color: #fff;
	--GW-table-zebra-stripe-alternate-row-background-color: #252525;
	--GW-table-row-hover-outline-color: #fff;

	/*  Code blocks.
     */
	--GW-code-element-border-color: #606060;
	--GW-code-element-background-color: #1d1d1d;
	--GW-pre-element-border-color: #606060;
	--GW-pre-element-background-color: #1d1d1d;
	--GW-pre-element-scrollbar-track-color: #1d1d1d;
	--GW-pre-element-scrollbar-thumb-color: #5c5c5c;
	--GW-pre-element-scrollbar-thumb-hover-color: #8b8b8b;
	--GW-code-block-line-highlight-background-color: #171600;
	--GW-code-block-line-highlight-border-color: #494949;
	--GW-code-block-line-number-color: #7c7c7c;
	--GW-code-block-line-number-divider-color: #5c5c5c;


	/*  Syntax highlight theme.
     */
	--GW-syntax-highlight-color-normal: #f1edec;
	--GW-syntax-highlight-color-attribute: #b9e8ff;
	--GW-syntax-highlight-color-data-type: inherit;
	--GW-syntax-highlight-color-variable: #b4b4b4;
	--GW-syntax-highlight-color-other: inherit;
	--GW-syntax-highlight-color-preprocessor: inherit;
	--GW-syntax-highlight-color-extension: #a6a6a6;
	--GW-syntax-highlight-color-comment: #a6a6a6;
	--GW-syntax-highlight-color-control-flow: #b4edaf;
	--GW-syntax-highlight-color-keyword: #b9e8ff;
	--GW-syntax-highlight-color-operator: #b9e8ff;
	--GW-syntax-highlight-color-special-char: #94adb6;
	--GW-syntax-highlight-color-built-in: #b9e8ff;
	--GW-syntax-highlight-color-function: #b9e8ff;
	--GW-syntax-highlight-color-constant: inherit;
	--GW-syntax-highlight-color-base-n: inherit;
	--GW-syntax-highlight-color-dec-val: inherit;
	--GW-syntax-highlight-color-float: inherit;
	--GW-syntax-highlight-color-information: inherit;
	--GW-syntax-highlight-color-char: inherit;
	--GW-syntax-highlight-color-string: inherit;
	--GW-syntax-highlight-color-verbatim-string: inherit;
	--GW-syntax-highlight-color-alert: #ff8470;
	--GW-syntax-highlight-color-error: #ff4a39;
	--GW-syntax-highlight-color-import: #a6a6a6;
	--GW-syntax-highlight-color-special-string: #b4b4b4;

	/*  Math.
     */
	--GW-math-block-background-color: #252525;
	--GW-math-block-background-color-flash: #000;
	--GW-math-block-scrollbar-border-color: #5c5c5c;
	--GW-math-block-scrollbar-thumb-color: #5c5c5c;
	--GW-math-block-scrollbar-thumb-hover-color: #8b8b8b;

	/*  Admonitions.
     */
	--GW-admonition-note-left-border-color: #929292;
	--GW-admonition-note-background-color: #4f4f4f;
	--GW-admonition-tip-left-border-color: #4f4f4f;
	--GW-admonition-tip-background-color: #303030;
	--GW-admonition-warning-left-border-color: #bdbdbd;
	--GW-admonition-warning-background-color: #8a8a8a;
	--GW-admonition-warning-text-color: #000;
	--GW-admonition-error-left-border-color: #e1e1e1;
	--GW-admonition-error-background-color: #bdbdbd;
	--GW-admonition-error-text-color: #000;
	--GW-admonition-reversed-link-color: #494949;
	--GW-admonition-reversed-link-color-hover: #5c5c5c;
	--GW-admonition-reversed-link-underline-gradient-line-color: #5c5c5c;
	--GW-admonition-reversed-link-underline-gradient-line-color-hover: #6c6c6c;

	/*	Footer.
	 */
	--GW-bottom-ornament-line-color: #fff;

	/*	Pop-frames (popups or popins).
	 */
	--GW-popframes-object-popframe-background-color: #000;

	--GW-extracts-options-dialog-backdrop-background-color: rgba(0, 0, 0, 0.95);
	--GW-extracts-options-dialog-background-color: var(--GW-body-background-color);
	--GW-extracts-options-dialog-border-color: #7c7c7c;
	--GW-extracts-options-dialog-box-shadow-color: #cecece;
	--GW-extracts-options-dialog-horizontal-rule-color: #5c5c5c;
	--GW-extracts-options-dialog-button-background-color: var(--GW-body-background-color);
	--GW-extracts-options-dialog-button-text-color: #fff;
	--GW-extracts-options-dialog-button-border-color: #fff;
	--GW-extracts-options-dialog-button-hover-box-shadow-color: #fff;
	--GW-extracts-options-dialog-option-button-explanation-text-color: #a6a6a6;
	--GW-extracts-options-dialog-option-button-hover-text-color: #a6a6a6;
	--GW-extracts-options-dialog-radio-button-border-color: #fff;

	/*  Popups.
     */
	--GW-popups-popup-background-color: var(--GW-body-background-color);

	--GW-popups-popup-border-color: #5c5c5c;
	--GW-popups-popup-box-shadow-color: #5c5c5c;
	--GW-popups-popup-border-focused-color: #7c7c7c;
	--GW-popups-popup-box-shadow-focused-color: #7c7c7c;

	--GW-popups-popup-title-bar-background-color: #000;
	--GW-popups-popup-title-bar-button-color: #6c6c6c;
	--GW-popups-popup-title-bar-button-color-hover: #fff;
	--GW-popups-popup-title-bar-button-color-disabled: #333;
	--GW-popups-popup-title-color: #7c7c7c;
	--GW-popups-popup-title-link-hover-color: var(--GW-body-link-hover-color);
	--GW-popups-popup-title-bar-button-focused-color: #a6a6a6;
	--GW-popups-popup-title-bar-button-focused-color-hover: #fff;
	--GW-popups-popup-title-bar-button-focused-color-disabled: #494949;
	--GW-popups-popup-title-bar-submenu-box-shadow-color: #494949;
	--GW-popups-popup-title-focused-color: #fff;
	--GW-popups-popup-title-link-hover-focused-color: var(--GW-body-link-hover-color);

	--GW-popups-popup-scrollbar-thumb-color: #494949;
	--GW-popups-popup-scrollbar-thumb-hover-color: #6c6c6c;
	--GW-popups-popup-scrollbar-thumb-focused-color: #5c5c5c;
	--GW-popups-popup-scrollbar-thumb-hover-focused-color: #8b8b8b;

	/*  Popins.
     */
	--GW-popins-popin-background-color: var(--GW-body-background-color);

	--GW-popins-popin-border-color: #7c7c7c;
	--GW-popins-popin-backdrop-color: rgba(255, 255, 255, 0.4);
	--GW-popins-popin-box-shadow-color: #7c7c7c;

	--GW-popins-popin-title-bar-background-color: #000;
	--GW-popins-popin-title-bar-button-color: #a6a6a6;

	--GW-popins-popin-scrollbar-thumb-color: #5c5c5c;
	--GW-popins-popin-scrollbar-thumb-hover-color: #8b8b8b;

	--GW-popins-popin-stack-counter-text-color: #000;
	--GW-popins-popin-stack-counter-background-color: #6c6c6c;

	/*  Image focus.
     */
	--GW-image-focus-image-hover-drop-shadow-color: #a6a6a6;

	/*	Page toolbar.
	 */
	--GW-page-toolbar-border-color: #7c7c7c;
	--GW-page-toolbar-control-button-color: #7c7c7c;
	--GW-page-toolbar-control-button-active-color: #fff;

	/*	Page toolbar widgets.
	 */
	--GW-page-toolbar-button-icon-color: #7c7c7c;
	--GW-page-toolbar-button-selectable-icon-color: #404040;
	--GW-page-toolbar-button-selected-icon-color: #a6a6a6;
	--GW-page-toolbar-button-text-color: #b4b4b4;
	--GW-page-toolbar-button-disabled-text-color: #5c5c5c;
	--GW-page-toolbar-button-highlighted-text-color: #fff;

	/*	Reader mode.
	 */
	--GW-reader-mode-masked-links-key-toggle-info-alert-panel-background-color: rgba(255, 255, 255, 0.8);
	--GW-reader-mode-masked-links-key-toggle-info-alert-panel-text-color: #000;
	--GW-reader-mode-masked-links-key-toggle-info-alert-panel-text-shadow-color: #fff;
	--GW-reader-mode-masked-links-key-toggle-info-alert-panel-key-icon-border-color: #6c6c6c;
	--GW-reader-mode-masked-links-key-toggle-info-alert-panel-key-icon-background-color: #cecece;

	/*	"Back to top" link.
	 */
	--GW-back-to-top-link-color: #5c5c5c;
	--GW-back-to-top-link-hover-color: #8b8b8b;

	/*	Mobile floating header.
	 */
	--GW-floating-header-box-shadow-color: #5c5c5c;
	--GW-floating-header-scroll-indicator-color: #8b8b8b;

	/*	"Skip to content" accessibility link.
	 */
	--GW-skip-to-content-text-color: #000;
	--GW-skip-to-content-border-color: #000;
	--GW-skip-to-content-background-color: #ff847b;

	/*	Nav header.
	 */
	--GW-nav-header-link-color: #999;
	--GW-nav-header-link-hover-color: #fff;

	/*	X of the day.
	 */
	--GW-x-of-the-day-border-color: #5c5c5c;
}

:root {
	/*  Adjust background color to prevent pixels from turning off (contrary to
    	popular belief, pixels turning off saves trivial energy, like <1% in
    	measurements, and causes nasty scrolling/update jank due to delay in
    	pixels turning back on), and improve contrast with the white.
     */
	--GW-body-background-color: #161616;

	/*  Dial back from pure white to keep contrast from being *too* high &
    	'stark' (#fff bg / #000 text seems to work in light mode, but not in
    	dark mode, perhaps because of differences in lighting environment?)
     */
	--GW-body-text-color: #f1f1f1;

	--GW-popups-popup-title-bar-pattern: var(--GW-image-pattern-dotted-161616-on-252525-2x-gif);
	--GW-popups-popup-title-bar-pattern-focused: var(--GW-image-pattern-dotted-161616-on-3e3e3e-2x-gif);

	--GW-popins-popin-backdrop-color: rgba(0, 0, 0, 0.6);

	--GW-popins-popin-title-bar-button-color: #bbb;

	--GW-checkerboard-scrollbar-background-image: var(--GW-image-checkerboard-888-000-2x-gif);
	--GW-checkerboard-scrollbar-hover-background-image: var(--GW-image-checkerboard-bfbfbf-000-2x-gif);
}

.dark-mode-invert,
.dark-mode-invert::before,
.dark-mode-invert::after {
	filter: var(--dark-mode-invert-filter, none);
}

/*  Admonition icons.
 */
div.admonition.tip::before {
	filter: invert(1);
}

div.admonition.note::before {
	filter: none;
}

div.admonition.warning::before {
	filter: none;
}

div.admonition.error::before {
	filter: none;
}

/*  SVG icons in the two darker styles of admonitions.
 */
div.admonition.warning a[data-link-icon-type='svg'] .link-icon-hook::after,
div.admonition.error a[data-link-icon-type='svg'] .link-icon-hook::after {
	filter: none;
}

/*  For sortable table column headings, we use dark versions of the up/down/both
    arrow icons.
 */
table th.tablesorter-header {
	background-image: url('/static/img/tablesorter/tablesorter-bg-dark.gif');
}

table th.tablesorter-headerAsc {
	background-image: url('/static/img/tablesorter/tablesorter-asc-dark.gif');
}

table th.tablesorter-headerDesc {
	background-image: url('/static/img/tablesorter/tablesorter-desc-dark.gif');
}

/*  Images that are marked as '.invert' by the server are inverted,
    hue-rotated, and desaturated. Other (non-invertible) images are merely
    desaturated. Hovering over an image restores it to its original state.
    Hierarchy: '.invert-not'/'.invert-not-auto': no inversion or grayscale;
    '.invert'/'.invert-auto': inverted (uninverted upon mouse hover);
    none: grayscaled (ungrayscaled on hover).
 */
figure img.invert,
figure img.invert-auto {
	filter: grayscale(50%) invert(100%) brightness(95%) hue-rotate(180deg);
}

figure img:not(.invert):not(.invert-auto) {
	filter: grayscale(50%);
}

figure img,
figure img.invert,
figure img.invert-auto {
	transition: filter 0.25s ease;
}

figure img:not(.drop-filter-on-hover-not):hover,
figure img:not(.drop-filter-on-hover-not).invert:hover,
figure img:not(.drop-filter-on-hover-not).invert-auto:hover,
figure img:not(.drop-filter-on-hover-not):not(.invert):not(.invert-auto):hover {
	filter: none;
	transition: filter 0s ease 0.25s;
}

figure img[src$=".svg"].invert:hover,
figure img[src$=".svg"].invert-auto:hover {
	filter: grayscale(50%) invert(100%) brightness(95%) hue-rotate(180deg);
}

/*  Image alt-text.
 */
figure img.invert::before,
figure img.invert-auto::before {
	filter: invert(1);
}

figure img.invert:hover::before,
figure img.invert-auto:hover::before {
	filter: none;
}

/*  Styling the image alt-text interferes with the transitions in dark mode.
    (We include non-class'd `img` in this selector for consistency.)
	
    TEMPORARY until we transition to a color-based instead of filter-based
    scheme for this. —SA 2022-07-29
 */
figure img,
figure img:hover,
figure img.invert,
figure img.invert:hover,
figure img.invert-auto,
figure img.invert-auto:hover {
	transition: none;
}

/*  For images which have been marked up (manually or automatically) with
	'.invert-not', we avoid any filtering at all. If they are manually marked up
	(artwork, diagrams with multiple subtly-different colors matched to a
	legend/caption), the color is important and shouldn't be faded out by
	default. (Or invertOrNot has judged the image to be non-invertible, which
	presumably means something like the above also.)
 */
#markdownBody figure img.invert-not,
#markdownBody figure img.invert-not-auto {
	filter: none;
}

/*  The loading spinner for object popups (image, iframe, object) is inverted
    and made more visible in dark mode.
 */
.popframe.loading::before {
	filter: invert(1);
	opacity: 0.4;
}

/*  "Loading failed" messages for object popups.
 */
.popframe.loading-failed::after {
	opacity: 0.4;
}

/*  Masked links key toggle info alert panel.
 */
div#masked-links-key-toggle-info-alert img {
	filter: drop-shadow(0 0 3px var(--GW-reader-mode-masked-links-key-toggle-info-alert-panel-text-shadow-color));
}

/*  Recently-modified icon, manicule
 */
.has-recently-modified-icon .recently-modified-icon-hook::before,
.manicule svg {
	filter: invert(1);
}