﻿/**
 * Copyright: P. Wagner
 * Accessibility Tools — panel UI and visitor preference modes.
 *
 * Kept class/CSS variable contracts for theme compatibility:
 * ws-high-contrast, ws-disable-physics, --ws-text-scale, --ws-focus, --ws-saturation, etc.
 *
 * @package Accessibility_Tools
 */
/* Visitor-controlled high contrast mode (html.ws-high-contrast) */
:root.ws-high-contrast {
  --ws-background: #ffffff;
  --ws-primary: #ffffff;
  --ws-primary-dark: #0b2239;
  --ws-blue: #003a63;
  --ws-accent: #ffd24d;
  --ws-text: #111111;
  --ws-text-light: #222222;
  --ws-focus: #000000;
}

.ws-high-contrast body {
  background-color: #ffffff;
  color: #111111;
}

.ws-high-contrast main a {
  color: #003a63;
}

.ws-high-contrast main a:hover,
.ws-high-contrast main a:focus-visible {
  color: #001f33;
}

.ws-high-contrast .site-footer a {
  color: #ffd24d;
}

.ws-high-contrast .site-footer a:hover,
.ws-high-contrast .site-footer a:focus-visible {
  color: #ffffff;
}

/* Ensure high-contrast mode also covers key homepage/content feature blocks. */
.ws-high-contrast .bulletin-board,
.ws-high-contrast .bulletin-board-inner,
.ws-high-contrast .home-link-box,
.ws-high-contrast .home-content-box,
.ws-high-contrast .entry-content .ws-float-box {
  background: #ffffff !important;
  color: #111111 !important;
  border-color: #111111 !important;
  box-shadow: none !important;
}

.ws-high-contrast .bulletin-board-heading,
.ws-high-contrast .home-link-box-title,
.ws-high-contrast .home-content-box-title,
.ws-high-contrast .entry-content .ws-float-box :is(h1, h2, h3, h4, h5, h6) {
  color: #111111 !important;
}

.ws-high-contrast .bulletin-board a,
.ws-high-contrast .home-link-box a,
.ws-high-contrast .home-content-box a,
.ws-high-contrast .entry-content .ws-float-box a {
  color: #003a63 !important;
  text-decoration: underline !important;
}

.ws-high-contrast .bulletin-board a:hover,
.ws-high-contrast .home-link-box a:hover,
.ws-high-contrast .home-content-box a:hover,
.ws-high-contrast .entry-content .ws-float-box a:hover,
.ws-high-contrast .bulletin-board a:focus-visible,
.ws-high-contrast .home-link-box a:focus-visible,
.ws-high-contrast .home-content-box a:focus-visible,
.ws-high-contrast .entry-content .ws-float-box a:focus-visible {
  color: #001f33 !important;
}

.ws-accessibility-panel {
  position: fixed;
  right: var(--ws-a11y-offset-x, 0px);
  bottom: var(--ws-a11y-offset-y, 16px);
  z-index: 1100;
  background: var(--ws-a11y-panel-bg, var(--ws-background));
  border: 2px solid var(--ws-a11y-panel-border, var(--ws-blue));
  border-radius: 12px;
  padding: 10px;
  min-width: 190px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transform-origin: right bottom;
  will-change: transform, opacity, box-shadow;
  transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.3s ease, box-shadow 0.3s ease;
}

.ws-accessibility-panel.is-collapsed {
  transform: translateX(8px);
  opacity: 1;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding: 0;
  min-width: auto;
}

