/*
 * Makerique Boutique theme for OpenCart 4
 * Copyright (c) 2026 Heliopsy. All Rights Reserved.
 * https://makerique.com
 * SPDX-License-Identifier: LicenseRef-Proprietary
 * Proprietary and confidential. Unauthorized copying, distribution, or
 * modification of this file, by any means, is strictly prohibited.
 */

/*
 * Makerique Boutique: optional reading preferences (launcher, panel, aids).
 *
 * Every preference rule hangs off a data-a11y-* attribute on <html>, set from the
 * visitor's saved choices, so with nothing chosen this file changes nothing. The
 * launcher and panel carry data-a11y-ui and are exempt from the colour filters.
 * Colours come from the theme tokens (--mr-*), so contrast modes stay inside the
 * store's own palette and the panel follows the active skin.
 */

:root {
  --a11y-accent: var(--mr-accent, #D8A24A);
  --a11y-focus: var(--mr-primary, #B4694E);
  --a11y-mark: color-mix(in srgb, var(--a11y-accent) 26%, transparent);
}

/* § Text size: the root size (rem lengths) and the body size (the theme's px base). */
html[data-a11y-text="115"] { font-size: 115%; --a11y-scale: 1.15; }
html[data-a11y-text="130"] { font-size: 130%; --a11y-scale: 1.3; }
html[data-a11y-text="150"] { font-size: 150%; --a11y-scale: 1.5; }
html[data-a11y-text="175"] { font-size: 175%; --a11y-scale: 1.75; }
html[data-a11y-text] body { font-size: calc(var(--mr-fs-base, 16px) * var(--a11y-scale, 1)); }
/* Reflow when text is enlarged: long words may break instead of overflowing. */
html[data-a11y-text] body :where(h1, h2, h3, h4, h5, h6, p, li, dd, dt, td, th, label, blockquote) {
  overflow-wrap: anywhere;
  hyphens: auto;
}
html[data-a11y-text] body :where(a, span, button) { overflow-wrap: break-word; }
@media (max-width: 40rem) {
  html:is([data-a11y-text="150"], [data-a11y-text="175"]) body :where(td, th) { white-space: normal !important; }
}

/* § Line height and spacing (WCAG 1.4.12 values at the wider step). */
html[data-a11y-leading="relaxed"] body :where(p, li, dd, dt, td, th, blockquote, label, a, span) { line-height: 1.75 !important; }
html[data-a11y-leading="loose"] body :where(p, li, dd, dt, td, th, blockquote, label, a, span) { line-height: 2.1 !important; }
html[data-a11y-leading="loose"] body p { margin-block-end: 1em; }
html[data-a11y-spacing="wide"] body { letter-spacing: 0.06em !important; word-spacing: 0.1em !important; }
html[data-a11y-spacing="wider"] body { letter-spacing: 0.12em !important; word-spacing: 0.16em !important; }
html[data-a11y-spacing] body * { letter-spacing: inherit !important; }

/* § Typeface: swap the font tokens so headings and body change together; code keeps its mono face. */
html[data-a11y-font="readable"] {
  --mr-font-heading: "MR A11y Hyperlegible", ui-sans-serif, system-ui, sans-serif;
  --mr-font-body: "MR A11y Hyperlegible", ui-sans-serif, system-ui, sans-serif;
  --mr-font-nav: "MR A11y Hyperlegible", ui-sans-serif, system-ui, sans-serif;
  --mr-font-button: "MR A11y Hyperlegible", ui-sans-serif, system-ui, sans-serif;
  --mr-font-price: "MR A11y Hyperlegible", ui-sans-serif, system-ui, sans-serif;
}
html[data-a11y-font="dyslexic"] {
  --mr-font-heading: "MR A11y OpenDyslexic", ui-sans-serif, system-ui, sans-serif;
  --mr-font-body: "MR A11y OpenDyslexic", ui-sans-serif, system-ui, sans-serif;
  --mr-font-nav: "MR A11y OpenDyslexic", ui-sans-serif, system-ui, sans-serif;
  --mr-font-button: "MR A11y OpenDyslexic", ui-sans-serif, system-ui, sans-serif;
  --mr-font-price: "MR A11y OpenDyslexic", ui-sans-serif, system-ui, sans-serif;
}
html[data-a11y-font="readable"] body :not(code, pre, kbd, samp, i, .fa-solid, .fa-regular, .fa-brands, [class*="fa-"]) { font-family: "MR A11y Hyperlegible", ui-sans-serif, system-ui, sans-serif; }
html[data-a11y-font="dyslexic"] body :not(code, pre, kbd, samp, i, .fa-solid, .fa-regular, .fa-brands, [class*="fa-"]) { font-family: "MR A11y OpenDyslexic", ui-sans-serif, system-ui, sans-serif; }
html[data-a11y-font] body :is(em) { font-style: normal; text-decoration: underline dotted; }

/* § Alignment: ragged right is easier to track than justified text. */
html[data-a11y-align="left"] body :where(p, li, dd, dt, h1, h2, h3, h4, h5, h6, blockquote, td, th) {
  text-align: left !important;
  hyphens: none !important;
}

/* § Contrast. "high" strengthens the store's palette; "dark" and "light" force a high-contrast scheme. */
html[data-a11y-contrast="high"] {
  --mr-text: #000000;
  --mr-heading: #000000;
  --mr-muted: #3b3b3b;
  --mr-border: #6b6b6b;
  --mr-border-strong: #4a4a4a;
  --mr-link: color-mix(in srgb, var(--mr-primary) 55%, #000);
  --mr-link-hover: #000000;
}
html[data-a11y-contrast="dark"] {
  --mr-bg: #000000;
  --mr-surface: #0a0a0a;
  --mr-surface-2: #121212;
  --mr-text: #ffffff;
  --mr-heading: #ffffff;
  --mr-muted: #ececec;
  --mr-border: #9a9a9a;
  --mr-border-strong: #bdbdbd;
  --mr-primary: #ffd77a;
  --mr-primary-600: #ffe6a8;
  --mr-link: #ffd77a;
  --mr-link-hover: #ffffff;
  --mr-footer-bg: #000000;
  --a11y-focus: #ffd77a;
  color-scheme: dark;
}
html[data-a11y-contrast="light"] {
  --mr-bg: #ffffff;
  --mr-surface: #ffffff;
  --mr-surface-2: #ffffff;
  --mr-text: #000000;
  --mr-heading: #000000;
  --mr-muted: #111111;
  --mr-border: #555555;
  --mr-border-strong: #333333;
  --mr-primary: #00245a;
  --mr-primary-600: #001a42;
  --mr-link: #00245a;
  --mr-link-hover: #000000;
  --a11y-focus: #00245a;
  color-scheme: light;
}
/* Selected pills and the launcher sit on the gold primary here, so their text goes dark. */
html[data-a11y-contrast="dark"] .mr-a11y { --mr-badge-text: #000000; }
html[data-a11y-contrast="dark"] body :is(.btn-primary, .button, [class*="mr-btn"]):not([data-a11y-ui] *) { color: #000; }
html[data-a11y-contrast] body :where(input, select, textarea) { border-color: var(--mr-text); }
html[data-a11y-contrast] body a:not([data-a11y-ui] *) { text-decoration-thickness: 2px; }

/* § Saturation, applied to page content only so the panel stays legible. */
html[data-a11y-saturation="low"] body > :not([data-a11y-ui]) { filter: saturate(0.35); }
html[data-a11y-saturation="none"] body > :not([data-a11y-ui]) { filter: grayscale(1); }

/* § Highlights: outlines and backgrounds only, so nothing moves. */
html[data-a11y-links="on"] body a:not([data-a11y-ui] *) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px;
  background-color: var(--a11y-mark);
  outline: 1px solid var(--a11y-accent);
  outline-offset: 1px;
}
html[data-a11y-headings="on"] body :is(h1, h2, h3, h4, h5, h6):not([data-a11y-ui] *) {
  outline: 2px solid var(--a11y-accent);
  outline-offset: 6px;
}
html[data-a11y-focus="on"] :focus-visible {
  outline: 4px solid var(--a11y-focus) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--a11y-accent) 45%, transparent) !important;
}

/* § Motion: "system" defers to the theme's prefers-reduced-motion rules. */
html[data-a11y-motion="pause"] { scroll-behavior: auto !important; }
html[data-a11y-motion="pause"] *,
html[data-a11y-motion="pause"] *::before,
html[data-a11y-motion="pause"] *::after {
  animation-play-state: paused !important;
  animation-delay: -1ms !important;
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* § Pointer. */
html[data-a11y-cursor="large"],
html[data-a11y-cursor="large"] * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewBox='0 0 40 48'%3E%3Cpath d='M6 4 L6 38 L14.5 30 L20 43 L26 40.5 L20.5 28 L32 28 Z' fill='%23000' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 6 4, auto !important;
}
html[data-a11y-cursor="large"] :is(a, button, [role="button"], [role="radio"], [role="switch"], label, summary, select),
html[data-a11y-cursor="large"] :is(a, button, [role="button"], [role="radio"], [role="switch"], label, summary, select) * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewBox='0 0 40 48'%3E%3Cpath d='M14 22 V7.5 a3 3 0 0 1 6 0 V20 h0.5 V17 a3 3 0 0 1 6 0 v3.5 a3 3 0 0 1 6 0 v2 a3 3 0 0 1 5 2 V33 c0 7 -5 12 -12 12 h-3 c-5 0 -8 -2.5 -11 -7 L4.5 30 a3 3 0 0 1 5 -3.5 L14 32 Z' fill='%23000' stroke='%23fff' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E") 16 4, pointer !important;
}

/* § Reading aids. */
.mr-a11y-guide,
.mr-a11y-mask { position: fixed; left: 0; right: 0; z-index: 2147483000; pointer-events: none; }
.mr-a11y-guide {
  height: 0.6rem;
  margin-top: -0.3rem;
  background: color-mix(in srgb, var(--a11y-accent) 55%, transparent);
  border-block: 1px solid var(--a11y-accent);
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25);
}
.mr-a11y-mask { background: rgb(0 0 0 / 0.62); }

