/* =============================================
   UMAIMON — Accessibility Widget
   ============================================= */

/* ── Trigger Button ──────────────────────────── */
#a11y-widget {
  position: fixed;
  bottom: 2rem;
  left: 1.5rem;
  z-index: 10000;
  font-family: 'Josefin Sans', 'Gill Sans', Arial, sans-serif;
}

#a11y-trigger {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #1569f6;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(21,105,246,0.55);
  transition: transform 0.2s, box-shadow 0.2s;
  padding: 0;
}
#a11y-trigger:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(21,105,246,0.65); }
#a11y-trigger svg { width: 28px; height: 28px; }

/* ── Panel ───────────────────────────────────── */
#a11y-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 420px;
  max-width: 100vw;
  max-height: 88vh;
  background: #eef0f7;
  border-radius: 0 20px 0 0;
  box-shadow: 0 -4px 40px rgba(0,0,0,0.22);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 10001;
  font-family: 'Josefin Sans', 'Gill Sans', Arial, sans-serif;
}
#a11y-panel.a11y-open { display: flex; }

/* ── Header ──────────────────────────────────── */
.a11y-header {
  background: #1569f6;
  color: #fff;
  padding: 0.7rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.a11y-header-title {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.01em;
}
.a11y-header-btn {
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.45);
  color: #fff;
  border-radius: 20px;
  padding: 0.28rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.a11y-header-btn:hover { background: rgba(0,0,0,0.30); }

/* ── Tabs ────────────────────────────────────── */
.a11y-tabs {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #dde1ef;
  flex-shrink: 0;
}
.a11y-tab-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 0.6rem 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: #595959;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.01em;
}
.a11y-tab-btn.a11y-tab-active { color: #1569f6; border-bottom-color: #1569f6; }

/* ── Tab Content ─────────────────────────────── */
.a11y-tab-content {
  overflow-y: auto;
  flex: 1;
  padding: 0.85rem;
}

/* ── Section Title ───────────────────────────── */
.a11y-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0.9rem 0 0.55rem;
}
.a11y-section-title:first-child { margin-top: 0; }

