/**
 * VOSKA Module: Accessibility (a11y)
 *
 * Uses VOSKA CSS custom properties from variables.css.
 * Panel self-protection: #vsk-a11y-panel specificity (1-0-0)
 * beats body.class selectors (0-1-1) so features never leak into the panel.
 */


/* ═══════════════════════════════════════════════════════════════════
   1. MODULE CUSTOM PROPERTIES
   ═══════════════════════════════════════════════════════════════════ */

:root {
	--vsk-a11y-fs:  1;
	--vsk-a11y-lh:  1.5;
	--vsk-a11y-ls:  0em;
	--vsk-a11y-ws:  0em;
}

.vsk-a11y {
	--_accent:     var(--vsk-clr--accent, #8C9D34);
	--_secondary:  var(--vsk-clr--secondary, #2D3528);
	--_light:      var(--vsk-clr--light, #F4F4F0);
	--_dark:       var(--vsk-clr--dark, #121214);
	--_ease:       var(--vsk-trns--ease, cubic-bezier(0.66, 0, 0.34, 1));
	--_dur:        var(--vsk-trns--duration, 0.35s);
	--_panel-bg:   #1a1a1e;
	--_panel-w:    clamp(min(100%, 320px), 30vw, 540px);
	--_text:       var(--_light);
	--_text-mid:   rgba(244, 244, 240, 0.7);
	--_text-fade:  rgba(244, 244, 240, 0.45);
	--_border:     rgba(45, 53, 40, 0.6);
}


/* ═══════════════════════════════════════════════════════════════════
   2. FAB
   ═══════════════════════════════════════════════════════════════════ */

.vsk-a11y__fab {
	position: fixed;
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 1.5px solid rgba(140, 157, 52, 0.3);
	border-radius: 50%;
	background: var(--_secondary);
	cursor: pointer;
	transition:
		transform var(--_dur) var(--_ease),
		background-color 0.2s,
		opacity var(--_dur) var(--_ease);
}

.vsk-a11y__fab:hover  { background: #353d2e; transform: scale(1.08); }
.vsk-a11y__fab:active { transform: scale(0.95); }

.vsk-a11y__fab:focus-visible {
	outline: 2px solid var(--_accent);
	outline-offset: 3px;
}

.vsk-a11y__fab-icon {
	width: 22px;
	height: 22px;
	fill: var(--_accent);
	pointer-events: none;
}

/* Position variants (set via data-position on .vsk-a11y) */
.vsk-a11y[data-position="bottom-left"]  .vsk-a11y__fab { bottom: 24px; left: 24px; }
.vsk-a11y[data-position="bottom-right"] .vsk-a11y__fab { bottom: 24px; right: 24px; }
.vsk-a11y[data-position="top-left"]     .vsk-a11y__fab { top: 24px; left: 24px; }
.vsk-a11y[data-position="top-right"]    .vsk-a11y__fab { top: 24px; right: 24px; }

/* WP admin-bar offset */
body.admin-bar .vsk-a11y[data-position^="top"] .vsk-a11y__fab { top: 56px; }

/* Hide FAB when panel is open */
.vsk-a11y.is-open .vsk-a11y__fab {
	opacity: 0;
	pointer-events: none;
	transform: scale(0.5);
}


/* ═══════════════════════════════════════════════════════════════════
   3. PANEL
   ═══════════════════════════════════════════════════════════════════ */

.vsk-a11y__panel {
	position: fixed;
	z-index: 99991;
	top: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: var(--_panel-w);
	max-width: 90vw;
	background: var(--_panel-bg);
	font-family: var(--vsk-font--family-text, 'Roboto', sans-serif);
	color: var(--_text);
	visibility: hidden;
	transition:
		transform var(--_dur) var(--_ease),
		visibility 0s var(--_dur);
}

/* Panel slides from the side where the FAB is */
.vsk-a11y[data-position$="left"]  .vsk-a11y__panel { left: 0;  border-right: 1px solid var(--_border); transform: translateX(-100%); }
.vsk-a11y[data-position$="right"] .vsk-a11y__panel { right: 0; border-left: 1px solid var(--_border);  transform: translateX(100%); }

.vsk-a11y.is-open .vsk-a11y__panel {
	transform: translateX(0);
	visibility: visible;
	transition:
		transform var(--_dur) var(--_ease),
		visibility 0s 0s;
}

/* WP admin-bar offset */
body.admin-bar .vsk-a11y__panel { top: 32px; }

/* ─── Head ─────────────────────────────────────────────────────── */

.vsk-a11y__head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 20px 20px 16px;
	flex-shrink: 0;
}

.vsk-a11y__title {
	font-family: var(--vsk-font--family-heading, 'Fraunces', serif);
	font-size: 16px;
	font-weight: 400;
	color: var(--_accent);
	letter-spacing: 0.02em;
}

.vsk-a11y__shortcut {
	font-size: 10px;
	color: var(--_text-fade);
	letter-spacing: 0.04em;
	margin-right: auto;
}

.vsk-a11y__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: transparent;
	color: var(--_text-fade);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
	flex-shrink: 0;
}

.vsk-a11y__close:hover { background: rgba(244, 244, 240, 0.06); color: var(--_text); }
.vsk-a11y__close:focus-visible { outline: 2px solid var(--_accent); outline-offset: -2px; }

/* ─── Body (scrollable) ───────────────────────────────────────── */

.vsk-a11y__body {
	flex: 1 1 auto;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 0 0 12px;
	scrollbar-width: thin;
	scrollbar-color: var(--_secondary) transparent;
}

.vsk-a11y__body::-webkit-scrollbar       { width: 4px; }
.vsk-a11y__body::-webkit-scrollbar-track  { background: transparent; }
.vsk-a11y__body::-webkit-scrollbar-thumb  { background: var(--_secondary); border-radius: 2px; }

/* ─── Foot ─────────────────────────────────────────────────────── */

.vsk-a11y__foot {
	flex-shrink: 0;
	padding: 16px 20px;
	border-top: 1px solid var(--_border);
}

.vsk-a11y__reset {
	display: block;
	width: 100%;
	padding: 8px;
	border: 1px solid var(--_border);
	border-radius: var(--vsk-bdr-rad--s, 6px);
	background: transparent;
	color: var(--_text-fade);
	font-family: inherit;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s;
}

.vsk-a11y__reset:hover { border-color: var(--_accent); color: var(--_accent); }
.vsk-a11y__reset:focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px; }


/* ═══════════════════════════════════════════════════════════════════
   4. SECTIONS & CONTROLS
   ═══════════════════════════════════════════════════════════════════ */

.vsk-a11y__section {
	padding: 0 20px;
	margin: 0 0 20px;
	border: none;
}

.vsk-a11y__legend {
	display: block;
	width: 100%;
	padding-bottom: 6px;
	margin-bottom: 12px;
	border-bottom: 1px solid var(--_border);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--_text-fade);
}

/* ─── Stepper (font-size) ──────────────────────────────────────── */

.vsk-a11y__stepper { margin-bottom: 16px; }
.vsk-a11y__stepper:last-child { margin-bottom: 0; }

.vsk-a11y__stepper-label {
	display: block;
	font-size: 12px;
	color: var(--_text-mid);
	margin-bottom: 6px;
}

.vsk-a11y__stepper-ctrl {
	display: flex;
	align-items: stretch;
}

.vsk-a11y__stepper-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	min-height: 44px;
	padding: 0;
	border: 1px solid var(--_border);
	background: transparent;
	color: var(--_text-mid);
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s, background-color 0.2s;
	flex-shrink: 0;
}

