/* ============================================================
   EMAZIS — Accessibility Widget Stylesheet
   Premium floating accessibility panel
   ============================================================ */

/* ----- Trigger Button ----- */
.a11y-trigger {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 9998;
  background: #ffffff;
  color: var(--clr-blue);
  border: 2px solid var(--clr-blue);
  border-left: none;
  border-radius: 0 8px 8px 0;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 3px 2px 14px rgba(10, 46, 92, 0.3);
  transition: background 0.25s ease, transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

.a11y-trigger:hover {
  background: var(--clr-blue);
  color: #ffffff;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 3px 4px 18px rgba(26, 92, 173, 0.45);
}

.a11y-trigger:focus-visible {
  outline: 3px solid var(--clr-blue-light);
  outline-offset: 2px;
}

.a11y-trigger svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  pointer-events: none;
}

/* Hide trigger when panel is open */
.a11y-trigger[aria-expanded="true"] {
  opacity: 0;
  pointer-events: none;
}

/* ----- Overlay ----- */
.a11y-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(10, 46, 92, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.a11y-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ----- Panel ----- */
.a11y-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 340px;
  max-width: 92vw;
  height: 100vh;
  z-index: 9999;
  background: var(--clr-white);
  box-shadow: 4px 0 30px rgba(10, 46, 92, 0.15);
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.a11y-panel.is-open {
  transform: translateX(0);
}

/* Panel header */
.a11y-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  background: var(--clr-navy);
  color: var(--clr-white);
  flex-shrink: 0;
}

.a11y-panel__title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.a11y-panel__title svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

.a11y-panel__close {
  background: none;
  border: none;
  color: var(--clr-white);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.a11y-panel__close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.a11y-panel__close:focus-visible {
  outline: 2px solid var(--clr-blue-light);
  outline-offset: 2px;
}

.a11y-panel__close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  pointer-events: none;
}

/* Panel body */
.a11y-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--clr-gray-light) transparent;
}

.a11y-panel__body::-webkit-scrollbar {
  width: 5px;
}

.a11y-panel__body::-webkit-scrollbar-track {
  background: transparent;
}

.a11y-panel__body::-webkit-scrollbar-thumb {
  background: var(--clr-gray-light);
  border-radius: 3px;
}

/* Section groups */
.a11y-group {
  margin-bottom: 1.25rem;
}

.a11y-group__label {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--clr-gray);
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--clr-gray-light);
}

/* Control buttons */
.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.a11y-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.7rem 0.4rem;
  min-height: 64px;
  border: 1.5px solid var(--clr-gray-light);
  border-radius: 6px;
  background: var(--clr-white);
  color: var(--clr-dark);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.a11y-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: var(--clr-navy);
  transition: fill 0.2s ease;
}

.a11y-btn:hover {
  border-color: var(--clr-blue);
  background: var(--clr-off-white);
}

.a11y-btn:focus-visible {
  outline: 3px solid var(--clr-blue-light);
  outline-offset: 1px;
}

/* Active state */
.a11y-btn[aria-pressed="true"] {
  background: var(--clr-navy);
  border-color: var(--clr-navy);
  color: var(--clr-white);
}

.a11y-btn[aria-pressed="true"] svg {
  fill: var(--clr-white);
}

/* Special buttons: reset / sitemap */
.a11y-btn--reset {
  border-color: #fecaca;
  color: #b91c1c;
}

.a11y-btn--reset svg {
  fill: #b91c1c;
}

.a11y-btn--reset:hover {
  background: #fef2f2;
  border-color: #f87171;
}

.a11y-btn--link {
  border-color: var(--clr-gray-light);
}

/* Text size controls */
.a11y-size-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.a11y-size-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.55rem 0.5rem;
  border: 1.5px solid var(--clr-gray-light);
  border-radius: 6px;
  background: var(--clr-white);
  color: var(--clr-dark);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.a11y-size-btn svg {
  width: 16px;
  height: 16px;
  fill: var(--clr-navy);
  flex-shrink: 0;
}

.a11y-size-btn:hover {
  border-color: var(--clr-blue);
  background: var(--clr-off-white);
}

.a11y-size-btn:focus-visible {
  outline: 3px solid var(--clr-blue-light);
  outline-offset: 1px;
}

.a11y-size-value {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--clr-navy);
  min-width: 40px;
  text-align: center;
}

/* TTS controls */
.a11y-tts {
  display: flex;
  gap: 0.4rem;
}

.a11y-tts-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.55rem 0.3rem;
  border: 1.5px solid var(--clr-gray-light);
  border-radius: 6px;
  background: var(--clr-white);
  color: var(--clr-dark);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.a11y-tts-btn svg {
  width: 15px;
  height: 15px;
  fill: var(--clr-navy);
  flex-shrink: 0;
}

