/* ===========================================================================
   SSS Universal Accessibility & Classroom Reader Toolbar
   Smart Stuff Studios — WCAG 2.2 AA + Section 508
   Dependency-free. No build step. No %-formatting (P-258).
   Contains:
     1. The base accessibility layer (focus ring, reduced motion, skip link)
     2. The Accessibility & Reader Toolbar widget styles
   =========================================================================== */

/* ---------------------------------------------------------------------------
   1. BASE ACCESSIBILITY LAYER
   --------------------------------------------------------------------------- */

/* Two-tone focus ring: a 3px amber ring plus a 6px black ring.
   The indicator therefore clears 3:1 against BOTH light backgrounds
   (black outer ring) and dark backgrounds (amber inner ring) — WCAG 1.4.11. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="switch"]:focus-visible,
[role="checkbox"]:focus-visible,
[role="radio"]:focus-visible,
video:focus-visible,
audio:focus-visible,
iframe:focus-visible,
details:focus-visible,
[contenteditable]:focus-visible,
[contenteditable="true"]:focus-visible {
  outline: 3px solid #ffd400 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 6px #101010 !important;
  }

/* Keyboard focus must never be removed outright. */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
  outline-color: #ffd400;
}

/* Skip link — visually hidden until it takes keyboard focus. */
.sss-skip-link {
  position: absolute !important;
  left: -9999px !important;
  top: 0 !important;
  z-index: 100000 !important;
  padding: 12px 20px !important;
  background: #101010 !important;
  color: #ffffff !important;
  font: 700 1rem/1.2 system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
  text-decoration: underline !important;
  border-radius: 0 0 8px 0 !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45) !important;
}
.sss-skip-link:focus,
.sss-skip-link:focus-visible {
  left: 0 !important;
  top: 0 !important;
  outline: 3px solid #ffd400 !important;
  outline-offset: -3px !important;
}

/* Screen-reader-only helper text. */
.sss-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* prefers-reduced-motion: kill animation + looping motion everywhere. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------------------------
   2. READER MODES
   --------------------------------------------------------------------------- */

/* (a) Dyslexia-friendly spacing + font */
html.sss-dyslexia body,
html.sss-dyslexia .sss-a11y-toolbar {
  font-family: "Comic Sans MS", "Trebuchet MS", Verdana, Tahoma, sans-serif !important;
  letter-spacing: 0.035em !important;
  word-spacing: 0.14em !important;
  line-height: 1.75 !important;
}
html.sss-dyslexia p,
html.sss-dyslexia li,
html.sss-dyslexia dd,
html.sss-dyslexia p,
html.sss-dyslexia blockquote {
  font-size: 1.06em !important;
  max-width: 68ch !important;
}
html.sss-dyslexia h1,
html.sss-dyslexia h2,
html.sss-dyslexia h3,
html.sss-dyslexia h4 {
  letter-spacing: 0.02em !important;
  line-height: 1.35 !important;
}

/* (b) High contrast mode */
html.sss-contrast body {
  background: #000000 !important;
  color: #ffffff !important;
}
html.sss-contrast body * {
  border-color: #ffffff !important;
  text-shadow: none !important;
}
/* A high-contrast mode that only recolours TEXT leaves light-surfaced
   cards light - so white text lands on a white card and becomes
   INVISIBLE. That is worse than no mode at all. Every surface that
   paints a background must also go dark, or the text colour must stay
   dark. We do BOTH: surfaces go black, text goes white. */
html.sss-contrast body div,
html.sss-contrast body section,
html.sss-contrast body article,
html.sss-contrast body aside,
html.sss-contrast body header,
html.sss-contrast body footer,
html.sss-contrast body nav,
html.sss-contrast body main,
html.sss-contrast body ul,
html.sss-contrast body ol,
html.sss-contrast body li,
html.sss-contrast body figure,
html.sss-contrast body blockquote,
html.sss-contrast body table,
html.sss-contrast body tr,
html.sss-contrast body td,
html.sss-contrast body th,
html.sss-contrast body form,
html.sss-contrast body fieldset,
html.sss-contrast body address {
  background-color: #000000 !important;
  background-image: none !important;
  color: #ffffff !important;
}
/* Cards that carry a light tint in the base theme get an explicit dark
   surface plus a visible light border so they stay legible AND
   distinguishable from the page background. */
html.sss-contrast body .card,
html.sss-contrast body [class*="-card"],
html.sss-contrast body [class*="card-"],
html.sss-contrast body [class*="panel"],
html.sss-contrast body [class*="btn"],
html.sss-contrast body [class*="button"] {
  background-color: #000000 !important;
  color: #ffffff !important;
  border: 1px solid #ffffff !important;
}
/* Headings on a dark surface stay white. */
html.sss-contrast body h1,
html.sss-contrast body h2,
html.sss-contrast body h3,
html.sss-contrast body h4,
html.sss-contrast body h5,
html.sss-contrast body h6 {
  color: #ffffff !important;
}
/* Muted/meta text goes light grey, not pure white, so it still reads as
   secondary but passes 4.5:1 on black. */
html.sss-contrast body small,
html.sss-contrast body .muted,
html.sss-contrast body [class*="muted"],
html.sss-contrast body [class*="text-3"],
html.sss-contrast body [class*="subtle"] {
  color: #d7d7d7 !important;
}
/* Images keep their content but are no longer washed out. */
html.sss-contrast body img,
html.sss-contrast body video,
html.sss-contrast body canvas {
  filter: contrast(1.15) brightness(0.95) !important;
}
html.sss-contrast body h1,
html.sss-contrast body h2,
html.sss-contrast body h3,
html.sss-contrast body h4,
html.sss-contrast body h5,
html.sss-contrast body h6,
html.sss-contrast body p,
html.sss-contrast body li,
html.sss-contrast body span,
html.sss-contrast body div,
html.sss-contrast body strong,
html.sss-contrast body small,
html.sss-contrast body label,
html.sss-contrast body td,
html.sss-contrast body th {
  color: #ffffff !important;
}
html.sss-contrast body a {
  color: #4fc3ff !important;
  text-decoration: underline !important;
}
html.sss-contrast body input,
html.sss-contrast body select,
html.sss-contrast body textarea,
html.sss-contrast body button {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}