.vsk-a11y__stepper-btn:first-child {
	border-radius: var(--vsk-bdr-rad--s, 6px) 0 0 var(--vsk-bdr-rad--s, 6px);
}

.vsk-a11y__stepper-btn:last-child {
	border-radius: 0 var(--vsk-bdr-rad--s, 6px) var(--vsk-bdr-rad--s, 6px) 0;
}

.vsk-a11y__stepper-btn:hover:not(:disabled) {
	border-color: var(--_accent);
	color: var(--_accent);
	background: rgba(140, 157, 52, 0.08);
}

.vsk-a11y__stepper-btn:disabled {
	opacity: 0.25;
	cursor: not-allowed;
}

.vsk-a11y__stepper-btn:focus-visible {
	outline: 2px solid var(--_accent);
	outline-offset: -2px;
	z-index: 1;
}

.vsk-a11y__stepper-btn svg {
	width: 16px;
	height: 16px;
	pointer-events: none;
}

.vsk-a11y__stepper-val {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 4px;
	border-top: 1px solid var(--_border);
	border-bottom: 1px solid var(--_border);
	background: rgba(140, 157, 52, 0.04);
	font-size: 13px;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	color: var(--_accent);
}

/* ─── Presets (lh, ls, ws) ─────────────────────────────────────── */

