/* ============================================================================
   COREVO Accessibility Panel
   ============================================================================ */

/* Visually hidden but readable by screen readers */
.corevo-a11y-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;
}

/* --------------------------------------------------------------------------
   Trigger button (fixed, bottom-left corner)
   -------------------------------------------------------------------------- */

.corevo-a11y-trigger {
	position: fixed;
	bottom: 24px;
	left: 24px;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 50%;
	background-color: #1a1a2e;
	color: #fff;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
	transition: background-color 0.2s, transform 0.2s;
}

.corevo-a11y-trigger:hover {
	background-color: #16213e;
	transform: scale(1.05);
}

.corevo-a11y-trigger:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Panel container
   -------------------------------------------------------------------------- */

.corevo-a11y-panel {
	position: fixed;
	bottom: 84px;
	left: 24px;
	z-index: 9998;
	width: 280px;
	background-color: #fff;
	border: 1px solid #d0d0d0;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
	overflow: hidden;
	font-size: 14px;
	line-height: 1.4;
}

.corevo-a11y-panel[hidden] {
	display: none;
}

/* --------------------------------------------------------------------------
   Panel header
   -------------------------------------------------------------------------- */

.corevo-a11y-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 16px;
	background-color: #1a1a2e;
	color: #fff;
}

.corevo-a11y-panel-title {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
}

.corevo-a11y-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 4px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	flex-shrink: 0;
}

.corevo-a11y-close:hover {
	background-color: rgba(255, 255, 255, 0.15);
}

.corevo-a11y-close:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Controls area
   -------------------------------------------------------------------------- */

.corevo-a11y-panel-controls {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 12px 16px;
}

/* Text size controls side by side */
.corevo-a11y-text-controls {
	display: flex;
	gap: 6px;
}

.corevo-a11y-text-controls .corevo-a11y-action {
	flex: 1;
}

/* Action buttons (Increase / Decrease text size) */
.corevo-a11y-action {
	padding: 8px 10px;
	border: 1px solid #c0c0c0;
	border-radius: 4px;
	background-color: #f5f5f5;
	color: #1a1a2e;
	font-size: 13px;
	cursor: pointer;
	text-align: center;
	transition: background-color 0.15s;
}

.corevo-a11y-action:hover:not(:disabled) {
	background-color: #e8e8e8;
}

.corevo-a11y-action:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}

.corevo-a11y-action:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Toggle buttons */
.corevo-a11y-toggle {
	padding: 8px 12px;
	border: 2px solid #c0c0c0;
	border-radius: 4px;
	background-color: #f5f5f5;
	color: #1a1a2e;
	font-size: 13px;
	text-align: left;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s;
}

.corevo-a11y-toggle:hover {
	background-color: #e8e8e8;
}

.corevo-a11y-toggle:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}

/* Active state — non-color cue: border + background change (WCAG 1.4.1) */
.corevo-a11y-toggle[aria-pressed="true"] {
	border-color: #1a1a2e;
	background-color: #1a1a2e;
	color: #fff;
	font-weight: 600;
}

/* --------------------------------------------------------------------------
   Panel footer
   -------------------------------------------------------------------------- */

.corevo-a11y-panel-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 10px 16px;
	border-top: 1px solid #e0e0e0;
	background-color: #fafafa;
	flex-wrap: wrap;
}

.corevo-a11y-reset {
	padding: 6px 10px;
	border: 1px solid #c0c0c0;
	border-radius: 4px;
	background-color: #fff;
	color: #555;
	font-size: 13px;
	cursor: pointer;
	transition: background-color 0.15s;
}

.corevo-a11y-reset:hover {
	background-color: #f0f0f0;
}

.corevo-a11y-reset:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}

.corevo-a11y-statement-link {
	font-size: 13px;
	color: #1a1a2e;
	text-decoration: underline;
}