.a11y-tts-btn:hover {
  border-color: var(--clr-blue);
  background: var(--clr-off-white);
}

.a11y-tts-btn:focus-visible {
  outline: 3px solid var(--clr-blue-light);
  outline-offset: 1px;
}

.a11y-tts-btn.is-active {
  background: var(--clr-navy);
  border-color: var(--clr-navy);
  color: var(--clr-white);
}

.a11y-tts-btn.is-active svg {
  fill: var(--clr-white);
}

.a11y-tts-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Panel footer */
.a11y-panel__footer {
  flex-shrink: 0;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--clr-gray-light);
  font-size: 0.68rem;
  color: var(--clr-gray);
  text-align: center;
}

/* ============================================================
   GLOBAL ACCESSIBILITY MODE CLASSES
   Applied to <html> element
   ============================================================ */

/* --- Grayscale --- */
html.a11y-grayscale {
  filter: grayscale(100%);
}

/* --- Light background / reading mode --- */
html.a11y-light-bg body {
  background-color: #fffef5 !important;
}

html.a11y-light-bg .section--alt {
  background-color: #faf8ed !important;
}

html.a11y-light-bg p,
html.a11y-light-bg li,
html.a11y-light-bg td,
html.a11y-light-bg span {
  color: #1a1a1a !important;
}

/* --- Underlined links --- */
html.a11y-underline-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

html.a11y-underline-links a:hover {
  text-decoration-thickness: 2px !important;
}

/* --- Readable font --- */
html.a11y-readable-font * {
  font-family: Georgia, 'Times New Roman', serif !important;
  letter-spacing: 0.01em;
}

html.a11y-readable-font h1,
html.a11y-readable-font h2,
html.a11y-readable-font h3,
html.a11y-readable-font h4 {
  font-family: Georgia, 'Times New Roman', serif !important;
}

/* --- Dark mode --- */
html.a11y-dark-mode body {
  background-color: #121820 !important;
  color: #d8dee6 !important;
}

html.a11y-dark-mode .header {
  background: #0d1520 !important;
  border-bottom-color: #1a3050 !important;
}

html.a11y-dark-mode .header--solid,
html.a11y-dark-mode .header--transparent {
  background: #0d1520 !important;
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.3) !important;
}

html.a11y-dark-mode h1,
html.a11y-dark-mode h2,
html.a11y-dark-mode h3,
html.a11y-dark-mode h4,
html.a11y-dark-mode h5,
html.a11y-dark-mode h6 {
  color: #e2e8f0 !important;
}

html.a11y-dark-mode p,
html.a11y-dark-mode li,
html.a11y-dark-mode td,
html.a11y-dark-mode span,
html.a11y-dark-mode label {
  color: #c5cdd8 !important;
}

html.a11y-dark-mode a {
  color: #6db8f2 !important;
}

html.a11y-dark-mode .section--alt {
  background-color: #161e2a !important;
}

html.a11y-dark-mode .section {
  background-color: #121820 !important;
}

html.a11y-dark-mode .footer {
  background: #0a1018 !important;
}

html.a11y-dark-mode .btn--primary {
  background-color: #2d7bd6 !important;
}

html.a11y-dark-mode input,
html.a11y-dark-mode textarea,
html.a11y-dark-mode select {
  background: #1a2332 !important;
  color: #d8dee6 !important;
  border-color: #2a3a4e !important;
}

html.a11y-dark-mode .news-card,
html.a11y-dark-mode .card,
html.a11y-dark-mode .expertise-card {
  background: #1a2332 !important;
  border-color: #2a3a4e !important;
}

html.a11y-dark-mode .nav__link {
  color: #c5cdd8 !important;
}

html.a11y-dark-mode .a11y-panel {
  background: #1a2332;
}

html.a11y-dark-mode .a11y-btn {
  background: #1e2a3a;
  border-color: #2a3a4e;
  color: #d8dee6;
}

html.a11y-dark-mode .a11y-btn svg {
  fill: #6db8f2;
}

html.a11y-dark-mode .a11y-btn:hover {
  background: #243348;
  border-color: #3a5a7e;
}

html.a11y-dark-mode .a11y-btn[aria-pressed="true"] {
  background: var(--clr-blue);
  border-color: var(--clr-blue);
  color: #fff;
}

html.a11y-dark-mode .a11y-group__label {
  color: #7a8a9e;
  border-bottom-color: #2a3a4e;
}

html.a11y-dark-mode .a11y-panel__footer {
  border-top-color: #2a3a4e;
  color: #5a6a7e;
}