.vsk-a11y__presets { margin-bottom: 16px; }
.vsk-a11y__presets:last-child { margin-bottom: 0; }

.vsk-a11y__presets-label {
	display: block;
	font-size: 12px;
	color: var(--_text-mid);
	margin-bottom: 6px;
}

.vsk-a11y__presets-opts {
	display: flex;
}

.vsk-a11y__preset {
	flex: 1;
	min-height: 44px;
	padding: 8px 2px;
	border: 1px solid var(--_border);
	background: transparent;
	color: var(--_text-fade);
	font-family: inherit;
	font-size: 11px;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.vsk-a11y__preset + .vsk-a11y__preset { margin-left: -1px; }

.vsk-a11y__preset:first-child {
	border-radius: var(--vsk-bdr-rad--s, 6px) 0 0 var(--vsk-bdr-rad--s, 6px);
}

.vsk-a11y__preset:last-child {
	border-radius: 0 var(--vsk-bdr-rad--s, 6px) var(--vsk-bdr-rad--s, 6px) 0;
}

.vsk-a11y__preset:only-child { border-radius: var(--vsk-bdr-rad--s, 6px); }

.vsk-a11y__preset:hover:not(.is-active) {
	color: var(--_text);
	border-color: var(--_accent);
	z-index: 1;
}

.vsk-a11y__preset.is-active {
	background: var(--_accent);
	border-color: var(--_accent);
	color: var(--_dark);
	font-weight: 500;
	z-index: 2;
}

.vsk-a11y__preset:focus-visible {
	outline: 2px solid var(--_accent);
	outline-offset: -2px;
	z-index: 3;
}

/* ─── Toggles ──────────────────────────────────────────────────── */

.vsk-a11y__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 0;
}

.vsk-a11y__toggle + .vsk-a11y__toggle {
	border-top: 1px solid rgba(45, 53, 40, 0.3);
}

.vsk-a11y__toggle-info {
	display: flex;
	align-items: center;
	gap: 10px;
}

.vsk-a11y__toggle-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: var(--vsk-bdr-rad--s, 6px);
	background: rgba(140, 157, 52, 0.1);
	flex-shrink: 0;
}

.vsk-a11y__icon {
	width: 14px;
	height: 14px;
	color: var(--_accent);
}

.vsk-a11y__toggle-text {
	font-size: 12px;
	color: var(--_text-mid);
}

/* Switch */
.vsk-a11y__switch {
	position: relative;
	display: block;
	width: 36px;
	height: 20px;
	flex-shrink: 0;
	cursor: pointer;
}

.vsk-a11y__switch input {
	position: absolute;
	width: 0;
	height: 0;
	opacity: 0;
}

.vsk-a11y__switch-track {
	position: absolute;
	inset: 0;
	border-radius: 10px;
	background: var(--_secondary);
	transition: background-color 0.2s;
}

.vsk-a11y__switch-thumb {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--_text-fade);
	transition:
		transform 0.2s var(--_ease),
		background-color 0.2s;
}

.vsk-a11y__switch input:checked ~ .vsk-a11y__switch-track  { background: var(--_accent); }
.vsk-a11y__switch input:checked ~ .vsk-a11y__switch-thumb  { transform: translateX(16px); background: var(--_light); }

.vsk-a11y__switch input:focus-visible ~ .vsk-a11y__switch-track {
	outline: 2px solid var(--_accent);
	outline-offset: 2px;
}


/* ═══════════════════════════════════════════════════════════════════
   5. PANEL SELF-PROTECTION
   ID selector (#) beats all body.class selectors so feature
   overrides never leak into the panel.
   ═══════════════════════════════════════════════════════════════════ */

#vsk-a11y,
#vsk-a11y-panel,
#vsk-a11y-panel *,
#vsk-a11y-fab {
	font-size: revert;
	line-height: revert;
	letter-spacing: revert;
	word-spacing: revert;
	cursor: revert;
	filter: none !important;
	outline: revert;
}

