/* ==========================================================================
   Adasat Accessibility
   Settings are stored as data-a11y-* attributes on <html>.
   ========================================================================== */

.adasat-a11y {
	--a11y-accent: #b3832f;
	--a11y-accent-strong: #8a6220;
	--a11y-bg: #fff;
	--a11y-fg: #1d1d1f;
	--a11y-muted: #f3efe7;
	--a11y-border: #e2d9c8;
	font-family: inherit;
	line-height: 1.4;
}

.adasat-a11y-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* Launcher: bottom corner on the reading-start side (right in RTL). */
.adasat-a11y-launcher {
	position: fixed;
	inset-block-end: 20px;
	inset-inline-start: 20px;
	z-index: 99998;
	display: grid;
	place-items: center;
	width: 52px; height: 52px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--a11y-accent);
	color: #fff;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
	cursor: pointer;
}
.adasat-a11y-launcher:hover { background: var(--a11y-accent-strong); }
.adasat-a11y-launcher svg { width: 30px; height: 30px; fill: currentColor; }

.adasat-a11y button:focus-visible,
.adasat-a11y-inline button:focus-visible,
.adasat-a11y-inline-print:focus-visible,
.adasat-a11y-open-link:focus-visible {
	outline: 3px solid #1a73e8;
	outline-offset: 2px;
}

.adasat-a11y-panel {
	position: fixed;
	inset-block-end: 84px;
	inset-inline-start: 20px;
	z-index: 99999;
	width: min(340px, calc(100vw - 32px));
	max-height: calc(100vh - 110px);
	overflow-y: auto;
	padding: 16px;
	border: 1px solid var(--a11y-border);
	border-radius: 14px;
	background: var(--a11y-bg);
	color: var(--a11y-fg);
	box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
	font-size: 16px;
}
.adasat-a11y-panel[hidden] { display: none; }

.adasat-a11y-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-block-end: 8px;
}
.adasat-a11y-head h2 { margin: 0; font-size: 18px; font-weight: 700; color: inherit; }

.adasat-a11y-row {
	margin: 0;
	padding: 12px 0;
	border: 0;
	border-block-start: 1px solid var(--a11y-border);
}
.adasat-a11y-label { display: block; margin-block-end: 8px; padding: 0; font-size: 14px; font-weight: 700; }

.adasat-a11y-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.adasat-a11y-switches .adasat-a11y-toggle { flex: 1 1 100%; text-align: start; }

.adasat-a11y-btn,
.adasat-a11y-toggle,
.adasat-a11y-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 40px;
	margin: 0;
	padding: 6px 12px;
	border: 1px solid var(--a11y-border);
	border-radius: 8px;
	background: var(--a11y-bg);
	color: var(--a11y-fg);
	font: inherit;
	font-size: 15px;
	line-height: 1.2;
	cursor: pointer;
}
.adasat-a11y-btn svg, .adasat-a11y-action svg { width: 20px; height: 20px; fill: none; }
.adasat-a11y-btn:hover, .adasat-a11y-toggle:hover, .adasat-a11y-action:hover { background: var(--a11y-muted); }
.adasat-a11y-btn:disabled { opacity: .4; cursor: default; }

.adasat-a11y-toggle[aria-pressed="true"] {
	border-color: var(--a11y-accent);
	background: var(--a11y-accent);
	color: #fff;
}
.adasat-a11y-switches .adasat-a11y-toggle::before {
	content: "";
	width: 16px; height: 16px;
	border: 2px solid currentColor;
	border-radius: 4px;
	flex: none;
}
.adasat-a11y-switches .adasat-a11y-toggle[aria-pressed="true"]::before {
	background: currentColor;
	box-shadow: inset 0 0 0 2px var(--a11y-accent);
}

.adasat-a11y-size { display: inline-flex; gap: 6px; align-items: center; }
.adasat-a11y-size-value { min-width: 64px; font-variant-numeric: tabular-nums; }

.adasat-a11y-foot {
	display: flex;
	gap: 8px;
	padding-block-start: 12px;
	border-block-start: 1px solid var(--a11y-border);
}
.adasat-a11y-foot .adasat-a11y-action { flex: 1; }

