/* VS Accessibility Suite frontend styles */
:root {
  --vsas-brand: #111827;
  --vsas-accent: #fbbf24;
  --vsas-font-scale: 1;
  --vsas-line-height: 1.5;
  --vsas-letter-spacing: 0px;
  --vsas-word-spacing: 0px;
  --vsas-guide-y: 50vh;
}

.vsas-skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 1000000;
  transform: translateY(-160%);
  background: #000;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}

.vsas-skip-link:focus {
  transform: translateY(0);
  outline: 3px solid var(--vsas-accent);
  outline-offset: 3px;
}

.vsas-root,
.vsas-root * {
  box-sizing: border-box;
}

.vsas-root {
  position: fixed;
  z-index: 999999;
  font-family: Arial, Helvetica, sans-serif;
  color: #111827;
  isolation: isolate;
}

.vsas-pos-bottom-right { right: 18px; bottom: 18px; }
.vsas-pos-bottom-left { left: 18px; bottom: 18px; }
.vsas-pos-middle-right { right: 18px; top: 50%; transform: translateY(-50%); }
.vsas-pos-middle-left { left: 18px; top: 50%; transform: translateY(-50%); }

.vsas-toggle {
  border: 0;
  border-radius: 999px;
  min-height: 52px;
  padding: 12px 18px;
  background: var(--vsas-brand);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 14px 40px rgba(0,0,0,.28);
}

.vsas-toggle:hover,
.vsas-toggle:focus-visible {
  transform: translateY(-1px);
  outline: 3px solid var(--vsas-accent);
  outline-offset: 3px;
}

.vsas-toggle-icon {
  font-size: 20px;
  line-height: 1;
}

.vsas-panel {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: min(390px, calc(100vw - 32px));
  max-height: min(78vh, 720px);
  overflow: auto;
  background: #ffffff;
  color: #111827;
  border-radius: 22px;
  border: 1px solid rgba(17,24,39,.12);
  box-shadow: 0 24px 80px rgba(0,0,0,.32);
  padding: 16px;
}

.vsas-pos-bottom-left .vsas-panel,
.vsas-pos-middle-left .vsas-panel {
  left: 0;
  right: auto;
}

.vsas-pos-middle-right .vsas-panel,
.vsas-pos-middle-left .vsas-panel {
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
}

.vsas-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(17,24,39,.1);
}

.vsas-panel h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  color: #111827;
}

.vsas-icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(17,24,39,.18);
  background: #f9fafb;
  color: #111827;
  font-size: 24px;
  cursor: pointer;
}

.vsas-status {
  min-height: 24px;
  padding: 8px 0 2px;
  color: #374151;
  font-size: 13px;
}

.vsas-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0 14px;
}

.vsas-tabs button,
.vsas-grid button,
.vsas-reset {
  min-height: 42px;
  border: 1px solid rgba(17,24,39,.16);
  border-radius: 12px;
  background: #f9fafb;
  color: #111827;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 9px 10px;
}

.vsas-tabs button[aria-selected="true"],
.vsas-grid button[aria-pressed="true"] {
  background: var(--vsas-brand);
  color: #fff;
  border-color: var(--vsas-brand);
}

.vsas-tab-panel {
  outline: none;
}

.vsas-control {
  margin: 10px 0;
}

.vsas-control label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #111827;
}

.vsas-control input[type="range"],
.vsas-control select {
  width: 100%;
}