/* Re-apply panel's own explicit sizes after revert */
#vsk-a11y-panel                     { font-size: 14px; line-height: 1.5; letter-spacing: 0; word-spacing: 0; }
#vsk-a11y-panel .vsk-a11y__title    { font-size: 16px; letter-spacing: 0.02em; }
#vsk-a11y-panel .vsk-a11y__legend   { font-size: 10px; letter-spacing: 0.1em; }
#vsk-a11y-panel .vsk-a11y__stepper-label,
#vsk-a11y-panel .vsk-a11y__presets-label,
#vsk-a11y-panel .vsk-a11y__toggle-text { font-size: 12px; letter-spacing: 0; }
#vsk-a11y-panel .vsk-a11y__stepper-val { font-size: 13px; }
#vsk-a11y-panel .vsk-a11y__preset      { font-size: 11px; }
#vsk-a11y-panel .vsk-a11y__shortcut    { font-size: 10px; }
#vsk-a11y-panel .vsk-a11y__close       { font-size: 20px; }
#vsk-a11y-panel .vsk-a11y__reset       { font-size: 11px; letter-spacing: 0.06em; }

/* Keep panel cursor normal */
#vsk-a11y-panel,
#vsk-a11y-panel * { cursor: auto; }
#vsk-a11y-panel button,
#vsk-a11y-panel label,
#vsk-a11y-panel input[type="range"] { cursor: pointer; }

/* No hover highlight inside panel */
body.vsk-a11y--highlight #vsk-a11y *:hover { outline: none !important; }

/* Panel always dark — immune to light mode toggle */
#vsk-a11y-panel {
	background: var(--_panel-bg) !important;
	color: var(--_text) !important;
}


/* ═══════════════════════════════════════════════════════════════════
   6. FEATURE OVERRIDES
   Applied via body classes toggled by a11y.js.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── 6a. Font size scaling ────────────────────────────────────── */

html.vsk-a11y--fs {
	font-size: calc(var(--vsk-font--base-size) * var(--vsk-a11y-fs)) !important;
}

/* ─── 6b. Line height ─────────────────────────────────────────── */

body.vsk-a11y--lh,
body.vsk-a11y--lh p,
body.vsk-a11y--lh li,
body.vsk-a11y--lh td,
body.vsk-a11y--lh th,
body.vsk-a11y--lh dd,
body.vsk-a11y--lh dt,
body.vsk-a11y--lh label,
body.vsk-a11y--lh blockquote,
body.vsk-a11y--lh h1,
body.vsk-a11y--lh h2,
body.vsk-a11y--lh h3,
body.vsk-a11y--lh h4,
body.vsk-a11y--lh h5,
body.vsk-a11y--lh h6 {
	line-height: var(--vsk-a11y-lh) !important;
}

/* ─── 6c. Letter spacing ──────────────────────────────────────── */

body.vsk-a11y--ls,
body.vsk-a11y--ls p,
body.vsk-a11y--ls li,
body.vsk-a11y--ls td,
body.vsk-a11y--ls th,
body.vsk-a11y--ls span,
body.vsk-a11y--ls h1,
body.vsk-a11y--ls h2,
body.vsk-a11y--ls h3,
body.vsk-a11y--ls h4,
body.vsk-a11y--ls h5,
body.vsk-a11y--ls h6 {
	letter-spacing: var(--vsk-a11y-ls) !important;
}

/* ─── 6d. Word spacing ────────────────────────────────────────── */

body.vsk-a11y--ws,
body.vsk-a11y--ws p,
body.vsk-a11y--ws li,
body.vsk-a11y--ws td,
body.vsk-a11y--ws th,
body.vsk-a11y--ws span {
	word-spacing: var(--vsk-a11y-ws) !important;
}

/* ─── 6e. High contrast ───────────────────────────────────────── */

body.vsk-a11y--contrast {
	--vsk-clr--text:            #ffffff;
	--vsk-clr--text-faded:      rgba(255, 255, 255, 0.75);
	--vsk-clr--dark:            #000000;
	--vsk-clr--light:           #ffffff;
	--vsk-clr--border:          #ffffff;
	--vsk-clr--border-soft:     rgba(255, 255, 255, 0.75);
	--vsk-clr--accent:          #c8e632;
	--vsk-clr--primary:         #c8e632;
	--vsk-clr--background-dark: #000000;
	--vsk-clr--background-soft: rgba(255, 255, 255, 0.15);
	background-color: #000000 !important;
	color: #ffffff !important;
}