/* Inline controls placed with shortcodes (e.g. top of a post). */
.adasat-a11y-inline {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: .5% 0;
}
.adasat-a11y-inline .adasat-a11y-label { margin: 0; font-size: 1.1em; }
.adasat-a11y-inline .adasat-a11y-btn,
.adasat-a11y-inline-print {
	border-color: transparent;
	background: transparent;
	color: #b3832f;
}
.adasat-a11y-inline .adasat-a11y-btn svg { width: 24px; height: 24px; }
.adasat-a11y-inline-print { padding: 6px; }
.adasat-a11y-inline-print svg { width: 30px; height: 30px; }
.adasat-a11y-inline .adasat-a11y-btn:hover,
.adasat-a11y-inline-print:hover { background: rgba(33, 37, 41, .1); color: #8a6220; }

.adasat-a11y-open-link {
	padding: 0; border: 0; background: none;
	color: inherit; font: inherit; text-decoration: underline; cursor: pointer;
}

/* ---------- Line spacing ---------- */
html[data-a11y-spacing="wide"] body :is(p, li, dd, blockquote, td) { line-height: 2 !important; }
html[data-a11y-spacing="wider"] body :is(p, li, dd, blockquote, td) { line-height: 2.4 !important; word-spacing: .12em !important; }

/* ---------- Readable font ---------- */
html[data-a11y-font="readable"] body :is(p, li, dd, td, th, h1, h2, h3, h4, h5, h6, a, span, blockquote, label, input, textarea) {
	font-family: Tahoma, "Segoe UI", "Noto Sans Arabic", Arial, sans-serif !important;
	letter-spacing: 0 !important;
}

/* ---------- Links ---------- */
html[data-a11y-links="underline"] body a:not(.adasat-a11y a) {
	text-decoration: underline !important;
	text-underline-offset: .2em;
	text-decoration-thickness: max(1px, .08em);
}

/* ---------- Reduced motion ---------- */
html[data-a11y-motion="reduce"] *,
html[data-a11y-motion="reduce"] *::before,
html[data-a11y-motion="reduce"] *::after {
	animation-duration: .001ms !important;
	animation-iteration-count: 1 !important;
	transition-duration: .001ms !important;
	scroll-behavior: auto !important;
}

/* ---------- Dark mode ---------- */
html[data-a11y-theme="dark"],
html[data-a11y-theme="dark"] body { background-color: #121212 !important; color-scheme: dark; }
html[data-a11y-theme="dark"] body *:not(.adasat-a11y, .adasat-a11y *, img, video, iframe, svg, svg *, picture) {
	background-color: transparent !important;
	background-image: none !important;
	color: #e6e3dc !important;
	border-color: #3a3a3a !important;
}
html[data-a11y-theme="dark"] body :is(header, footer, .site-header, .site-footer) { background-color: #1b1b1b !important; }
html[data-a11y-theme="dark"] body a:not(.adasat-a11y a),
html[data-a11y-theme="dark"] body a:not(.adasat-a11y a) * { color: #e9c27a !important; }
html[data-a11y-theme="dark"] body :is(input, textarea, select) { background-color: #1e1e1e !important; }

/* ---------- High contrast ---------- */
html[data-a11y-theme="contrast"],
html[data-a11y-theme="contrast"] body { background-color: #000 !important; color-scheme: dark; }
html[data-a11y-theme="contrast"] body *:not(.adasat-a11y, .adasat-a11y *, img, video, iframe, svg, svg *, picture) {
	background-color: #000 !important;
	background-image: none !important;
	color: #fff !important;
	border-color: #fff !important;
	text-shadow: none !important;
	box-shadow: none !important;
}
html[data-a11y-theme="contrast"] body a:not(.adasat-a11y a),
html[data-a11y-theme="contrast"] body a:not(.adasat-a11y a) * { color: #ffeb3b !important; text-decoration: underline !important; }
html[data-a11y-theme="contrast"] body :is(button, input, textarea, select):not(.adasat-a11y *) { border: 2px solid #fff !important; }
html[data-a11y-theme="contrast"] body :focus-visible { outline: 3px solid #ffeb3b !important; outline-offset: 2px; }
html[data-a11y-theme="contrast"] .adasat-a11y { --a11y-accent: #ffeb3b; --a11y-accent-strong: #fff176; }
html[data-a11y-theme="contrast"] .adasat-a11y-launcher,
html[data-a11y-theme="contrast"] .adasat-a11y-toggle[aria-pressed="true"] { color: #000; }

/* Panel follows the chosen theme too. */
html[data-a11y-theme="dark"] .adasat-a11y { --a11y-bg: #1e1e1e; --a11y-fg: #eee; --a11y-muted: #2a2a2a; --a11y-border: #3a3a3a; }
html[data-a11y-theme="contrast"] .adasat-a11y { --a11y-bg: #000; --a11y-fg: #fff; --a11y-muted: #222; --a11y-border: #fff; }

/* ---------- Print ---------- */
/* The theme owns the print layout; the plugin only hides its own UI and
   undoes reader settings so paper always gets the clean default. */
@media print {
	.adasat-a11y,
	.adasat-a11y-noprint { display: none !important; }
	html[data-a11y-size] * { zoom: 1 !important; }
	html[data-a11y-theme] body * {
		background: transparent !important;
		color: #000 !important;
		border-color: #999 !important;
	}
}
