/*
 * H2A Accessibility Tools Styles
 */

:root {
	--h2a-hc-bg: #000000;
	--h2a-hc-fg: #ffffff;
	--h2a-hc-link: #ffff00;
	--h2a-hc-border: #ffffff;
	--h2a-hc-input-bg: #222222;
	--h2a-hc-media-border: #ffff00;
	--h2a-hc-focus: #00ffff;
}

/* Screen reader only */
.h2a-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Wrapper and main Accessibility button */
.h2a-accessibility-wrapper {
	position: relative;
	display: inline-flex;
	z-index: 99999;
}

.h2a-accessibility-wrapper[data-allow-motion],
.h2a-accessibility-wrapper[data-allow-motion] * {
	animation-duration: revert !important;
	animation-iteration-count: revert !important;
	transition-duration: revert !important;
	transition-delay: revert !important;
}

.h2a-accessibility-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	padding: 0.5rem 1.2rem;
	border-radius: 0.5rem;
	border: 2px solid #ffffff;
	background: #000000;
	color: #ffffff;
	font-size: 1rem;
	cursor: pointer;
}

.h2a-accessibility-button-icon {
	flex-shrink: 0;
}

/* Fixed corner placement (auto-inject mode) */
.h2a-accessibility-wrapper--fixed {
	position: fixed;
	bottom: 1rem;
	right: 1rem;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}

.h2a-accessibility-wrapper--fixed .h2a-accessibility-panel {
	position: fixed;
	bottom: calc(1rem + 3rem);
	right: 1rem;
	top: auto;
}

@media (max-width: 600px) {
	.h2a-accessibility-wrapper--fixed {
		position: fixed;
		bottom: 0.75rem;
		right: 0.75rem;
	}

	.h2a-accessibility-wrapper--fixed .h2a-accessibility-panel {
		left: 50%;
		right: auto;
		transform: translateX(-50%);
		bottom: 4rem;
		width: calc(100vw - 1.5rem);
	}
}

.h2a-accessibility-button:focus-visible {
	outline: 3px solid var(--h2a-hc-focus, #00ffff);
	outline-offset: 2px;
}

/* Panel backdrop */
.h2a-accessibility-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 99998;
}

.h2a-accessibility-backdrop.is-visible {
	display: block;
}

/* Panel (modal) */
.h2a-accessibility-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	max-width: 420px;
	min-width: 300px;
	background: #111111;
	color: #ffffff;
	border-radius: 12px;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
	padding: 1.8rem 2.2rem 2rem;
	z-index: 99999;
}

@media (max-width: 600px) {
	.h2a-accessibility-wrapper {
		position: static;
	}

	.h2a-accessibility-panel {
		left: 50%;
		right: auto;
		transform: translateX(-50%);
		top: 3rem;
		width: calc(100vw - 2rem);
		max-width: 420px;
		min-width: 0;
	}
}

.h2a-accessibility-panel-inner {
	position: relative;
}

.h2a-accessibility-title {
	margin: 0 0 1rem 0;
	font-size: 1.4rem;
	font-weight: 800;
	color: #ffffff;
}

.h2a-accessibility-privacy {
	margin: 0 0 1.2rem 0;
	font-size: 0.85rem;
	line-height: 1.4;
	color: #cccccc;
}

.h2a-accessibility-close {
	position: absolute;
	top: 0;
	right: 0;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	border: 2px solid #ffffff;
	background: transparent;
	color: #ffffff;
	font-size: 1.4rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transform: translate(50%, -50%);
}

.h2a-accessibility-close span {
	line-height: 1;
}

.h2a-accessibility-option {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 1.2rem;
}

.h2a-accessibility-label {
	font-size: 1rem;
	flex: 1;
}

/* Switch styles */
.h2a-switch {
	position: relative;
	flex-shrink: 0;
	width: 48px;
	height: 24px;
	border: 0;
	padding: 0;
	background: none;
	cursor: pointer;
}

.h2a-switch-track {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: #777777;
	display: flex;
	align-items: center;
	padding: 0 4px;
	transition: background 0.2s ease;
}

.h2a-switch-thumb {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
	transform: translateX(0);
	transition: transform 0.2s ease;
}

.h2a-switch[aria-checked="true"] .h2a-switch-track {
	background: #e4002b;
}