.ws-accessibility-panel-toggle {
  width: 56px;
  height: 56px;
  border: 2px solid var(--ws-a11y-ring, #ffffff);
  background: linear-gradient(180deg, var(--ws-a11y-btn-start, #0a8dff) 0%, var(--ws-a11y-btn-end, #0062dc) 100%);
  color: var(--ws-off-white);
  border-radius: 999px;
  padding: 0;
  font-size: 0;
  font-weight: 700;
  cursor: pointer;
  margin: 0 0 8px auto;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-shadow: 0 10px 20px rgba(0, 54, 135, 0.35), 0 0 0 3px rgba(0, 122, 255, 0.28);
}

.ws-accessibility-panel-toggle::after {
  content: "";
}

.ws-accessibility-panel-toggle-icon {
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
  filter: brightness(0) saturate(100%) invert(1);
}

.ws-accessibility-panel-title,
.ws-text-size-control label {
  color: var(--ws-a11y-panel-text, var(--ws-primary-dark));
}

body.ws-a11y-side-left .ws-accessibility-panel {
  left: var(--ws-a11y-offset-x, 0px);
  right: auto;
  transform-origin: left bottom;
}

body.ws-a11y-side-left .ws-accessibility-panel.is-collapsed {
  transform: translateX(-8px);
}

body.ws-a11y-side-left .ws-accessibility-panel-toggle {
  margin: 0 auto 8px 0;
}

.ws-accessibility-toggle-text {
  display: none;
}

.ws-accessibility-panel-toggle:hover {
  transform: translateY(-1px);
}

.ws-accessibility-panel-title,
.ws-accessibility-panel-actions {
  opacity: 1;
  max-height: none;
  overflow: visible;
  transform: translateX(0);
  transition: opacity 0.22s ease, max-height 0.28s ease, transform 0.28s ease, margin 0.2s ease;
}

#ws-accessibility-panel-content {
  max-height: min(70vh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.ws-accessibility-panel.is-collapsed .ws-accessibility-panel-title,
.ws-accessibility-panel.is-collapsed .ws-accessibility-panel-actions {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  margin: 0;
  transform: translateX(8px);
  pointer-events: none;
}

.ws-accessibility-panel.is-collapsed .ws-accessibility-toggle-text {
  display: none;
}

.ws-accessibility-panel.is-collapsed .ws-accessibility-panel-toggle {
  justify-content: center;
  margin: 0 0 0 auto;
}

body.ws-a11y-side-left .ws-accessibility-panel.is-collapsed .ws-accessibility-panel-toggle {
  margin: 0 auto 0 0;
}

.ws-accessibility-panel.is-collapsed .ws-accessibility-panel-toggle-icon {
  width: 30px;
  height: 30px;
}

.ws-accessibility-panel.is-collapsed .ws-accessibility-panel-toggle:hover,
.ws-accessibility-panel.is-collapsed .ws-accessibility-panel-toggle:focus-visible {
  transform: translateY(-1px) scale(1.03);
}

.ws-accessibility-panel-title {
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ws-a11y-panel-text, var(--ws-primary-dark));
}

.ws-accessibility-panel-actions {
  display: grid;
  gap: 8px;
}

.ws-accessibility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ws-accessibility-option-toggle {
  border: 1px solid rgba(13, 61, 77, 0.22);
  background: #ffffff;
  color: #12222a;
  border-radius: 10px;
  padding: 10px 8px;
  min-height: 58px;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.ws-accessibility-option-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(13, 61, 77, 0.16);
}

.ws-accessibility-option-toggle.is-active,
.ws-accessibility-option-toggle[aria-pressed="true"] {
  border-color: #0a8dff;
  background: linear-gradient(180deg, #e6f4ff 0%, #d7ecff 100%);
  box-shadow: 0 6px 14px rgba(10, 141, 255, 0.2);
}

.ws-contrast-toggle {
  border: 2px solid color-mix(in srgb, var(--ws-off-white) 45%, var(--ws-blue) 55%);
  background: color-mix(in srgb, var(--ws-blue) 76%, black 24%);
  color: var(--ws-off-white);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

.ws-contrast-toggle[aria-pressed="true"] {
  background: var(--ws-accent);
  border-color: var(--ws-accent);
  color: var(--ws-primary-dark);
}

.ws-text-size-control label {
  display: block;
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ws-a11y-panel-text, var(--ws-primary-dark));
}

.ws-text-size-control input[type="range"] {
  width: 100%;
}

/* Visitor accessibility: pointer size + colour (SVG data URIs); classes on <html> from accessibility menu */
.ws-cursor-size-control {
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}

.ws-cursor-size-legend {
  display: block;
  margin: 0 0 6px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ws-a11y-panel-text, var(--ws-primary-dark));
}

.ws-cursor-size-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.ws-cursor-size-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #12222a;
  cursor: pointer;
}

.ws-cursor-size-label input {
  width: 1rem;
  height: 1rem;
  accent-color: #0a8dff;
}

/* Pointer colour (paired with Medium/Large); SVG fill/stroke per palette */
.ws-cursor-colour-control {
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}

.ws-cursor-colour-legend {
  display: block;
  margin: 0 0 4px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ws-a11y-panel-text, var(--ws-primary-dark));
}

.ws-cursor-colour-hint {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  color: color-mix(in srgb, var(--ws-a11y-panel-text, var(--ws-primary-dark)) 72%, #ffffff);
}

.ws-cursor-colour-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.ws-cursor-colour-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #12222a;
  cursor: pointer;
}

.ws-cursor-colour-label input {
  width: 1rem;
  height: 1rem;
  accent-color: #0a8dff;
}

html.ws-cursor-size-medium.ws-cursor-palette-default body,
html.ws-cursor-size-medium.ws-cursor-palette-default body *,
html.ws-cursor-size-medium.ws-cursor-palette-default body *::before,
html.ws-cursor-size-medium.ws-cursor-palette-default body *::after {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23111827' stroke='%23f9fafb' stroke-width='1' stroke-linejoin='round' d='M2 2L2 24L8 18L12 27L16 25L11 15H26V10H10L10 2Z'/%3E%3C/svg%3E") 2 2, auto !important;
}

html.ws-cursor-size-medium.ws-cursor-palette-yellow body,
html.ws-cursor-size-medium.ws-cursor-palette-yellow body *,
html.ws-cursor-size-medium.ws-cursor-palette-yellow body *::before,
html.ws-cursor-size-medium.ws-cursor-palette-yellow body *::after {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23facc15' stroke='%23111827' stroke-width='1' stroke-linejoin='round' d='M2 2L2 24L8 18L12 27L16 25L11 15H26V10H10L10 2Z'/%3E%3C/svg%3E") 2 2, auto !important;
}

html.ws-cursor-size-medium.ws-cursor-palette-light body,
html.ws-cursor-size-medium.ws-cursor-palette-light body *,
html.ws-cursor-size-medium.ws-cursor-palette-light body *::before,
html.ws-cursor-size-medium.ws-cursor-palette-light body *::after {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%23ffffff' stroke='%23111827' stroke-width='1' stroke-linejoin='round' d='M2 2L2 24L8 18L12 27L16 25L11 15H26V10H10L10 2Z'/%3E%3C/svg%3E") 2 2, auto !important;
}

html.ws-cursor-size-medium.ws-cursor-palette-cyan body,
html.ws-cursor-size-medium.ws-cursor-palette-cyan body *,
html.ws-cursor-size-medium.ws-cursor-palette-cyan body *::before,
html.ws-cursor-size-medium.ws-cursor-palette-cyan body *::after {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath fill='%2322d3ee' stroke='%23111827' stroke-width='1' stroke-linejoin='round' d='M2 2L2 24L8 18L12 27L16 25L11 15H26V10H10L10 2Z'/%3E%3C/svg%3E") 2 2, auto !important;
}

html.ws-cursor-size-large.ws-cursor-palette-default body,
html.ws-cursor-size-large.ws-cursor-palette-default body *,
html.ws-cursor-size-large.ws-cursor-palette-default body *::before,
html.ws-cursor-size-large.ws-cursor-palette-default body *::after {
  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 fill='%23111827' stroke='%23f9fafb' stroke-width='1.5' stroke-linejoin='round' d='M3 3L3 36L12 27L18 41L24 37L16 22H39V14H14L14 3Z'/%3E%3C/svg%3E") 3 3, auto !important;
}

html.ws-cursor-size-large.ws-cursor-palette-yellow body,
html.ws-cursor-size-large.ws-cursor-palette-yellow body *,
html.ws-cursor-size-large.ws-cursor-palette-yellow body *::before,
html.ws-cursor-size-large.ws-cursor-palette-yellow body *::after {
  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 fill='%23facc15' stroke='%23111827' stroke-width='1.5' stroke-linejoin='round' d='M3 3L3 36L12 27L18 41L24 37L16 22H39V14H14L14 3Z'/%3E%3C/svg%3E") 3 3, auto !important;
}

html.ws-cursor-size-large.ws-cursor-palette-light body,
html.ws-cursor-size-large.ws-cursor-palette-light body *,
html.ws-cursor-size-large.ws-cursor-palette-light body *::before,
html.ws-cursor-size-large.ws-cursor-palette-light body *::after {
  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 fill='%23ffffff' stroke='%23111827' stroke-width='1.5' stroke-linejoin='round' d='M3 3L3 36L12 27L18 41L24 37L16 22H39V14H14L14 3Z'/%3E%3C/svg%3E") 3 3, auto !important;
}

html.ws-cursor-size-large.ws-cursor-palette-cyan body,
html.ws-cursor-size-large.ws-cursor-palette-cyan body *,
html.ws-cursor-size-large.ws-cursor-palette-cyan body *::before,
html.ws-cursor-size-large.ws-cursor-palette-cyan body *::after {
  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 fill='%2322d3ee' stroke='%23111827' stroke-width='1.5' stroke-linejoin='round' d='M3 3L3 36L12 27L18 41L24 37L16 22H39V14H14L14 3Z'/%3E%3C/svg%3E") 3 3, auto !important;
}

html.ws-cursor-size-medium:is(.ws-cursor-palette-default, .ws-cursor-palette-yellow, .ws-cursor-palette-light, .ws-cursor-palette-cyan) body :is(input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="tel"], input[type="password"], input[type="number"], textarea),
html.ws-cursor-size-medium:is(.ws-cursor-palette-default, .ws-cursor-palette-yellow, .ws-cursor-palette-light, .ws-cursor-palette-cyan) body [contenteditable="true"],
html.ws-cursor-size-large:is(.ws-cursor-palette-default, .ws-cursor-palette-yellow, .ws-cursor-palette-light, .ws-cursor-palette-cyan) body :is(input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="tel"], input[type="password"], input[type="number"], textarea),
html.ws-cursor-size-large:is(.ws-cursor-palette-default, .ws-cursor-palette-yellow, .ws-cursor-palette-light, .ws-cursor-palette-cyan) body [contenteditable="true"] {
  cursor: text !important;
}

