/**
 * Килослов: режимы «Светлый / Тёмный / Ночь».
 *
 * The mode lives in <html data-kmode="light|dark|night">; for dark and night the class
 * km-dark is added too. It is set by a tiny inline script in <head> before the page is
 * drawn, so there is no white flash.
 *
 * The block marked «Twenty Sixteen» is generated from the theme's own colour-scheme
 * template (inc/customizer.php), so every element the theme colours is covered.
 */

html {
	color-scheme: light;
}

html.km-dark {
	color-scheme: dark;
	--km-bg: #262626;
	--km-page: #1a1a1a;
	--km-link: #9adffd;
	--km-text: #e5e5e5;
	--km-text2: #c1c1c1;
	--km-border: rgba(229, 229, 229, 0.2);
	--km-input: #262626;
}

/* Ночь: almost black, warm low-glare text, no harsh blue. */
html.km-dark[data-kmode="night"] {
	--km-bg: #050403;
	--km-page: #100d0a;
	--km-link: #d9a35b;
	--km-text: #c2ae8e;
	--km-text2: #9d8c71;
	--km-border: rgba(194, 174, 142, 0.2);
	--km-input: #1b1712;
}

/* ---------- Twenty Sixteen (generated) ----------
 * Wrapped in :where() so every rule keeps the theme's own specificity: the theme's more
 * specific rules (and plugins' class-based styles) still win, exactly as with the theme's
 * built-in dark colour scheme. This file loads after the theme stylesheet, so ties go to it.
 */

:where(html.km-dark) body {
	background-color: var(--km-bg);
}

:where(html.km-dark) .site {
	background-color: var(--km-page);
}

:where(html.km-dark) mark,
:where(html.km-dark) ins,
:where(html.km-dark) button,
:where(html.km-dark) button[disabled]:hover,
:where(html.km-dark) button[disabled]:focus,
:where(html.km-dark) input[type="button"],
:where(html.km-dark) input[type="button"][disabled]:hover,
:where(html.km-dark) input[type="button"][disabled]:focus,
:where(html.km-dark) input[type="reset"],
:where(html.km-dark) input[type="reset"][disabled]:hover,
:where(html.km-dark) input[type="reset"][disabled]:focus,
:where(html.km-dark) input[type="submit"],
:where(html.km-dark) input[type="submit"][disabled]:hover,
:where(html.km-dark) input[type="submit"][disabled]:focus,
:where(html.km-dark) .menu-toggle.toggled-on,
:where(html.km-dark) .menu-toggle.toggled-on:hover,
:where(html.km-dark) .menu-toggle.toggled-on:focus,
:where(html.km-dark) .pagination .prev,
:where(html.km-dark) .pagination .next,
:where(html.km-dark) .pagination .prev:hover,
:where(html.km-dark) .pagination .prev:focus,
:where(html.km-dark) .pagination .next:hover,
:where(html.km-dark) .pagination .next:focus,
:where(html.km-dark) .pagination .nav-links:before,
:where(html.km-dark) .pagination .nav-links:after,
:where(html.km-dark) .widget_calendar tbody a,
:where(html.km-dark) .widget_calendar tbody a:hover,
:where(html.km-dark) .widget_calendar tbody a:focus,
:where(html.km-dark) .page-links a,
:where(html.km-dark) .page-links a:hover,
:where(html.km-dark) .page-links a:focus {
	color: var(--km-page);
}

:where(html.km-dark) .menu-toggle:hover,
:where(html.km-dark) .menu-toggle:focus,
:where(html.km-dark) a,
:where(html.km-dark) .main-navigation a:hover,
:where(html.km-dark) .main-navigation a:focus,
:where(html.km-dark) .dropdown-toggle:hover,
:where(html.km-dark) .dropdown-toggle:focus,
:where(html.km-dark) .social-navigation a:hover:before,
:where(html.km-dark) .social-navigation a:focus:before,
:where(html.km-dark) .post-navigation a:hover .post-title,
:where(html.km-dark) .post-navigation a:focus .post-title,
:where(html.km-dark) .tagcloud a:hover,
:where(html.km-dark) .tagcloud a:focus,
:where(html.km-dark) .site-branding .site-title a:hover,
:where(html.km-dark) .site-branding .site-title a:focus,
:where(html.km-dark) .entry-title a:hover,
:where(html.km-dark) .entry-title a:focus,
:where(html.km-dark) .entry-footer a:hover,
:where(html.km-dark) .entry-footer a:focus,
:where(html.km-dark) .comment-metadata a:hover,
:where(html.km-dark) .comment-metadata a:focus,
:where(html.km-dark) .pingback .comment-edit-link:hover,
:where(html.km-dark) .pingback .comment-edit-link:focus,
:where(html.km-dark) .comment-reply-link,
:where(html.km-dark) .comment-reply-link:hover,
:where(html.km-dark) .comment-reply-link:focus,
:where(html.km-dark) .required,
:where(html.km-dark) .site-info a:hover,
:where(html.km-dark) .site-info a:focus {
	color: var(--km-link);
}

