/* ==========================================================================
   ZDSMA / WCAG 2.1 AA Accessibility Module Styles — Spletni Recepti
   ========================================================================== */

/* Screen-reader only utility */
.sr-only-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Global baseline keyboard focus indicator (WCAG 2.1 AA 2.4.7) */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid #1a56db !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.9) !important;
}

main[tabindex="-1"]:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Skip Links Bar */
.sr-skip-links {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 12000;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem;
  pointer-events: none;
}

.sr-skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  background: #111827;
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.65rem 1.1rem;
  border-radius: 0.5rem;
  border: 2px solid #ffeb3b;
  text-decoration: none !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  pointer-events: auto;
}

.sr-skip-link:focus,
.sr-skip-link:focus-visible {
  position: static;
  left: auto;
  outline: 3px solid #ffeb3b !important;
  outline-offset: 2px !important;
}

/* Floating Accessibility Launcher (bottom-left, opposite to bottom-right chatbot) */
.sr-a11y-root {
  position: fixed;
  left: 1.25rem;
  bottom: 1.35rem;
  z-index: 1086;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.sr-audio-dock-open .sr-a11y-root {
  bottom: 5.75rem;
}

.sr-a11y-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 46px;
  padding: 0 1rem 0 0.85rem;
  border-radius: 999px;
  border: 2px solid #1d4ed8;
  background: #1e3a8a;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(30, 58, 138, 0.32);
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.sr-a11y-fab i {
  font-size: 1.25rem;
  line-height: 1;
}

.sr-a11y-fab:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(29, 78, 216, 0.38);
}

.sr-a11y-fab-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fde047;
  border: 1px solid #111827;
}

.sr-a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  z-index: 1087;
}

/* Accessibility Dialog Panel */
.sr-a11y-panel {
  position: fixed;
  left: 1.25rem;
  bottom: 4.85rem;
  width: min(410px, calc(100vw - 1.5rem));
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  color: #111827;
  border: 1px solid #d1d5db;
  border-radius: 1rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  z-index: 1088;
  overflow: hidden;
}

.sr-a11y-panel[hidden],
.sr-a11y-backdrop[hidden] {
  display: none !important;
}

.sr-a11y-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  background: #1e3a8a;
  color: #ffffff;
}

.sr-a11y-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.sr-a11y-panel-desc {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.35;
}

.sr-a11y-close-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sr-a11y-close-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.sr-a11y-panel-body {
  padding: 1rem 1.15rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sr-a11y-group-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #374151;
  margin: 0 0 0.55rem;
}

.sr-a11y-group-title i {
  color: #1d4ed8;
}

/* Segmented Font Size Control */
.sr-a11y-seg-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.sr-a11y-seg-btn {
  padding: 0.5rem 0.25rem;
  border-radius: 0.55rem;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #111827;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sr-a11y-seg-btn[aria-pressed="true"] {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #ffffff;
}

/* Option Tiles */
.sr-a11y-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.sr-a11y-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #111827;
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sr-a11y-tile i {
  font-size: 1.1rem;
  color: #1d4ed8;
}

.sr-a11y-tile:hover {
  border-color: #1d4ed8;
  background: #eff6ff;
}

.sr-a11y-tile[aria-pressed="true"] {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #ffffff;
}

.sr-a11y-tile[aria-pressed="true"] i {
  color: #fde047;
}

/* TTS Controls */
.sr-a11y-wide-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border-radius: 0.65rem;
  border: 1.5px solid #b91c1c;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.sr-a11y-wide-btn:hover {
  background: #b91c1c;
}

.sr-a11y-tts-row {
  display: flex;
  gap: 0.5rem;
}

.sr-a11y-tts-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.58rem 0.75rem;
  border-radius: 0.6rem;
  border: 1.5px solid #1e3a8a;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

.sr-a11y-tts-btn[aria-pressed="true"] {
  background: #1e3a8a;
  color: #ffffff;
}

.sr-a11y-tts-stop {
  flex: 0 0 auto;
  border-color: #9ca3af;
  background: #f3f4f6;
  color: #1f2937;
}

.sr-a11y-tts-stop:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sr-a11y-tts-speed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sr-a11y-inline-label {
  font-size: 0.83rem;
  font-weight: 600;
  color: #374151;
}

.sr-a11y-select {
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #111827;
  font-size: 0.84rem;
  font-weight: 600;
}

/* Shortcuts details */
.sr-a11y-shortcuts {
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.6rem 0.8rem;
  background: #f8fafc;
}

.sr-a11y-shortcuts summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1f2937;
  cursor: pointer;
}

.sr-a11y-shortcuts-list {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #374151;
}

.sr-a11y-shortcuts-list kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  background: #111827;
  color: #ffffff;
  border-radius: 0.25rem;
}