.vsas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.vsas-panel-foot {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(17,24,39,.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vsas-reset {
  background: #111827;
  color: #fff;
}

.vsas-panel small,
.vsas-note {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.4;
}

.vsas-headings-list {
  margin-top: 12px;
  padding: 10px;
  border-radius: 12px;
  background: #f3f4f6;
  max-height: 180px;
  overflow: auto;
}

.vsas-headings-list a {
  display: block;
  color: #111827;
  padding: 6px 4px;
  text-decoration: underline;
}

.vsas-headings-list .vsas-h2 { padding-left: 12px; }
.vsas-headings-list .vsas-h3 { padding-left: 24px; }
.vsas-headings-list .vsas-h4,
.vsas-headings-list .vsas-h5,
.vsas-headings-list .vsas-h6 { padding-left: 36px; }

/* Accessibility transformations
   v1.1.1: visual tools must affect the website, not the accessibility widget.
   Font/text controls are applied by frontend.js using inline styles on real site
   text elements only, because Astra/Spectra often use specific font-size rules. */
html.vsas-user-modified {
  --vsas-font-scale: var(--vsas-font-scale, 1);
  --vsas-line-height: var(--vsas-line-height, 1.5);
  --vsas-letter-spacing: var(--vsas-letter-spacing, 0px);
  --vsas-word-spacing: var(--vsas-word-spacing, 0px);
}

/* Keep the widget stable no matter which user mode is enabled. */
#vsas-root,
#vsas-root *,
.vsas-skip-link,
.vsas-reading-guide-line,
.vsas-reading-mask-overlay {
  filter: none !important;
  letter-spacing: normal;
  word-spacing: normal;
}

#vsas-root {
  font-size: 16px !important;
  line-height: 1.4 !important;
}

#vsas-root,
#vsas-root button,
#vsas-root input,
#vsas-root textarea,
#vsas-root select {
  font-family: Arial, Helvetica, sans-serif !important;
}

