/* Accessibility panel — Medik style */
.medik-a11y {
	--a11y-fab-size: 52px;
	position: relative;
	z-index: 99985;
}

/* ——— FAB (bottom-left) ——— */
.medik-a11y__fab {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 99986;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: var(--a11y-fab-size);
	padding: 0 18px 0 14px;
	color: #fff;
	background: linear-gradient(135deg, #358f8a 0%, #47aaa5 50%, #5ec4be 100%);
	border: 1px solid rgba(255, 255, 255, 0.25);
	border-radius: 999px;
	box-shadow:
		0 8px 28px rgba(53, 143, 138, 0.45),
		0 2px 8px rgba(46, 61, 60, 0.15);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.medik-a11y__fab:hover {
	transform: translateY(-2px);
	box-shadow:
		0 12px 36px rgba(53, 143, 138, 0.5),
		0 4px 12px rgba(46, 61, 60, 0.18);
}

.medik-a11y__fab:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.medik-a11y__fab[aria-expanded='true'] {
	background: linear-gradient(135deg, #2a5c59 0%, #3da8a3 100%);
}

.medik-a11y__fab svg {
	flex-shrink: 0;
}

.medik-a11y__fab-text {
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* Lift above cookie bar */
body:has(.cookie-notice:not([hidden]):not(.is-hiding)) .medik-a11y__fab {
	bottom: 96px;
}

body:has(.cookie-notice:not([hidden]):not(.is-hiding)) .medik-a11y__panel {
	bottom: 96px;
}

/* ——— Backdrop ——— */
.medik-a11y__backdrop {
	position: fixed;
	inset: 0;
	z-index: 99987;
	background: rgba(46, 61, 60, 0.35);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.medik-a11y__backdrop.is-visible {
	opacity: 1;
}

.medik-a11y__backdrop[hidden] {
	display: none !important;
}

/* ——— Panel ——— */
.medik-a11y__panel {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 99988;
	width: min(380px, calc(100vw - 40px));
	max-height: min(78vh, 640px);
	display: flex;
	flex-direction: column;
	border-radius: 16px;
	background: var(--medik-white, #f9f9f9);
	border: 1px solid var(--medik-gray-200, #e3eeed);
	box-shadow:
		0 24px 64px rgba(46, 61, 60, 0.2),
		0 0 0 1px rgba(71, 170, 165, 0.08);
	transform: translateX(calc(-100% - 32px)) scale(0.96);
	opacity: 0;
	visibility: hidden;
	transition:
		transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
		opacity 0.3s ease,
		visibility 0.3s ease;
}

.medik-a11y__panel.is-open {
	transform: translateX(0) scale(1);
	opacity: 1;
	visibility: visible;
}

.medik-a11y__panel[hidden] {
	display: none !important;
}

.medik-a11y__panel-inner {
	display: flex;
	flex-direction: column;
	max-height: inherit;
	overflow: hidden;
	border-radius: inherit;
}

.medik-a11y__header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 16px 18px;
	background: linear-gradient(115deg, #2a5c59 0%, #47aaa5 100%);
	color: #fff;
}

.medik-a11y__header-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: rgba(255, 255, 255, 0.15);
	border-radius: 10px;
}

.medik-a11y__title {
	margin: 0;
	flex: 1;
	font-size: 17px;
	font-weight: 800;
	letter-spacing: 0.02em;
}

.medik-a11y__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	color: #fff;
	background: rgba(255, 255, 255, 0.12);
	border-radius: 8px;
	transition: background 0.15s ease;
}

.medik-a11y__close:hover {
	background: rgba(255, 255, 255, 0.22);
}

.medik-a11y__body {
	flex: 1;
	overflow-y: auto;
	padding: 16px 18px;
	-webkit-overflow-scrolling: touch;
}

.medik-a11y__block + .medik-a11y__block {
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px solid var(--medik-gray-200, #e3eeed);
}

.medik-a11y__label {
	margin: 0 0 10px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--medik-gray-600, #5c6e6c);
}

.medik-a11y__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.medik-a11y__pill {
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--medik-text, #2e3d3c);
	background: var(--medik-gray-100, #f5faf9);
	border: 1px solid var(--medik-gray-200, #e3eeed);
	border-radius: 999px;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.medik-a11y__pill:hover {
	border-color: var(--medik-accent, #47aaa5);
	color: var(--medik-accent-dark, #3da8a3);
}

.medik-a11y__pill.is-active {
	color: #fff;
	background: var(--medik-accent-dark, #3da8a3);
	border-color: var(--medik-accent-dark, #3da8a3);
	box-shadow: 0 4px 12px rgba(71, 170, 165, 0.35);
}

.medik-a11y__toggles {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
}

.medik-a11y__toggle {
	padding: 12px 14px;
	font-size: 13px;
	font-weight: 600;
	text-align: left;
	color: var(--medik-text, #2e3d3c);
	background: var(--medik-white, #fff);
	border: 1px solid var(--medik-gray-200, #e3eeed);
	border-radius: var(--medik-radius, 8px);
	transition: background 0.15s ease, border-color 0.15s ease;
}

.medik-a11y__toggle:hover {
	border-color: var(--medik-accent, #47aaa5);
}

.medik-a11y__toggle[aria-pressed='true'] {
	color: var(--medik-accent-dark, #3da8a3);
	background: var(--medik-accent-soft, #ecf9f8);
	border-color: var(--medik-accent, #47aaa5);
	box-shadow: inset 0 0 0 1px var(--medik-accent, #47aaa5);
}

.medik-a11y__footer {
	padding: 14px 18px 18px;
	border-top: 1px solid var(--medik-gray-200, #e3eeed);
}

.medik-a11y__reset {
	width: 100%;
	min-height: 44px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--medik-gray-600, #5c6e6c);
	background: transparent;
	border: 1px dashed var(--medik-gray-200, #e3eeed);
	border-radius: var(--medik-radius, 8px);
	transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.medik-a11y__reset:hover {
	color: var(--medik-accent-dark, #3da8a3);
	border-color: var(--medik-accent, #47aaa5);
	background: var(--medik-accent-soft, #ecf9f8);
}

@media (max-width: 480px) {
	.medik-a11y__fab-text {
		display: none;
	}

	.medik-a11y__fab {
		width: var(--a11y-fab-size);
		height: var(--a11y-fab-size);
		padding: 0;
		justify-content: center;
		border-radius: 50%;
	}

	.medik-a11y__panel {
		left: 12px;
		right: 12px;
		width: auto;
		max-height: 70vh;
	}
}

/* ========== Site-wide accessibility modes (#page + cookie bar) ========== */

/* UI chrome never themed */
.medik-a11y,
.medik-a11y *,
.cookie-notice,
.cookie-notice * {
	filter: none !important;
}

/* —— Text scale: font-size via JS (see accessibility.js), hook on html —— */
html {
	--medik-a11y-scale: 1;
}

html.medik-a11y-text-scaled #page {
	line-height: 1.55;
}

/* —— Fonts —— */
html[data-a11y-font='sans'] #page,
html[data-a11y-font='sans'] #page button,
html[data-a11y-font='sans'] #page input,
html[data-a11y-font='sans'] #page textarea {
	font-family: Arial, Helvetica, 'Segoe UI', sans-serif !important;
}

html[data-a11y-font='serif'] #page,
html[data-a11y-font='serif'] #page button,
html[data-a11y-font='serif'] #page input,
html[data-a11y-font='serif'] #page textarea {
	font-family: Georgia, 'Times New Roman', serif !important;
}

html[data-a11y-font='mono'] #page,
html[data-a11y-font='mono'] #page button,
html[data-a11y-font='mono'] #page input,
html[data-a11y-font='mono'] #page textarea {
	font-family: 'Courier New', Courier, monospace !important;
}

/* —— Spacing —— */
html[data-a11y-spacing='1'] #page :where(p, li, td, th, label, a, span, h1, h2, h3, h4, h5, h6, button, input, textarea) {
	letter-spacing: 0.04em;
	word-spacing: 0.12em;
}

html[data-a11y-spacing='2'] #page :where(p, li, td, th, label, a, span, h1, h2, h3, h4, h5, h6, button, input, textarea) {
	letter-spacing: 0.08em;
	word-spacing: 0.2em;
}

/* —— Line height —— */
html[data-a11y-lh='1'] #page :where(p, li, td, th, label, a, span, h1, h2, h3, h4, h5, h6) {
	line-height: 1.75 !important;
}

html[data-a11y-lh='2'] #page :where(p, li, td, th, label, a, span, h1, h2, h3, h4, h5, h6) {
	line-height: 2 !important;
}

/* —— Theme: black & white (grayscale + контраст) —— */
html[data-a11y-theme='bw'] #page {
	filter: grayscale(1) contrast(1.35);
}

html[data-a11y-theme='bw'] .cookie-notice {
	filter: grayscale(1) contrast(1.25);
}

html[data-a11y-theme='bw'] #page :where(a:not(.btn)) {
	text-decoration: underline !important;
	text-underline-offset: 3px;
}

html[data-a11y-theme='bw'] #page :where(.btn, button) {
	outline: 1px solid currentColor !important;
}

/* —— Theme variables —— */
/* Белый фон, чёрный текст */
html[data-a11y-theme='wb'] {
	--a11y-bg: #ffffff;
	--a11y-surface: #ffffff;
	--a11y-text: #000000;
	--a11y-muted: #1a1a1a;
	--a11y-link: #000000;
	--a11y-btn-bg: #000000;
	--a11y-btn-text: #ffffff;
	--a11y-border: #000000;
	--a11y-input-bg: #ffffff;
}

/* Жёлтый текст на чёрном */
html[data-a11y-theme='yb'] {
	--a11y-bg: #000000;
	--a11y-surface: #000000;
	--a11y-text: #ffff00;
	--a11y-muted: #e6e600;
	--a11y-link: #ffff00;
	--a11y-btn-bg: #ffff00;
	--a11y-btn-text: #000000;
	--a11y-border: #ffff00;
	--a11y-input-bg: #1a1a00;
}

/* Белый текст на синем */
html[data-a11y-theme='blw'] {
	--a11y-bg: #063a6b;
	--a11y-surface: #063a6b;
	--a11y-text: #ffffff;
	--a11y-muted: #cce4ff;
	--a11y-link: #ffffff;
	--a11y-btn-bg: #ffffff;
	--a11y-btn-text: #063a6b;
	--a11y-border: #ffffff;
	--a11y-input-bg: #0c5294;
}

/* Переопределение токенов темы Medik внутри контента */
html[data-a11y-theme='wb'] #page {
	--medik-text: #000000;
	--medik-gray-400: #333333;
	--medik-gray-600: #000000;
	--medik-accent: #000000;
	--medik-accent-dark: #000000;
	--medik-accent-soft: #f0f0f0;
	--medik-accent-light: #ffffff;
	--medik-on-accent: #ffffff;
	--medik-brand: #000000;
	--medik-white: #ffffff;
	--footer-bg: #ffffff;
	--footer-bg-soft: #ffffff;
	--footer-text: #000000;
	--footer-muted: #333333;
}

html[data-a11y-theme='yb'] #page {
	--medik-text: #ffff00;
	--medik-gray-400: #e6e600;
	--medik-gray-600: #ffff00;
	--medik-accent: #ffff00;
	--medik-accent-dark: #ffff00;
	--medik-accent-soft: #1a1a00;
	--medik-accent-light: #000000;
	--medik-on-accent: #000000;
	--medik-brand: #ffff00;
	--medik-white: #000000;
	--footer-bg: #000000;
	--footer-bg-soft: #000000;
	--footer-text: #ffff00;
	--footer-muted: #e6e600;
}

html[data-a11y-theme='blw'] #page {
	--medik-text: #ffffff;
	--medik-gray-400: #cce4ff;
	--medik-gray-600: #ffffff;
	--medik-accent: #ffffff;
	--medik-accent-dark: #ffffff;
	--medik-accent-soft: #0c5294;
	--medik-accent-light: #063a6b;
	--medik-on-accent: #063a6b;
	--medik-brand: #ffffff;
	--medik-white: #063a6b;
	--footer-bg: #063a6b;
	--footer-bg-soft: #0a4d8c;
	--footer-text: #ffffff;
	--footer-muted: #cce4ff;
}

/* ========== High-contrast themes (wb, yb, blw) — unified ========== */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) body {
	background: var(--a11y-bg) !important;
	color: var(--a11y-text) !important;
}

html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page,
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page .site-main {
	background: var(--a11y-bg) !important;
	color: var(--a11y-text) !important;
}

/* Фоны блоков — одна схема, без градиентов */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :where(
	section,
	.header,
	.top_header,
	.bottom_header,
	.panel_header,
	.site-footer,
	.site-footer__cta,
	.site-footer__main,
	.site-footer__bottom,
	.hero,
	.appeal,
	.products,
	.item_product,
	.item_center,
	.legal-page,
	.contact-page,
	.doctors,
	.catalog-sidebar,
	.catalog-card,
	.card_product,
	.reviews,
	.news,
	.manufacturers,
	.services-page,
	.specialists-page,
	.article-page,
	.product-card,
	div,
	article,
	aside,
	nav,
	main,
	ul,
	ol,
	li,
	form,
	table,
	thead,
	tbody,
	tr,
	td,
	th,
	figure,
	figcaption,
	fieldset
) {
	background-color: var(--a11y-surface) !important;
	background-image: none !important;
	border-color: var(--a11y-border) !important;
}

/* Весь текст в контенте — цвет схемы (перебивает #fff из темы) */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :where(
	*:not(img):not(video):not(picture):not(canvas):not(iframe):not(svg):not(path):not(circle):not(rect):not(line):not(polyline):not(polygon)
) {
	color: var(--a11y-text) !important;
	-webkit-text-fill-color: var(--a11y-text) !important;
}

/* Ссылки */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page a:not(.btn):not(.medik-a11y__fab) {
	color: var(--a11y-link) !important;
	-webkit-text-fill-color: var(--a11y-link) !important;
	text-decoration: underline !important;
	text-underline-offset: 3px;
}

/* Кнопки — инвертированные цвета */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :is(
	.btn,
	button,
	input[type='submit'],
	input[type='button'],
	.search_header__submit,
	.products-tabs__btn.is-active,
	.contact-centers__tab.is-active
) {
	background-color: var(--a11y-btn-bg) !important;
	background-image: none !important;
	color: var(--a11y-btn-text) !important;
	-webkit-text-fill-color: var(--a11y-btn-text) !important;
	border: 2px solid var(--a11y-border) !important;
	box-shadow: none !important;
}

html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :is(.btn, button) :where(span, svg, path) {
	color: inherit !important;
	-webkit-text-fill-color: inherit !important;
	fill: currentColor !important;
	stroke: currentColor !important;
}

/* Неактивные табы */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :is(
	.products-tabs__btn:not(.is-active),
	.contact-centers__tab:not(.is-active)
) {
	background-color: var(--a11y-surface) !important;
	color: var(--a11y-text) !important;
	-webkit-text-fill-color: var(--a11y-text) !important;
}

/* Поля ввода */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :where(input, textarea, select) {
	background-color: var(--a11y-input-bg) !important;
	color: var(--a11y-text) !important;
	-webkit-text-fill-color: var(--a11y-text) !important;
	border: 2px solid var(--a11y-border) !important;
}

html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :where(input, textarea)::placeholder {
	color: var(--a11y-muted) !important;
	-webkit-text-fill-color: var(--a11y-muted) !important;
	opacity: 1 !important;
}

/* Иконки */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :where(svg, path, circle, rect, line, polyline, polygon) {
	fill: currentColor !important;
	stroke: currentColor !important;
}

/* Cookie-баннер */
html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) .cookie-notice {
	background: var(--a11y-bg) !important;
	background-image: none !important;
	color: var(--a11y-text) !important;
	border: 2px solid var(--a11y-border) !important;
}

html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) .cookie-notice :where(p, span, .cookie-notice__icon) {
	color: var(--a11y-text) !important;
	-webkit-text-fill-color: var(--a11y-text) !important;
}

html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) .cookie-notice__text a {
	color: var(--a11y-link) !important;
	-webkit-text-fill-color: var(--a11y-link) !important;
}

html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) .cookie-notice__btn {
	background: var(--a11y-btn-bg) !important;
	color: var(--a11y-btn-text) !important;
	-webkit-text-fill-color: var(--a11y-btn-text) !important;
	border-color: var(--a11y-border) !important;
}

/* JS-дочистка контраста */
html[data-a11y-contrast-fixed='1'] #page [data-a11y-fix='color'] {
	color: var(--a11y-text) !important;
	-webkit-text-fill-color: var(--a11y-text) !important;
}

html[data-a11y-contrast-fixed='1'] #page [data-a11y-fix='bg'] {
	background-color: var(--a11y-surface) !important;
	background-image: none !important;
}

/* —— Hide images with alt placeholder —— */
html[data-a11y-no-images='1'] #page :is(img, picture, video, svg image) {
	display: none !important;
}

html[data-a11y-no-images='1'] #page iframe[src*='map'],
html[data-a11y-no-images='1'] #page iframe[title*='арта' i],
html[data-a11y-no-images='1'] #page iframe[title*='map' i] {
	display: none !important;
}

html[data-a11y-no-images='1'] #page .a11y-img-placeholder {
	display: flex !important;
	align-items: center;
	justify-content: center;
	min-height: 72px;
	padding: 12px 16px;
	text-align: center;
	background: var(--medik-gray-200, #e3eeed) !important;
	border: 2px dashed var(--medik-gray-400, #8fa8a6);
	border-radius: var(--medik-radius, 8px);
}

html[data-a11y-no-images='1'] #page .a11y-img-placeholder::before {
	content: attr(data-a11y-alt);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--medik-gray-600, #5c6e6c);
}

html[data-a11y-no-images='1'] #page .a11y-img-placeholder:not([data-a11y-alt])::before {
	content: 'Изображение скрыто';
}

html[data-a11y-theme='wb'] #page .a11y-img-placeholder,
html[data-a11y-theme='yb'] #page .a11y-img-placeholder,
html[data-a11y-theme='blw'] #page .a11y-img-placeholder {
	background: var(--a11y-input-bg) !important;
	border-color: var(--a11y-border) !important;
}

html[data-a11y-theme='wb'] #page .a11y-img-placeholder::before,
html[data-a11y-theme='yb'] #page .a11y-img-placeholder::before,
html[data-a11y-theme='blw'] #page .a11y-img-placeholder::before {
	color: var(--a11y-text) !important;
}

/* —— Underline links —— */
html[data-a11y-underline-links='1'] #page a,
html[data-a11y-underline-links='1'] .cookie-notice a {
	text-decoration: underline !important;
	text-underline-offset: 3px;
	text-decoration-thickness: 2px;
}

/* —— Simple layout (no motion, calmer UI) —— */
html[data-a11y-simple='1'] #page *,
html[data-a11y-simple='1'] #page *::before,
html[data-a11y-simple='1'] #page *::after {
	animation-duration: 0.001ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001ms !important;
	scroll-behavior: auto !important;
}

html[data-a11y-simple='1'] #page :where(.item_product, .item_center, .item_news, .hero, .site-footer__cta) {
	box-shadow: none !important;
}

html[data-a11y-simple='1'] #page .products__track,
html[data-a11y-simple='1'] #page .contact-gallery__track {
	transform: none !important;
}

html[data-a11y-simple='1'] #page .products__arrow,
html[data-a11y-simple='1'] #page .hero__arrow,
html[data-a11y-simple='1'] #page .contact-gallery__btn {
	opacity: 0.5;
}

/* Slight polish when any a11y mode on */
html.medik-a11y-on #page :focus-visible {
	outline: 3px solid var(--medik-accent, #47aaa5) !important;
	outline-offset: 3px !important;
}

html:is([data-a11y-theme='wb'], [data-a11y-theme='yb'], [data-a11y-theme='blw']) #page :focus-visible {
	outline-color: var(--a11y-text) !important;
}
