/* Theme tokens — light matches current site look */
:root,
[data-theme="light"] {
	--bg: #ffffff;
	--bg-elevated: #ffffff;
	--text: rgba(0, 0, 0, .87);
	--text-body: rgba(0, 0, 0, .8);
	--text-muted: rgba(0, 0, 0, .64);
	--text-faint: rgba(0, 0, 0, .32);
	--text-solid: #000000;
	--heading: #212121;
	--border: rgba(0, 0, 0, .16);
	--brand: #00a5e0;
	--brand-alt: #c40000;
	--surface-footer: #ececec;
	--underline-mask: #ffffff;
	--highlight-bg: #c8e1f2;
	--input-bg: #ffffff;
	--input-border: #000000;
	--topbar-text: #000000;
	--nav-mobile-link: #000000;
	--theme-toggle-bg: rgba(0, 0, 0, .06);
	--theme-toggle-color: rgba(0, 0, 0, .72);
	--theme-toggle-hover: rgba(0, 0, 0, .12);
	--tag-link: #2d4292;
	color-scheme: light;
}

[data-theme="dark"] {
	--bg: #222526;
	--bg-elevated: #2c3034;
	--text: rgba(255, 255, 255, .87);
	--text-body: rgba(255, 255, 255, .8);
	--text-muted: rgba(255, 255, 255, .64);
	--text-faint: rgba(255, 255, 255, .4);
	--text-solid: #f0f0f0;
	--heading: #f5f5f5;
	--border: rgba(255, 255, 255, .16);
	--brand: #33b8e8;
	--brand-alt: #c40000;
	--surface-footer: #1c1f22;
	--underline-mask: #222526;
	--highlight-bg: rgba(0, 165, 224, .28);
	--input-bg: #2c3034;
	--input-border: rgba(255, 255, 255, .4);
	--topbar-text: rgba(255, 255, 255, .87);
	--nav-mobile-link: rgba(255, 255, 255, .9);
	--theme-toggle-bg: rgba(255, 255, 255, .1);
	--theme-toggle-color: rgba(255, 255, 255, .88);
	--theme-toggle-hover: rgba(255, 255, 255, .18);
	--tag-link: rgba(255, 255, 255, .92);
	color-scheme: dark;
}

html,
body {
	background-color: var(--bg);
	color: var(--text-body);
}

/* Theme toggle */
.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	margin-left: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--theme-toggle-bg);
	color: var(--theme-toggle-color);
	cursor: pointer;
	vertical-align: middle;
	transition: background-color .15s ease;
}

.theme-toggle:hover,
.theme-toggle:focus {
	background: var(--theme-toggle-hover);
	outline: none;
}

.theme-toggle:focus-visible {
	box-shadow: 0 0 0 2px var(--brand);
}

.theme-toggle__icon {
	display: none;
	width: 18px;
	height: 18px;
	background-color: currentColor;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
}

.theme-toggle__icon--moon {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12.1 22c-5.5 0-10-4.5-10-10 0-4.2 2.6-7.8 6.4-9.3.5-.2 1 .3.8.8A8 8 0 0 0 20.5 13c.5-.2 1 .3.8.8C19.8 19.4 16.2 22 12.1 22z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12.1 22c-5.5 0-10-4.5-10-10 0-4.2 2.6-7.8 6.4-9.3.5-.2 1 .3.8.8A8 8 0 0 0 20.5 13c.5-.2 1 .3.8.8C19.8 19.4 16.2 22 12.1 22z'/%3E%3C/svg%3E");
}