html.vsas-highlight-links body a:not(.vsas-skip-link):not(#vsas-root *),
html.vsas-highlight-links body a:not(.vsas-skip-link):not(#vsas-root) {
  outline: 2px solid currentColor !important;
  outline-offset: 3px !important;
  text-decoration: underline !important;
  text-decoration-thickness: .14em !important;
}

html.vsas-highlight-headings body :is(h1,h2,h3,h4,h5,h6):not(#vsas-root *) {
  outline: 3px solid var(--vsas-accent) !important;
  outline-offset: 4px !important;
}

html.vsas-hide-images body :is(img,picture,video,svg):not(#vsas-root *) {
  visibility: hidden !important;
}

html.vsas-pause-animations body *:not(#vsas-root):not(#vsas-root *),
html.vsas-pause-animations body *:not(#vsas-root):not(#vsas-root *)::before,
html.vsas-pause-animations body *:not(#vsas-root):not(#vsas-root *)::after {
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  scroll-behavior: auto !important;
}

/* Apply color filters only to direct page layers, not to the fixed widget. */
html.vsas-filter-grayscale body > *:not(#vsas-root):not(.vsas-skip-link):not(.vsas-reading-guide-line):not(.vsas-reading-mask-overlay):not(#wpadminbar) {
  filter: grayscale(1) !important;
}

html.vsas-filter-invert body > *:not(#vsas-root):not(.vsas-skip-link):not(.vsas-reading-guide-line):not(.vsas-reading-mask-overlay):not(#wpadminbar) {
  filter: invert(1) hue-rotate(180deg) !important;
}

html.vsas-filter-saturate body > *:not(#vsas-root):not(.vsas-skip-link):not(.vsas-reading-guide-line):not(.vsas-reading-mask-overlay):not(#wpadminbar) {
  filter: saturate(1.8) !important;
}

/* Contrast modes: target site containers/elements, then explicitly restore the widget. */
html.vsas-contrast-high body,
html.vsas-contrast-high body :is(main,article,section,header,footer,aside,nav,div,p,li,span,h1,h2,h3,h4,h5,h6,td,th,label,legend,blockquote):not(#vsas-root):not(#vsas-root *) {
  background-color: #000 !important;
  color: #fff !important;
  text-shadow: none !important;
  box-shadow: none !important;
}

html.vsas-contrast-high body a:not(#vsas-root *),
html.vsas-contrast-high body button:not(#vsas-root *),
html.vsas-contrast-high body input:not(#vsas-root *),
html.vsas-contrast-high body textarea:not(#vsas-root *),
html.vsas-contrast-high body select:not(#vsas-root *) {
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}

html.vsas-contrast-dark body,
html.vsas-contrast-dark body :is(main,article,section,header,footer,aside,nav,div,p,li,span,h1,h2,h3,h4,h5,h6,td,th,label,legend,blockquote):not(#vsas-root):not(#vsas-root *) {
  background-color: #111827 !important;
  color: #f9fafb !important;
  text-shadow: none !important;
}

html.vsas-contrast-light body,
html.vsas-contrast-light body :is(main,article,section,header,footer,aside,nav,div,p,li,span,h1,h2,h3,h4,h5,h6,td,th,label,legend,blockquote):not(#vsas-root):not(#vsas-root *) {
  background-color: #ffffff !important;
  color: #111827 !important;
  text-shadow: none !important;
}

html.vsas-contrast-high #vsas-root,
html.vsas-contrast-dark #vsas-root,
html.vsas-contrast-light #vsas-root {
  background: transparent !important;
  color: #111827 !important;
}

html.vsas-contrast-high #vsas-root .vsas-panel,
html.vsas-contrast-dark #vsas-root .vsas-panel,
html.vsas-contrast-light #vsas-root .vsas-panel {
  background: #fff !important;
  color: #111827 !important;
}

html.vsas-contrast-high #vsas-root .vsas-toggle,
html.vsas-contrast-dark #vsas-root .vsas-toggle,
html.vsas-contrast-light #vsas-root .vsas-toggle {
  background: var(--vsas-brand) !important;
  color: #fff !important;
}

html.vsas-big-cursor,
html.vsas-big-cursor body *:not(#vsas-root):not(#vsas-root *) {
  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='black' stroke='white' stroke-width='2' d='M8 4l27 25-13 2-6 13-8-40z'/%3E%3C/svg%3E") 8 4, auto !important;
}

html.vsas-keyboard-mode body :focus,
html.vsas-keyboard-mode body :focus-visible,
html.vsas-focus-enhancer body :focus-visible {
  outline: 4px solid var(--vsas-accent) !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 2px #000 !important;
}

.vsas-speaking-now {
  outline: 4px solid var(--vsas-accent) !important;
  outline-offset: 5px !important;
  background: rgba(251, 191, 36, .18) !important;
  transition: background .2s ease;
}

.vsas-read-from-click-active body *:not(#vsas-root):not(#vsas-root *) {
  cursor: crosshair !important;
}

.vsas-reading-guide-line {
  display: none;
  position: fixed;
  left: 0;
  top: var(--vsas-guide-y);
  width: 100vw;
  height: 8px;
  background: var(--vsas-accent);
  box-shadow: 0 0 0 9999px transparent;
  z-index: 999998;
  pointer-events: none;
  opacity: .88;
  transform: translateY(-50%);
}

html.vsas-reading-guide .vsas-reading-guide-line {
  display: block;
}

.vsas-reading-mask-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999997;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,.55) 0,
    rgba(0,0,0,.55) calc(var(--vsas-guide-y) - 42px),
    transparent calc(var(--vsas-guide-y) - 42px),
    transparent calc(var(--vsas-guide-y) + 42px),
    rgba(0,0,0,.55) calc(var(--vsas-guide-y) + 42px),
    rgba(0,0,0,.55) 100%
  );
}

html.vsas-reading-mask .vsas-reading-mask-overlay {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .vsas-toggle,
  .vsas-speaking-now {
    transition: none !important;
  }
}

@media (max-width: 520px) {
  .vsas-root {
    right: 12px !important;
    left: 12px !important;
    bottom: 12px !important;
    top: auto !important;
    transform: none !important;
    display: flex;
    justify-content: flex-end;
  }

  .vsas-panel {
    position: fixed;
    left: 12px !important;
    right: 12px !important;
    bottom: 78px !important;
    top: auto !important;
    width: auto;
    max-height: 76vh;
    transform: none !important;
  }

  .vsas-grid {
    grid-template-columns: 1fr;
  }

  .vsas-toggle-text {
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
