/* ============================================================
   Iron Sushi — Accessibility Widget Styles
   ============================================================ */

/* ── Trigger button ── */
#a11y-trigger {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  z-index: 999990;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0;
}
#a11y-trigger:hover { transform: scale(1.08); box-shadow: 0 4px 18px rgba(0,0,0,0.32); }
#a11y-trigger:focus-visible { outline: 3px solid #1569f6; outline-offset: 3px; }
#a11y-trigger img { width: 120%; height: 120%; display: block; object-fit: cover; margin: -10%; }

/* ── Panel ── */
#a11y-panel {
  position: fixed;
  bottom: 84px;
  left: 24px;
  width: 320px;
  max-height: 86vh;
  background: #eef0f7;
  border-radius: 10px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.22);
  z-index: 999991;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform-origin: bottom left;
  transform: scale(0.92) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s cubic-bezier(.4,0,.2,1), opacity 0.16s ease;
}
#a11y-panel.a11y-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ── */
#a11y-header {
  background: #1569f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  height: 44px;
  flex-shrink: 0;
  gap: 6px;
}
#a11y-header h2 {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin: 0;
  flex: 1;
  text-align: center;
  white-space: nowrap;
}
.a11y-hbtn {
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.a11y-hbtn:hover { background: rgba(255,255,255,0.3); }
.a11y-hbtn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ── Tabs ── */
#a11y-tabs {
  display: flex;
  background: #dde0ec;
  flex-shrink: 0;
}
.a11y-tab {
  flex: 1;
  padding: 8px 2px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  text-align: center;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #444;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.a11y-tab[aria-selected="true"] {
  color: #1569f6;
  border-bottom-color: #1569f6;
  background: #eef0f7;
}
.a11y-tab:focus-visible { outline: 2px solid #1569f6; outline-offset: -2px; }

/* ── Tab panels ── */
#a11y-body {
  overflow-y: auto;
  flex: 1;
  padding: 10px 10px;
}
#a11y-body::-webkit-scrollbar { width: 4px; }
#a11y-body::-webkit-scrollbar-thumb { background: #c0c3d8; border-radius: 4px; }

.a11y-panel-tab { display: none; }
.a11y-panel-tab.a11y-active { display: block; }

/* ── Section label ── */
.a11y-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #595959;
  margin: 12px 0 5px;
}
.a11y-section-label:first-child { margin-top: 0; }

