/* ==========================================================================
   asafmoran.co.il — Accessibility Toolbar Styles (ת"י 5568 / WCAG 2.1 AA)
   Designed to integrate seamlessly with the Night & Brass aesthetic.
   ========================================================================== */

:root {
  --a11y-primary: #14313B;
  --a11y-brass: #B88E3E;
  --a11y-brass-light: #FAF4E6;
  --a11y-accent: #E09A5F;
  --a11y-bg: #FFFFFF;
  --a11y-border: #DECFAA;
  --a11y-text: #0F172A;
  --a11y-text-muted: #475569;
}

/* --------------------------------------------------------------------------
   0. Skip to Main Content Link (ת"י 5568 / WCAG 2.1 AA - 2.4.1 Bypass Blocks)
   -------------------------------------------------------------------------- */
.skip-to-content,
.skip-link {
  position: absolute;
  top: -9999px;
  inset-inline-start: 1.25rem;
  background: var(--a11y-primary, #14313B);
  color: #FFFFFF !important;
  border: 2px solid var(--a11y-brass, #B88E3E);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.4), 0 0 10px rgba(184, 142, 62, 0.3);
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  z-index: 9999999;
  transition: top 0.18s ease-out;
}

.skip-to-content:focus,
.skip-to-content:focus-visible,
.skip-link:focus,
.skip-link:focus-visible {
  top: 1.25rem;
  outline: 3px solid var(--a11y-accent, #E09A5F) !important;
  outline-offset: 3px !important;
}

#main-content:focus {
  outline: none;
}

/* --------------------------------------------------------------------------
   1. Floating Accessibility Trigger Button
   -------------------------------------------------------------------------- */
#a11y-trigger {
  position: fixed;
  bottom: 24px;
  inset-inline-start: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--a11y-primary);
  color: #FAF4E5;
  border: 2px solid var(--a11y-brass);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.3), 0 0 12px rgba(184, 142, 62, 0.25);
  cursor: pointer;
  z-index: 999990;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  padding: 0;
}

#a11y-trigger:hover {
  transform: scale(1.08);
  background: #1E293B;
  box-shadow: 0 6px 24px rgba(15, 23, 42, 0.4), 0 0 16px rgba(184, 142, 62, 0.35);
}

#a11y-trigger:focus-visible {
  outline: 3px solid var(--a11y-accent);
  outline-offset: 4px;
}

#a11y-trigger svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

/* --------------------------------------------------------------------------
   2. Accessibility Panel Modal
   -------------------------------------------------------------------------- */
#a11y-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999991;
}

#a11y-backdrop.is-active {
  display: block;
}

#a11y-modal {
  display: none;
  position: fixed;
  bottom: 86px;
  inset-inline-start: 24px;
  width: min(390px, calc(100vw - 32px));
  max-height: calc(100vh - 110px);
  background: var(--a11y-bg);
  border: 2px solid var(--a11y-brass);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.25), 0 4px 12px rgba(184, 142, 62, 0.15);
  z-index: 999992;
  overflow-y: auto;
  font-family: "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--a11y-text);
  animation: a11yFadeIn 0.2s ease-out;
}

#a11y-modal.is-active {
  display: flex;
  flex-direction: column;
}

@keyframes a11yFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Panel Header */
.a11y-header {
  padding: 1.1rem 1.25rem 0.9rem;
  background: var(--a11y-brass-light);
  border-bottom: 1.5px solid var(--a11y-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.a11y-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.a11y-title-wrap svg {
  width: 22px;
  height: 22px;
  fill: var(--a11y-primary);
  flex-shrink: 0;
}

.a11y-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--a11y-primary);
  margin: 0;
}