.ws-focus-colour-control {
  display: grid;
  gap: 6px;
}

.ws-focus-colour-control label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ws-a11y-panel-text, var(--ws-primary-dark));
}

.ws-focus-colour-control input[type="color"] {
  width: 100%;
  height: 40px;
  border: 1px solid rgba(13, 61, 77, 0.28);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.ws-focus-colour-reset {
  border: 1px solid rgba(13, 61, 77, 0.26);
  background: #ffffff;
  color: #123243;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.ws-saturation-control {
  display: grid;
  gap: 6px;
}

.ws-saturation-control label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ws-a11y-panel-text, var(--ws-primary-dark));
}

.ws-saturation-control input[type="range"] {
  width: 100%;
}

:root.ws-saturation-active .site-header,
:root.ws-saturation-active main,
:root.ws-saturation-active .site-footer,
:root.ws-saturation-active .ws-accessibility-panel {
  filter: saturate(var(--ws-saturation, 1));
}

:root.ws-highlight-links main a {
  text-decoration-thickness: 0.16em;
  text-underline-offset: 0.2em;
  text-decoration-skip-ink: none;
}

:root.ws-highlight-links main a:not(.wp-block-button__link) {
  background-color: rgba(255, 235, 59, 0.22);
  box-shadow: inset 0 -0.56em 0 rgba(255, 235, 59, 0.55);
  border-radius: 3px;
  padding: 0 0.12em;
}

