/* ============================================================
   Rychwal Accessibility — plugin styles
   Pasek dostepnosci cyfrowej zgodny z WCAG 2.1 AA i OPZ 3.2.1
   ============================================================ */

/* === TRIGGER (przycisk w headerze) === */
.ra-trigger {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	background: #0a4ca3;
	color: #ffffff;
	border: 2px solid #0a4ca3;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
	text-decoration: none;
}

.ra-trigger:hover {
	background: #083d82;
	border-color: #083d82;
}

.ra-trigger:focus-visible {
	outline: 3px solid #ffff22;
	outline-offset: 3px;
}

.ra-trigger__icon svg {
	width: 20px;
	height: 20px;
	display: block;
}

.ra-trigger__label {
	white-space: nowrap;
}

@media (max-width: 767px) {
	.ra-trigger__label {
		display: none;
	}
	.ra-trigger {
		padding: 10px;
	}
}

/* === PANEL (modal) === */
.ra-panel {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: flex-end;
}

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

.ra-panel__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	cursor: pointer;
}

.ra-panel__dialog {
	position: relative;
	width: 100%;
	max-width: 440px;
	height: 100vh;
	background: #ffffff;
	color: #3e4244;
	box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: ra-slide-in .25s ease-out;
}

@keyframes ra-slide-in {
	from { transform: translateX(100%); }
	to   { transform: translateX(0); }
}

.ra-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 24px;
	background: #0a4ca3;
	color: #ffffff;
	flex-shrink: 0;
}

.ra-panel__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.2;
}

.ra-panel__close {
	background: transparent;
	border: 2px solid transparent;
	color: #ffffff;
	width: 36px;
	height: 36px;
	border-radius: 4px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background-color .2s ease, border-color .2s ease;
}

.ra-panel__close:hover {
	background: rgba(255, 255, 255, 0.15);
}

.ra-panel__close:focus-visible {
	outline: none;
	border-color: #ffff22;
}

.ra-panel__close svg {
	width: 22px;
	height: 22px;
}

.ra-panel__desc {
	margin: 0;
	padding: 16px 24px;
	font-size: 14px;
	line-height: 1.5;
	color: #6d6d6d;
	border-bottom: 1px solid #e2e2e2;
	background: #f8f9fa;
}

.ra-panel__body {
	flex: 1;
	overflow-y: auto;
	padding: 8px 24px 24px;
}

.ra-panel__footer {
	padding: 16px 24px;
	border-top: 1px solid #e2e2e2;
	background: #f8f9fa;
	display: flex;
	justify-content: stretch;
	flex-shrink: 0;
}

/* === GROUP (fieldset per opcja) === */
.ra-group {
	margin: 16px 0;
	padding: 0;
	border: 0;
}

.ra-group + .ra-group {
	padding-top: 16px;
	border-top: 1px solid #e2e2e2;
}

.ra-group__legend {
	padding: 0;
	margin: 0 0 10px 0;
	font-size: 15px;
	font-weight: 700;
	color: #3e4244;
}

.ra-group__options {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.ra-group__help {
	margin: 10px 0 0 0;
	font-size: 13px;
	color: #6d6d6d;
	line-height: 1.5;
}

/* === OPTIONS === */
.ra-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 6px;
	cursor: pointer;
	transition: background-color .15s ease;
}

.ra-option:hover {
	background: #f5f5f5;
}

.ra-option input:focus-visible + * {
	outline: 2px solid #0a4ca3;
	outline-offset: 2px;
	border-radius: 4px;
}

.ra-option__label {
	font-size: 14px;
	color: #3e4244;
	line-height: 1.3;
}

.ra-option--radio input {
	width: 18px;
	height: 18px;
	accent-color: #0a4ca3;
	cursor: pointer;
	flex-shrink: 0;
}

/* Toggle switch */
.ra-option--toggle {
	justify-content: space-between;
}

.ra-option--toggle input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.ra-toggle {
	width: 44px;
	height: 24px;
	background: #c4c4c4;
	border-radius: 999px;
	position: relative;
	transition: background-color .2s ease;
	flex-shrink: 0;
	order: 2;
}

.ra-option--toggle .ra-option__label {
	order: 1;
	flex-grow: 1;
}

.ra-toggle__thumb {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 20px;
	height: 20px;
	background: #ffffff;
	border-radius: 50%;
	transition: transform .2s ease;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ra-option--toggle input:checked + .ra-toggle {
	background: #0a4ca3;
}

.ra-option--toggle input:checked + .ra-toggle .ra-toggle__thumb {
	transform: translateX(20px);
}

.ra-option--toggle input:focus-visible + .ra-toggle {
	outline: 3px solid #0a4ca3;
	outline-offset: 2px;
}

/* === BUTTON (reset) === */
.ra-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 10px 16px;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease;
	border: 2px solid transparent;
}

.ra-btn--secondary {
	background: #ffffff;
	color: #0a4ca3;
	border-color: #0a4ca3;
}

.ra-btn--secondary:hover {
	background: #0a4ca3;
	color: #ffffff;
}

.ra-btn--secondary:focus-visible {
	outline: 3px solid #ffff22;
	outline-offset: 2px;
}

.ra-btn svg {
	width: 16px;
	height: 16px;
}

/* Body modal open - disable scroll */
body.ra-modal-open {
	overflow: hidden;
}