.theme-toggle__icon--sun {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-16a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0V3a1 1 0 0 1 1-1zm0 18a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1zM4.2 5.6a1 1 0 0 1 1.4 0l.7.7a1 1 0 1 1-1.4 1.4l-.7-.7a1 1 0 0 1 0-1.4zm14.2 14.2a1 1 0 0 1 1.4 0l.7.7a1 1 0 1 1-1.4 1.4l-.7-.7a1 1 0 0 1 0-1.4zM2 12a1 1 0 0 1 1-1h1a1 1 0 1 1 0 2H3a1 1 0 0 1-1-1zm18 0a1 1 0 0 1 1-1h1a1 1 0 1 1 0 2h-1a1 1 0 0 1-1-1zM4.2 18.4a1 1 0 0 1 0-1.4l.7-.7a1 1 0 1 1 1.4 1.4l-.7.7a1 1 0 0 1-1.4 0zm14.2-14.2a1 1 0 0 1 0-1.4l.7-.7a1 1 0 1 1 1.4 1.4l-.7.7a1 1 0 0 1-1.4 0z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-16a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0V3a1 1 0 0 1 1-1zm0 18a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1zM4.2 5.6a1 1 0 0 1 1.4 0l.7.7a1 1 0 1 1-1.4 1.4l-.7-.7a1 1 0 0 1 0-1.4zm14.2 14.2a1 1 0 0 1 1.4 0l.7.7a1 1 0 1 1-1.4 1.4l-.7-.7a1 1 0 0 1 0-1.4zM2 12a1 1 0 0 1 1-1h1a1 1 0 1 1 0 2H3a1 1 0 0 1-1-1zm18 0a1 1 0 0 1 1-1h1a1 1 0 1 1 0 2h-1a1 1 0 0 1-1-1zM4.2 18.4a1 1 0 0 1 0-1.4l.7-.7a1 1 0 1 1 1.4 1.4l-.7.7a1 1 0 0 1-1.4 0zm14.2-14.2a1 1 0 0 1 0-1.4l.7-.7a1 1 0 1 1 1.4 1.4l-.7.7a1 1 0 0 1-1.4 0z'/%3E%3C/svg%3E");
}

[data-theme="light"] .theme-toggle__icon--moon {
	display: block;
}

[data-theme="dark"] .theme-toggle__icon--sun {
	display: block;
}

.topbar-links {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
}

/* Brand / links */
a:not([class]) {
	color: var(--brand);
	-webkit-box-shadow: inset 0 -.0625em var(--brand);
	box-shadow: inset 0 -.0625em var(--brand);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
	color: var(--heading);
}

.highlighter {
	background-color: var(--highlight-bg);
}

/* Forms */
.form-control {
	color: var(--text-solid);
	background-color: var(--input-bg);
	border-color: var(--input-border);
}

.navbar-search .input-search,
.navbar-offcanvas .navbar-search .input-search {
	background-color: var(--input-bg) !important;
	border-color: var(--input-border) !important;
	color: var(--text-solid) !important;
}

.navbar-offcanvas .navbar-nav.d-lg-none .nav-link,
.nav-link--mobile {
	color: var(--nav-mobile-link) !important;
}

.input-search--mobile {
	background-color: var(--input-bg) !important;
	border: 1px solid var(--input-border) !important;
	color: var(--text-solid) !important;
}

/* Topbar */
.topbar-datetime,
.topbar-currencies,
.topbar-weather,
.currencies-item {
	color: var(--topbar-text);
}

.topbar-weather,
.currencies-item span {
	color: var(--text-muted);
}

/* Breadcrumbs */
.breadcrumb-item {
	color: var(--text-faint);
}

.breadcrumb-item a {
	-webkit-box-shadow: inset 0 -.0625em var(--underline-mask), inset 0 -.125em var(--text-faint);
	box-shadow: inset 0 -.0625em var(--underline-mask), inset 0 -.125em var(--text-faint);
}

/* Pagination */
.page-link {
	color: var(--text-body);
}

.page-item:first-child .page-link,
.page-item:last-child .page-link {
	color: var(--brand);
}

.page-link:hover {
	color: var(--brand-alt);
}

/* Tabs / news meta */
.nav-tabs .nav-link {
	border-bottom-color: var(--border);
	color: var(--text);
}

.news-item__datetime,
.topics-item__datetime,
.article-detail__datetime,
.news-detail__datetime {
	color: var(--text-muted);
}

.topics-item__title,
.news-item__title,
.article-detail__title a,
.issues-item__title,
.programs-item__title,
.latest-news__title,
.video-item__title {
	color: var(--text);
}

/* Footer */
.footer-main {
	background-color: var(--surface-footer);
}

.footer-nav .nav-item {
	color: var(--text-muted);
}

.footer-nav .nav-link {
	color: var(--text-solid);
}

.footer-nav .nav-item:not(.active) .nav-link span {
	-webkit-box-shadow: inset 0 -1px var(--text-muted);
	box-shadow: inset 0 -1px var(--text-muted);
}

