/* =============================================================
   Studio Visuali — Accessibility Widget v1.1.0
   ============================================================= */

/* ── Skip link ──────────────────────────────────────────────── */
/* position:fixed on focus — works regardless of parent overflow:hidden */
.visuali-a11y-skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  text-decoration: none;
}
.visuali-a11y-skip-link:focus,
.visuali-a11y-skip-link:focus-visible {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  padding: 12px 24px;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  z-index: 999999;
  background: #000;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
}

/* ── Widget wrapper ─────────────────────────────────────────── */
#visuali-a11y-widget {
  position: fixed;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}
#visuali-a11y-widget.vaa-pos-bottom-right { bottom: 24px; right: 24px; }
#visuali-a11y-widget.vaa-pos-bottom-left  { bottom: 24px; left:  24px; }
#visuali-a11y-widget.vaa-pos-bottom-center {
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
}

/* ── Toggle button ──────────────────────────────────────────── */
#visuali-a11y-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,.28);
  transition: transform .15s, box-shadow .15s;
}
#visuali-a11y-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
#visuali-a11y-toggle:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* ── Panel ──────────────────────────────────────────────────── */
#visuali-a11y-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 340px;
  max-height: 82vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  border: 1px solid #e4e4e4;
}
#visuali-a11y-widget.vaa-pos-bottom-left #visuali-a11y-panel {
  right: auto;
  left: 0;
}
#visuali-a11y-widget.vaa-pos-bottom-center #visuali-a11y-panel {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}
#visuali-a11y-panel[hidden] { display: none; }

/* ── Panel header ───────────────────────────────────────────── */
.visuali-a11y-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: var(--vaa-color, #1e4da1);
  border-radius: 13px 13px 0 0;
}
.visuali-a11y-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--vaa-text-color, #fff);
}
.visuali-a11y-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--vaa-text-color, #fff);
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  opacity: 0.85;
}
.visuali-a11y-close:hover { opacity: 1; background: rgba(255,255,255,.15); }
.visuali-a11y-close:focus-visible { outline: 2px solid var(--vaa-text-color, #fff); }

/* ── Features grid ──────────────────────────────────────────── */
.visuali-a11y-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 12px;
}

/* ── Feature buttons ────────────────────────────────────────── */
.visuali-a11y-feature-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px 12px;
  background: #f6f7fb;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  color: #333;
  transition: background .12s, border-color .12s, color .12s;
  text-align: center;
  line-height: 1.3;
  min-height: 76px;
}
.visuali-a11y-feature-btn:hover {
  background: #eef0ff;
  border-color: #c5c8ff;
}
.visuali-a11y-feature-btn.vaa-active,
.visuali-a11y-feature-btn[aria-pressed="true"] {
  background: #e8efff;
  border-color: var(--vaa-color, #1e4da1);
  color: var(--vaa-color, #1e4da1);
}
.visuali-a11y-feature-btn:focus-visible {
  outline: 2px solid #005fcc;
  outline-offset: 2px;
}

/* ── Feature icon (Lucide SVG) ──────────────────────────────── */
.visuali-a11y-feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--vaa-color, #1e4da1);
}
.visuali-a11y-feature-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.75;
}

/* ── Feature label ──────────────────────────────────────────── */
.visuali-a11y-feature-label {
  font-size: 11.5px;
  font-weight: 500;
  color: inherit;
  line-height: 1.25;
}

/* ── Font size row (spans both columns) ─────────────────────── */
.visuali-a11y-feature-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f6f7fb;
  border-radius: 10px;
  gap: 8px;
}
.visuali-a11y-row-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #333;
  font-size: 12.5px;
  font-weight: 600;
}
.visuali-a11y-row-label .visuali-a11y-feature-icon {
  color: #555;
}
.visuali-a11y-font-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.visuali-a11y-feature-btn.vaa-font-btn {
  flex-direction: row;
  min-height: auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  gap: 0;
}

/* ── Footer ─────────────────────────────────────────────────── */
.visuali-a11y-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 12px;
  border-top: 1px solid #f0f0f0;
  gap: 8px;
  flex-wrap: wrap;
}
.visuali-a11y-reset {
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  color: #555;
}
.visuali-a11y-reset:hover { background: #f5f5f5; }
.visuali-a11y-statement-link {
  font-size: 12px;
  color: var(--vaa-color, #1e4da1);
  text-decoration: underline;
}

/* ── Visuali credit ─────────────────────────────────────────── */
.visuali-a11y-credit {
  text-align: center;
  padding: 4px 0 10px;
  font-size: 10px;
  border-top: 1px solid #f5f5f5;
}
.visuali-a11y-credit a {
  color: #767676;
  text-decoration: underline;
}
.visuali-a11y-credit a:hover {
  color: #444;
}

/* ── Accessibility state classes ────────────────────────────── */

/* High contrast — no image inversion */
body.vaa-high-contrast,
body.vaa-high-contrast * {
  background-color: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
}
body.vaa-high-contrast a,
body.vaa-high-contrast a * { color: #ff0 !important; }

/* Grayscale — overlay div (filter on body breaks position:fixed) */
#vaa-grayscale-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  background: #fff;
  mix-blend-mode: color;
  pointer-events: none;
}

/* Inverted contrast — white overlay with difference blend */
#vaa-invert-overlay {
  position: fixed;
  inset: 0;
  z-index: 99997;
  background: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}

/* Dyslexia font */
body.vaa-dyslexia,
body.vaa-dyslexia * {
  font-family: 'OpenDyslexic', Arial, sans-serif !important;
}

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

/* Highlight links — yellow background */
body.vaa-highlight-links a {
  background-color: #ffff00 !important;
  color: #000 !important;
  text-decoration: underline !important;
}

/* Strong focus */
body.vaa-strong-focus *:focus,
body.vaa-strong-focus *:focus-visible {
  outline: 4px solid #005fcc !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 2px #fff !important;
}

/* Readable font */
body.vaa-readable-font,
body.vaa-readable-font * {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
}

/* Line height */
body.vaa-line-height,
body.vaa-line-height * {
  line-height: 1.8 !important;
  letter-spacing: 0.02em !important;
}

/* Big cursor */
body.vaa-big-cursor,
body.vaa-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M4 2l16 12-7.5 1.5-4 7.5L4 2z'/%3E%3C/svg%3E") 0 0, default !important;
}

/* Hide images */
body.vaa-hide-images img,
body.vaa-hide-images video,
body.vaa-hide-images [style*="background-image"] {
  visibility: hidden !important;
}

/* Highlight headings */
body.vaa-headings h1,
body.vaa-headings h2,
body.vaa-headings h3,
body.vaa-headings h4,
body.vaa-headings h5,
body.vaa-headings h6 {
  outline: 2px solid var(--vaa-color, #1e4da1) !important;
  outline-offset: 3px !important;
  background-color: rgba(30, 77, 161, 0.06) !important;
}

/* Reading mask */
#vaa-mask-top,
#vaa-mask-bot {
  position: fixed;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.65);
  pointer-events: none;
  z-index: 99996;
}
#vaa-mask-top {
  top: 0;
  height: 0;
}
#vaa-mask-bot {
  top: 100px;
  bottom: 0;
}

/* ── Accessibility statement page styles ────────────────────── */
.visuali-a11y-statement {
  max-width: 760px;
  line-height: 1.7;
}
.visuali-a11y-statement h2 { margin-top: 0; }
.visuali-a11y-statement h3 { margin-top: 1.5em; }
.visuali-a11y-statement ul { padding-right: 1.5em; }