/* ---------------------------------------------------------------------------
   3. THE TOOLBAR WIDGET
   --------------------------------------------------------------------------- */
.sss-a11y-toolbar {
  position: fixed !important;
  right: 16px !important;
  bottom: 16px !important;
  z-index: 99980 !important;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  line-height: 1.4 !important;
  text-align: left !important;
}

.sss-a11y-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 16px !important;
  min-height: 44px !important;
  border-radius: 999px !important;
  border: 2px solid #101010 !important;
  background: #ffd400 !important;
  color: #101010 !important;
  font: 700 0.95rem/1 system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
  cursor: pointer !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}
.sss-a11y-btn:hover { background: #ffe066 !important; }
.sss-a11y-btn .sss-a11y-glyph { font-size: 1.15rem !important; }

.sss-a11y-panel {
  position: absolute !important;
  right: 0 !important;
  bottom: 58px !important;
  /* Never sit ON TOP of the content the user is reading. The panel is
     sized to fit and scrolls internally if the viewport is short. */
  max-height: calc(100vh - 110px) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  width: min(310px, calc(100vw - 32px)) !important;
  padding: 14px !important;
  border-radius: 14px !important;
  background: #101010 !important;
  color: #ffffff !important;
  border: 2px solid #ffd400 !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55) !important;
}
.sss-a11y-panel[hidden] { display: none !important; }

.sss-a11y-panel h2 {
  margin: 0 0 10px !important;
  font: 700 1rem/1.3 system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
  color: #ffd400 !important;
}

.sss-a11y-opt {
  display: block !important;
  width: 100% !important;
  margin: 0 0 8px !important;
  padding: 11px 12px !important;
  min-height: 44px !important;
  text-align: left !important;
  border-radius: 10px !important;
  border: 2px solid #ffffff !important;
  background: #1c1c1c !important;
  color: #ffffff !important;
  font: 500 0.95rem/1.35 system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
  cursor: pointer !important;
}
.sss-a11y-opt:hover { background: #2c2c2c !important; }
.sss-a11y-opt[aria-pressed="true"] {
  background: #ffd400 !important;
  color: #101010 !important;
  border-color: #ffd400 !important;
  font-weight: 700 !important;
}
.sss-a11y-opt[aria-pressed="true"]::before {
  content: "\2713\00a0";
}

.sss-a11y-status {
  margin-top: 8px !important;
  min-height: 1.2em !important;
  font: 400 0.85rem/1.35 system-ui, -apple-system, "Segoe UI", Arial, sans-serif !important;
  color: #ffd400 !important;
}

.sss-a11y-close {
  margin-top: 2px !important;
  background: transparent !important;
  border-color: #ffd400 !important;
  color: #ffd400 !important;
}


/* ---------------------------------------------------------------------------
   3b. THE WIDGET ITSELF UNDER HIGH CONTRAST
   The broad `html.sss-contrast body *` rules above out-specify the
   widget's own styles, so the yellow trigger would be flattened to black
   on black. These re-assert the widget with HIGHER specificity
   (0,2,1 beats 0,1,2) so it stays legible in its own high-contrast mode.
   --------------------------------------------------------------------------- */
html.sss-contrast .sss-a11y-toolbar .sss-a11y-btn {
  background: #ffd400 !important;
  color: #101010 !important;
  border: 2px solid #101010 !important;
}
html.sss-contrast .sss-a11y-toolbar .sss-a11y-btn:hover {
  background: #ffe066 !important;
}
html.sss-contrast .sss-a11y-toolbar .sss-a11y-panel {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffd400 !important;
}
html.sss-contrast .sss-a11y-toolbar .sss-a11y-panel h2 {
  color: #ffd400 !important;
}
html.sss-contrast .sss-a11y-toolbar .sss-a11y-opt {
  background: #000000 !important;
  color: #ffffff !important;
  border: 2px solid #ffffff !important;
}
html.sss-contrast .sss-a11y-toolbar .sss-a11y-opt[aria-pressed="true"] {
  background: #ffd400 !important;
  color: #101010 !important;
  border-color: #ffd400 !important;
}
html.sss-contrast .sss-a11y-toolbar .sss-a11y-status {
  color: #ffd400 !important;
}
html.sss-contrast .sss-a11y-toolbar .sss-a11y-close {
  background: transparent !important;
  border-color: #ffd400 !important;
  color: #ffd400 !important;
}


/* ---------------------------------------------------------------------------
   3c. THE OPEN PANEL MUST NOT COVER THE CONTENT
   The widget is a bottom-right overlay. On a wide viewport the centred
   content column reaches the right edge, so an open panel sat ON TOP of
   the CTA and the pricing card. When the panel is open we reserve a
   right-hand gutter so the content moves clear of it.
   --------------------------------------------------------------------------- */
@media (min-width: 1180px) {
  html.sss-a11y-open body {
    padding-right: 336px !important;
  }
  html.sss-a11y-open .sss-eco-bar .sss-eco-inner {
    padding-right: 336px !important;
  }
}

/* The widget must obey the user's motion preference too. */
@media (prefers-reduced-motion: reduce) {
  .sss-a11y-btn,
  .sss-a11y-opt,
  .sss-a11y-panel {
    transition: none !important;
    animation: none !important;
  }
}
