/* ========================================
   OFFART A11y Widget — Floating Accessibility Panel
   - Trigger: gold orb (bottom-left, above dock)
   - Panel: glassmorphic, RTL, keyboard accessible
   - Persists user prefs to localStorage
   ======================================== */

/* --- Trigger Button --- */
.a11y-trigger {
  position: fixed;
  bottom: 32px;
  left: 24px;
  z-index: 9500;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(15,15,15,0.92) 0%, rgba(30,30,30,0.92) 100%);
  border: 1px solid rgba(201, 168, 76, 0.55);
  color: #c9a84c;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.55), 0 0 0 0 rgba(201,168,76,0);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.3s ease,
              border-color 0.3s ease;
  padding: 0;
}

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

.a11y-trigger:hover {
  transform: scale(1.08);
  border-color: #c9a84c;
  box-shadow: 0 14px 36px rgba(0,0,0,0.6), 0 0 0 6px rgba(201,168,76,0.12);
}

.a11y-trigger[aria-expanded="true"] {
  background: linear-gradient(135deg, #c9a84c 0%, #d9b85c 100%);
  color: #050505;
  border-color: #c9a84c;
}

.a11y-trigger:focus { outline: none; }
.a11y-trigger:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.9);
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .a11y-trigger {
    bottom: auto;
    top: 50%;
    left: 0;
    width: 32px;
    height: 64px;
    border-radius: 0 32px 32px 0;
    border-left: none;
    transform: translateY(-50%);
    transform-origin: left center;
  }
  .a11y-trigger svg { width: 18px; height: 18px; }
  .a11y-trigger:hover {
    transform: translateY(-50%) scale(1.06);
  }
}

/* --- Backdrop --- */
.a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9498;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.a11y-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* --- Panel --- */
.a11y-panel {
  position: fixed;
  bottom: 88px;
  left: 24px;
  z-index: 9499;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 132px);
  max-height: calc(100dvh - 132px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(12, 12, 12, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(201, 168, 76, 0.4);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.7), 0 0 24px rgba(201, 168, 76, 0.12);
  padding: 0;
  color: #fff;
  font-family: 'Inter', sans-serif;
  direction: rtl;
  text-align: right;
  transform: translateY(12px) scale(0.96);
  transform-origin: bottom left;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.22s ease,
              visibility 0.22s ease;
}
.a11y-panel.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

@media (max-width: 768px) {
  .a11y-panel {
    bottom: 70px;
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
  }
}

.a11y-panel::-webkit-scrollbar { width: 6px; }
.a11y-panel::-webkit-scrollbar-thumb {
  background: rgba(201,168,76,0.3);
  border-radius: 6px;
}

/* --- Header (sticky so title stays visible while scrolling) --- */
.a11y-panel-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
  gap: 12px;
  background: rgba(12, 12, 12, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 20px 20px 0 0;
}
.a11y-panel-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #c9a84c;
  text-transform: uppercase;
  margin: 0;
}
.a11y-panel-close {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  padding: 0;
}
.a11y-panel-close:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.a11y-panel-close svg { width: 14px; height: 14px; }

/* --- Section --- */
.a11y-section {
  margin: 0 18px 12px;
}
.a11y-section:last-of-type {
  margin-bottom: 6px;
}
.a11y-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  margin: 0 0 6px;
}

/* --- Toggle list --- */
.a11y-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.a11y-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.75);
  border-radius: 12px;
  padding: 8px 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 11.5px;
  text-align: center;
  min-height: 60px;
}
.a11y-toggle svg {
  width: 20px;
  height: 20px;
  opacity: 0.85;
}
.a11y-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
}
.a11y-toggle.is-active {
  background: rgba(201,168,76,0.16);
  border-color: rgba(201,168,76,0.5);
  color: #c9a84c;
}
.a11y-toggle.is-active svg { opacity: 1; }

/* --- Steppers --- */
.a11y-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 6px 12px;
  margin: 0 18px 10px;
}
.a11y-stepper-label {
  font-size: 13px;
  color: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  gap: 8px;
}
.a11y-stepper-label svg {
  width: 18px;
  height: 18px;
  color: #c9a84c;
}
.a11y-stepper-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.a11y-stepper-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
  padding: 0;
}
.a11y-stepper-btn:hover {
  background: rgba(201,168,76,0.18);
  border-color: rgba(201,168,76,0.4);
  color: #c9a84c;
}
.a11y-stepper-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.a11y-stepper-value {
  min-width: 36px;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-variant-numeric: tabular-nums;
}