/* ── Profile Toggle Rows ─────────────────────── */
.a11y-profile-row {
  background: #fff;
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.55rem;
  box-shadow: 0 1px 5px rgba(0,0,0,0.07);
}
.a11y-profile-info { flex: 1; min-width: 0; }
.a11y-profile-info h4 { font-size: 0.85rem; font-weight: 700; color: #1a1a2e; margin: 0 0 0.1rem; }
.a11y-profile-info p  { font-size: 0.72rem; color: #666; margin: 0; }
.a11y-profile-icon {
  width: 34px; height: 34px;
  background: #f0f2f8;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}

/* Toggle Pill */
.a11y-toggle {
  display: flex;
  background: #e8ebf5;
  border-radius: 20px;
  overflow: hidden;
  flex-shrink: 0;
}
.a11y-toggle-btn {
  border: none;
  background: none;
  padding: 0.28rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  color: #595959;
  border-radius: 20px;
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.03em;
}
.a11y-toggle-btn.a11y-off-on  { background: #ccc; color: #1a1a1a; }
.a11y-toggle-btn.a11y-on-on   { background: #1569f6; color: #fff; }

/* ── Grid Cards ──────────────────────────────── */
.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}
.a11y-grid-card {
  background: #fff;
  border-radius: 14px;
  padding: 0.8rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0,0,0,0.07);
  border: 2px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: center;
}
.a11y-grid-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.12); }
.a11y-grid-card.a11y-card-on { border-color: #1569f6; }
.a11y-grid-card-icon { font-size: 1.35rem; line-height: 1; }
.a11y-grid-card-label { font-size: 0.71rem; font-weight: 700; color: #333; line-height: 1.2; }

/* ── Stepper Cards ───────────────────────────── */
.a11y-stepper-card {
  background: #fff;
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.55rem;
  box-shadow: 0 1px 5px rgba(0,0,0,0.07);
}
.a11y-stepper-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #333;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.a11y-stepper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.a11y-stepper-dec,
.a11y-stepper-inc {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #1569f6;
  color: #fff;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.a11y-stepper-dec:hover,
.a11y-stepper-inc:hover { background: #0f55d4; }
.a11y-stepper-value {
  flex: 1;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1569f6;
}

/* ── Color Swatches ──────────────────────────── */
.a11y-swatches {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.45rem;
}
.a11y-swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid #e0e0e0;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.a11y-swatch:hover { transform: scale(1.18); }
.a11y-swatch.a11y-swatch-on { border-color: #1569f6; transform: scale(1.1); }
.a11y-swatch-cancel {
  font-size: 0.62rem;
  font-weight: 700;
  color: #595959;
  cursor: pointer;
  padding: 0.15rem 0.45rem;
  background: #f0f0f0;
  border-radius: 10px;
  border: none;
  transition: background 0.15s;
}
.a11y-swatch-cancel:hover { background: #e0e0e0; }

/* ── Always-visible focus rings inside the widget ─── */
#a11y-trigger:focus-visible,
#a11y-panel button:focus-visible,
#a11y-panel a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #1569f6;
}
#a11y-panel .a11y-tab-content button:focus-visible,
#a11y-panel .a11y-tab-content a:focus-visible {
  outline: 3px solid #1569f6;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(21,105,246,0.25);
}

/* ── Dynamic Overlays ────────────────────────── */
#a11y-reading-guide {
  position: fixed; left: 0; width: 100%; height: 22px;
  background: rgba(255,255,0,0.25);
  border-top: 2px solid rgba(220,180,0,0.7);
  border-bottom: 2px solid rgba(220,180,0,0.7);
  pointer-events: none; z-index: 9998; display: none;
}
#a11y-mask-top, #a11y-mask-bottom {
  position: fixed; left: 0; width: 100%;
  background: rgba(0,0,0,0.65);
  pointer-events: none; z-index: 9997; display: none;
}
#a11y-mask-top { top: 0; }
#a11y-mask-bottom { bottom: 0; }
#a11y-magnifier {
  position: fixed;
  background: #fff;
  border: 2px solid #1569f6;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  pointer-events: none;
  z-index: 9999;
  display: none;
  max-width: 320px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  font-size: 1.5rem !important;
  line-height: 1.4;
  word-break: break-word;
  font-family: 'Josefin Sans', 'Gill Sans', Arial, sans-serif !important;
  color: #222 !important;
}

/* ============================================
   ACCESSIBILITY EFFECT CLASSES
   ============================================ */

/* Seizure Safety */
html.a11y-seizure *,
html.a11y-seizure *::before,
html.a11y-seizure *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* Low Vision */
html.a11y-low-vision body { font-size: 120% !important; }
html.a11y-low-vision #page-content { filter: contrast(1.3); }

/* ADHD */
html.a11y-adhd *, html.a11y-adhd *::before, html.a11y-adhd *::after {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}
html.a11y-adhd .signature-section,
html.a11y-adhd .carousel { display: none !important; }

/* Reading & Cognitive */
html.a11y-cognitive body {
  font-family: Arial, Helvetica, sans-serif !important;
  line-height: 1.9 !important;
  word-spacing: 0.12em !important;
}

/* Keyboard Nav */
html.a11y-keyboard-nav *:focus {
  outline: 3px solid #1569f6 !important;
  outline-offset: 3px !important;
}

/* Older Adults */
html.a11y-older-adults body {
  font-size: 118% !important;
  line-height: 1.75 !important;
  letter-spacing: 0.025em !important;
}

/* Readable Font */
html.a11y-readable-font,
html.a11y-readable-font * {
  font-family: Arial, Helvetica, sans-serif !important;
}

/* Highlight Titles */
html.a11y-highlight-titles h1,
html.a11y-highlight-titles h2,
html.a11y-highlight-titles h3,
html.a11y-highlight-titles h4,
html.a11y-highlight-titles h5,
html.a11y-highlight-titles h6 {
  border-bottom: 2px solid currentColor !important;
  padding-bottom: 3px !important;
}

/* Highlight Links */
html.a11y-highlight-links a {
  text-decoration: underline !important;
  text-decoration-color: #1569f6 !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
}

/* Font size delta */
html.a11y-font-adj * {
  font-size: calc(1em + var(--a11y-font-delta, 0px)) !important;
}
/* Line height delta */
html.a11y-lh-adj * {
  line-height: calc(1.5 + var(--a11y-lh-delta, 0)) !important;
}
/* Letter spacing delta */
html.a11y-ls-adj * {
  letter-spacing: calc(0em + var(--a11y-ls-delta, 0em)) !important;
}

/* Align */
html.a11y-align-center * { text-align: center !important; }
html.a11y-align-left   * { text-align: left   !important; }
html.a11y-align-right  * { text-align: right  !important; }

/* Dark Contrast */
html.a11y-dark-contrast #page-content          { filter: invert(0.9) hue-rotate(180deg); }
html.a11y-dark-contrast #page-content img,
html.a11y-dark-contrast #page-content video    { filter: invert(1) hue-rotate(180deg); }

/* Light Contrast */
html.a11y-light-contrast #page-content         { background: #fff !important; }
html.a11y-light-contrast #page-content *       { color: #111 !important; background-color: transparent !important; }

/* High Contrast */
html.a11y-high-contrast #page-content { filter: contrast(2.2); }

/* Saturation */
html.a11y-high-saturation #page-content { filter: saturate(2.5); }
html.a11y-low-saturation  #page-content { filter: saturate(0.4); }
html.a11y-monochrome      #page-content { filter: grayscale(1); }

/* Custom text/title/bg colors */
html[style*="--a11y-text-color"]  body,
html[style*="--a11y-text-color"]  body * { color:            var(--a11y-text-color)  !important; }
html[style*="--a11y-title-color"] h1,
html[style*="--a11y-title-color"] h2,
html[style*="--a11y-title-color"] h3,
html[style*="--a11y-title-color"] h4,
html[style*="--a11y-title-color"] h5,
html[style*="--a11y-title-color"] h6     { color:            var(--a11y-title-color) !important; }
html[style*="--a11y-bg-color"]    body,
html[style*="--a11y-bg-color"]    body * { background-color: var(--a11y-bg-color)    !important; }

/* Hide Images */
html.a11y-hide-images img,
html.a11y-hide-images picture { opacity: 0 !important; }

/* Stop Animations */
html.a11y-stop-anims *,
html.a11y-stop-anims *::before,
html.a11y-stop-anims *::after { animation: none !important; transition: none !important; }

/* Read Mode */
html.a11y-read-mode .hero-col-img-stack,
html.a11y-read-mode .dish-grid,
html.a11y-read-mode .signature-section,
html.a11y-read-mode .carousel,
html.a11y-read-mode .page-hero-bg { display: none !important; }

/* Highlight Hover */
html.a11y-highlight-hover *:hover:not(#a11y-widget):not(#a11y-panel):not(#a11y-panel *) {
  outline: 2px solid #1569f6 !important;
  outline-offset: 2px !important;
}

/* Highlight Focus */
html.a11y-highlight-focus *:focus {
  outline: 3px solid #f6c715 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px rgba(246,199,21,0.3) !important;
}

/* Big Cursors */
html.a11y-big-black-cursor,
html.a11y-big-black-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M6 4 L6 32 L13 25 L18 38 L23 36 L18 23 L28 23 Z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 6 4, auto !important;
}
html.a11y-big-white-cursor,
html.a11y-big-white-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M6 4 L6 32 L13 25 L18 38 L23 36 L18 23 L28 23 Z' fill='%23fff' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E") 6 4, auto !important;
}