/* ── Launcher ─────────────────────────────────────────────────────── */
.mr-a11y-launcher {
  position: fixed;
  z-index: 1040;
  display: inline-flex;
  align-items: center;
  gap: 0;
  height: 3rem;
  max-width: 3rem;
  padding: 0 .8rem;
  overflow: hidden;
  border: 2px solid var(--mr-surface, #fff);
  border-radius: var(--mr-radius-pill, 999px);
  background: var(--mr-primary, #B4694E);
  color: var(--mr-badge-text, #fff);
  font: 600 .9rem/1 var(--mr-font-button, inherit);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--mr-shadow, 0 4px 18px rgba(0, 0, 0, .15));
  transition: max-width .25s ease, gap .25s ease, background var(--mr-transition, .22s ease);
}
.mr-a11y-launcher:hover,
.mr-a11y-launcher:focus-visible { max-width: 14rem; gap: .55rem; background: var(--mr-primary-600, #9E5842); }
.mr-a11y-launcher:focus-visible { outline: 3px solid var(--mr-heading, #211E1A); outline-offset: 3px; }
.mr-a11y-icon { flex: none; }
.mr-a11y-launcher-label { opacity: 0; transition: opacity .2s ease; }
.mr-a11y-launcher:hover .mr-a11y-launcher-label,
.mr-a11y-launcher:focus-visible .mr-a11y-launcher-label { opacity: 1; }
.mr-a11y-dot {
  position: absolute; top: .3rem; right: .3rem;
  width: .65rem; height: .65rem; border-radius: 50%;
  background: var(--mr-accent, #D8A24A); border: 2px solid var(--mr-surface, #fff);
}
.mr-a11y-dot[hidden] { display: none; }

/* Positions: left/right edge, bottom or vertical middle. */
.mr-a11y-launcher--bottom-left   { left: 1.1rem;  bottom: 1.1rem; }
.mr-a11y-launcher--bottom-right  { right: 1.1rem; bottom: 4.9rem; }
.mr-a11y-launcher--middle-left   { left: 1.1rem;  top: 50%; transform: translateY(-50%); }
.mr-a11y-launcher--middle-right  { right: 1.1rem; top: 50%; transform: translateY(-50%); }
.mr-a11y-launcher--bottom-right,
.mr-a11y-launcher--middle-right { flex-direction: row-reverse; }
/* Keep the sales-notification toast clear of a bottom-left launcher. */
body:has(.mr-a11y-launcher--bottom-left) .mr-salespop--bottom-left { left: 5rem; }

/* ── Panel (native <dialog>) ──────────────────────────────────────── */
.mr-a11y-dialog {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  width: min(27rem, 100vw);
  max-width: 100vw;
  padding: 0;
  border: 0;
  background: var(--mr-surface, #fff);
  color: var(--mr-text, #2B2723);
  box-shadow: var(--mr-shadow-hover, 0 12px 34px rgba(0, 0, 0, .25));
}
.mr-a11y-dialog[data-side="left"] { margin: 0 auto 0 0; }
.mr-a11y-dialog::backdrop { background: rgb(20 16 12 / 0.5); }
.mr-a11y-dialog[open] { animation: mr-a11y-in .2s ease-out; display: block; }
@keyframes mr-a11y-in { from { transform: translateX(1.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
.mr-a11y-dialog[data-side="left"][open] { animation-name: mr-a11y-in-left; }
@keyframes mr-a11y-in-left { from { transform: translateX(-1.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mr-a11y-dialog[open] { animation: none; } .mr-a11y-launcher { transition: none; } }

.mr-a11y-panel { display: flex; flex-direction: column; height: 100%; font-family: var(--mr-font-body, inherit); }
.mr-a11y-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.25rem 1.25rem 1rem; border-bottom: 1px solid var(--mr-border, #E7DFD5);
}
.mr-a11y-title { margin: 0 0 .35rem; font: var(--mr-heading-weight, 600) 1.3rem/1.2 var(--mr-font-heading, inherit); color: var(--mr-heading, #211E1A); }
.mr-a11y-intro { margin: 0; font-size: .88rem; line-height: 1.5; color: var(--mr-muted, #6f665e); }
.mr-a11y-close {
  flex: none; width: 2.5rem; height: 2.5rem; border: 1px solid var(--mr-border, #E7DFD5); border-radius: 50%;
  background: transparent; color: var(--mr-text, #2B2723); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.mr-a11y-close:hover { background: var(--mr-surface-2, #F4ECE3); }
.mr-a11y-body { flex: 1; overflow-y: auto; padding: .5rem 1.25rem 1rem; }
.mr-a11y-section { padding: 1rem 0; border-bottom: 1px solid var(--mr-border, #E7DFD5); }
.mr-a11y-sec-title {
  margin: 0 0 .75rem; font: 700 .75rem/1.2 var(--mr-font-body, inherit); letter-spacing: .08em; text-transform: uppercase; color: var(--mr-primary-600, #9E5842);
}
.mr-a11y-pref { margin-bottom: 1rem; }
.mr-a11y-pref:last-child { margin-bottom: 0; }
.mr-a11y-preflabel { display: block; margin-bottom: .35rem; font-weight: 600; font-size: .95rem; color: var(--mr-heading, #211E1A); }
.mr-a11y-hint { display: block; margin: -.15rem 0 .5rem; font-size: .8rem; line-height: 1.45; color: var(--mr-muted, #6f665e); }
.mr-a11y-choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.mr-a11y-choice {
  min-height: 2.25rem; padding: .35rem .8rem; border: 1px solid var(--mr-border-strong, #D8CCBD);
  border-radius: var(--mr-radius-sm, 9px); background: var(--mr-surface, #fff); color: var(--mr-text, #2B2723);
  font: 500 .875rem/1.2 var(--mr-font-body, inherit); cursor: pointer; transition: background var(--mr-transition, .2s), color var(--mr-transition, .2s);
}
.mr-a11y-choice:hover { background: var(--mr-surface-2, #F4ECE3); }
.mr-a11y-choice[aria-checked="true"] { background: var(--mr-primary, #B4694E); border-color: var(--mr-primary, #B4694E); color: var(--mr-badge-text, #fff); }
.mr-a11y-switchrow { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.mr-a11y-prefinfo { flex: 1; }
.mr-a11y-switch {
  flex: none; min-width: 4.4rem; min-height: 2.25rem; padding: .3rem .8rem; border: 2px solid var(--mr-border-strong, #D8CCBD);
  border-radius: var(--mr-radius-pill, 999px); background: var(--mr-surface, #fff); color: var(--mr-text, #2B2723);
  font: 600 .8rem/1 var(--mr-font-body, inherit); cursor: pointer;
}
.mr-a11y-switch[aria-checked="true"] { background: var(--mr-primary, #B4694E); border-color: var(--mr-primary, #B4694E); color: var(--mr-badge-text, #fff); }
.mr-a11y-dialog :is(button, a):focus-visible { outline: 3px solid var(--mr-heading, #211E1A); outline-offset: 2px; }
.mr-a11y-specimen { margin-top: 1rem; padding: .9rem 1rem; border: 1px dashed var(--mr-border-strong, #D8CCBD); border-radius: var(--mr-radius-sm, 9px); background: var(--mr-surface-2, #F4ECE3); }
.mr-a11y-specimen-label { display: block; margin-bottom: .25rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mr-muted, #6f665e); }
.mr-a11y-specimen p { margin: 0; }
.mr-a11y-foot { padding: .9rem 1.25rem 1.1rem; border-top: 1px solid var(--mr-border, #E7DFD5); }
.mr-a11y-status { min-height: 1.2em; margin: 0 0 .5rem; font-size: .8rem; color: var(--mr-muted, #6f665e); }
.mr-a11y-foot-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.mr-a11y-reset {
  min-height: 2.5rem; padding: .45rem 1rem; border: 1px solid var(--mr-heading, #211E1A); border-radius: var(--mr-radius-sm, 9px);
  background: transparent; color: var(--mr-heading, #211E1A); font: 600 .875rem/1 var(--mr-font-body, inherit); cursor: pointer;
}
.mr-a11y-reset:hover { background: var(--mr-heading, #211E1A); color: var(--mr-surface, #fff); }
.mr-a11y-statement { font-size: .875rem; color: var(--mr-link, #9E5842); text-decoration: underline; }

/* The panel scales with the page text but never hyphenates its own copy. */
.mr-a11y-dialog :where(p, h2, h3, span, label, button, a) { hyphens: manual !important; overflow-wrap: break-word; }
@media print { .mr-a11y, .mr-a11y-guide, .mr-a11y-mask { display: none !important; } }
