/* ── Accessibility (IS 5568 / WCAG 2.0) ── */

.skip-link {
  position: absolute;
  top: -120px;
  right: 1rem;
  z-index: 10001;
  padding: 0.65rem 1rem;
  background: #fff;
  color: #000;
  border-radius: var(--radius);
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.skip-link:focus {
  top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[data-theme="dark"] :focus-visible {
  outline-color: #fff;
}

.a11y-widget {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 9999;
}

.a11y-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  min-height: 3rem;
  padding: 0.5rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.a11y-fab:hover,
.a11y-fab:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.a11y-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 0.5rem);
  width: min(280px, calc(100vw - 2rem));
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.a11y-panel[hidden] {
  display: none;
}

.a11y-panel-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.a11y-panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.a11y-btn {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: right;
  cursor: pointer;
}

.a11y-btn:hover,
.a11y-btn:focus-visible {
  border-color: var(--accent);
}

.a11y-btn.is-active {
  border-color: var(--accent);
  background: rgba(196, 69, 105, 0.15);
  color: var(--accent);
}

.a11y-panel-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.a11y-panel-footer a {
  color: var(--accent);
}

/* User preference modes */
html.a11y-font-lg {
  font-size: 106.25%;
}

html.a11y-font-xl {
  font-size: 118.75%;
}

html.a11y-high-contrast {
  --bg: #000;
  --surface: #000;
  --surface-2: #111;
  --border: #fff;
  --text: #fff;
  --muted: #e0e0e0;
  --accent: #ffeb3b;
  --accent-hover: #fff176;
  --success: #69f0ae;
  --error: #ff5252;
}

html.a11y-high-contrast .btn-primary {
  background: #ffeb3b;
  color: #000;
  border-color: #ffeb3b;
}

html.a11y-underline-links a {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

html.a11y-reduce-motion,
html.a11y-reduce-motion * {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

[role="alert"] {
  outline: none;
}

.chat-attach {
  min-width: 2.5rem;
  min-height: 2.5rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 480px) {
  .a11y-widget {
    left: 0.75rem;
    bottom: 0.75rem;
  }
}
