/* ═══════════════════════════════════════════════════════════════
   HOGAN STAKES UK — Accessibility Widget
   V8.1 | March 2026
   ═══════════════════════════════════════════════════════════════ */

/* OpenDyslexic font — CDN, only loads when dyslexia mode active */
@import url('https://fonts.cdnfonts.com/css/opendyslexic');

/* ─── TRIGGER BUTTON ─────────────────────────────────────────── */
.a11y-trigger {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #FFB800;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 2147483647;
  transition: transform 0.2s ease;
  padding: 0;
}
.a11y-trigger:hover {
  transform: scale(1.1);
}
.a11y-trigger:focus {
  outline: 3px solid #1A1A1A;
  outline-offset: 3px;
}

/* ─── PANEL ──────────────────────────────────────────────────── */
.a11y-panel {
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 320px;
  max-height: 80vh;
  overflow-y: auto;
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  padding: 20px;
  z-index: 2147483647;
  /* Hidden state */
  visibility: hidden;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
  font-family: Arial, Helvetica, system-ui, sans-serif;
  box-sizing: border-box;
}
.a11y-panel.a11y-panel-open {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s;
}

/* ─── PANEL HEADER ───────────────────────────────────────────── */
.a11y-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2px;
}
.a11y-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: #1A1A1A;
  margin: 0;
  font-family: Arial, Helvetica, system-ui, sans-serif;
}
.a11y-panel-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 0 4px;
  margin-top: -2px;
  font-family: Arial, Helvetica, system-ui, sans-serif;
}
.a11y-panel-close:hover {
  color: #1A1A1A;
}
.a11y-panel-close:focus {
  outline: 2px solid #FFB800;
  outline-offset: 2px;
}
.a11y-panel-reset {
  font-size: 12px;
  color: #888;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  margin-bottom: 14px;
  display: block;
  font-family: Arial, Helvetica, system-ui, sans-serif;
}
.a11y-panel-reset:hover {
  color: #1A1A1A;
}
.a11y-panel-reset:focus {
  outline: 2px solid #FFB800;
  outline-offset: 2px;
}

/* ─── TILES GRID ─────────────────────────────────────────────── */
.a11y-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ─── SINGLE TILE ────────────────────────────────────────────── */
.a11y-tile {
  background: #F5F5F5;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 12px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  min-height: 72px;
  min-width: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}
.a11y-tile:hover {
  border-color: #CCCCCC;
}
.a11y-tile:focus {
  outline: 2px solid #FFB800;
  outline-offset: 2px;
}
.a11y-tile.a11y-tile-active {
  border-color: #FFB800;
  background-color: #FFF8E1;
}
.a11y-tile svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: #1A1A1A;
}
.a11y-tile-label {
  font-size: 11px;
  font-weight: 600;
  color: #1A1A1A;
  line-height: 1.3;
  font-family: Arial, Helvetica, system-ui, sans-serif;
  word-break: break-word;
}

/* ─── READING GUIDE BAR ──────────────────────────────────────── */
.a11y-reading-guide-bar {
  position: fixed;
  left: 0;
  width: 100%;
  height: 40px;
  background: rgba(255, 184, 0, 0.18);
  pointer-events: none;
  z-index: 2147483646;
  transform: translateY(-50%);
}

/* ─── SCREEN READER ONLY ─────────────────────────────────────── */
.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;
}

/* ─── MOBILE ─────────────────────────────────────────────────── */
@media (max-width: 400px) {
  .a11y-panel {
    left: 0;
    right: 0;
    width: auto;
    bottom: 0;
    border-radius: 12px 12px 0 0;
    max-height: 80vh;
  }
}
@media (max-width: 320px) {
  .a11y-tiles {
    grid-template-columns: 1fr;
  }
}


/* ═══════════════════════════════════════════════════════════════
   A11Y OVERRIDE CLASSES
   Applied to <html> element for FOUC-prevention on page load.
   ═══════════════════════════════════════════════════════════════ */

/* ─── CONTRAST + ─────────────────────────────────────────────── */
html.a11y-high-contrast body,
html.a11y-high-contrast section,
html.a11y-high-contrast div,
html.a11y-high-contrast header,
html.a11y-high-contrast footer,
html.a11y-high-contrast nav,
html.a11y-high-contrast main,
html.a11y-high-contrast article,
html.a11y-high-contrast aside {
  background-color: #000 !important;
  background-image: none !important;
  color: #FFF !important;
}
html.a11y-high-contrast a {
  color: #FFB800 !important;
  text-decoration: underline !important;
}
html.a11y-high-contrast img {
  filter: contrast(1.2);
}
html.a11y-high-contrast .btn-primary {
  background-color: #FFB800 !important;
  color: #000 !important;
  border: 2px solid #FFF !important;
}

/* ─── HIGHLIGHT LINKS ────────────────────────────────────────── */
html.a11y-highlight-links a {
  background-color: rgba(255, 184, 0, 0.2) !important;
  color: #1A1A1A !important;
  text-decoration: underline !important;
  outline: 1px solid #FFB800 !important;
  padding: 2px 4px !important;
}

/* ─── BIGGER TEXT ────────────────────────────────────────────── */
html.a11y-text-large body { font-size: 125% !important; }
html.a11y-text-xlarge body { font-size: 150% !important; }

/* ─── TEXT SPACING ───────────────────────────────────────────── */
html.a11y-text-spacing * {
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
  line-height: 1.8 !important;
}

/* ─── PAUSE ANIMATIONS ───────────────────────────────────────── */
html.a11y-pause-animations *,
html.a11y-pause-animations *::before,
html.a11y-pause-animations *::after {
  animation: none !important;
  transition: none !important;
}

/* ─── HIDE IMAGES ────────────────────────────────────────────── */
html.a11y-hide-images img {
  opacity: 0 !important;
}
html.a11y-hide-images [style*="background-image"] {
  background-image: none !important;
}

/* ─── DYSLEXIA FRIENDLY ──────────────────────────────────────── */
html.a11y-dyslexia * {
  font-family: 'OpenDyslexic', Arial, sans-serif !important;
  line-height: 1.8 !important;
}

/* ─── BIG CURSOR ─────────────────────────────────────────────── */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M5 3l14 8-6 2 4 8-3 1-4-8-5 4z' fill='%23000' stroke='%23FFF' stroke-width='1'/%3E%3C/svg%3E") 4 2, auto !important;
}
html.a11y-big-cursor a,
html.a11y-big-cursor button,
html.a11y-big-cursor [role="button"] {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M4 4h4v1H5v3H4V4zm12 0h4v4h-1V5h-3V4zM4 16v4h4v-1H5v-3H4zm16 0v3h-3v1h4v-4h-1z' fill='%23000' stroke='%23FFF' stroke-width='0.5'/%3E%3Cpath d='M10 8h4v8h-4z' fill='%23FFB800'/%3E%3C/svg%3E") 12 12, pointer !important;
}
