/* Torio accessibility widget — shared across the marketing site, the booking
   page (RN-Web) and the static legal pages. Loaded by the absolute /a11y/ URL on
   every surface (served by Cloudflare Pages). All page-state classes live on
   <html>; the widget's own nodes carry .t11y-root and counter-invert so the
   button + panel stay readable even in invert mode. No external dependencies. */

/* ---------- page state classes (applied to <html>) ---------- */
html.t11y-contrast { filter: contrast(1.3); }
html.t11y-grayscale { filter: grayscale(1); }
html.t11y-invert { filter: invert(1) hue-rotate(180deg); background: #fff; }

/* re-invert page media so photos/logos look normal under invert */
html.t11y-invert img,
html.t11y-invert video,
html.t11y-invert picture,
html.t11y-invert [style*="background-image"] {
  filter: invert(1) hue-rotate(180deg);
}

/* the widget itself: a child filter cannot "undo" a parent filter, so to keep the
   FAB + panel readable in invert mode we DOUBLE-invert them back to normal. */
html.t11y-invert .t11y-root {
  filter: invert(1) hue-rotate(180deg) !important;
}

html.t11y-readable-font,
html.t11y-readable-font *:not([style*="font-family:ionicons"]):not([style*="font-family:material-community"]):not([style*="font-family:FontAwesome5"]) {
  font-family: Arial, "Noto Sans Hebrew", "Segoe UI", sans-serif !important;
  letter-spacing: normal !important;
}

/* Highlight every clickable control — real links (<a>), native buttons, and
   RN-Web role=button/role=link (the booking page has no <a> at all). Exclude the
   widget's own UI so the panel/FAB don't get marked. */
html.t11y-highlight-links a:not(.t11y-fab):not(.t11y-btn):not(.t11y-close):not(.t11y-statement-link):not(.t11y-skip),
html.t11y-highlight-links button:not(.t11y-fab):not(.t11y-btn):not(.t11y-close):not(.t11y-statement-link):not(.t11y-skip),
html.t11y-highlight-links [role="button"]:not(.t11y-fab):not(.t11y-btn):not(.t11y-close):not(.t11y-statement-link):not(.t11y-skip),
html.t11y-highlight-links [role="link"]:not(.t11y-fab):not(.t11y-btn):not(.t11y-close):not(.t11y-statement-link):not(.t11y-skip) {
  text-decoration: underline !important;
  text-underline-offset: 2px;
  outline: 2px solid currentColor;
  outline-offset: 1px;
  background: #fff59d !important;
  color: #1a1a1a !important;
}

html.t11y-big-cursor,
html.t11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M8 4l28 16-12 3-3 12L8 4z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}
html.t11y-big-cursor input,
html.t11y-big-cursor textarea,
html.t11y-big-cursor [contenteditable] {
  cursor: text !important;
}

html.t11y-stop-animations,
html.t11y-stop-animations *,
html.t11y-stop-animations *::before,
html.t11y-stop-animations *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* Highlight headings (h1–h6) with yellow bg and dark text, excluding the widget's own title */
html.t11y-highlight-headings h1:not(.t11y-root),
html.t11y-highlight-headings h2:not(.t11y-root),
html.t11y-highlight-headings h3:not(.t11y-root),
html.t11y-highlight-headings h4:not(.t11y-root),
html.t11y-highlight-headings h5:not(.t11y-root),
html.t11y-highlight-headings h6:not(.t11y-root) {
  text-decoration: underline !important;
  text-underline-offset: 2px;
  outline: 2px solid currentColor;
  outline-offset: 1px;
  background: #fff59d !important;
  color: #1a1a1a !important;
}

/* Site-wide keyboard focus highlight (complements the booking-only always-on rule) */
html.t11y-focus-highlight :focus-visible {
  outline: 3px solid #1a73e8 !important;
  outline-offset: 2px;
}

/* ---------- floating button (FAB) — collapsed to an EDGE TAB ----------
   Hugs the right viewport edge, vertically centred, so it recedes instead of
   floating as a big circle in the corner. Still ≥44px in both dimensions
   (WCAG 2.5.5 target size), keyboard-focusable, and the JS keeps all the ARIA. */