html.a11y-dark-mode .a11y-size-btn,
html.a11y-dark-mode .a11y-tts-btn {
  background: #1e2a3a;
  border-color: #2a3a4e;
  color: #d8dee6;
}

html.a11y-dark-mode .a11y-size-btn svg,
html.a11y-dark-mode .a11y-tts-btn svg {
  fill: #6db8f2;
}

html.a11y-dark-mode .a11y-size-value {
  color: #6db8f2;
}

html.a11y-dark-mode .a11y-trigger {
  background: #1e2a3a;
  border-color: #6db8f2;
  color: #6db8f2;
  box-shadow: 3px 2px 14px rgba(0, 0, 0, 0.5);
}

html.a11y-dark-mode .a11y-trigger:hover {
  background: #6db8f2;
  color: #0d1520;
}

/* --- High contrast --- */
html.a11y-high-contrast body {
  background-color: #000 !important;
  color: #fff !important;
}

html.a11y-high-contrast h1,
html.a11y-high-contrast h2,
html.a11y-high-contrast h3,
html.a11y-high-contrast h4,
html.a11y-high-contrast h5,
html.a11y-high-contrast h6,
html.a11y-high-contrast p,
html.a11y-high-contrast li,
html.a11y-high-contrast td,
html.a11y-high-contrast th,
html.a11y-high-contrast span,
html.a11y-high-contrast label {
  color: #fff !important;
}

html.a11y-high-contrast a {
  color: #ffff00 !important;
  text-decoration: underline !important;
}

html.a11y-high-contrast .header,
html.a11y-high-contrast .header--solid,
html.a11y-high-contrast .header--transparent {
  background: #000 !important;
  border-bottom-color: #fff !important;
}

html.a11y-high-contrast .section,
html.a11y-high-contrast .section--alt {
  background-color: #000 !important;
}

html.a11y-high-contrast .footer {
  background: #000 !important;
  color: #fff !important;
}

html.a11y-high-contrast .btn--primary {
  background: #ffff00 !important;
  color: #000 !important;
  border: 2px solid #ffff00 !important;
}

html.a11y-high-contrast img {
  filter: contrast(1.2);
}

html.a11y-high-contrast input,
html.a11y-high-contrast textarea,
html.a11y-high-contrast select {
  background: #000 !important;
  color: #fff !important;
  border: 2px solid #fff !important;
}

html.a11y-high-contrast .news-card,
html.a11y-high-contrast .card,
html.a11y-high-contrast .expertise-card {
  background: #111 !important;
  border: 2px solid #fff !important;
}

html.a11y-high-contrast .a11y-panel {
  background: #111;
  border-right: 2px solid #fff;
}

html.a11y-high-contrast .a11y-btn {
  background: #000;
  border: 2px solid #fff;
  color: #fff;
}

html.a11y-high-contrast .a11y-btn svg {
  fill: #ffff00;
}

html.a11y-high-contrast .a11y-btn[aria-pressed="true"] {
  background: #ffff00;
  color: #000;
  border-color: #ffff00;
}

html.a11y-high-contrast .a11y-btn[aria-pressed="true"] svg {
  fill: #000;
}

html.a11y-high-contrast .a11y-trigger {
  background: #ffff00;
  border-color: #ffff00;
  color: #000;
  box-shadow: 3px 2px 14px rgba(255, 255, 0, 0.4);
}

html.a11y-high-contrast .a11y-trigger:hover {
  background: #fff;
  color: #000;
}

/* --- Reduced motion --- */
html.a11y-reduced-motion *,
html.a11y-reduced-motion *::before,
html.a11y-reduced-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* --- Dyslexia-friendly --- */
html.a11y-dyslexia * {
  font-family: 'OpenDyslexic', 'Comic Sans MS', 'Arial', sans-serif !important;
  word-spacing: 0.16em !important;
  letter-spacing: 0.04em !important;
}

html.a11y-dyslexia p,
html.a11y-dyslexia li,
html.a11y-dyslexia td {
  line-height: 2 !important;
}

/* --- Text spacing --- */
html.a11y-text-spacing p,
html.a11y-text-spacing li,
html.a11y-text-spacing td,
html.a11y-text-spacing span,
html.a11y-text-spacing label,
html.a11y-text-spacing div {
  line-height: 2 !important;
  letter-spacing: 0.06em !important;
  word-spacing: 0.12em !important;
}

html.a11y-text-spacing p {
  margin-bottom: 1.5em !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .a11y-panel {
    width: 100vw;
    max-width: 100vw;
  }

  .a11y-trigger {
    width: 40px;
    height: 40px;
  }

  .a11y-trigger svg {
    width: 18px;
    height: 18px;
  }
}