:where(html.km-dark) mark,
:where(html.km-dark) ins,
:where(html.km-dark) button:hover,
:where(html.km-dark) button:focus,
:where(html.km-dark) input[type="button"]:hover,
:where(html.km-dark) input[type="button"]:focus,
:where(html.km-dark) input[type="reset"]:hover,
:where(html.km-dark) input[type="reset"]:focus,
:where(html.km-dark) input[type="submit"]:hover,
:where(html.km-dark) input[type="submit"]:focus,
:where(html.km-dark) .pagination .prev:hover,
:where(html.km-dark) .pagination .prev:focus,
:where(html.km-dark) .pagination .next:hover,
:where(html.km-dark) .pagination .next:focus,
:where(html.km-dark) .widget_calendar tbody a,
:where(html.km-dark) .page-links a:hover,
:where(html.km-dark) .page-links a:focus {
	background-color: var(--km-link);
}

:where(html.km-dark) input[type="date"]:focus,
:where(html.km-dark) input[type="time"]:focus,
:where(html.km-dark) input[type="datetime-local"]:focus,
:where(html.km-dark) input[type="week"]:focus,
:where(html.km-dark) input[type="month"]:focus,
:where(html.km-dark) input[type="text"]:focus,
:where(html.km-dark) input[type="email"]:focus,
:where(html.km-dark) input[type="url"]:focus,
:where(html.km-dark) input[type="password"]:focus,
:where(html.km-dark) input[type="search"]:focus,
:where(html.km-dark) input[type="tel"]:focus,
:where(html.km-dark) input[type="number"]:focus,
:where(html.km-dark) textarea:focus,
:where(html.km-dark) .tagcloud a:hover,
:where(html.km-dark) .tagcloud a:focus,
:where(html.km-dark) .menu-toggle:hover,
:where(html.km-dark) .menu-toggle:focus {
	border-color: var(--km-link);
}

:where(html.km-dark) body,
:where(html.km-dark) blockquote cite,
:where(html.km-dark) blockquote small,
:where(html.km-dark) .main-navigation a,
:where(html.km-dark) .menu-toggle,
:where(html.km-dark) .dropdown-toggle,
:where(html.km-dark) .social-navigation a,
:where(html.km-dark) .post-navigation a,
:where(html.km-dark) .pagination a:hover,
:where(html.km-dark) .pagination a:focus,
:where(html.km-dark) .widget-title a,
:where(html.km-dark) .site-branding .site-title a,
:where(html.km-dark) .entry-title a,
:where(html.km-dark) .page-links > .page-links-title,
:where(html.km-dark) .comment-author,
:where(html.km-dark) .comment-reply-title small a:hover,
:where(html.km-dark) .comment-reply-title small a:focus {
	color: var(--km-text);
}

:where(html.km-dark) blockquote,
:where(html.km-dark) .menu-toggle.toggled-on,
:where(html.km-dark) .menu-toggle.toggled-on:hover,
:where(html.km-dark) .menu-toggle.toggled-on:focus,
:where(html.km-dark) .post-navigation,
:where(html.km-dark) .post-navigation div + div,
:where(html.km-dark) .pagination,
:where(html.km-dark) .widget,
:where(html.km-dark) .page-header,
:where(html.km-dark) .page-links a,
:where(html.km-dark) .comments-title,
:where(html.km-dark) .comment-reply-title {
	border-color: var(--km-text);
}

:where(html.km-dark) button,
:where(html.km-dark) button[disabled]:hover,
:where(html.km-dark) button[disabled]:focus,
:where(html.km-dark) input[type="button"],
:where(html.km-dark) input[type="button"][disabled]:hover,
:where(html.km-dark) input[type="button"][disabled]:focus,
:where(html.km-dark) input[type="reset"],
:where(html.km-dark) input[type="reset"][disabled]:hover,
:where(html.km-dark) input[type="reset"][disabled]:focus,
:where(html.km-dark) input[type="submit"],
:where(html.km-dark) input[type="submit"][disabled]:hover,
:where(html.km-dark) input[type="submit"][disabled]:focus,
:where(html.km-dark) .menu-toggle.toggled-on,
:where(html.km-dark) .menu-toggle.toggled-on:hover,
:where(html.km-dark) .menu-toggle.toggled-on:focus,
:where(html.km-dark) .pagination:before,
:where(html.km-dark) .pagination:after,
:where(html.km-dark) .pagination .prev,
:where(html.km-dark) .pagination .next,
:where(html.km-dark) .page-links a {
	background-color: var(--km-text);
}