/* ============================================================
   MODYFIKATORY A11Y — aplikowane na <html> gdy user wybiera opcje
   WAZNE: wszystkie modyfikatory WYKLUCZAJA UI samego pluginu
   (.ra-trigger, .ra-panel i ich dzieci w tym backdrop).
   ============================================================ */

/* --- 1. KONTRAST WYSOKI (kolorystyka) --- */
.a11y-contrast-high body :not(:is(.ra-panel, .ra-panel *, .ra-trigger, .ra-trigger *)) {
	background-color: #000000 !important;
	color: #ffff00 !important;
	border-color: #ffff00 !important;
}
.a11y-contrast-high body a:not(:is(.ra-panel a, .ra-trigger a)),
.a11y-contrast-high body a:not(:is(.ra-panel a, .ra-trigger a)) * {
	color: #00ffff !important;
}
.a11y-contrast-high body img:not(:is(.ra-panel img, .ra-trigger img)),
.a11y-contrast-high body video:not(:is(.ra-panel video, .ra-trigger video)),
.a11y-contrast-high body svg:not(:is(.ra-panel svg, .ra-trigger svg)) {
	background: transparent !important;
}

/* --- 1b. KONTRAST: czarno-bialy (filter) --- */
/* Filter aplikujemy na bezposrednie dzieci body, OPROCZ panelu pluginu */
.a11y-contrast-mono body > *:not(.ra-panel) {
	filter: grayscale(100%) !important;
}

/* --- 1c. KONTRAST: inwersja (filter) --- */
.a11y-contrast-invert body > *:not(.ra-panel) {
	filter: invert(100%) hue-rotate(180deg) !important;
}
/* Re-invert obrazow zeby wygladaly normalnie */
.a11y-contrast-invert body > *:not(.ra-panel) img,
.a11y-contrast-invert body > *:not(.ra-panel) video {
	filter: invert(100%) hue-rotate(180deg) !important;
}

/* --- 2. ROZMIAR TEKSTU ---
   Strategia: skalujemy TYLKO root font-size (html). Wszystko co uzywa rem/em
   przeskaluje sie raz, bez kaskadowego powielania. Panel pluginu uzywa
   jednostek px — pozostanie bez zmian. */
html.a11y-fontsize-large {
	font-size: 112.5% !important;  /* +12.5% (16px -> 18px) */
}
html.a11y-fontsize-xlarge {
	font-size: 125% !important;    /* +25% (16px -> 20px) */
}

/* --- 3. CZYTELNA CZCIONKA (dla dyslektykow) --- */
@font-face {
	font-family: 'Atkinson Hyperlegible';
	font-style: normal;
	font-weight: 400;
	src: local('Atkinson Hyperlegible Regular'), local('AtkinsonHyperlegible-Regular');
	font-display: swap;
}

.a11y-font-on body :not(:is(.ra-panel, .ra-panel *, .ra-trigger, .ra-trigger *)) {
	font-family: 'Atkinson Hyperlegible', 'Lexend', Georgia, serif !important;
	letter-spacing: 0.03em !important;
}

/* --- 4. ODSTEPY MIEDZY LITERAMI --- */
.a11y-spacing-on body :not(:is(.ra-panel, .ra-panel *, .ra-trigger, .ra-trigger *)) {
	letter-spacing: 0.12em !important;
	word-spacing: 0.16em !important;
	line-height: 1.8 !important;
}

/* --- 5. POWIEKSZONY KURSOR --- */
.a11y-cursor-on body :not(:is(.ra-panel, .ra-panel *, .ra-trigger, .ra-trigger *)) {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M6 6 L6 38 L14 30 L20 44 L26 41 L20 27 L32 27 Z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 2 2, auto !important;
}
.a11y-cursor-on body a:not(:is(.ra-panel a, .ra-trigger a)),
.a11y-cursor-on body button:not(:is(.ra-panel button, .ra-trigger)),
.a11y-cursor-on body [role="button"]:not(:is(.ra-panel [role="button"], .ra-trigger)) {
	cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M16 4 L16 24 M8 16 L16 24 L24 16 M16 24 L16 42' stroke='black' stroke-width='4' fill='none'/%3E%3Cpath d='M16 4 L16 24 M8 16 L16 24 L24 16 M16 24 L16 42' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E") 16 24, pointer !important;
}

/* --- 6. PODSWIETLENIE LINKOW --- */
.a11y-links-on body a:not(:is(.ra-panel a, .ra-trigger a)),
.a11y-links-on body a:link:not(:is(.ra-panel a, .ra-trigger a)),
.a11y-links-on body a:visited:not(:is(.ra-panel a, .ra-trigger a)) {
	text-decoration: underline !important;
	text-underline-offset: 3px !important;
	text-decoration-thickness: 2px !important;
	background: #ffff22 !important;
	color: #000000 !important;
	padding: 2px 4px !important;
	border-radius: 3px !important;
}

/* --- 7. WSTRZYMAJ ANIMACJE --- */
.a11y-motion-on body *:not(:is(.ra-panel, .ra-panel *, .ra-trigger, .ra-trigger *)),
.a11y-motion-on body *:not(:is(.ra-panel, .ra-panel *, .ra-trigger, .ra-trigger *))::before,
.a11y-motion-on body *:not(:is(.ra-panel, .ra-panel *, .ra-trigger, .ra-trigger *))::after {
	animation-duration: 0.01ms !important;
	animation-iteration-count: 1 !important;
	animation-delay: 0ms !important;
	transition-duration: 0.01ms !important;
	transition-delay: 0ms !important;
	scroll-behavior: auto !important;
}
