/**
 * apps/website/accessibility.css
 * Comprehensive SEBI & W3C WCAG 2.1 Level AA / AAA Accessibility System
 * Project WOWW — Wealth Intelligence & Family Office Platform
 *
 * Grounded in:
 * - SEBI Official Accessibility Standards (https://www.sebi.gov.in/accessibility-features.html)
 * - W3C Web Content Accessibility Guidelines (WCAG) 2.1 Level AA & AAA
 * - Universal Design for Visual, Cognitive, Motor, and Auditory Accessibility
 */

/* ==========================================================================
   1. KEYBOARD NAVIGATION: SKIP LINKS & ENHANCED FOCUS RING
   ========================================================================== */
.a11y-skip-link {
  position: fixed;
  top: -120px;
  left: 20px;
  z-index: 1000000;
  background: #000000 !important;
  color: #FFD700 !important;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 14px 26px;
  border: 3px solid #FFD700;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
  text-decoration: underline;
  transition: top 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.a11y-skip-link:focus,
.a11y-skip-link:focus-visible {
  top: 18px;
  outline: 4px solid #FFFFFF !important;
  outline-offset: 4px;
}

/* Enhanced Focus Ring: Always visible on keyboard tab focus */
:focus-visible {
  outline: 3.5px solid #FFD700 !important;
  outline-offset: 3px !important;
}

/* ==========================================================================
   2. FLOATING TRIGGER BUTTON (Bottom-Right / Bottom-Left)
   ========================================================================== */
.a11y-widget-wrapper {
  position: fixed;
  bottom: 54px;
  right: 24px;
  z-index: 99990;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  transition: right 0.3s ease, left 0.3s ease;
}

/* Docked Left position */
body.a11y-dock-left .a11y-widget-wrapper {
  right: auto;
  left: 24px;
}

.a11y-trigger-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #08152F;
  color: #FFE58F;
  border: 2px solid #D4AF37;
  border-radius: 50px;
  padding: 10px 20px 10px 14px;
  cursor: pointer;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 18px rgba(212, 175, 55, 0.4);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.a11y-trigger-btn:hover {
  background: #11285A;
  border-color: #FFD700;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(255, 215, 0, 0.55);
  transform: translateY(-2px);
}

.a11y-trigger-btn:focus-visible {
  outline: 4px solid #FFD700 !important;
  outline-offset: 4px;
}

.a11y-trigger-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #FFE58F, #D4AF37) !important;
  background-color: #D4AF37 !important;
  color: #08152F !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  flex-shrink: 0;
}

.a11y-trigger-label {
  display: inline-block;
  white-space: nowrap;
}

.a11y-trigger-pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 10px #10B981;
  animation: a11yPulse 2s infinite;
}

@keyframes a11yPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ==========================================================================
   3. ACCESSIBILITY OPTIONS DROPDOWN PANEL
   ========================================================================== */
.a11y-dropdown-panel {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 440px;
  max-width: calc(100vw - 32px);
  max-height: 82vh;
  overflow-y: auto;
  background: #08152F;
  border: 2px solid #D4AF37;
  border-radius: 18px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8), 0 0 35px rgba(212, 175, 55, 0.3);
  color: #F8FAFC;
  display: none;
  flex-direction: column;
  z-index: 99995;
  animation: a11ySlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: #D4AF37 #08152F;
}

body.a11y-dock-left .a11y-dropdown-panel {
  right: auto;
  left: 0;
}

.a11y-dropdown-panel.is-open {
  display: flex;
}

@keyframes a11ySlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel Header */
.a11y-panel-header {
  padding: 16px 20px;
  background: linear-gradient(180deg, #10244F 0%, #08152F 100%);
  border-bottom: 1.5px solid rgba(212, 175, 55, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 3;
}

.a11y-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.a11y-header-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FFE58F, #D4AF37);
  color: #08152F;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 900;
  flex-shrink: 0;
}

.a11y-header-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #FFFFFF;
  margin: 0;
  line-height: 1.2;
}

.a11y-header-compliance {
  font-size: 0.7rem;
  color: #D4AF37;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  display: block;
  margin-top: 2px;
}

.a11y-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.a11y-reset-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #E2E8F0;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.a11y-reset-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #EF4444;
  color: #FCA5A5;
}

.a11y-close-btn {
  background: none;
  border: none;
  color: #94A3B8;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.a11y-close-btn:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.12);
}

/* Panel Body & Sections */
.a11y-panel-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.a11y-section-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94A3B8;
  font-weight: 800;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.a11y-section-title .a11y-val-badge {
  color: #D4AF37;
  font-size: 0.72rem;
  font-family: monospace;
  font-weight: 700;
}

/* 1. Text Sizing Group (SEBI Standard) */
.a11y-size-btn-group {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
}

