/* ==========================================================================
   CLEANFACTORY ACCESSIBILITY ENGINE (Display & Usability Tools)
   Production-Grade Display & Usability Accessibility Utility
   ========================================================================== */

/* 1. Root & Base Text Scaling */
html[data-a11y-text-scale="1"] { font-size: 110% !important; }
html[data-a11y-text-scale="2"] { font-size: 120% !important; }
html[data-a11y-text-scale="3"] { font-size: 130% !important; }

/* 2. High Contrast Dark (Yellow on Black) */
html[data-a11y-contrast="dark-high"] {
  --primary-color: #ffff00 !important;
  --secondary-color: #ffffff !important;
  --accent-color: #ffff00 !important;
  --accent-hover: #ffffff !important;
  --text-color: #ffff00 !important;
  --text-light: #ffffff !important;
  --bg-light: #0f0f0f !important;
  --white: #000000 !important;
  --shadow: 0 0 0 2px #ffff00 !important;
}
html[data-a11y-contrast="dark-high"] body {
  background: #000000 !important;
  color: #ffff00 !important;
}
html[data-a11y-contrast="dark-high"] .navbar,
html[data-a11y-contrast="dark-high"] .hero,
html[data-a11y-contrast="dark-high"] .treatment-card,
html[data-a11y-contrast="dark-high"] .article-card,
html[data-a11y-contrast="dark-high"] .stat-item,
html[data-a11y-contrast="dark-high"] .contact-card,
html[data-a11y-contrast="dark-high"] .contact-form-card,
html[data-a11y-contrast="dark-high"] .legal-card,
html[data-a11y-contrast="dark-high"] .accordion-header,
html[data-a11y-contrast="dark-high"] .accordion-body {
  background: #000000 !important;
  color: #ffff00 !important;
  border: 1px solid #ffff00 !important;
}

/* 3. High Contrast Light (Black on White) */
html[data-a11y-contrast="light-high"] {
  --primary-color: #000000 !important;
  --secondary-color: #111111 !important;
  --accent-color: #000000 !important;
  --accent-hover: #222222 !important;
  --text-color: #000000 !important;
  --text-light: #222222 !important;
  --bg-light: #f4f4f4 !important;
  --white: #ffffff !important;
  --shadow: 0 0 0 2px #000000 !important;
}
html[data-a11y-contrast="light-high"] body {
  background: #ffffff !important;
  color: #000000 !important;
}
html[data-a11y-contrast="light-high"] .navbar,
html[data-a11y-contrast="light-high"] .treatment-card,
html[data-a11y-contrast="light-high"] .article-card,
html[data-a11y-contrast="light-high"] .stat-item,
html[data-a11y-contrast="light-high"] .contact-card,
html[data-a11y-contrast="light-high"] .contact-form-card,
html[data-a11y-contrast="light-high"] .legal-card,
html[data-a11y-contrast="light-high"] .accordion-header,
html[data-a11y-contrast="light-high"] .accordion-body {
  background: #ffffff !important;
  color: #000000 !important;
  border: 1px solid #000000 !important;
}

/* 4. Monochrome / Grayscale */
html[data-a11y-monochrome="true"] {
  filter: grayscale(100%) !important;
}

/* 5. Invert Colors (Preserves media images/videos) */
html[data-a11y-invert="true"] {
  filter: invert(100%) hue-rotate(180deg) !important;
}
html[data-a11y-invert="true"] img,
html[data-a11y-invert="true"] video,
html[data-a11y-invert="true"] svg,
html[data-a11y-invert="true"] picture {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* 6. Readable Font */
html[data-a11y-readable-font="true"],
html[data-a11y-readable-font="true"] * {
  font-family: Arial, Helvetica, Tahoma, sans-serif !important;
  letter-spacing: 0.03em !important;
}

/* 7. Text Spacing & Line Height */
html[data-a11y-text-spacing="true"] body,
html[data-a11y-text-spacing="true"] p,
html[data-a11y-text-spacing="true"] span,
html[data-a11y-text-spacing="true"] li,
html[data-a11y-text-spacing="true"] h1,
html[data-a11y-text-spacing="true"] h2,
html[data-a11y-text-spacing="true"] h3,
html[data-a11y-text-spacing="true"] h4 {
  line-height: 1.95 !important;
  letter-spacing: 0.08em !important;
  word-spacing: 0.12em !important;
}

/* 8. Highlight Links */
html[data-a11y-highlight-links="true"] a {
  text-decoration: underline 3px #ffff00 !important;
  background-color: rgba(255, 235, 59, 0.4) !important;
  color: #000000 !important;
  font-weight: 700 !important;
  padding: 0 4px !important;
  border-radius: 4px !important;
}

/* 9. Highlight Headings */
html[data-a11y-highlight-headings="true"] h1,
html[data-a11y-highlight-headings="true"] h2,
html[data-a11y-highlight-headings="true"] h3,
html[data-a11y-highlight-headings="true"] h4 {
  outline: 2px dashed #C5A059 !important;
  outline-offset: 4px !important;
}

/* 10. Large Cursor */
html[data-a11y-big-cursor="true"],
html[data-a11y-big-cursor="true"] * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 24 24' fill='%230F2027' stroke='%23ffffff' stroke-width='1.5'%3E%3Cpath d='m3 3 7 18 3-7 7-3z'/%3E%3C/svg%3E"), auto !important;
}

