/* ============================================================
 * حضانة الرغد — Accessibility widget + floating UI kit
 * ============================================================ */

/* ---------- Skip-to-content link ---------- */
.skip-link {
  position: absolute;
  top: -80px;
  right: 16px;
  z-index: 10000;
  background: var(--pink, #ff8fa3);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 16px; outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- Global focus rings ---------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--pink, #ff8fa3);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ============================================================
 * ACCESSIBILITY WIDGET (right side in RTL, left in visual terms
 * of the viewport). User asked for widget on RIGHT — in an RTL
 * layout that means logical inline-start, which is right.
 * ============================================================ */

.a11y-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a2d6f, #7b59a3);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 10px 24px rgba(74, 45, 111, 0.35);
  font-size: 26px;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease, box-shadow .25s ease;
}
.a11y-toggle:hover { transform: scale(1.08) rotate(8deg); }
.a11y-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

.a11y-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: 80vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.20);
  padding: 20px;
  z-index: 9997;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, transform .25s, visibility 0s linear .25s;
  font-family: inherit;
  color: #2d2438;
}
.a11y-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition: opacity .25s, transform .25s;
}

.a11y-panel h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: #4a2d6f;
  font-weight: 900;
}
.a11y-panel p.a11y-lead {
  margin: 0 0 14px;
  font-size: .82rem;
  color: #6b6478;
}

