/* ==========================================================================
   accessibility.css – skip-link, focus vizibil (WCAG 2.1 AA) și widgetul de
   accesibilitate (buton ♿ + panou), adaptate la stilul site.css
   ========================================================================== */

/* ---------- skip-link ---------- */
.skip-to-main {
  position: absolute;
  top: -70px;
  left: 12px;
  background: var(--teal, #0b7080);
  color: #fff;
  padding: 10px 18px;
  text-decoration: none;
  z-index: 100000;
  font-weight: 700;
  font-size: 14px;
  border-radius: 0 0 10px 10px;
  transition: top 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.skip-to-main:focus {
  top: 0;
  color: #fff;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ---------- focus vizibil pentru tastatură ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--teal, #0b7080) !important;
  outline-offset: 3px !important;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* dimensiune minimă pentru atingere (WCAG 2.5.5) */
.site_header .nav-link,
.social_row a,
.lang_switch a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-contrast: high) {
  a { text-decoration: underline !important; }
  button, .btn_main, .btn_line, .btn_small { border: 2px solid currentColor !important; }
}

@media print {
  .site_header, .site_footer, .a11y-trigger, .a11y-panel, .a11y-overlay, .to_top, #cookieConsent, .lang_switch { display: none !important; }
}

/* ---------- butonul widgetului ---------- */
.a11y-trigger {
  position: fixed;
  bottom: 24px;
  right: 22px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--ink, #1c2b36);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.6);
  cursor: pointer;
  z-index: 99999;
  box-shadow: 0 10px 26px rgba(28, 43, 54, 0.35);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, background 0.25s ease;
  outline: none;
  padding: 0;
}

.a11y-trigger:hover {
  transform: scale(1.08);
  background: var(--teal, #0b7080);
}

.a11y-trigger[aria-expanded="true"] {
  background: var(--teal, #0b7080);
}

/* ---------- fundal și panou ---------- */
.a11y-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 30, 0.45);
  z-index: 99997;
  backdrop-filter: blur(2px);
}

.a11y-overlay.open { display: block; }

.a11y-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  max-width: 100vw;
  height: 100vh;
  background: #16222b;
  color: #eef2f4;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.32s;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  font-family: var(--sans, 'Lato', sans-serif);
}

.a11y-panel.open {
  transform: none;
  visibility: visible;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
}

.a11y-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #0f1a21;
  flex-shrink: 0;
}

.a11y-header h2 {
  margin: 0;
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.a11y-header h2 span { color: #5fc3d2; }

.a11y-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #cfd8dd;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.a11y-close:hover { background: var(--teal, #0b7080); color: #fff; }

.a11y-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(95, 195, 210, 0.4) transparent;
}

.a11y-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: #5fc3d2;
  padding: 16px 22px 6px;
  margin: 0;
}

.a11y-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 22px;
  transition: background 0.18s ease;
}

.a11y-row:hover { background: rgba(255, 255, 255, 0.05); }

.a11y-row-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.a11y-row-label {
  flex: 1;
  font-size: 0.9rem;
  color: #dfe6ea;
  line-height: 1.3;
}

/* comutatoare */
.a11y-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin: 0;
}

.a11y-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.a11y-toggle-track {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  transition: background 0.25s ease;
  cursor: pointer;
}

.a11y-toggle-track::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #9fb0b8;
  border-radius: 50%;
  transition: transform 0.25s ease, background 0.25s ease;
}