/* Panel Footer */
.sr-a11y-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1.15rem;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.sr-a11y-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 0.5rem;
  border: 1.5px solid #9ca3af;
  background: #ffffff;
  color: #111827;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.sr-a11y-reset-btn:hover {
  background: #f3f4f6;
}

.sr-a11y-statement-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e3a8a;
  text-decoration: underline;
}

@media (max-width: 575.98px) {
  .sr-a11y-root {
    left: 0.75rem;
    bottom: 0.85rem;
  }

  .sr-a11y-fab {
    width: 46px;
    height: 46px;
    padding: 0;
    justify-content: center;
  }

  .sr-a11y-fab-label {
    display: none;
  }

  .sr-a11y-fab-dot {
    position: absolute;
    top: 4px;
    right: 4px;
  }

  .sr-a11y-panel {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 4.1rem;
    width: auto;
  }
}

/* ==========================================================================
   Reading Guide Bar (Bralno ravnilo)
   ========================================================================== */
.sr-a11y-reading-guide-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  top: 40vh;
  height: 42px;
  pointer-events: none;
  z-index: 1084;
  background: rgba(254, 240, 138, 0.28);
  border-top: 2px solid #ca8a04;
  border-bottom: 2px solid #ca8a04;
}

html.sr-a11y-reading-guide .sr-a11y-reading-guide-bar {
  display: block;
}

/* ==========================================================================
   Active Accessibility Modes
   ========================================================================== */

/* 1. Font Scaling (scales rem-based Bootstrap & theme typography cleanly) */
html.sr-a11y-font-115 {
  font-size: 115% !important;
}
html.sr-a11y-font-130 {
  font-size: 130% !important;
}
html.sr-a11y-font-150 {
  font-size: 150% !important;
}

/* 2. High Contrast — Dark (Black + White + Yellow) */
html.sr-a11y-contrast-dark,
html.sr-a11y-contrast-dark body {
  background-color: #000000 !important;
  color: #ffffff !important;
}

html.sr-a11y-contrast-dark header,
html.sr-a11y-contrast-dark nav,
html.sr-a11y-contrast-dark main,
html.sr-a11y-contrast-dark footer,
html.sr-a11y-contrast-dark section,
html.sr-a11y-contrast-dark article,
html.sr-a11y-contrast-dark .card,
html.sr-a11y-contrast-dark .recipe-surface,
html.sr-a11y-contrast-dark .modal-content,
html.sr-a11y-contrast-dark .offcanvas,
html.sr-a11y-contrast-dark .dropdown-menu,
html.sr-a11y-contrast-dark .bg-white,
html.sr-a11y-contrast-dark .bg-light,
html.sr-a11y-contrast-dark .sr-header-search-bar,
html.sr-a11y-contrast-dark .sr-cat-bar,
html.sr-a11y-contrast-dark .sr-search-box,
html.sr-a11y-contrast-dark .sr-a11y-panel,
html.sr-a11y-contrast-dark .sr-a11y-panel-footer,
html.sr-a11y-contrast-dark .sr-a11y-shortcuts {
  background-color: #000000 !important;
  background-image: none !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
  box-shadow: none !important;
}

html.sr-a11y-contrast-dark p,
html.sr-a11y-contrast-dark li,
html.sr-a11y-contrast-dark span,
html.sr-a11y-contrast-dark label,
html.sr-a11y-contrast-dark h1,
html.sr-a11y-contrast-dark h2,
html.sr-a11y-contrast-dark h3,
html.sr-a11y-contrast-dark h4,
html.sr-a11y-contrast-dark h5,
html.sr-a11y-contrast-dark h6,
html.sr-a11y-contrast-dark .text-muted,
html.sr-a11y-contrast-dark .text-secondary,
html.sr-a11y-contrast-dark .text-dark {
  color: #ffffff !important;
}

html.sr-a11y-contrast-dark a {
  color: #ffeb3b !important;
  text-decoration: underline !important;
}

html.sr-a11y-contrast-dark button,
html.sr-a11y-contrast-dark .btn,
html.sr-a11y-contrast-dark input,
html.sr-a11y-contrast-dark select,
html.sr-a11y-contrast-dark textarea {
  background-color: #111111 !important;
  color: #ffeb3b !important;
  border: 2px solid #ffeb3b !important;
}

html.sr-a11y-contrast-dark button[aria-pressed="true"],
html.sr-a11y-contrast-dark .btn.active,
html.sr-a11y-contrast-dark .sr-a11y-panel-header {
  background-color: #ffeb3b !important;
  color: #000000 !important;
  border-color: #ffffff !important;
}

html.sr-a11y-contrast-dark button[aria-pressed="true"] *,
html.sr-a11y-contrast-dark .sr-a11y-panel-header * {
  color: #000000 !important;
}