body.vsk-a11y--contrast img { filter: contrast(1.2); }

/* ─── 6f. Light mode ──────────────────────────────────────────── */

body.vsk-a11y--light {
	--vsk-clr--text:             var(--vsk-clr--dark);
	--vsk-clr--text-faded:       rgba(18, 18, 20, 0.5);
	--vsk-clr--background-dark:  var(--vsk-clr--light);
	--vsk-clr--background-light: var(--vsk-clr--dark);
	--vsk-clr--border:           rgba(18, 18, 20, 0.2);
	--vsk-clr--border-soft:      rgba(18, 18, 20, 0.1);
	--vsk-clr--background-soft:  rgba(18, 18, 20, 0.05);
	--vsk-clr--shadow:           rgba(0, 0, 0, 0.1);
	background-color: var(--vsk-clr--light) !important;
	color: var(--vsk-clr--dark) !important;
}

/* ─── 6g. Link highlighting ───────────────────────────────────── */

body.vsk-a11y--links a:not(#vsk-a11y-panel a) {
	text-decoration: underline !important;
	text-decoration-thickness: 2px !important;
	text-underline-offset: 3px !important;
	color: var(--vsk-clr--accent) !important;
	outline: 1px dashed rgba(140, 157, 52, 0.4);
	outline-offset: 2px;
}

body.vsk-a11y--links a:not(#vsk-a11y-panel a):hover {
	background: rgba(140, 157, 52, 0.15);
}

/* ─── 6h. Enhanced focus ring ─────────────────────────────────── */

body.vsk-a11y--focus *:focus-visible {
	outline: 3px solid var(--vsk-clr--accent, #8C9D34) !important;
	outline-offset: 3px !important;
	box-shadow: 0 0 0 6px rgba(140, 157, 52, 0.25) !important;
}

/* ─── 6i. Stop animations ─────────────────────────────────────── */

body.vsk-a11y--no-motion,
body.vsk-a11y--no-motion *,
body.vsk-a11y--no-motion *::before,
body.vsk-a11y--no-motion *::after {
	animation-duration:         0.001ms !important;
	animation-iteration-count:  1       !important;
	transition-duration:        0.001ms !important;
	scroll-behavior:            auto    !important;
}

/* Keep panel transitions functional */
body.vsk-a11y--no-motion #vsk-a11y-panel,
body.vsk-a11y--no-motion #vsk-a11y-fab,
body.vsk-a11y--no-motion .vsk-a11y__switch-track,
body.vsk-a11y--no-motion .vsk-a11y__switch-thumb {
	transition-duration: var(--_dur) !important;
}

/* ─── 6j. Large cursor ────────────────────────────────────────── */

body.vsk-a11y--cursor,
body.vsk-a11y--cursor * {
	cursor:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M10 4 L10 32 L18 24 L28 24 Z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E")
		10 4, auto !important;
}

body.vsk-a11y--cursor a,
body.vsk-a11y--cursor button,
body.vsk-a11y--cursor [role="button"],
body.vsk-a11y--cursor input[type="submit"],
body.vsk-a11y--cursor label,
body.vsk-a11y--cursor select,
body.vsk-a11y--cursor summary {
	cursor:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M16 5 C12 5 6 10 6 17 C6 24 12 28 16 32 C20 28 26 24 26 17 C26 10 20 5 16 5Z' fill='%238C9D34' stroke='%23fff' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='4' fill='%23fff'/%3E%3C/svg%3E")
		16 32, pointer !important;
}

/* ─── 6k. Hover highlight ─────────────────────────────────────── */

body.vsk-a11y--highlight *:hover {
	outline: 2px dashed var(--vsk-clr--accent, #8C9D34) !important;
	outline-offset: 2px !important;
}


/* ═══════════════════════════════════════════════════════════════════
   7. RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 400px) {
	.vsk-a11y { --_panel-w: 100vw; }

	.vsk-a11y__panel { border: none !important; }
}