/* Header color-mode control. */
.header-tools {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	height: 100%;
}

.header-tools > .search-form {
	flex: 0 0 auto;
}

/* Bootstrap adds a bottom margin to labels, which offsets the visible search box. */
.header-tools > .search-form form label {
	margin-bottom: 0;
}

.color-mode-switcher {
	position: relative;
	flex: 0 0 auto;
	/* Move only the button; increase this value to move it farther left. */
	margin-right: 15px;
}

.color-mode-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	color: #343434;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 50%;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.color-mode-toggle:hover,
.color-mode-toggle:focus-visible {
	color: #5869da;
	border-color: #5869da;
	outline: none;
}

.color-mode-toggle-label {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.color-mode-icon,
.color-mode-menu-icon {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}

.color-mode-icon-moon {
	display: none;
}

html[data-theme="dark"] .color-mode-icon-sun {
	display: none;
}

html[data-theme="dark"] .color-mode-icon-moon {
	display: block;
}

.color-mode-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 1000;
	min-width: 150px;
	padding: 6px;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
	text-align: left;
}

.color-mode-menu[hidden] {
	display: none;
}

.color-mode-menu button {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: 8px 10px;
	color: #343434;
	background: transparent;
	border: 0;
	border-radius: 5px;
	cursor: pointer;
	text-align: left;
}

.color-mode-menu button:hover,
.color-mode-menu button:focus-visible {
	background: #f0f1ff;
	outline: none;
}

.color-mode-menu button[aria-checked="true"] {
	color: #5869da;
	font-weight: 600;
}

.color-mode-system-icon {
	width: 20px;
	height: 20px;
	border: 1.8px solid currentColor;
	border-radius: 50%;
	background: linear-gradient(90deg, transparent 50%, currentColor 50%);
}

/* Dark palette: neutral surfaces inspired by ChatGPT, with Doly's indigo accent. */
html[data-theme="dark"] {
	color-scheme: dark;
}

html[data-theme="dark"] body {
	color: #ececec;
	background: #212121;
}

