/*
 * AMASAMYA platform - Accessibility Preferences Panel
 *
 * Shared across all AMASAMYA subdomain pages so the accessibility
 * settings surface matches the portfolio and stays consistent across
 * landing, FAQ, about, feedback, limitations, credits, and privacy.
 *
 * Uses fallback colours for every var() reference so this stylesheet
 * works even when included on a page whose CSS variable scheme
 * differs from landing.html's. The dark hex fallbacks pair correctly
 * with the platform's blue-navy palette.
 *
 * v4.3.1 - 2026-07-08
 */

/* ── Toggle button in the platform nav / header ─────────────────── */
.a11y-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  background: none;
  border: 2px solid var(--primary, #003366);
  border-radius: 50%;
  cursor: pointer;
  color: var(--primary, #003366);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}
.a11y-toggle:hover,
.a11y-toggle:focus-visible {
  background: rgba(0, 51, 102, 0.06);
  border-color: var(--accent-2, #0369a1);
  color: var(--accent-2, #0369a1);
}
.a11y-toggle:focus-visible {
  outline: 3px solid var(--accent, #7ec8e3);
  outline-offset: 2px;
}
.a11y-toggle svg { width: 22px; height: 22px; }

/* ── Backdrop ─────────────────────────────────────────────────── */
.a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.a11y-backdrop.open { opacity: 1; visibility: visible; }

/* ── Sliding panel ────────────────────────────────────────────── */
.a11y-panel {
  position: fixed;
  top: 0; right: 0;
  width: 360px;
  max-width: 92vw;
  height: 100vh;
  background: var(--bg-2, #ffffff);
  color: var(--text, #1a2a3a);
  border-left: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: -8px 0 30px rgba(15, 23, 42, 0.14);
  z-index: 2000;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  overflow-y: auto;
}
.a11y-panel.open { transform: translateX(0); }
.a11y-panel[hidden] { display: block !important; }
/* aria-modal="true" on the dialog element does the SR work; we override
   the hidden attribute so the sliding animation from off-screen can
   still be seen when the user opens the panel. */

.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}
.a11y-panel-header h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--primary, #003366);
  font-weight: 700;
}
.a11y-panel-close {
  background: none;
  border: 2px solid rgba(15, 23, 42, 0.15);
  border-radius: 50%;
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text, #1a2a3a);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.a11y-panel-close:hover,
.a11y-panel-close:focus-visible {
  border-color: var(--accent-2, #0369a1);
  color: var(--accent-2, #0369a1);
}
.a11y-panel-close:focus-visible {
  outline: 3px solid var(--accent, #7ec8e3);
  outline-offset: 2px;
}

.a11y-panel-body {
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}
.a11y-option {
  border: none;
  padding: 0;
  margin: 0;
}
.a11y-option legend,
.a11y-option-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text, #1a2a3a);
  margin-bottom: 0.5rem;
  display: block;
}

/* Text size row ─────────────────────────────────────────────── */
.a11y-text-sizes {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.a11y-size-btn {
  width: 48px;
  height: 48px;
  border: 2px solid rgba(15, 23, 42, 0.15);
  border-radius: var(--r, 8px);
  background: var(--bg, #f8fafc);
  color: var(--text, #1a2a3a);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.a11y-size-btn:hover { border-color: var(--accent-2, #0369a1); color: var(--accent-2, #0369a1); }
.a11y-size-btn:focus-visible {
  outline: 3px solid var(--accent, #7ec8e3);
  outline-offset: 2px;
  border-color: var(--accent-2, #0369a1);
}
.a11y-size-btn[aria-pressed="true"] {
  border-color: var(--primary, #003366);
  background: var(--primary, #003366);
  color: #fff;
}

/* Switches (contrast, dyslexia, motion) ──────────────────────── */
.a11y-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.a11y-switch-label {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text, #1a2a3a);
}
.a11y-switch {
  --sw-w: 44px;
  --sw-h: 24px;
  position: relative;
  width: var(--sw-w);
  height: var(--sw-h);
  min-width: var(--sw-w);
  border: 2px solid rgba(15, 23, 42, 0.15);
  border-radius: 999px;
  background: var(--bg, #f8fafc);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.a11y-switch::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 3px;
  width: calc(var(--sw-h) - 8px);
  height: calc(var(--sw-h) - 8px);
  background: var(--text-muted, #475569);
  border-radius: 50%;
  transform: translateY(-50%);
  transition: left 0.2s ease, background-color 0.2s ease;
}
.a11y-switch[aria-checked="true"] {
  background: var(--primary, #003366);
  border-color: var(--primary, #003366);
}
.a11y-switch[aria-checked="true"]::after {
  left: calc(var(--sw-w) - var(--sw-h) + 1px);
  background: #fff;
}
.a11y-switch:focus-visible {
  outline: 3px solid var(--accent, #7ec8e3);
  outline-offset: 2px;
}

/* Reset button ──────────────────────────────────────────────── */
.a11y-reset {
  margin-top: 0.25rem;
  padding: 0.65rem 1rem;
  background: transparent;
  border: 2px solid rgba(15, 23, 42, 0.15);
  color: var(--text, #1a2a3a);
  border-radius: var(--r, 8px);
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.a11y-reset:hover,
.a11y-reset:focus-visible {
  border-color: #b91c1c;
  color: #b91c1c;
}
.a11y-reset:focus-visible {
  outline: 3px solid var(--accent, #7ec8e3);
  outline-offset: 2px;
}

/* ── Site-wide preference application via data-* on <html> ────── */

/* Text size. Portfolio uses the same attribute name so users who
   navigate portfolio → platform → back experience continuous
   preferences. */
html[data-text-size="large"]  { font-size: 112.5%; }
html[data-text-size="larger"] { font-size: 125%; }

/* High contrast. Darker text, sharper background, prominent focus. */
html[data-high-contrast="true"] {
  background: #ffffff !important;
}
html[data-high-contrast="true"] body,
html[data-high-contrast="true"] main,
html[data-high-contrast="true"] .container,
html[data-high-contrast="true"] header[role="banner"] {
  background: #ffffff !important;
  color: #000000 !important;
}
html[data-high-contrast="true"] header[role="banner"] { border-bottom-color: #000; }
html[data-high-contrast="true"] a { color: #003366 !important; text-decoration: underline; }
html[data-high-contrast="true"] :focus-visible {
  outline: 4px solid #000 !important;
  outline-offset: 2px;
}

/* Dyslexia-friendly font. Uses OpenDyslexic where available with a
   safe stack fallback so we never depend on an external font file. */
html[data-dyslexia-font="true"] body,
html[data-dyslexia-font="true"] main,
html[data-dyslexia-font="true"] header[role="banner"] {
  font-family: 'OpenDyslexic', 'Comic Sans MS', 'Trebuchet MS', 'Verdana', sans-serif !important;
  letter-spacing: 0.02em;
  line-height: 1.75;
}

/* Reduce motion. Neutralises decorative transitions site-wide. Does
   not override the user's OS-level prefers-reduced-motion, which is
   already respected by the platform's default animations. */
html[data-reduce-motion="true"] *,
html[data-reduce-motion="true"] *::before,
html[data-reduce-motion="true"] *::after {
  animation-duration: 0.001s !important;
  animation-delay: 0s !important;
  transition-duration: 0.001s !important;
  scroll-behavior: auto !important;
}

/* Screen-reader-only helper (used inside size-button labels). */
.a11y-panel .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;
}