:root.ws-highlight-links main a:not(.wp-block-button__link):hover,
:root.ws-highlight-links main a:not(.wp-block-button__link):focus-visible {
  background-color: rgba(255, 224, 102, 0.34);
  box-shadow: inset 0 -0.62em 0 rgba(255, 224, 102, 0.68);
}

:root.ws-text-spacing body {
  letter-spacing: 0.03em;
  word-spacing: 0.08em;
}

:root.ws-text-spacing p,
:root.ws-text-spacing li,
:root.ws-text-spacing blockquote {
  line-height: 1.9;
}

:root.ws-pause-animations *,
:root.ws-pause-animations *::before,
:root.ws-pause-animations *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

:root.ws-hide-images img,
:root.ws-hide-images svg,
:root.ws-hide-images figure:not(.ws-accessibility-panel),
:root.ws-hide-images video {
  visibility: hidden !important;
}

:root.ws-hide-images .ws-accessibility-panel img,
:root.ws-hide-images .ws-accessibility-panel svg {
  visibility: visible !important;
}

:root.ws-dyslexia-friendly body,
:root.ws-dyslexia-friendly button,
:root.ws-dyslexia-friendly input,
:root.ws-dyslexia-friendly select,
:root.ws-dyslexia-friendly textarea {
  font-family: "OpenDyslexic", Calibri, Verdana, "Arial", sans-serif !important;
}

:root.ws-line-height p,
:root.ws-line-height li,
:root.ws-line-height blockquote,
:root.ws-line-height h1,
:root.ws-line-height h2,
:root.ws-line-height h3,
:root.ws-line-height h4,
:root.ws-line-height h5,
:root.ws-line-height h6 {
  line-height: 1.9 !important;
}

@media (max-width: 768px) {
  .ws-accessibility-panel {
    right: var(--ws-a11y-offset-x, 0px);
    min-width: 170px;
  }

  body.ws-a11y-side-left .ws-accessibility-panel {
    left: var(--ws-a11y-offset-x, 0px);
    right: auto;
  }

  #ws-accessibility-panel-content {
    max-height: min(62vh, 460px);
  }
}