.a11y-close-btn {
  background: transparent;
  border: none;
  color: var(--a11y-text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.a11y-close-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: var(--a11y-primary);
}

.a11y-close-btn:focus-visible {
  outline: 2px solid var(--a11y-accent);
}

/* Language selector inside toolbar */
.a11y-lang-bar {
  padding: 0.75rem 1.25rem;
  background: #FFFFFF;
  border-bottom: 1px solid var(--a11y-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.a11y-lang-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--a11y-text-muted);
}

.a11y-lang-select {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  border: 1.5px solid var(--a11y-brass);
  background: var(--a11y-brass-light);
  color: var(--a11y-primary);
  cursor: pointer;
  outline: none;
}

/* Toolbar Body & Controls Grid */
.a11y-body {
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.a11y-section-title {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--a11y-text-muted);
  margin-bottom: 0.55rem;
}

.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.a11y-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 0.5rem;
  border: 1.5px solid var(--a11y-border);
  border-radius: 10px;
  background: var(--a11y-bg);
  color: var(--a11y-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.15s ease;
  position: relative;
}

.a11y-btn:hover {
  background: var(--a11y-brass-light);
  border-color: var(--a11y-brass);
  transform: translateY(-1px);
}

.a11y-btn:focus-visible {
  outline: 2.5px solid var(--a11y-accent);
  outline-offset: 2px;
}

.a11y-btn.is-active {
  background: var(--a11y-primary);
  color: #FAF4E5;
  border-color: var(--a11y-brass);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.a11y-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Zoom Controls Row */
.a11y-zoom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.a11y-zoom-btn {
  padding: 0.65rem 0.4rem;
  border: 1.5px solid var(--a11y-border);
  border-radius: 8px;
  background: var(--a11y-bg);
  color: var(--a11y-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  transition: all 0.15s ease;
  text-align: center;
}

.a11y-zoom-btn:hover {
  background: var(--a11y-brass-light);
  border-color: var(--a11y-brass);
}

.a11y-zoom-btn:focus-visible {
  outline: 2px solid var(--a11y-accent);
}

.a11y-zoom-btn.is-active {
  background: var(--a11y-primary);
  color: #FAF4E5;
  border-color: var(--a11y-brass);
}

/* Panel Footer */
.a11y-footer {
  padding: 0.9rem 1.25rem 1.1rem;
  background: var(--a11y-brass-light);
  border-top: 1.5px solid var(--a11y-border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.a11y-reset-all-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: #FFFFFF;
  border: 1.5px solid #EF4444;
  color: #DC2626;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.a11y-reset-all-btn:hover {
  background: #FEE2E2;
}

.a11y-statement-link {
  display: block;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--a11y-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.2rem;
}

.a11y-statement-link:hover {
  color: var(--a11y-brass);
}

/* --------------------------------------------------------------------------
   3. Accessible Overrides Applied on <html> and <body>
   -------------------------------------------------------------------------- */

/* Font Sizing */
html.a11y-font-sm { font-size: 14.5px !important; }
html.a11y-font-lg { font-size: 18px !important; }
html.a11y-font-xl { font-size: 21px !important; }

/* Readable Font */
html.a11y-readable-font,
html.a11y-readable-font * {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
  letter-spacing: 0.02em !important;
  line-height: 1.8 !important;
}

/* High Contrast (Yellow on Black) */
html.a11y-contrast-high body {
  background-color: #000000 !important;
  color: #FFFF00 !important;
}

html.a11y-contrast-high *:not(#a11y-modal *):not(#a11y-trigger *):not(.session-lang-disclaimer *) {
  background-color: #000000 !important;
  color: #FFFF00 !important;
  border-color: #FFFF00 !important;
  box-shadow: none !important;
  text-shadow: none !important;
}

html.a11y-contrast-high a:not(#a11y-modal a):not(#a11y-trigger) {
  color: #00FFFF !important;
  text-decoration: underline !important;
}

html.a11y-contrast-high button:not(#a11y-modal button):not(#a11y-trigger),
html.a11y-contrast-high input,
html.a11y-contrast-high select,
html.a11y-contrast-high textarea {
  border: 2px solid #FFFF00 !important;
  background-color: #000000 !important;
  color: #FFFF00 !important;
}

/* Invert Contrast */
html.a11y-contrast-invert {
  filter: invert(100%) hue-rotate(180deg) !important;
}

html.a11y-contrast-invert img,
html.a11y-contrast-invert video,
html.a11y-contrast-invert #a11y-modal,
html.a11y-contrast-invert #a11y-trigger {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* Monochrome / Grayscale */
html.a11y-contrast-mono {
  filter: grayscale(100%) !important;
}

/* Highlight Links */
html.a11y-highlight-links a:not(.a11y-btn):not(.a11y-zoom-btn) {
  text-decoration: underline 3px solid #D97706 !important;
  text-underline-offset: 4px !important;
  font-weight: 800 !important;
  color: #0284C7 !important;
}

/* Highlight Focus for Keyboard Users */
html.a11y-highlight-focus *:focus,
html.a11y-highlight-focus *:focus-visible {
  outline: 3.5px solid #EA580C !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 12px rgba(234, 88, 12, 0.7) !important;
}

/* Stop Animations & Motion */
html.a11y-stop-anim *,
html.a11y-stop-anim *::before,
html.a11y-stop-anim *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Large Cursor - Black */
html.a11y-cursor-black,
html.a11y-cursor-black * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M4 4l14 36 6-16 16-6L4 4z' fill='%23000000' stroke='%23FFFFFF' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E"), auto !important;
}

/* Large Cursor - White */
html.a11y-cursor-white,
html.a11y-cursor-white * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M4 4l14 36 6-16 16-6L4 4z' fill='%23FFFFFF' stroke='%23000000' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E"), auto !important;
}

/* --------------------------------------------------------------------------
   4. Language Disclaimer Banner (Displayed in Non-Hebrew views)
   -------------------------------------------------------------------------- */
.session-lang-disclaimer {
  background: var(--a11y-primary);
  color: #FAF4E5;
  border-bottom: 2px solid var(--a11y-accent);
  padding: 0.65rem 1.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
  position: relative;
  z-index: 99990;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.session-lang-disclaimer strong {
  color: var(--a11y-accent);
}

.session-lang-disclaimer .disclaimer-icon {
  width: 18px;
  height: 18px;
  fill: var(--a11y-accent);
  flex-shrink: 0;
}

.session-lang-disclaimer-close {
  background: transparent;
  border: none;
  color: #FAF4E5;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  opacity: 0.8;
  position: absolute;
  inset-inline-end: 1rem;
}

.session-lang-disclaimer-close:hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   5. Multilingual Site Language Switcher (Header)
   -------------------------------------------------------------------------- */
.lang {
  position: relative;
  display: inline-block;
}

.lang__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-surface, #FFFFFF);
  border: 1px solid var(--brass-border, #DECFAA);
  padding: 0.42rem 0.85rem;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--night-primary, #0F172A);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.lang__btn:hover {
  border-color: var(--brass-rich, #B88E3E);
  background: var(--bg-brass-wash, #FAF4E6);
  color: #0F172A;
}

.lang__btn .ico {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.lang__menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  background: #FFFFFF;
  border: 1.5px solid var(--brass-border, #DECFAA);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
  padding: 0.5rem;
  min-width: 185px;
  z-index: 999995;
}

.lang__menu[data-open="true"] {
  display: block;
}

.lang__opt {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.9rem;
  color: #0F172A;
  text-align: start;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.lang__opt:hover {
  background: #FAF4E6;
  color: #7A5716;
}

.lang__opt[aria-selected="true"] {
  font-weight: 700;
  background: #F5ECCE;
}

.lang__opt .flag {
  font-size: 1.05rem;
}

.lang__note {
  font-size: 0.76rem;
  color: #64748B;
  padding: 0.5rem 0.6rem 0.2rem;
  margin: 0.35rem 0 0;
  border-top: 1px solid #E2E8F0;
  line-height: 1.35;
}

@media print {
  #a11y-trigger,
  #a11y-modal,
  #a11y-backdrop,
  .session-lang-disclaimer,
  .lang {
    display: none !important;
  }
}