html[data-theme="dark"] p,
html[data-theme="dark"] .entry-content,
html[data-theme="dark"] .entry-summary,
html[data-theme="dark"] .comment-content,
html[data-theme="dark"] .archive-description,
html[data-theme="dark"] .cat-links {
	color: #c7c7c7;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .site-title a,
html[data-theme="dark"] .entry-title a,
html[data-theme="dark"] .widget h2,
html[data-theme="dark"] .nav-links a,
html[data-theme="dark"] .comment-meta a {
	color: #ececec;
}

html[data-theme="dark"] a {
	color: #aab2ff;
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] a:focus,
html[data-theme="dark"] .entry-content a:not(.button),
html[data-theme="dark"] .entry-footer span a,
html[data-theme="dark"] .entry-meta a,
html[data-theme="dark"] .cat-links a {
	color: #aab2ff;
}

html[data-theme="dark"] .header-area,
html[data-theme="dark"] .mainmenu-area,
html[data-theme="dark"] .footer-area,
html[data-theme="dark"] .breadcrumbs-area {
	background-color: #212121;
	border-color: #404040;
}

html[data-theme="dark"] .mainmenu li a,
html[data-theme="dark"] .slicknav_nav a,
html[data-theme="dark"] .mainmenu .menu-item-has-children::after {
	color: #ececec;
}

html[data-theme="dark"] .mainmenu li:hover > a,
html[data-theme="dark"] .mainmenu li.active > a {
	color: #aab2ff;
}

html[data-theme="dark"] .mainmenu ul li ul,
html[data-theme="dark"] .slicknav_nav .slicknav_row:hover,
html[data-theme="dark"] .slicknav_nav a:hover {
	background: #2f2f2f;
}

html[data-theme="dark"] .mainmenu li ul.sub-menu li a:hover {
	color: #fff;
	background: #424242;
}

html[data-theme="dark"] .slicknav_icon span.slicknav_icon-bar {
	background: #ececec;
}

html[data-theme="dark"] article.post,
html[data-theme="dark"] article.page,
html[data-theme="dark"] .search-area article.page,
html[data-theme="dark"] .post-content,
html[data-theme="dark"] .comment-list li.comment,
html[data-theme="dark"] .nav-links a {
	background-color: #2f2f2f;
	border-color: #424242;
}

/* Keep every current and future widget flush with the page background. */
html[data-theme="dark"] .widget-area,
html[data-theme="dark"] .widget {
	background-color: #212121 !important;
}

html[data-theme="dark"] article.sticky,
html[data-theme="dark"] article.sticky .post-content {
	background-color: #383838;
	border-color: #565656;
}

html[data-theme="dark"] article.post::before,
html[data-theme="dark"] .search-area article.page::before {
	box-shadow: 0 10px 18px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .entry-content h1,
html[data-theme="dark"] .entry-content h2,
html[data-theme="dark"] .entry-content h3,
html[data-theme="dark"] .entry-content h4,
html[data-theme="dark"] .entry-content h5,
html[data-theme="dark"] .entry-content h6 {
	color: #ececec;
	border-color: #4a4a4a;
}

html[data-theme="dark"] .entry-content hr {
	background-color: #4a4a4a;
}

html[data-theme="dark"] .entry-content code {
	color: #ff9db5;
	background-color: #3a2930;
	border-color: #60404a;
}

html[data-theme="dark"] .entry-content pre,
html[data-theme="dark"] .entry-content pre[class*="language-"] {
	background-color: #171717;
}

html[data-theme="dark"] .entry-content pre code {
	color: inherit;
	background: transparent;
}

html[data-theme="dark"] .entry-content kbd {
	color: #ececec;
	background-color: #383838;
	border-color: #676767;
	box-shadow: inset 0 -1px 0 #676767;
}

html[data-theme="dark"] .entry-content blockquote {
	color: #c7c7c7;
	background-color: #2b2f44;
	border-left-color: #8792ff;
}

html[data-theme="dark"] .entry-content blockquote p strong {
	color: #aab2ff;
}

html[data-theme="dark"] .entry-content #toc_container {
	color: #c7c7c7;
	background: #2f2f2f;
	border-color: #565656;
}

html[data-theme="dark"] .entry-content table th,
html[data-theme="dark"] .entry-content table td,
html[data-theme="dark"] .comments-area table th,
html[data-theme="dark"] .comments-area table td,
html[data-theme="dark"] .widget table th,
html[data-theme="dark"] .widget table td {
	border-color: #565656;
}

html[data-theme="dark"] .entry-content table th,
html[data-theme="dark"] .entry-content table tr:nth-child(2n),
html[data-theme="dark"] .comments-area table th,
html[data-theme="dark"] .widget table th {
	background-color: #383838;
}

html[data-theme="dark"] .entry-content figcaption,
html[data-theme="dark"] .wp-caption-text {
	color: #aaa;
}

html[data-theme="dark"] .widget h2,
html[data-theme="dark"] .comment-list li.comment,
html[data-theme="dark"] .entry-content address,
html[data-theme="dark"] .comments-area address {
	border-color: #4a4a4a;
}

html[data-theme="dark"] .widget h2::after {
	background: #8792ff;
}

html[data-theme="dark"] .widget a {
	color: #c7c7c7;
}

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="url"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
	color: #ececec;
	background-color: #2f2f2f;
	border-color: #565656;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
	color: #999;
}

html[data-theme="dark"] .comment-form input[type="submit"],
html[data-theme="dark"] .search-form input[type="submit"] {
	color: #fff;
	background: #424242;
	border-color: #565656;
}

html[data-theme="dark"] a.button:hover {
	color: #aab2ff;
	background-color: #2f2f2f;
}

html[data-theme="dark"] .color-mode-toggle,
html[data-theme="dark"] .color-mode-menu {
	color: #ececec;
	background: #2f2f2f;
	border-color: #565656;
}

html[data-theme="dark"] .color-mode-menu button {
	color: #ececec;
}

html[data-theme="dark"] .color-mode-menu button:hover,
html[data-theme="dark"] .color-mode-menu button:focus-visible {
	background: #424242;
}

html[data-theme="dark"] .color-mode-menu button[aria-checked="true"] {
	color: #aab2ff;
}

@media (max-width: 991px) {
	.header-tools {
		margin-top: 12px;
	}

	.header-tools > .search-form {
		flex: 1 1 auto;
		min-width: 0;
	}
}

@media (prefers-reduced-motion: no-preference) {
	body,
	.header-area,
	.mainmenu-area,
	.footer-area,
	.post-content,
	.widget,
	.color-mode-toggle {
		transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
	}
}