.corevo-a11y-statement-link:focus-visible {
	outline: 3px solid #ffbf00;
	outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Preference class effects on <html>
   -------------------------------------------------------------------------- */

/* Text size */
html.corevo-a11y-text-lg body {
	font-size: 110% !important;
}

html.corevo-a11y-text-xl body {
	font-size: 125% !important;
}

/* High contrast */
html.corevo-a11y-contrast {
	filter: contrast(1.4);
}

/* Underline all links */
html.corevo-a11y-underline-links a {
	text-decoration: underline !important;
}

/* Reduce motion */
html.corevo-a11y-reduce-motion *,
html.corevo-a11y-reduce-motion *::before,
html.corevo-a11y-reduce-motion *::after {
	animation-duration: 0.001ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001ms !important;
	scroll-behavior: auto !important;
}

/* --------------------------------------------------------------------------
   Respect native prefers-reduced-motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}

	.corevo-a11y-trigger,
	.corevo-a11y-action,
	.corevo-a11y-toggle,
	.corevo-a11y-reset {
		transition: none;
	}
}

/* --------------------------------------------------------------------------
   Contrast mode — ensure panel focus indicators remain visible after filter
   filter: contrast(1.4) is applied to <html>; compensate with a brighter
   outline so the post-filter rendered colour stays above WCAG 1.4.11 3:1.
   -------------------------------------------------------------------------- */

html.corevo-a11y-contrast .corevo-a11y-trigger:focus-visible,
html.corevo-a11y-contrast .corevo-a11y-panel *:focus-visible {
	outline-color: #fff200;
}

/* --------------------------------------------------------------------------
   Position variants
   (bottom-left is the default, covered by base rules above)
   -------------------------------------------------------------------------- */

/* Bottom-right */
.corevo-a11y-trigger.corevo-a11y-pos-bottom-right {
	left: auto;
	right: 24px;
}

.corevo-a11y-panel.corevo-a11y-pos-bottom-right {
	left: auto;
	right: 24px;
}

/* Bottom-left — matches base, declared explicitly for completeness */
.corevo-a11y-trigger.corevo-a11y-pos-bottom-left {
	right: auto;
	left: 24px;
}

.corevo-a11y-panel.corevo-a11y-pos-bottom-left {
	right: auto;
	left: 24px;
}

/* Top-right */
.corevo-a11y-trigger.corevo-a11y-pos-top-right {
	bottom: auto;
	top: 24px;
}

.corevo-a11y-panel.corevo-a11y-pos-top-right {
	bottom: auto;
	top: 80px;
}

/* Top-left */
.corevo-a11y-trigger.corevo-a11y-pos-top-left {
	bottom: auto;
	top: 24px;
	right: auto;
	left: 24px;
}

.corevo-a11y-panel.corevo-a11y-pos-top-left {
	bottom: auto;
	top: 80px;
	right: auto;
	left: 24px;
}

/* --------------------------------------------------------------------------
   RTL support
   -------------------------------------------------------------------------- */

[dir="rtl"] .corevo-a11y-trigger {
	left: auto;
	right: 24px;
}

[dir="rtl"] .corevo-a11y-panel {
	left: auto;
	right: 24px;
}

[dir="rtl"] .corevo-a11y-toggle {
	text-align: right;
}

/* RTL overrides for explicit position variants */
[dir="rtl"] .corevo-a11y-trigger.corevo-a11y-pos-bottom-right,
[dir="rtl"] .corevo-a11y-panel.corevo-a11y-pos-bottom-right {
	right: auto;
	left: 24px;
}

[dir="rtl"] .corevo-a11y-trigger.corevo-a11y-pos-top-right,
[dir="rtl"] .corevo-a11y-panel.corevo-a11y-pos-top-right {
	left: 24px;
	right: auto;
}

[dir="rtl"] .corevo-a11y-trigger.corevo-a11y-pos-top-left,
[dir="rtl"] .corevo-a11y-panel.corevo-a11y-pos-top-left {
	left: auto;
	right: 24px;
}