.a11y-size-btn {
  background: #112248;
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #F8FAFC;
  border-radius: 8px;
  padding: 8px 3px;
  text-align: center;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.a11y-size-btn .size-lbl {
  font-size: 0.95rem;
}

.a11y-size-btn .size-pct {
  font-size: 0.62rem;
  color: #94A3B8;
  font-weight: 500;
}

.a11y-size-btn:hover {
  border-color: #FFD700;
  background: #162E62;
}

.a11y-size-btn.active {
  background: linear-gradient(135deg, #D4AF37, #B89228);
  border-color: #FFE58F;
  color: #08152F;
}

.a11y-size-btn.active .size-pct {
  color: #08152F;
  font-weight: 800;
}

/* 2. Contrast Schemes Grid (SEBI Standard) */
.a11y-contrast-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.a11y-contrast-btn {
  background: #112248;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  color: #F8FAFC;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  transition: all 0.2s ease;
  text-align: left;
}

.a11y-contrast-btn:hover {
  border-color: #FFD700;
  background: #162E62;
}

.a11y-contrast-btn.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: #FFD700;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
  color: #FFE58F;
}

.a11y-preview-chip {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.a11y-preview-default { background: linear-gradient(135deg, #153F91, #D4AF37); }
.a11y-preview-hc { background: #000000; border-color: #FFD700; }
.a11y-preview-mono { background: #64748B; }
.a11y-preview-dark { background: #000000; border-color: #FFFFFF; }
.a11y-preview-light { background: #FFFDF0; border-color: #000000; }
.a11y-preview-inv { background: #FFFFFF; border-color: #000; }

/* 3. Feature Toggles List */
.a11y-toggles-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.a11y-toggle-row {
  background: #112248;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.a11y-toggle-row:hover {
  background: #162E62;
  border-color: rgba(212, 175, 55, 0.4);
}

.a11y-toggle-row.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: #D4AF37;
}

.a11y-toggle-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.a11y-toggle-icon {
  font-size: 1.15rem;
}

.a11y-toggle-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #F8FAFC;
}

.a11y-toggle-desc {
  font-size: 0.67rem;
  color: #94A3B8;
  margin-top: 1px;
}

.a11y-switch-pill {
  width: 40px;
  height: 22px;
  background: #334155;
  border-radius: 22px;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.a11y-switch-pill::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform 0.2s ease;
}

.a11y-toggle-row.active .a11y-switch-pill {
  background: #D4AF37;
}

.a11y-toggle-row.active .a11y-switch-pill::after {
  transform: translateX(18px);
}

/* 4. Screen Reader Audio Assistance (SEBI Standard) */
.a11y-audio-controls {
  background: #112248;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.a11y-audio-buttons {
  display: flex;
  gap: 8px;
}

.a11y-audio-btn {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #F8FAFC;
  border-radius: 6px;
  padding: 9px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.a11y-audio-btn:hover {
  background: #162E62;
  border-color: #FFD700;
  color: #FFE58F;
}

.a11y-audio-btn.active {
  background: #10B981;
  border-color: #34D399;
  color: #FFFFFF;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.a11y-audio-speed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #94A3B8;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.a11y-speed-pills {
  display: flex;
  gap: 4px;
}

.a11y-speed-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #CBD5E1;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  cursor: pointer;
}

.a11y-speed-pill.active {
  background: #D4AF37;
  color: #08152F;
  font-weight: 800;
  border-color: #FFE58F;
}

.a11y-audio-status {
  font-size: 0.72rem;
  color: #FFE58F;
  font-style: italic;
  min-height: 18px;
}

/* 5. Dock Switch & Footer */
.a11y-dock-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(212, 175, 55, 0.4);
  border-radius: 8px;
  padding: 9px 14px;
}

.a11y-dock-btn {
  background: #112248;
  border: 1.5px solid rgba(212, 175, 55, 0.5);
  color: #FFE58F;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.a11y-dock-btn:hover {
  background: #D4AF37;
  color: #08152F;
}

.a11y-panel-footer {
  padding: 12px 20px;
  background: #050D1E;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  font-size: 0.72rem;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.a11y-panel-footer a {
  color: #D4AF37;
  text-decoration: underline;
  font-weight: 600;
}

/* ==========================================================================
   4. ACTIVE ACCESSIBILITY MUTATIONS ACROSS ENTIRE WEBSITE
   ========================================================================== */

/* 4a. Fluid Text Scaling (SEBI Customized Text Size) */
html.a11y-scale-85 { font-size: 13.5px !important; }
html.a11y-scale-90 { font-size: 14.5px !important; }
html.a11y-scale-100 { font-size: 16px !important; }
html.a11y-scale-115 { font-size: 18.5px !important; }
html.a11y-scale-130 { font-size: 21px !important; }
html.a11y-scale-150 { font-size: 24px !important; }

/* 4b. High Contrast Yellow-on-Black (SEBI Standard) */
html.a11y-high-contrast,
html.a11y-high-contrast body {
  background-color: #000000 !important;
  color: #FFFFFF !important;
}

html.a11y-high-contrast .hero-section,
html.a11y-high-contrast .section,
html.a11y-high-contrast .site-header,
html.a11y-high-contrast .site-footer,
html.a11y-high-contrast .bento-tile,
html.a11y-high-contrast .card,
html.a11y-high-contrast .theme-bar,
html.a11y-high-contrast .solutions-card,
html.a11y-high-contrast .swiss-drawer-row,
html.a11y-high-contrast .sanctuary-card,
html.a11y-high-contrast .monaco-card,
html.a11y-high-contrast .form-group input,
html.a11y-high-contrast .form-group select,
html.a11y-high-contrast .form-group textarea {
  background-color: #000000 !important;
  border-color: #FFD700 !important;
  color: #FFFFFF !important;
  box-shadow: none !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 .main-heading,
html.a11y-high-contrast .sub-heading,
html.a11y-high-contrast strong {
  color: #FFD700 !important;
}

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

html.a11y-high-contrast .btn-primary,
html.a11y-high-contrast .nav-cta,
html.a11y-high-contrast button {
  background: #FFD700 !important;
  color: #000000 !important;
  border: 2px solid #FFFFFF !important;
  font-weight: 800 !important;
}

/* 4c. Dark High Contrast (White on Black) */
html.a11y-contrast-dark,
html.a11y-contrast-dark body {
  background-color: #000000 !important;
  color: #FFFFFF !important;
}
html.a11y-contrast-dark * {
  border-color: #475569 !important;
}
html.a11y-contrast-dark a {
  color: #60A5FA !important;
  text-decoration: underline !important;
}

/* 4d. Light High Contrast (Black on Pale Cream) */
html.a11y-contrast-light,
html.a11y-contrast-light body {
  background-color: #FFFDF0 !important;
  color: #000000 !important;
}
html.a11y-contrast-light .hero-section,
html.a11y-contrast-light .section,
html.a11y-contrast-light .site-header,
html.a11y-contrast-light .site-footer,
html.a11y-contrast-light .card,
html.a11y-contrast-light .bento-tile,
html.a11y-contrast-light .theme-bar {
  background-color: #FFFFFF !important;
  color: #000000 !important;
  border-color: #000000 !important;
  box-shadow: none !important;
}
html.a11y-contrast-light h1,
html.a11y-contrast-light h2,
html.a11y-contrast-light h3,
html.a11y-contrast-light h4,
html.a11y-contrast-light strong {
  color: #000000 !important;
}

/* 4e. Monochrome / Grayscale Scheme */
html.a11y-monochrome {
  filter: grayscale(100%) !important;
}

/* 4f. Inverted Scheme */
html.a11y-invert {
  filter: invert(100%) hue-rotate(180deg) !important;
}
html.a11y-invert img,
html.a11y-invert video,
html.a11y-invert iframe {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* 4g. Dyslexia-Friendly Typography (Weighted baselines) */
html.a11y-dyslexic * {
  font-family: 'OpenDyslexic', 'Lexend', 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.08em !important;
}

/* 4h. Enhanced Text Spacing (WCAG 1.4.12 Success Criterion) */
html.a11y-spacing * {
  line-height: 1.95 !important;
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}
html.a11y-spacing p,
html.a11y-spacing li {
  margin-bottom: 1.6em !important;
}

/* 4i. Highlight Interactive Links */
html.a11y-highlight-links a {
  background-color: #FEF08A !important;
  color: #1E1B4B !important;
  text-decoration: underline 2.5px solid #1E1B4B !important;
  font-weight: 800 !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  box-shadow: 0 0 6px rgba(254, 240, 138, 0.8) !important;
}

/* 4j. Highlight Headings */
html.a11y-highlight-headings h1,
html.a11y-highlight-headings h2,
html.a11y-highlight-headings h3,
html.a11y-highlight-headings h4 {
  outline: 2px dashed #FFD700 !important;
  outline-offset: 4px !important;
  padding: 4px !important;
}

/* 4k. Large High-Contrast Mouse Cursor */
html.a11y-large-cursor,
html.a11y-large-cursor * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24' fill='%23FFD700' stroke='%23000000' stroke-width='1.8'><polygon points='3,2 3,21 8,16 13,22 16,20 11,14 18,14'/></svg>"), auto !important;
}

/* 4l. Pause Animations & Motion (Vestibular & Seizure Protection) */
html.a11y-pause-animations *,
html.a11y-pause-animations *::before,
html.a11y-pause-animations *::after {
  animation-play-state: paused !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001s !important;
  scroll-behavior: auto !important;
}

/* 4m. Reading Ruler Guide Bar */
.a11y-reading-ruler {
  position: fixed;
  left: 0;
  width: 100vw;
  height: 42px;
  background: rgba(255, 215, 0, 0.15);
  border-top: 2.5px solid #FFD700;
  border-bottom: 2.5px solid #FFD700;
  pointer-events: none;
  z-index: 999998;
  display: none;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

body.a11y-ruler-active .a11y-reading-ruler {
  display: block;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .a11y-widget-wrapper {
    bottom: 52px;
    right: 12px;
  }
  body.a11y-dock-left .a11y-widget-wrapper {
    left: 12px;
  }
  .a11y-dropdown-panel {
    width: calc(100vw - 24px);
    right: 0;
  }
  body.a11y-dock-left .a11y-dropdown-panel {
    left: 0;
  }
  .a11y-trigger-label {
    display: none;
  }
  .a11y-trigger-btn {
    padding: 10px;
    border-radius: 50%;
  }
}