.t11y-fab {
  position: fixed;
  right: 0; /* flush with the right edge, regardless of page direction */
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 52px;
  /* rounded on the inner (left) side only → reads as a tab attached to the edge */
  border-radius: 12px 0 0 12px;
  border: 2px solid #fff;
  border-right: none; /* sits flush against the viewport edge */
  background: #1a3a8f; /* deep blue — the conventional accessibility colour, ≥3:1 on any page */
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 2147483000;
  padding: 0;
  opacity: 0.9; /* recedes a touch at rest; full on hover/focus below */
  transition: opacity 0.15s, background 0.15s, transform 0.3s ease;
}
.t11y-fab svg { width: 26px; height: 26px; fill: currentColor; }
.t11y-fab:hover { background: #15307a; opacity: 1; }
.t11y-fab:focus-visible { outline: 3px solid #1a73e8; outline-offset: 3px; opacity: 1; }
/* Vertically centred on the edge → already clears the booking page's bottom
   "Book" bar, so no lift needed (kept for older cached markup). */
.t11y-fab--booking { bottom: auto; }
/* Auto-retract: after 10s idle the JS adds .t11y-fab--peek, sliding the tab off
   the right edge so only a ~12px sliver stays visible as a grab hint. Any
   hover / focus / touch removes the class (in JS) → it slides back out. Keeps
   translateY(-50%) so it stays vertically centred while it slides. */
.t11y-fab--peek {
  transform: translate(calc(100% - 12px), -50%);
  opacity: 0.7;
}

/* ---------- panel ---------- */
.t11y-panel {
  position: fixed;
  right: 16px;
  bottom: 84px;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: 72vh;
  overflow-y: auto;
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  z-index: 2147483001;
  padding: 14px;
  font-family: "Noto Sans Hebrew", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  text-align: right;
}
.t11y-panel[hidden] { display: none; }
.t11y-panel--booking { bottom: 156px; }

.t11y-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.t11y-panel h2 { font-size: 18px; font-weight: 700; margin: 0; color: #0f172a; }
.t11y-close { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: #0f172a; width: 36px; height: 36px; border-radius: 8px; }
.t11y-close:hover { background: #f1f5f9; }
.t11y-close:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }

.t11y-font-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.t11y-font-row .t11y-btn { flex: 1; margin: 0; }
.t11y-font-status { min-width: 56px; text-align: center; font-weight: 700; }

.t11y-btn {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: right;
  padding: 10px 12px;
  margin: 6px 0;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.t11y-btn:hover { background: #eef2f7; }
.t11y-btn:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.t11y-btn[aria-pressed="true"] { background: #1a3a8f; color: #fff; border-color: #1a3a8f; }
.t11y-btn[aria-pressed="true"]::after { content: " ✓"; }

.t11y-reset { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
.t11y-reset:hover { background: #fecaca; }

.t11y-statement-link {
  display: block;
  text-align: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  color: #1a3a8f;
  text-decoration: underline;
  font-weight: 600;
}
.t11y-statement-link:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }

/* ---------- skip link (centralised here → works on every surface that loads this CSS) ---------- */
.t11y-skip {
  position: fixed;
  inset-inline-start: 8px;
  top: -48px;
  z-index: 2147483600;
  background: #1a1a1a;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  transition: top 0.15s;
}
.t11y-skip:focus { top: 8px; }

@media (prefers-reduced-motion: reduce) {
  .t11y-fab, .t11y-skip, .t11y-btn { transition: none !important; }
}

/* Booking page (RN-Web) renders divs with role/tabindex but no focus styling —
   give keyboard users a visible focus ring there (WCAG 2.4.7). Scoped to the
   booking surface so the marketing site keeps its own shadcn focus styles. */
[data-torio-surface="booking"] [role="button"]:focus-visible,
[data-torio-surface="booking"] [tabindex]:focus-visible,
[data-torio-surface="booking"] a:focus-visible,
[data-torio-surface="booking"] input:focus-visible,
[data-torio-surface="booking"] select:focus-visible,
[data-torio-surface="booking"] textarea:focus-visible {
  outline: 3px solid #1a73e8 !important;
  outline-offset: 2px;
}