/* --- Footer --- */
.a11y-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 18px 14px;
  margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.a11y-reset-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.2s ease;
}
.a11y-reset-btn:hover {
  background: rgba(255,80,80,0.15);
  color: #ff8888;
  border-color: rgba(255,80,80,0.35);
}
.a11y-statement-link {
  color: #c9a84c;
  text-decoration: none;
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(201,168,76,0.4);
  padding-bottom: 1px;
  transition: all 0.2s ease;
}
.a11y-statement-link:hover {
  color: #d9b85c;
  border-bottom-color: #d9b85c;
}

/* ========================================
   GLOBAL A11Y PROFILE CLASSES
   ======================================== */

html.a11y-font-110 { font-size: 110%; }
html.a11y-font-120 { font-size: 120%; }
html.a11y-font-130 { font-size: 130%; }
html.a11y-font-140 { font-size: 140%; }
html.a11y-font-90  { font-size: 90%; }

html.a11y-contrast {
  filter: contrast(1.25);
}
html.a11y-contrast body,
html.a11y-contrast .glass-deck,
html.a11y-contrast .a11y-panel {
  background-color: #000 !important;
  color: #fff !important;
}
html.a11y-contrast :where(p, span, li, h1, h2, h3, h4, h5, h6, label, td, th) {
  color: #fff !important;
  text-shadow: none !important;
}
html.a11y-contrast a:not(.a11y-trigger):not(.a11y-statement-link) {
  color: #ffd84c !important;
  text-decoration: underline !important;
}
html.a11y-contrast button:not(.a11y-trigger):not(.a11y-toggle):not(.a11y-panel-close):not(.a11y-stepper-btn):not(.a11y-reset-btn) {
  background-color: #000 !important;
  color: #fff !important;
  border: 1px solid #fff !important;
}

html.a11y-grayscale {
  filter: grayscale(1) contrast(1.05);
}
html.a11y-grayscale.a11y-contrast {
  filter: grayscale(1) contrast(1.3);
}

html.a11y-links a:not(.a11y-trigger):not(.dock-pill):not(.dock-contact-btn) {
  background-color: #fff3a8 !important;
  color: #000 !important;
  text-decoration: underline !important;
  padding: 0 2px !important;
  border-radius: 2px !important;
}

html.a11y-readable,
html.a11y-readable * {
  font-family: 'Arial', 'Helvetica', sans-serif !important;
  letter-spacing: normal !important;
}
html.a11y-readable :where(h1, h2, h3, h4, h5, h6) {
  font-weight: 700 !important;
}

html.a11y-no-motion *,
html.a11y-no-motion *::before,
html.a11y-no-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
html.a11y-no-motion .hero-particles,
html.a11y-no-motion .pact-particles,
html.a11y-no-motion .svc-ripple,
html.a11y-no-motion .svc-core-ring,
html.a11y-no-motion .carousel-3d-track,
html.a11y-no-motion .hero-orb-ring,
html.a11y-no-motion .hero-accent-line {
  animation: none !important;
}

html.a11y-cursor,
html.a11y-cursor * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path fill='%23c9a84c' stroke='%23000' stroke-width='1' d='M5 3l14 9-7 1-3 7z'/></svg>") 0 0, auto !important;
}
html.a11y-cursor a,
html.a11y-cursor button,
html.a11y-cursor [role="button"] {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path fill='%23c9a84c' stroke='%23000' stroke-width='1' d='M12 2l-2 8h4z M12 22l-2-8h4z M2 12l8-2v4z M22 12l-8-2v4z'/></svg>") 16 16, pointer !important;
}

.a11y-reading-guide {
  position: fixed;
  left: 0;
  right: 0;
  height: 36px;
  background: rgba(201, 168, 76, 0.12);
  border-top: 1px solid rgba(201,168,76,0.55);
  border-bottom: 1px solid rgba(201,168,76,0.55);
  pointer-events: none;
  z-index: 9497;
  display: none;
}
html.a11y-reading-guide-on .a11y-reading-guide {
  display: block;
}

@media print {
  .a11y-trigger,
  .a11y-panel,
  .a11y-backdrop,
  .a11y-reading-guide { display: none !important; }
}