:where(html.km-dark) body:not(.search-results) .entry-summary {
	color: var(--km-text2);
}

:where(html.km-dark) blockquote,
:where(html.km-dark) .post-password-form label,
:where(html.km-dark) a:hover,
:where(html.km-dark) a:focus,
:where(html.km-dark) a:active,
:where(html.km-dark) .post-navigation .meta-nav,
:where(html.km-dark) .image-navigation,
:where(html.km-dark) .comment-navigation,
:where(html.km-dark) .widget_recent_entries .post-date,
:where(html.km-dark) .widget_rss .rss-date,
:where(html.km-dark) .widget_rss cite,
:where(html.km-dark) .site-description,
:where(html.km-dark) .author-bio,
:where(html.km-dark) .entry-footer,
:where(html.km-dark) .entry-footer a,
:where(html.km-dark) .sticky-post,
:where(html.km-dark) .taxonomy-description,
:where(html.km-dark) .entry-caption,
:where(html.km-dark) .comment-metadata,
:where(html.km-dark) .pingback .edit-link,
:where(html.km-dark) .comment-metadata a,
:where(html.km-dark) .pingback .comment-edit-link,
:where(html.km-dark) .comment-form label,
:where(html.km-dark) .comment-notes,
:where(html.km-dark) .comment-awaiting-moderation,
:where(html.km-dark) .logged-in-as,
:where(html.km-dark) .form-allowed-tags,
:where(html.km-dark) .site-info,
:where(html.km-dark) .site-info a,
:where(html.km-dark) .wp-caption .wp-caption-text,
:where(html.km-dark) .gallery-caption,
:where(html.km-dark) .widecolumn label,
:where(html.km-dark) .widecolumn .mu_register label {
	color: var(--km-text2);
}

:where(html.km-dark) .widget_calendar tbody a:hover,
:where(html.km-dark) .widget_calendar tbody a:focus {
	background-color: var(--km-text2);
}

:where(html.km-dark) fieldset,
:where(html.km-dark) pre,
:where(html.km-dark) abbr,
:where(html.km-dark) acronym,
:where(html.km-dark) table,
:where(html.km-dark) th,
:where(html.km-dark) td,
:where(html.km-dark) input[type="date"],
:where(html.km-dark) input[type="time"],
:where(html.km-dark) input[type="datetime-local"],
:where(html.km-dark) input[type="week"],
:where(html.km-dark) input[type="month"],
:where(html.km-dark) input[type="text"],
:where(html.km-dark) input[type="email"],
:where(html.km-dark) input[type="url"],
:where(html.km-dark) input[type="password"],
:where(html.km-dark) input[type="search"],
:where(html.km-dark) input[type="tel"],
:where(html.km-dark) input[type="number"],
:where(html.km-dark) textarea,
:where(html.km-dark) .main-navigation li,
:where(html.km-dark) .main-navigation .primary-menu,
:where(html.km-dark) .menu-toggle,
:where(html.km-dark) .dropdown-toggle:after,
:where(html.km-dark) .social-navigation a,
:where(html.km-dark) .image-navigation,
:where(html.km-dark) .comment-navigation,
:where(html.km-dark) .tagcloud a,
:where(html.km-dark) .entry-content,
:where(html.km-dark) .entry-summary,
:where(html.km-dark) .page-links a,
:where(html.km-dark) .page-links > span,
:where(html.km-dark) .comment-list article,
:where(html.km-dark) .comment-list .pingback,
:where(html.km-dark) .comment-list .trackback,
:where(html.km-dark) .comment-reply-link,
:where(html.km-dark) .no-comments,
:where(html.km-dark) .widecolumn .mu_register .mu_alert {
	border-color: var(--km-border);
}

:where(html.km-dark) hr,
:where(html.km-dark) code {
	background-color: var(--km-border);
}

@media screen and (min-width: 56.875em) {
	:where(html.km-dark) .main-navigation li:hover > a,
	:where(html.km-dark) .main-navigation li.focus > a {
		color: var(--km-link);
	}

	:where(html.km-dark) .main-navigation ul ul,
	:where(html.km-dark) .main-navigation ul ul li {
		border-color: var(--km-border);
	}

	:where(html.km-dark) .main-navigation ul ul:before {
		border-top-color: var(--km-border);
		border-bottom-color: var(--km-border);
	}

	:where(html.km-dark) .main-navigation ul ul li {
		background-color: var(--km-page);
	}

	:where(html.km-dark) .main-navigation ul ul:after {
		border-top-color: var(--km-page);
		border-bottom-color: var(--km-page);
	}
}

