/* ==========================================================================
   a11y by ShaferTech — accessibility widget UI
   ========================================================================== */
.a11y-fab {
  position: fixed;
  right: clamp(0.85rem, 2vw, 1.5rem);
  bottom: clamp(0.85rem, 2vw, 1.5rem);
  z-index: 9995;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: linear-gradient(150deg, var(--gold-400), var(--gold-500));
  color: var(--blue-900);
  box-shadow: 0 10px 26px rgba(16, 35, 58, 0.32);
  display: grid;
  place-items: center;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.a11y-fab:hover { transform: scale(1.06); box-shadow: 0 14px 32px rgba(16, 35, 58, 0.4); }
.a11y-fab:active { transform: scale(0.98); }
.a11y-fab svg { width: 30px; height: 30px; }

/* Backdrop */
.a11y-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9996;
  background: rgba(0, 35, 63, 0.42);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t) var(--ease), visibility var(--t);
}
.a11y-backdrop.open { opacity: 1; visibility: visible; }

/* Panel */
.a11y-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 9997;
  width: min(420px, 100vw);
  background: #fff;
  color: var(--ink-900);
  box-shadow: -18px 0 50px rgba(16, 35, 58, 0.28);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--t) var(--ease);
  font-family: var(--font-body);
}
.a11y-panel.open { transform: translateX(0); }
.a11y-panel * { letter-spacing: normal; }

.a11y-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  background: linear-gradient(150deg, var(--blue-800), var(--blue-900));
  color: #fff;
}
.a11y-head .a11y-mark {
  width: 40px; height: 40px; flex: none;
  border-radius: 11px;
  background: rgba(255,255,255,0.12);
  display: grid; place-items: center;
}
.a11y-head .a11y-mark svg { width: 24px; height: 24px; color: var(--gold-400); }
.a11y-head h2 { color: #fff; font-size: 1.12rem; margin: 0; line-height: 1.1; }
.a11y-head p { color: #b9cde0; font-size: 0.78rem; margin: 2px 0 0; }
.a11y-close {
  margin-left: auto;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08);
  color: #fff;
  display: grid; place-items: center;
}
.a11y-close:hover { background: rgba(255,255,255,0.18); }
.a11y-close svg { width: 22px; height: 22px; }

.a11y-body { flex: 1; overflow-y: auto; padding: 1.1rem 1.25rem 1.5rem; }
.a11y-body::-webkit-scrollbar { width: 10px; }
.a11y-body::-webkit-scrollbar-thumb { background: #cdd9e6; border-radius: 10px; border: 3px solid #fff; }

.a11y-group { margin-bottom: 1.4rem; }
.a11y-group > h3 {
  font-family: var(--font-display);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--blue-700);
  margin-bottom: 0.7rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.a11y-group > h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Profile buttons */
.a11y-profiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }
.a11y-profile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  text-align: left;
  color: var(--ink-700);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.a11y-profile:hover { border-color: var(--gold-500); transform: translateY(-1px); }
.a11y-profile .pic { width: 30px; height: 30px; border-radius: 9px; background: var(--blue-050); color: var(--blue-700); display: grid; place-items: center; }
.a11y-profile .pic svg { width: 18px; height: 18px; }
.a11y-profile .pname { font-weight: 600; font-size: 0.86rem; color: var(--blue-800); font-family: var(--font-display); }
.a11y-profile[aria-pressed="true"] { border-color: var(--gold-500); background: var(--gold-050); box-shadow: inset 0 0 0 1px var(--gold-500); }
.a11y-profile[aria-pressed="true"] .pic { background: var(--gold-100); color: var(--gold-600); }

/* Segmented controls */
.a11y-field { margin-bottom: 0.95rem; }
.a11y-field > .a11y-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-weight: 600; font-size: 0.88rem; color: var(--ink-900); margin-bottom: 0.45rem;
}
.a11y-field > .a11y-label .val { color: var(--gold-600); font-variant-numeric: tabular-nums; }
.seg { display: flex; gap: 0.35rem; background: var(--bg-alt); padding: 0.3rem; border-radius: 12px; }
.seg button {
  flex: 1;
  padding: 0.5rem 0.4rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-700);
  font-weight: 600;
  font-size: 0.82rem;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.seg button:hover { color: var(--blue-800); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--blue-800); box-shadow: var(--shadow-sm); }

/* Text size stepper */
.a11y-stepper { display: flex; align-items: center; gap: 0.6rem; }
.a11y-stepper button {
  width: 42px; height: 42px; flex: none;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--blue-800);
  font-size: 1.3rem; font-weight: 700;
  display: grid; place-items: center;
}
.a11y-stepper button:hover { border-color: var(--gold-500); background: var(--gold-050); }
.a11y-stepper input[type="range"] { flex: 1; accent-color: var(--gold-500); height: 6px; }

/* Toggle tools */
.a11y-tools { display: grid; gap: 0.45rem; }
.a11y-toggle {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: #fff;
  text-align: left; width: 100%;
  color: var(--ink-900);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.a11y-toggle:hover { border-color: var(--gold-500); }
.a11y-toggle .tic { width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--blue-050); color: var(--blue-700); display: grid; place-items: center; }
.a11y-toggle .tic svg { width: 18px; height: 18px; }
.a11y-toggle .tlabel { flex: 1; font-weight: 600; font-size: 0.88rem; }
.a11y-switch {
  width: 42px; height: 24px; flex: none;
  border-radius: 999px;
  background: #cdd9e6;
  position: relative;
  transition: background var(--t-fast) var(--ease);
}
.a11y-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform var(--t-fast) var(--ease);
}
.a11y-toggle[aria-pressed="true"] { border-color: var(--gold-500); background: var(--gold-050); }
.a11y-toggle[aria-pressed="true"] .a11y-switch { background: var(--gold-500); }
.a11y-toggle[aria-pressed="true"] .a11y-switch::after { transform: translateX(18px); }
.a11y-toggle[aria-pressed="true"] .tic { background: var(--gold-100); color: var(--gold-600); }

/* Footer / reset */
.a11y-foot {
  border-top: 1px solid var(--line);
  padding: 0.9rem 1.25rem;
  background: var(--bg-alt);
}
.a11y-reset {
  width: 100%;
  padding: 0.75rem;
  border-radius: 11px;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--blue-800);
  font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.a11y-reset:hover { border-color: var(--blue-800); background: var(--blue-050); }
.a11y-reset svg { width: 18px; height: 18px; }
.a11y-credit {
  text-align: center;
  margin-top: 0.8rem;
  font-size: 0.76rem;
  color: var(--ink-500);
}
.a11y-credit strong { color: var(--blue-800); font-weight: 700; }
.a11y-credit a { color: var(--blue-700); font-weight: 600; text-decoration: none; }
.a11y-credit a:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .a11y-panel { width: 100vw; }
  .a11y-profiles { grid-template-columns: repeat(2, 1fr); }
}

/* keep widget unaffected by page color filters / contrast overrides handled by being outside #app */
