/* Accessibility widget — button + panel styling, adapted from src/App.css
   (.storefront-a11y-toggle / .a11y-panel*) for a real page instead of the in-admin mock. */

/* Real OpenDyslexic webfont for the "Dyslexic Font" feature (see the a11y-font-dyslexic rule
   below) — previously this name was referenced with no @font-face ever shipped for it, so it
   silently fell back to an installed font. Served from Fontsource's jsDelivr CDN build. Kept in
   sync by hand with the same @font-face in src/index.css for the in-admin preview. */
@font-face {
  font-family: 'OpenDyslexic';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src:
    url('https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@5.3.0/latin-400-normal.woff2') format('woff2'),
    url('https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@5.3.0/latin-400-normal.woff') format('woff');
}

@font-face {
  font-family: 'OpenDyslexic';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src:
    url('https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@5.3.0/latin-700-normal.woff2') format('woff2'),
    url('https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@5.3.0/latin-700-normal.woff') format('woff');
}

/* Bigger Cursor: an inherited `cursor` on the content wrapper alone is overridden by any
   descendant with its own `cursor` rule (links/buttons almost always set `cursor: pointer`
   in theme CSS), which is most of a real storefront — so this must win with !important on
   every descendant, not just inherit down from the wrapper. */
#a11y-content-wrapper.a11y-big-cursor,
#a11y-content-wrapper.a11y-big-cursor * {
  cursor: var(--a11y-cursor-url) !important;
}

.a11y-widget-root {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483000;
}

.a11y-widget-root > * {
  pointer-events: auto;
}

.storefront-a11y-toggle {
  position: absolute;
  bottom: 7rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}

.storefront-a11y-toggle:hover {
  transform: scale(1.08);
}

.storefront-a11y-panel-anchor {
  /* `bottom` is set inline by widget.js from the toggle button's actual measured position
     (see positionAnchor()) — this is just a sane initial value before that first runs. */
  position: fixed;
  bottom: 168px;
  z-index: 2147483000;
}

.a11y-panel {
  width: 350px;
  max-height: 720px;
  overflow-y: auto;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
}

.a11y-panel-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.a11y-panel-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.a11y-panel-empty {
  margin: 0;
  color: inherit;
  opacity: 0.7;
}

.a11y-panel-group-title {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: inherit;
  opacity: 0.65;
}

.a11y-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.a11y-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(128, 128, 128, 0.16);
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  padding: 10px 4px;
  cursor: pointer;
  text-align: center;
  min-height: 64px;
}

.a11y-tile:hover {
  background: rgba(128, 128, 128, 0.28);
}

.a11y-tile-active {
  background: rgba(64, 156, 255, 0.25);
  border-color: #409cff;
}

.a11y-tile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.a11y-tile-icon-text {
  font-weight: 700;
  font-size: 15px;
}

.a11y-tile-label {
  font-size: 10px;
  line-height: 1.2;
}

.a11y-tile-dots {
  display: flex;
  gap: 3px;
  margin-top: 2px;
}

.a11y-tile-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.4);
}

.a11y-tile-dot-filled {
  background: #409cff;
}

.a11y-tile-filter-wrap {
  display: contents;
}

.a11y-filter-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.a11y-chip {
  background: rgba(128, 128, 128, 0.18);
  border: 1px solid rgba(128, 128, 128, 0.35);
  color: inherit;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}

.a11y-chip-active {
  background: #409cff;
  border-color: #409cff;
}

.a11y-panel-reset {
  background: rgba(128, 128, 128, 0.25);
  border: none;
  color: inherit;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

/* Reading Line / Reading Mask overlays (Navigation group) — fixed to the viewport since they
   track the real page, not a scoped preview container. */
.a11y-reading-line {
  display: block!important;
  position: fixed;
  left: 0;
  right: 0;
  height: 3px;
  background: #ffeb3b;
  pointer-events: none;
  z-index: 2147482999;
}

.a11y-reading-mask {
  display: block!important;
  position: fixed;
  left: 0;
  right: 0;
  height: 160px;
  transform: translateY(-30px);
  box-shadow: 0 -9999px 0 9999px rgba(0, 0, 0, 0.75), 0 9999px 0 9999px rgba(0, 0, 0, 0.75);
  pointer-events: none;
  z-index: 2147482998;
}

/* Tooltips feature */
.a11y-live-tooltip {
  position: absolute;
  transform: translateY(-100%);
  background: #1a1a1a;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2147483000;
}

/* Highlight Links feature */
html.a11y-highlight-links a {
  background: #ffeb3b !important;
  color: #1a1a1a !important;
  outline: 1px solid #1a1a1a !important;
}

/* Page Structure panel: a dedicated sub-view (Skip To Title / Landmarks / Go To Link) that
   replaces the main tile grid, reachable from the "Page Structure" tile. */
.a11y-ps-panel {
  padding: 0;
}

.a11y-ps-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 14px 0;
  font-weight: 700;
  font-size: 15px;
}

.a11y-ps-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.a11y-ps-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 14px 0;
}

.a11y-ps-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(128, 128, 128, 0.14);
  border: 1px solid transparent;
  border-radius: 8px;
  color: inherit;
  padding: 8px 4px;
  font-size: 10px;
  cursor: pointer;
  text-align: center;
}

.a11y-ps-tab-active {
  background: rgba(13, 148, 136, 0.18);
  border-color: #0d9488;
  color: #0d9488;
}

.a11y-ps-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  max-height: 420px;
  overflow-y: auto;
}

.a11y-ps-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 8px 6px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}

.a11y-ps-item:hover {
  background: rgba(128, 128, 128, 0.16);
}

.a11y-ps-item-text {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.a11y-ps-badge {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #0d9488;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

/* Hide Images feature */
html.a11y-hide-images img,
html.a11y-hide-images picture,
html.a11y-hide-images video,
html.a11y-hide-images svg image {
  visibility: hidden !important;
}

/* Line Height feature: unitless line-height inherits as the specified number, so each
   descendant recomputes it against its own font-size — no runaway compounding like `em`
   font-size would have, safe to force everywhere. */
html.a11y-line-1 body,
html.a11y-line-1 body * {
  line-height: 1.8 !important;
}

html.a11y-line-2 body,
html.a11y-line-2 body * {
  line-height: 2.2 !important;
}

/* Readable Fonts / Dyslexic Font features. OpenDyslexic is now actually loaded (see the
   @font-face rules above) and listed first so it wins instead of being shadowed by an
   earlier, more commonly-installed fallback like Comic Sans MS. */
html.a11y-font-readable body,
html.a11y-font-readable body * {
  font-family: Arial, Verdana, sans-serif !important;
}

html.a11y-font-dyslexic body,
html.a11y-font-dyslexic body * {
  font-family: "OpenDyslexic", Verdana, Tahoma, sans-serif !important;
  letter-spacing: 0.06em !important;
  word-spacing: 0.12em !important;
  line-height: 1.6 !important;
}

/* Stop Animations feature */
html.a11y-stop-animations *,
html.a11y-stop-animations *::before,
html.a11y-stop-animations *::after {
  animation: none !important;
  transition: none !important;
}