/* ── Profile toggle rows ── */
.a11y-profile-row {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.a11y-profile-info { flex: 1; min-width: 0; }
.a11y-profile-name { font-size: 0.78rem; font-weight: 600; color: #222; }
.a11y-profile-desc { font-size: 0.66rem; color: #595959; margin-top: 1px; line-height: 1.3; }

/* OFF / ON toggle */
.a11y-offon {
  display: flex;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #d0d3e3;
  flex-shrink: 0;
}
.a11y-offon-btn {
  padding: 4px 9px;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: #f0f2fa;
  color: #aaa;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.a11y-offon-btn + .a11y-offon-btn { border-left: 1px solid #d0d3e3; }
.a11y-offon-btn.active-off { background: #e8eaf6; color: #555; }
.a11y-offon-btn.active-on  { background: #1569f6; color: #fff; }
.a11y-offon-btn:focus-visible { outline: 2px solid #1569f6; outline-offset: -2px; }

/* ── Steppers ── */
.a11y-stepper-card {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.a11y-stepper-label { flex: 1; font-size: 0.78rem; font-weight: 600; color: #222; }
.a11y-stepper-controls { display: flex; align-items: center; gap: 6px; }
.a11y-step-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1.5px solid #d0d3e3;
  background: #f0f2fa;
  color: #333;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.a11y-step-btn:hover { background: #1569f6; color: #fff; border-color: #1569f6; }
.a11y-step-btn:focus-visible { outline: 2px solid #1569f6; outline-offset: 2px; }
.a11y-step-val {
  font-size: 0.78rem;
  font-weight: 700;
  color: #1569f6;
  min-width: 20px;
  text-align: center;
}

/* ── Toggle cards (2-col grid) ── */
.a11y-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}
.a11y-toggle-card {
  background: #fff;
  border-radius: 8px;
  padding: 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-size: 0.7rem;
  font-weight: 600;
  color: #333;
  transition: border-color 0.15s, background 0.15s;
  min-height: 52px;
  justify-content: center;
  line-height: 1.2;
}
.a11y-toggle-card[aria-pressed="true"] {
  border-color: #1569f6;
  background: #ebf0ff;
  color: #1569f6;
}
.a11y-toggle-card:focus-visible { outline: 2px solid #1569f6; outline-offset: 2px; }
.a11y-card-icon { display: none; }

/* ── Color swatches ── */
.a11y-swatch-row {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  gap: 7px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  flex-wrap: wrap;
}
.a11y-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.a11y-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.12);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.a11y-swatch:hover { transform: scale(1.15); }
.a11y-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px #1569f6; }
.a11y-swatch:focus-visible { outline: 2px solid #1569f6; outline-offset: 2px; }
.a11y-swatch-clear {
  margin-left: auto;
  background: none;
  border: none;
  color: #595959;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.a11y-swatch-clear:hover { color: #e53935; }
.a11y-swatch-clear:focus-visible { outline: 2px solid #1569f6; outline-offset: 2px; }

/* ── Dynamic overlays ── */
#a11y-guide {
  position: fixed;
  left: 0; right: 0;
  height: 3px;
  background: rgba(255,220,0,0.9);
  box-shadow: 0 0 0 1px rgba(200,160,0,0.4);
  pointer-events: none;
  z-index: 999980;
  display: none;
}
#a11y-mask-top, #a11y-mask-bot {
  position: fixed;
  left: 0; right: 0;
  background: rgba(0,0,0,0.75);
  pointer-events: none;
  z-index: 999979;
  display: none;
}
#a11y-magnifier {
  position: fixed;
  background: #fff;
  border: 2px solid #1569f6;
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 1.4rem;
  font-weight: 600;
  max-width: 240px;
  pointer-events: none;
  z-index: 999985;
  display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  line-height: 1.3;
}

/* ── Stepper effects (only active when JS sets a non-zero delta) ── */
html[style*="--a11y-font-delta"] { font-size: calc(16px + calc(var(--a11y-font-delta) * 1px)) !important; }
html[style*="--a11y-lh-delta"]   body { line-height: calc(1.5 + calc(var(--a11y-lh-delta) * 0.15)) !important; }
html[style*="--a11y-ls-delta"]   body { letter-spacing: calc(var(--a11y-ls-delta) * 0.025em) !important; }

/* ──────────────────────────────────────────
   WCAG Effect Classes (applied to <html>)
   ────────────────────────────────────────── */
html.a11y-seizure * { animation: none !important; transition: none !important; }
html.a11y-seizure video { display: none !important; }

html.a11y-low-vision { filter: contrast(1.25) !important; }

html.a11y-adhd * { transition-duration: 0.05s !important; animation-duration: 0.05s !important; }
html.a11y-adhd p, html.a11y-adhd li { line-height: 1.8 !important; }

html.a11y-cognitive p, html.a11y-cognitive li {
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 1.05em !important;
  line-height: 1.85 !important;
  letter-spacing: 0.02em !important;
}

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

html.a11y-older * { font-size: calc(1em + 2px) !important; line-height: 1.75 !important; }

/* Content */
html.a11y-readable * { font-family: Arial, Helvetica, sans-serif !important; }
html.a11y-titles h1, html.a11y-titles h2, html.a11y-titles h3,
html.a11y-titles h4, html.a11y-titles h5, html.a11y-titles h6 {
  text-decoration: underline !important; text-decoration-color: #1569f6 !important; text-underline-offset: 4px !important;
}
html.a11y-links a { background: #fffb8f !important; color: #000 !important; outline: 1px solid #e0c000 !important; border-radius: 2px !important; }
html.a11y-center p, html.a11y-center li, html.a11y-center h1, html.a11y-center h2, html.a11y-center h3 { text-align: center !important; }
html.a11y-left   p, html.a11y-left   li, html.a11y-left   h1, html.a11y-left   h2, html.a11y-left   h3 { text-align: left !important; }
html.a11y-right  p, html.a11y-right  li, html.a11y-right  h1, html.a11y-right  h2, html.a11y-right  h3 { text-align: right !important; }

/* Color modes */
html.a11y-dark-contrast  { filter: invert(1) hue-rotate(180deg) !important; }
html.a11y-dark-contrast  img, html.a11y-dark-contrast  video { filter: invert(1) hue-rotate(180deg) !important; }
html.a11y-light-contrast { filter: contrast(0.8) brightness(1.1) !important; }
html.a11y-high-contrast  { filter: contrast(2) !important; }
html.a11y-high-saturation { filter: saturate(2.5) !important; }
html.a11y-low-saturation  { filter: saturate(0.3) !important; }
html.a11y-monochrome      { filter: grayscale(1) !important; }

/* Orientation */
html.a11y-hide-images img, html.a11y-hide-images picture, html.a11y-hide-images svg { visibility: hidden !important; }
html.a11y-read-mode main { max-width: 720px !important; margin: 40px auto !important; font-size: 1.1rem !important; line-height: 1.9 !important; }
html.a11y-stop-anim * { animation: none !important; transition: none !important; }
html.a11y-highlight-hover *:hover { outline: 3px solid #e53935 !important; outline-offset: 2px !important; }
html.a11y-highlight-focus *:focus { outline: 4px solid #1569f6 !important; outline-offset: 3px !important; box-shadow: 0 0 0 6px rgba(21,105,246,0.18) !important; }
html.a11y-cursor-black * { 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 d='M8 2 L8 26 L14 20 L18 30 L21 29 L17 19 L25 19 Z' fill='black' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E") 8 2, auto !important; }
html.a11y-cursor-white * { 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 d='M8 2 L8 26 L14 20 L18 30 L21 29 L17 19 L25 19 Z' fill='white' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") 8 2, auto !important; }