.a11y-panel .a11y-close {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: #f3f0f7;
  color: #4a2d6f;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.a11y-panel .a11y-close:hover { background: #e5dff0; }

.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.a11y-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 2px solid #ece7f4;
  background: #fafafa;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: .82rem;
  color: #2d2438;
  font-weight: 600;
  transition: background .18s, border-color .18s, transform .18s;
  text-align: center;
  min-height: 78px;
}
.a11y-btn:hover { background: #f3f0f7; border-color: #c7b8ea; }
.a11y-btn.active {
  background: #4a2d6f;
  border-color: #4a2d6f;
  color: #fff;
}
.a11y-btn .a11y-ic {
  font-size: 22px;
  line-height: 1;
}
.a11y-btn.a11y-reset {
  grid-column: span 2;
  background: linear-gradient(135deg, #ff8fa3, #ffd6a5);
  color: #fff;
  border-color: transparent;
  min-height: 44px;
  flex-direction: row;
  gap: 8px;
}
.a11y-btn.a11y-reset:hover { filter: brightness(1.05); }

.a11y-panel .a11y-hide {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: none;
  border: 0;
  color: #8a8397;
  cursor: pointer;
  font-size: .78rem;
  text-decoration: underline;
  font-family: inherit;
}
.a11y-panel .a11y-hide:hover { color: #4a2d6f; }

.a11y-panel .a11y-kbd-hint {
  margin: 8px 0 0;
  font-size: .72rem;
  color: #8a8397;
  text-align: center;
}

/* ============================================================
 * A11Y FEATURE STATES — the 11 features
 * ============================================================ */

/* 1 & 2 & 3: text size (larger / largest / default via class removal) */
html.a11y-text-large  { font-size: 118%; }
html.a11y-text-xl     { font-size: 135%; }

/* 4. Grayscale */
html.a11y-grayscale { filter: grayscale(100%); }

/* 5. High contrast */
html.a11y-high-contrast body,
html.a11y-high-contrast .section,
html.a11y-high-contrast .hero,
html.a11y-high-contrast .site-header,
html.a11y-high-contrast .site-footer {
  background: #000 !important;
  color: #ffff00 !important;
}
html.a11y-high-contrast h1, html.a11y-high-contrast h2, html.a11y-high-contrast h3,
html.a11y-high-contrast p, html.a11y-high-contrast li, html.a11y-high-contrast span,
html.a11y-high-contrast a, html.a11y-high-contrast label {
  color: #ffff00 !important;
  background: transparent !important;
}
html.a11y-high-contrast a { color: #00ffff !important; text-decoration: underline !important; }
html.a11y-high-contrast .btn { background: #ffff00 !important; color: #000 !important; border-color: #ffff00 !important; }

/* 6. Negative contrast — invert colors while keeping images intact */
html.a11y-negative { filter: invert(1) hue-rotate(180deg); background: #fff; }
html.a11y-negative img,
html.a11y-negative video,
html.a11y-negative iframe { filter: invert(1) hue-rotate(180deg); }

/* 7. Light / plain background */
html.a11y-light-bg body,
html.a11y-light-bg .section,
html.a11y-light-bg .hero,
html.a11y-light-bg .site-footer,
html.a11y-light-bg .site-header {
  background: #ffffff !important;
  color: #000 !important;
}
html.a11y-light-bg .hero-bg { display: none !important; }

/* 8. Underline all links */
html.a11y-underline-links a { text-decoration: underline !important; }

/* 9. Readable font (dyslexia-friendly) — larger spacing, plain font */
html.a11y-readable-font,
html.a11y-readable-font body,
html.a11y-readable-font * {
  font-family: "Tahoma", "Arial", "Segoe UI", sans-serif !important;
}
html.a11y-readable-font body {
  letter-spacing: 0.03em !important;
  word-spacing: 0.10em !important;
  line-height: 1.85 !important;
}

/* 10. Big cursor */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'><path d='M8 4 L8 52 L20 44 L28 60 L36 56 L28 40 L44 40 Z' fill='%23000' stroke='%23fff' stroke-width='3'/></svg>") 4 4, auto !important;
}

/* 11. Stop animations */
html.a11y-no-motion,
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;
}

/* When widget itself is hidden by user */
body.a11y-widget-hidden .a11y-toggle,
body.a11y-widget-hidden .a11y-panel { display: none !important; }
body.a11y-widget-hidden .a11y-reveal { display: flex !important; }

.a11y-reveal {
  display: none;
  position: fixed;
  right: 8px;
  bottom: 8px;
  width: 28px; height: 28px;
  align-items: center; justify-content: center;
  background: #fff;
  border: 1px solid #ccc;
  color: #666;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  z-index: 9998;
  opacity: 0.6;
}
.a11y-reveal:hover { opacity: 1; }

/* ============================================================
 * WHATSAPP FAB (left side)
 * ============================================================ */
.wa-fab {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 10px 24px rgba(37, 211, 102, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  transition: transform .25s ease;
  text-decoration: none;
}
.wa-fab:hover { transform: scale(1.08); }
.wa-fab:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.wa-fab svg { width: 30px; height: 30px; fill: #fff; }
.wa-fab .wa-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: #25d366;
  opacity: 0.35;
  animation: waPulse 2.2s ease-out infinite;
  z-index: -1;
}
@keyframes waPulse {
  0% { transform: scale(0.95); opacity: 0.35; }
  70% { transform: scale(1.6); opacity: 0; }
  100% { opacity: 0; }
}

/* Share FAB — sits above WhatsApp on the left */
.share-fab {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  color: #4a2d6f;
  border: 2px solid #e5dff0;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  cursor: pointer;
  font-size: 22px;
  transition: transform .2s ease, background .2s ease;
}
.share-fab:hover { transform: translateY(-2px); background: #f8f5fd; }
.share-fab:focus-visible { outline: 3px solid var(--pink, #ff8fa3); outline-offset: 3px; }

.share-toast {
  position: fixed;
  left: 20px;
  bottom: 150px;
  background: #2d2438;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: .85rem;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.share-toast.show { opacity: 1; }

/* ============================================================
 * BACK-TO-TOP button (LEFT side, stacked above the share button)
 * Left stack, bottom → top: Share (20) → Top (82)
 * ============================================================ */
.to-top {
  position: fixed;
  left: 20px;
  bottom: 82px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #fff;
  color: #4a2d6f;
  border: 2px solid #e5dff0;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9997;
  font-size: 22px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: transform .3s ease, opacity .3s ease, visibility 0s linear .3s;
}
.to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: transform .3s ease, opacity .3s ease;
}
.to-top:hover { background: #f8f5fd; transform: translateY(-2px); }
.to-top:focus-visible { outline: 3px solid var(--pink, #ff8fa3); outline-offset: 3px; }

/* ============================================================
 * MOBILE tweaks
 * ============================================================ */
@media (max-width: 720px) {
  .a11y-toggle, .wa-fab { width: 48px; height: 48px; }
  .a11y-toggle { font-size: 22px; right: 14px; bottom: 14px; }
  .wa-fab { left: 14px; bottom: 14px; }
  .wa-fab svg { width: 26px; height: 26px; }
  .share-fab { left: 14px; bottom: 74px; width: 44px; height: 44px; font-size: 20px; }
  .to-top { left: 14px; bottom: 130px; width: 44px; height: 44px; font-size: 20px; }
  .a11y-panel { right: 14px; bottom: 74px; width: calc(100vw - 28px); }
}

/* ============================================================
 * Legal pages (privacy / terms / accessibility)
 * ============================================================ */
.legal-page {
  padding-block: 40px 80px;
}
.legal-page .container {
  max-width: 820px;
}
.legal-page h1 {
  color: var(--pink, #ff8fa3);
  margin-bottom: 8px;
}
.legal-page .last-updated {
  color: #8a8397;
  font-size: .95rem;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0e6ea;
}
.legal-page h2 {
  color: #2d2438;
  font-size: 1.35rem;
  margin-top: 32px;
  padding-top: 8px;
}
.legal-page h3 {
  color: #4a3c2e;
  font-size: 1.1rem;
  margin-top: 20px;
}
.legal-page p, .legal-page li {
  color: #4a3c2e;
  line-height: 1.9;
}
.legal-page ul, .legal-page ol {
  margin: 12px 0 20px;
  padding-inline-start: 24px;
  list-style: disc;
}
.legal-page ol { list-style: decimal; }
.legal-page ul li, .legal-page ol li { margin-bottom: 8px; }
.legal-page .callout {
  background: #fff8f0;
  border-inline-start: 4px solid var(--pink, #ff8fa3);
  padding: 16px 20px;
  border-radius: 12px;
  margin: 20px 0;
}
.legal-page a {
  color: #4a2d6f;
  text-decoration: underline;
}
.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #f0e6ea;
  color: #2d2438;
  text-decoration: none;
  font-weight: 700;
  font-size: .95rem;
}
.legal-back:hover { border-color: var(--pink, #ff8fa3); color: var(--pink, #ff8fa3); }