/* 3. High Contrast — Light (White + Black + Deep Blue) */
html.sr-a11y-contrast-light,
html.sr-a11y-contrast-light body {
  background-color: #ffffff !important;
  color: #000000 !important;
}

html.sr-a11y-contrast-light header,
html.sr-a11y-contrast-light nav,
html.sr-a11y-contrast-light main,
html.sr-a11y-contrast-light footer,
html.sr-a11y-contrast-light section,
html.sr-a11y-contrast-light article,
html.sr-a11y-contrast-light .card,
html.sr-a11y-contrast-light .recipe-surface,
html.sr-a11y-contrast-light .modal-content,
html.sr-a11y-contrast-light .offcanvas,
html.sr-a11y-contrast-light .dropdown-menu,
html.sr-a11y-contrast-light .bg-light,
html.sr-a11y-contrast-light .sr-header-search-bar,
html.sr-a11y-contrast-light .sr-cat-bar,
html.sr-a11y-contrast-light .sr-search-box {
  background-color: #ffffff !important;
  background-image: none !important;
  color: #000000 !important;
  border-color: #000000 !important;
  box-shadow: none !important;
}

html.sr-a11y-contrast-light p,
html.sr-a11y-contrast-light li,
html.sr-a11y-contrast-light span,
html.sr-a11y-contrast-light label,
html.sr-a11y-contrast-light h1,
html.sr-a11y-contrast-light h2,
html.sr-a11y-contrast-light h3,
html.sr-a11y-contrast-light h4,
html.sr-a11y-contrast-light h5,
html.sr-a11y-contrast-light h6,
html.sr-a11y-contrast-light .text-muted,
html.sr-a11y-contrast-light .text-secondary {
  color: #000000 !important;
}

html.sr-a11y-contrast-light a {
  color: #003399 !important;
  text-decoration: underline !important;
}

html.sr-a11y-contrast-light button,
html.sr-a11y-contrast-light .btn,
html.sr-a11y-contrast-light input,
html.sr-a11y-contrast-light select,
html.sr-a11y-contrast-light textarea {
  background-color: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
}

html.sr-a11y-contrast-light button[aria-pressed="true"],
html.sr-a11y-contrast-light .btn.active {
  background-color: #000000 !important;
  color: #ffffff !important;
}

html.sr-a11y-contrast-light button[aria-pressed="true"] * {
  color: #ffffff !important;
}

/* 4. Grayscale Mode (applied to page regions so fixed widgets keep working) */
html.sr-a11y-grayscale header,
html.sr-a11y-grayscale main,
html.sr-a11y-grayscale footer,
html.sr-a11y-grayscale .modal,
html.sr-a11y-grayscale .offcanvas {
  filter: grayscale(100%) !important;
}

/* 5. Readable Font & Spacing (Low Vision / Dyslexia Friendly) */
html.sr-a11y-readable-font body,
html.sr-a11y-readable-font p,
html.sr-a11y-readable-font li,
html.sr-a11y-readable-font a,
html.sr-a11y-readable-font h1,
html.sr-a11y-readable-font h2,
html.sr-a11y-readable-font h3,
html.sr-a11y-readable-font h4,
html.sr-a11y-readable-font button,
html.sr-a11y-readable-font input,
html.sr-a11y-readable-font label {
  font-family: Arial, Verdana, "Segoe UI", system-ui, sans-serif !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.12em !important;
  line-height: 1.75 !important;
}

/* 6. Highlight Links & Buttons */
html.sr-a11y-highlight-links a {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
}

html.sr-a11y-highlight-links a:hover,
html.sr-a11y-highlight-links a:focus-visible {
  background-color: #fef08a !important;
  color: #000000 !important;
  border-radius: 2px;
}

/* 7. Strong Keyboard Focus */
html.sr-a11y-strong-focus :where(a, button, input, select, textarea, summary, [tabindex]):focus {
  outline: 4px solid #facc15 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 7px #000000 !important;
}

/* 8. Stop Animations & Motion */
html.sr-a11y-reduce-motion *,
html.sr-a11y-reduce-motion *::before,
html.sr-a11y-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* 9. Large High-Visibility Cursor */
html.sr-a11y-large-cursor,
html.sr-a11y-large-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M4 2 L4 34 L13 25 L20 37 L25 34 L18 22 L30 22 Z' fill='%23000000' stroke='%23ffffff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto !important;
}

/* Accessibility Statement Page Styling */
.sr-a11y-statement-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  padding: 1rem 1.2rem;
  border-radius: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  margin-bottom: 1.5rem;
}

.sr-a11y-statement-meta strong {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #475569;
  margin-bottom: 0.2rem;
}