/* 11. Stop Animations */
html[data-a11y-stop-anim="true"] *,
html[data-a11y-stop-anim="true"] *::before,
html[data-a11y-stop-anim="true"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* 12. Reading Guide Line */
.a11y-reading-guide {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(197, 160, 89, 0.95);
  box-shadow: 0 0 12px rgba(197, 160, 89, 0.8);
  pointer-events: none;
  z-index: 999999;
  transform: translateY(-50%);
}

/* 13. Top Skip Link */
.skip-link {
  position: absolute;
  top: -60px;
  inset-inline-start: 16px;
  background: var(--primary-color, #0F2027);
  color: var(--accent-color, #C5A059);
  padding: 10px 18px;
  font-weight: bold;
  border-radius: 6px;
  z-index: 1000000;
  transition: top 0.2s ease;
  text-decoration: none;
  border: 2px solid var(--accent-color, #C5A059);
}
.skip-link:focus {
  top: 16px;
}

/* 14. Floating Accessibility Trigger Button */
.a11y-floating-btn {
  position: fixed;
  bottom: 24px;
  inset-inline-end: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0F2027 0%, #203A43 100%);
  color: #C5A059;
  border: 2px solid #C5A059;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99999;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.a11y-floating-btn:hover,
.a11y-floating-btn:focus-visible {
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(197, 160, 89, 0.4);
  outline: 3px solid #C5A059;
  outline-offset: 3px;
}
.a11y-floating-btn .a11y-badge {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #0F2027;
  display: none;
}

/* 15. Modal Backdrop & Accessibility Panel */
.a11y-modal-backdrop,
.a11y-stmt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 23, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: a11yFadeIn 0.25s ease-out;
}

@keyframes a11yFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.a11y-panel,
.a11y-stmt-card {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(197, 160, 89, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: a11ySlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] .a11y-panel,
[data-theme="dark"] .a11y-stmt-card {
  background: #122129;
  color: #f1f5f9;
  border-color: rgba(197, 160, 89, 0.4);
}

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

.a11y-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #0F2027 0%, #203A43 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #C5A059;
}

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

.a11y-header-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(197, 160, 89, 0.2);
  color: #C5A059;
  display: flex;
  align-items: center;
  justify-content: center;
}

.a11y-header-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.a11y-header-sub {
  font-size: 0.8rem;
  color: #C5A059;
}

.a11y-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.a11y-close-btn:hover,
.a11y-close-btn:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  outline: 2px solid #C5A059;
}

.a11y-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.a11y-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
[data-theme="dark"] .a11y-section-title {
  color: #94a3b8;
}

.a11y-text-size-bar {
  display: flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
}
[data-theme="dark"] .a11y-text-size-bar {
  background: #0A1217;
}

.a11y-size-btn {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.2s;
}
[data-theme="dark"] .a11y-size-btn {
  color: #cbd5e1;
}
.a11y-size-btn:hover,
.a11y-size-btn:focus-visible {
  background: #e2e8f0;
  outline: 2px solid #C5A059;
}
[data-theme="dark"] .a11y-size-btn:hover {
  background: #1e293b;
}
.a11y-size-btn.active {
  background: #ffffff;
  color: #0F2027;
  border-color: #C5A059;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
[data-theme="dark"] .a11y-size-btn.active {
  background: #1e293b;
  color: #C5A059;
}

.a11y-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.a11y-btn-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  text-align: start;
  transition: all 0.2s;
}
[data-theme="dark"] .a11y-btn-toggle {
  background: #0A1217;
  border-color: #1e293b;
  color: #cbd5e1;
}
.a11y-btn-toggle:hover,
.a11y-btn-toggle:focus-visible {
  background: #f1f5f9;
  border-color: #C5A059;
  outline: 2px solid #C5A059;
}
[data-theme="dark"] .a11y-btn-toggle:hover {
  background: #1e293b;
}
.a11y-btn-toggle.active {
  background: rgba(197, 160, 89, 0.15);
  border-color: #C5A059;
  color: #C5A059;
  font-weight: 700;
}
.a11y-btn-toggle svg {
  flex-shrink: 0;
}

.a11y-footer {
  padding: 14px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
[data-theme="dark"] .a11y-footer {
  background: #0A1217;
  border-color: #1e293b;
}

.a11y-reset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.a11y-reset-btn:hover,
.a11y-reset-btn:focus-visible {
  background: #fecaca;
  outline: 2px solid #b91c1c;
}

.a11y-statement-btn {
  padding: 8px 14px;
  background: transparent;
  color: #0F2027;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
[data-theme="dark"] .a11y-statement-btn {
  color: #e2e8f0;
  border-color: #334155;
}
.a11y-statement-btn:hover,
.a11y-statement-btn:focus-visible {
  background: #e2e8f0;
  border-color: #C5A059;
  outline: 2px solid #C5A059;
}
[data-theme="dark"] .a11y-statement-btn:hover {
  background: #1e293b;
}

/* Statement Card Specific */
.a11y-stmt-body {
  padding: 24px 20px;
  line-height: 1.7;
  font-size: 0.95rem;
}