.h2a-switch[aria-checked="true"] .h2a-switch-thumb {
	transform: translateX(24px);
}

.h2a-switch:focus-visible {
	outline: 3px solid var(--h2a-hc-focus, #00ffff);
	outline-offset: 2px;
}

/* Panel footer actions */
.h2a-accessibility-actions {
	margin-top: 1.5rem;
	padding-top: 1rem;
	border-top: 1px solid #444444;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.h2a-accessibility-reset {
	width: 100%;
	padding: 0.5rem 0.75rem;
	border-radius: 4px;
	border: 1px solid #ffffff;
	background: transparent;
	color: #ffffff;
	font-size: 0.9rem;
	cursor: pointer;
}

.h2a-accessibility-reset:hover,
.h2a-accessibility-reset:focus-visible {
	background: #333333;
}

.h2a-accessibility-statement {
	color: var(--h2a-hc-link, #ffff00);
	font-size: 0.9rem;
	text-decoration: underline;
}

/* High contrast mode — generic palette (modes: generic, both) */
body.h2a-contrast-mode-generic.high-contrast,
body.h2a-contrast-mode-both.high-contrast,
body.high-contrast:not([class*="h2a-contrast-mode-"]) {
	background-color: var(--h2a-hc-bg) !important;
	color: var(--h2a-hc-fg) !important;
}

body.h2a-contrast-mode-generic.high-contrast :where(h1, h2, h3, h4, h5, h6, p, li, span, label, legend, td, th, figcaption),
body.h2a-contrast-mode-both.high-contrast :where(h1, h2, h3, h4, h5, h6, p, li, span, label, legend, td, th, figcaption),
body.high-contrast:not([class*="h2a-contrast-mode-"]) :where(h1, h2, h3, h4, h5, h6, p, li, span, label, legend, td, th, figcaption) {
	color: var(--h2a-hc-fg) !important;
}

body.h2a-contrast-mode-generic.high-contrast a,
body.h2a-contrast-mode-both.high-contrast a,
body.high-contrast:not([class*="h2a-contrast-mode-"]) a {
	color: var(--h2a-hc-link) !important;
	text-decoration: underline !important;
}

body.h2a-contrast-mode-generic.high-contrast a:visited,
body.h2a-contrast-mode-both.high-contrast a:visited,
body.high-contrast:not([class*="h2a-contrast-mode-"]) a:visited {
	color: #ffcc00 !important;
}

body.h2a-contrast-mode-generic.high-contrast :where(button, input, select, textarea),
body.h2a-contrast-mode-both.high-contrast :where(button, input, select, textarea),
body.high-contrast:not([class*="h2a-contrast-mode-"]) :where(button, input, select, textarea) {
	background-color: var(--h2a-hc-input-bg) !important;
	color: var(--h2a-hc-fg) !important;
	border: 1px solid var(--h2a-hc-border) !important;
}

body.h2a-contrast-mode-generic.high-contrast :where(img, video, svg, iframe),
body.h2a-contrast-mode-both.high-contrast :where(img, video, svg, iframe),
body.high-contrast:not([class*="h2a-contrast-mode-"]) :where(img, video, svg, iframe) {
	border: 2px solid var(--h2a-hc-media-border) !important;
}

body.h2a-contrast-mode-generic.high-contrast :focus-visible,
body.h2a-contrast-mode-both.high-contrast :focus-visible,
body.high-contrast:not([class*="h2a-contrast-mode-"]) :focus-visible {
	outline: 3px solid var(--h2a-hc-focus) !important;
	outline-offset: 2px !important;
}

/* Reduced motion — exclude panel and opt-in elements */
body.reduce-motion *:not([data-allow-motion]):not([data-allow-motion] *),
body.reduce-motion *:not([data-allow-motion]):not([data-allow-motion] *)::before,
body.reduce-motion *:not([data-allow-motion]):not([data-allow-motion] *)::after,
body.h2a-animations-disabled *:not([data-allow-motion]):not([data-allow-motion] *),
body.h2a-animations-disabled *:not([data-allow-motion]):not([data-allow-motion] *)::before,
body.h2a-animations-disabled *:not([data-allow-motion]):not([data-allow-motion] *)::after {
	animation-duration: 0.01ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.01ms !important;
	scroll-behavior: auto !important;
	transition-delay: 0ms !important;
}