/* Page canvas and text, stronger than any light background set in Additional CSS. */
html.km-dark body,
html.km-dark body.custom-background {
	background-color: var(--km-bg);
	color: var(--km-text);
}

html.km-dark body .site {
	background-color: var(--km-page);
}

/* ---------- What the theme scheme leaves light ---------- */

html.km-dark input[type="date"],
html.km-dark input[type="time"],
html.km-dark input[type="datetime-local"],
html.km-dark input[type="week"],
html.km-dark input[type="month"],
html.km-dark input[type="text"],
html.km-dark input[type="email"],
html.km-dark input[type="url"],
html.km-dark input[type="password"],
html.km-dark input[type="search"],
html.km-dark input[type="tel"],
html.km-dark input[type="number"],
html.km-dark textarea,
html.km-dark select {
	background-color: var(--km-input);
	color: var(--km-text);
}

html.km-dark input:focus,
html.km-dark textarea:focus,
html.km-dark select:focus {
	background-color: var(--km-page);
	color: var(--km-text);
}

html.km-dark ::placeholder {
	color: var(--km-text2);
	opacity: 1;
}

html.km-dark pre,
html.km-dark code,
html.km-dark kbd,
html.km-dark tt,
html.km-dark var {
	color: var(--km-text);
}

html.km-dark pre {
	background-color: transparent;
}

html.km-dark ::selection {
	background-color: var(--km-link);
	color: var(--km-page);
}

/* Night: dim pictures and embeds a little. */
html[data-kmode="night"] img,
html[data-kmode="night"] video,
html[data-kmode="night"] iframe {
	filter: brightness(0.82);
}

/* The novel's story tree is drawn for a light page: keep it on light «paper». */
html.km-dark .kn-tree {
	background-color: #f4f1ea;
	color: #1a1a1a;
	border-radius: 6px;
}

html[data-kmode="night"] .kn-tree {
	filter: brightness(0.82) sepia(0.12);
}

/* ---------- The mode button ---------- */

.kobzor-mode {
	display: none;
}

html[data-kmode] body .kobzor-mode {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 100;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(26, 26, 26, 0.2);
	border-radius: 50%;
	background: #fff;
	color: #1a1a1a;
	box-shadow: none;
	font: inherit;
	letter-spacing: 0;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
	transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

html.km-dark body .kobzor-mode {
	border-color: var(--km-border);
	background: var(--km-page);
	color: var(--km-text);
}

html[data-kmode] body .kobzor-mode:hover,
html[data-kmode] body .kobzor-mode:focus {
	border-color: currentColor;
	background: inherit;
	color: #007acc;
}

html.km-dark body .kobzor-mode:hover,
html.km-dark body .kobzor-mode:focus {
	background: var(--km-page);
	color: var(--km-link);
}

html[data-kmode] body .kobzor-mode:focus {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

html[data-kmode] body .kobzor-mode:focus:not(:focus-visible) {
	outline: none;
}

.kobzor-mode__icon {
	display: none;
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

html[data-kmode="light"] .kobzor-mode__icon--light,
html[data-kmode="dark"] .kobzor-mode__icon--dark,
html[data-kmode="night"] .kobzor-mode__icon--night {
	display: block;
}

.kobzor-mode__icon--night .kobzor-mode__fill {
	fill: currentColor;
	stroke: none;
}

/* A short label after a click: «Тёмный», «Ночь»… */
.kobzor-mode__tip {
	position: absolute;
	top: 50%;
	right: calc(100% + 8px);
	padding: 4px 8px;
	border-radius: 3px;
	background: #1a1a1a;
	color: #fff;
	font-family: Montserrat, "Helvetica Neue", sans-serif;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-50%);
	transition: opacity 0.2s;
}

html.km-dark .kobzor-mode__tip {
	background: var(--km-text);
	color: var(--km-page);
}

.kobzor-mode.is-tip .kobzor-mode__tip {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	html[data-kmode] body .kobzor-mode,
	.kobzor-mode__tip {
		transition: none;
	}
}

/* Logged-in toolbar. */
body.admin-bar .kobzor-mode {
	margin-top: 46px !important;
}

@media screen and (min-width: 783px) {
	body.admin-bar .kobzor-mode {
		margin-top: 32px !important;
	}
}

/* Twenty Sixteen draws a 21px frame from this width on. */
@media screen and (min-width: 44.375em) {
	html[data-kmode] body .kobzor-mode {
		top: 31px;
		right: 31px;
	}
}