.footer-nav .nav-item:not(.active) .nav-link span:hover {
	color: var(--brand);
}

.footer-text {
	color: var(--text-muted);
}

/* Calendar / panels */
.calendar__datepicker,
.ui-datepicker {
	background-color: var(--bg-elevated) !important;
	border-color: var(--border) !important;
	color: var(--text-body);
}

.ui-datepicker .ui-datepicker-header,
.ui-datepicker .ui-datepicker-title,
.ui-datepicker th,
.ui-datepicker td a,
.ui-datepicker td span {
	color: var(--text-body);
}

.ui-datepicker .ui-state-default {
	background: var(--bg-elevated);
	color: var(--text-body);
	border-color: var(--border);
}

.ui-datepicker .ui-state-hover,
.ui-datepicker .ui-state-active {
	background: var(--brand) !important;
	color: #fff !important;
	border-color: var(--brand) !important;
}

/* Contacts / elevated panels */
.contacts-list {
	background-color: var(--bg-elevated);
}

/* Online radio white controls stay white on brand panels — OK */

.btn-confirm {
	background-color: var(--bg-elevated);
}

.online-radio__btn-play,
.online-radio .volume .ui-slider-handle {
	background: var(--bg-elevated);
}

/* Mobile offcanvas */
@media (max-width: 959.98px) {
	.navbar-opened .navbar-offcanvas {
		background-color: var(--bg-elevated);
	}
}

/* Logo readability on dark (navbar stays blue gradient; soft brighten if needed) */
[data-theme="dark"] .navbar-brand img {
	filter: brightness(1.05) contrast(1.05);
}

/* Fancybox chrome */
[data-theme="dark"] .fancybox-bg {
	background: #0a0a0a;
}

[data-theme="dark"] .fancybox-button {
	background: rgba(30, 30, 30, .85);
}

/* Inline light-theme leftovers on about/team pages */
[data-theme="dark"] .gallery-member p[style*="color:#555"],
[data-theme="dark"] .gallery-person-about,
[data-theme="dark"] p[style*="color:#555"] {
	color: var(--text-muted) !important;
}

/* Bootstrap tables / misc content */
.table {
	color: var(--text-body);
}

.dropdown-menu {
	background-color: var(--bg-elevated);
	border-color: var(--border);
}

.dropdown-item,
.dropdown-link {
	color: var(--text);
}

/* Schedule / article body text */
.schedule-block,
.article-detail,
.news-detail,
.content {
	color: var(--text-body);
}

.article-detail h1,
.article-detail h2,
.article-detail h3,
.news-detail h1,
.news-detail h2,
.news-detail h3 {
	color: var(--heading);
}

/* About / contacts tables */
table.conts,
td.contstd,
td.contstdh {
	border-color: var(--border) !important;
	color: var(--text-body);
}

[data-theme="dark"] table.conts {
	background-color: var(--bg-elevated);
}

/* Extra muted / secondary chrome */
.slick-dots li button:before {
	color: var(--text-muted);
}

[data-theme="dark"] .navbar {
	border-bottom-color: rgba(255, 255, 255, .12);
}

[data-theme="dark"] .root {
	background-color: var(--bg);
}

/* VK/YouTube/smotrim iframes break under parent color-scheme:dark — force light scheme on embeds */
.video iframe,
.news-detail__video iframe,
.news-detail__text iframe,
.article-detail iframe,
.content iframe,
iframe[src*="vk.com"],
iframe[src*="youtube.com"],
iframe[src*="youtu.be"],
iframe[src*="smotrim.ru"],
iframe[src*="player.vgtrk.com"] {
	color-scheme: light;
}

.video .video-js,
.news-detail__video .video-js {
	color-scheme: light;
}

/* Keep social share / already-dark footer side as-is */
.footer-side {
	color: #fff;
}

/* Search page / results inherit tokens via --text* already in main.css */

/* Prefer softer brand hover on dark */
[data-theme="dark"] a:not([class]):hover {
	color: #5ec8ef;
}

[data-theme="dark"] .theme-toggle {
	flex-shrink: 0;
}

@media (max-width: 959.98px) {
	.navbar-opened .header {
		position: relative;
		z-index: 1001;
		background-color: var(--bg);
	}
}