.a11y-toggle input:checked + .a11y-toggle-track { background: rgba(11, 112, 128, 0.55); }
.a11y-toggle input:checked + .a11y-toggle-track::before { transform: translateX(20px); background: #5fc3d2; }
.a11y-toggle input:focus-visible + .a11y-toggle-track { outline: 2px solid #5fc3d2; outline-offset: 2px; }

/* dimensiunea textului */
.a11y-font-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.a11y-font-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #eef2f4;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.a11y-font-btn:hover { background: var(--teal, #0b7080); border-color: var(--teal, #0b7080); color: #fff; }
.a11y-font-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.a11y-font-counter {
  font-size: 0.8rem;
  color: #5fc3d2;
  font-weight: 700;
  min-width: 26px;
  text-align: center;
  font-family: monospace;
}

.a11y-divider { height: 1px; background: rgba(255, 255, 255, 0.07); margin: 4px 22px; }

.a11y-footer { padding: 12px 22px 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); flex-shrink: 0; }

.a11y-reset {
  width: 100%;
  padding: 11px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  color: #cfd8dd;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.a11y-reset:hover { background: var(--teal, #0b7080); border-color: var(--teal, #0b7080); color: #fff; }

/* ghid de lectură */
.a11y-reading-guide {
  position: fixed;
  left: 0;
  right: 0;
  height: 34px;
  background: rgba(201, 162, 74, 0.14);
  border-top: 2px solid rgba(201, 162, 74, 0.7);
  border-bottom: 2px solid rgba(201, 162, 74, 0.7);
  pointer-events: none;
  z-index: 99990;
}

.a11y-speaking {
  background: rgba(11, 112, 128, 0.12) !important;
  outline: 2px solid rgba(11, 112, 128, 0.45) !important;
  border-radius: 4px;
}

/* ---------- clase aplicate pe <body> de widget ---------- */
body.a11y-letter-spacing * { letter-spacing: 0.1em !important; word-spacing: 0.16em !important; }

body.a11y-line-height p,
body.a11y-line-height li,
body.a11y-line-height td { line-height: 2.2 !important; }

body.a11y-dyslexia,
body.a11y-dyslexia * { font-family: 'Lexend', sans-serif !important; }

body.a11y-high-contrast { background: #000 !important; color: #fff !important; }
body.a11y-high-contrast *:not(.a11y-panel):not(.a11y-panel *):not(.a11y-trigger) {
  background-color: transparent !important;
  background-image: none !important;
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  box-shadow: none !important;
}
body.a11y-high-contrast a { color: #ffff00 !important; text-decoration: underline !important; }
body.a11y-high-contrast .site_header,
body.a11y-high-contrast .site_footer,
body.a11y-high-contrast .events_band,
body.a11y-high-contrast .cta_band,
body.a11y-high-contrast .quote_band { background: #000 !important; }
body.a11y-high-contrast .btn_main,
body.a11y-high-contrast .btn_line,
body.a11y-high-contrast .btn_small,
body.a11y-high-contrast .btn_light,
body.a11y-high-contrast button:not(.a11y-close):not(.a11y-font-btn):not(.a11y-reset):not(.a11y-trigger) {
  background: #fff !important;
  color: #000 !important;
  border: 2px solid #fff !important;
}
body.a11y-high-contrast .navbar-brand img { filter: invert(1); }
body.a11y-high-contrast img { filter: contrast(1.2); }
body.a11y-high-contrast .event_card,
body.a11y-high-contrast .news_card,
body.a11y-high-contrast .book_card,
body.a11y-high-contrast .feature,
body.a11y-high-contrast .form_card { outline: 1px solid rgba(255, 255, 255, 0.4); }

body.a11y-invert { filter: invert(1) hue-rotate(180deg); background: #fff; }
body.a11y-invert img,
body.a11y-invert video,
body.a11y-invert .a11y-panel,
body.a11y-invert .a11y-trigger { filter: invert(1) hue-rotate(180deg); }

body.a11y-highlight-links a:not(.a11y-trigger):not(.a11y-close):not(.a11y-reset):not(.navbar-brand):not(.book_cover):not(.art_item) {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  text-decoration-thickness: 2px !important;
  background: rgba(201, 162, 74, 0.18) !important;
  padding: 1px 3px !important;
  border-radius: 3px !important;
  color: #063f49 !important;
}

body.a11y-highlight-headings h1,
body.a11y-highlight-headings h2,
body.a11y-highlight-headings h3,
body.a11y-highlight-headings h4 {
  border-left: 4px solid var(--gold, #c9a24a) !important;
  padding-left: 10px !important;
  background: rgba(201, 162, 74, 0.08) !important;
  border-radius: 0 6px 6px 0 !important;
}

body.a11y-no-animations *,
body.a11y-no-animations *::before,
body.a11y-no-animations *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
body.a11y-no-animations .reveal { opacity: 1 !important; transform: none !important; }

body.a11y-tts-mode p,
body.a11y-tts-mode h1, body.a11y-tts-mode h2, body.a11y-tts-mode h3,
body.a11y-tts-mode h4, body.a11y-tts-mode h5, body.a11y-tts-mode h6,
body.a11y-tts-mode li { cursor: cell !important; }
body.a11y-tts-mode p:hover,
body.a11y-tts-mode li:hover { background: rgba(11, 112, 128, 0.08) !important; border-radius: 4px; }

@media (max-width: 480px) {
  .a11y-panel { width: 100vw; }
  .a11y-trigger { bottom: 18px; right: 16px; width: 50px; height: 50px; font-size: 22px; }
}
