/* ==========================================================================
   Diamor - Accessibility overrides
   --------------------------------------------------------------------------
   Fixes for the "One Click Accessibility / Pojo A11y" plugin modes:

     body.pojo-a11y-high-contrast     (High contrast)
     body.pojo-a11y-negative-contrast (Negative contrast)
     body.pojo-a11y-light-background  (Light background)

   THE PROBLEM
   The plugin repaints the page with the `background` SHORTHAND and !important:

     body.pojo-a11y-high-contrast a, div, span, ...   { background: black !important }
     body.pojo-a11y-negative-contrast :not(#pojo-a11y-toolbar) { background: #000 !important }
     body.pojo-a11y-light-background  :not(#pojo-a11y-toolbar) { background: #fff !important }

   The shorthand resets `background-image` to `none`, so every CSS background
   image on the site (Elementor containers, category cards, banners...) turns
   into a flat black or white block.

   THE FIX
   Pure CSS cannot bring an unknown image URL back once it has been killed with
   !important, so the URLs are re-applied inline by js/accessibility.js, which
   also tags each such element with `.a11y-bg-restored`. Everything below builds
   on that tag: it clears whatever the plugin paints ON TOP of the image, and
   keeps the text sitting on the image readable.

   ABOUT `:not(#pojo-a11y-toolbar *)` BELOW - IT DOES TWO JOBS

   1. SPECIFICITY. The plugin's negative-contrast and light-background rules
      score (1 id, 1 class, 1 type) thanks to their own `:not(#pojo-a11y-toolbar)`.
      A selector built only from classes can never outrank an id, no matter how
      many classes it has, so our rules borrow a `:not()` with an id to reach
      (1 id, 2+ classes) and win. Delete it and two of the three modes silently
      stop working.

   2. IT KEEPS THE ACCESSIBILITY TOOLBAR OUT. Note the ` *` - it excludes every
      element INSIDE #pojo-a11y-toolbar, not just the <nav> itself. That matters:
      an earlier version used the bare `:not(#pojo-a11y-toolbar)`, which still
      let the toolbar's own links and buttons match the button rules in section 4,
      and the "fix" for that (a `padding: revert !important` reset) collapsed the
      10px 15px padding on every item in the accessibility menu. Excluding the
      toolbar's descendants here is the correct fix, so no reset rule is needed
      and the toolbar renders exactly as the plugin designed it.

   Loaded from functions.php after the plugin stylesheet.
   ========================================================================== */

:root {
	--a11y-dark-bg:   #000;
	--a11y-dark-fg:   #fff;
	--a11y-light-bg:  #fff;
	--a11y-light-fg:  #000;
	--a11y-border-w:  2px;
	--a11y-text-pad:  4px 10px;
}


/* ==========================================================================
   1. BACKGROUND IMAGES - whole site, all three modes
   ========================================================================== */

/* 1.1 The container that owns the image keeps its image (re-applied inline with
       !important by the JS) but must not be tinted by the plugin's flat colour. */
html body.pojo-a11y-high-contrast     .a11y-bg-restored:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast .a11y-bg-restored:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background  .a11y-bg-restored:not(#pojo-a11y-toolbar *) {
	background-color: transparent !important;
	-webkit-filter: none !important;
	        filter: none !important;
	opacity: 1 !important;
}

/* 1.2 Every wrapper INSIDE that container (Elementor's .e-con-inner,
       .elementor-widget-container, column/row divs, overlays...) is painted
       solid by the plugin and covers the image completely. Make them
       see-through so the restored image is actually visible. */
html body.pojo-a11y-high-contrast     .a11y-bg-restored *:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast .a11y-bg-restored *:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background  .a11y-bg-restored *:not(#pojo-a11y-toolbar *) {
	background-color: transparent !important;
}

/* 1.3 Same for the ::before / ::after layers Elementor uses for background
       overlays and hover states. */
html body.pojo-a11y-high-contrast     .a11y-bg-restored:not(#pojo-a11y-toolbar *)::before,
html body.pojo-a11y-high-contrast     .a11y-bg-restored:not(#pojo-a11y-toolbar *)::after,
html body.pojo-a11y-high-contrast     .a11y-bg-restored *:not(#pojo-a11y-toolbar *)::before,
html body.pojo-a11y-high-contrast     .a11y-bg-restored *:not(#pojo-a11y-toolbar *)::after,
html body.pojo-a11y-negative-contrast .a11y-bg-restored:not(#pojo-a11y-toolbar *)::before,
html body.pojo-a11y-negative-contrast .a11y-bg-restored:not(#pojo-a11y-toolbar *)::after,
html body.pojo-a11y-negative-contrast .a11y-bg-restored *:not(#pojo-a11y-toolbar *)::before,
html body.pojo-a11y-negative-contrast .a11y-bg-restored *:not(#pojo-a11y-toolbar *)::after,
html body.pojo-a11y-light-background  .a11y-bg-restored:not(#pojo-a11y-toolbar *)::before,
html body.pojo-a11y-light-background  .a11y-bg-restored:not(#pojo-a11y-toolbar *)::after,
html body.pojo-a11y-light-background  .a11y-bg-restored *:not(#pojo-a11y-toolbar *)::before,
html body.pojo-a11y-light-background  .a11y-bg-restored *:not(#pojo-a11y-toolbar *)::after {
	background-color: transparent !important;
}


/* ==========================================================================
   2. REAL MEDIA (<img>, <picture>, <video>, <svg>, canvas) - whole site
   --------------------------------------------------------------------------
   High contrast sets `img { background: grey !important }`, which puts a grey
   plate behind every transparent PNG (logo, payment icons, badges...).
   ========================================================================== */

html body.pojo-a11y-high-contrast     img:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-high-contrast     picture:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-high-contrast     video:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-high-contrast     canvas:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast img:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast picture:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast video:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast canvas:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background  img:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background  picture:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background  video:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background  canvas:not(#pojo-a11y-toolbar *) {
	background: transparent !important;
	border: 0 !important;
	-webkit-filter: none !important;
	        filter: none !important;
	mix-blend-mode: normal !important;
}

/* 2.1 The wrapper an image sits in must not paint over it either. */
html body.pojo-a11y-high-contrast     :is(.elementor-widget-image, .elementor-image, .wp-block-image, .woocommerce-product-gallery__image, .astra-shop-thumbnail-wrap, figure) > img:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast :is(.elementor-widget-image, .elementor-image, .wp-block-image, .woocommerce-product-gallery__image, .astra-shop-thumbnail-wrap, figure) > img:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background  :is(.elementor-widget-image, .elementor-image, .wp-block-image, .woocommerce-product-gallery__image, .astra-shop-thumbnail-wrap, figure) > img:not(#pojo-a11y-toolbar *) {
	background: transparent !important;
}

/* 2.2 Icon SVGs follow the text colour so they never end up black-on-black
       (limited to icon wrappers so multi-colour logos are left alone). */
html body.pojo-a11y-high-contrast     :is(.elementor-icon, .ast-icon, .elementor-social-icon, .elementor-button-icon, .tinvwl-icon, i) > svg:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast :is(.elementor-icon, .ast-icon, .elementor-social-icon, .elementor-button-icon, .tinvwl-icon, i) > svg:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-high-contrast     :is(.elementor-icon, .ast-icon, .elementor-social-icon, .elementor-button-icon, .tinvwl-icon, i) > svg :is(path, circle, rect, polygon, line):not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast :is(.elementor-icon, .ast-icon, .elementor-social-icon, .elementor-button-icon, .tinvwl-icon, i) > svg :is(path, circle, rect, polygon, line):not(#pojo-a11y-toolbar *) {
	fill: currentColor !important;
	stroke: currentColor !important;
}

html body.pojo-a11y-light-background :is(.elementor-icon, .ast-icon, .elementor-social-icon, .elementor-button-icon, .tinvwl-icon, i) > svg:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background :is(.elementor-icon, .ast-icon, .elementor-social-icon, .elementor-button-icon, .tinvwl-icon, i) > svg :is(path, circle, rect, polygon, line):not(#pojo-a11y-toolbar *) {
	fill: var(--a11y-light-fg) !important;
	stroke: var(--a11y-light-fg) !important;
}

/* 2.3 The site logo keeps its own transparency. */
html body.pojo-a11y-high-contrast     :is(.custom-logo-link, .site-logo-img, .astra-logo-svg, .ast-site-identity) img:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast :is(.custom-logo-link, .site-logo-img, .astra-logo-svg, .ast-site-identity) img:not(#pojo-a11y-toolbar *),
html body.pojo-a11y-light-background  :is(.custom-logo-link, .site-logo-img, .astra-logo-svg, .ast-site-identity) img:not(#pojo-a11y-toolbar *) {
	background: transparent !important;
}


/* ==========================================================================
   3. HOME PAGE - solid plate behind the text only
   --------------------------------------------------------------------------
   Section 1 removed the flat colour from the image containers so the pictures
   show through. On the home page those containers also hold headings and CTAs,
   so the TEXT gets its black plate back (white in Light background mode, where
   the text itself is black) while the container stays transparent.

   Scoped to `body.home` + `.a11y-bg-restored`, so no other page or section on
   the site is affected.
   ========================================================================== */

/* 3.1 Text: black plate, dark modes. */
html body.home.pojo-a11y-high-contrast     .a11y-bg-restored :is(h1, h2, h3, h4, h5, h6, p, .elementor-heading-title, a):not(#pojo-a11y-toolbar *):not(:where(h1, h2, h3, h4, h5, h6, p, .elementor-heading-title) *):not(.elementor-button):not(.button):not(:where(.elementor-button, .button) *),
html body.home.pojo-a11y-negative-contrast .a11y-bg-restored :is(h1, h2, h3, h4, h5, h6, p, .elementor-heading-title, a):not(#pojo-a11y-toolbar *):not(:where(h1, h2, h3, h4, h5, h6, p, .elementor-heading-title) *):not(.elementor-button):not(.button):not(:where(.elementor-button, .button) *) {
	background-color: var(--a11y-dark-bg) !important;
	padding: var(--a11y-text-pad) !important;
	display: inline-block;
	-webkit-box-decoration-break: clone;
	        box-decoration-break: clone;
}

/* 3.2 Text: white plate, Light background mode. */
html body.home.pojo-a11y-light-background .a11y-bg-restored :is(h1, h2, h3, h4, h5, h6, p, .elementor-heading-title, a):not(#pojo-a11y-toolbar *):not(:where(h1, h2, h3, h4, h5, h6, p, .elementor-heading-title) *):not(.elementor-button):not(.button):not(:where(.elementor-button, .button) *) {
	background-color: var(--a11y-light-bg) !important;
	color: var(--a11y-light-fg) !important;
	padding: var(--a11y-text-pad) !important;
	display: inline-block;
	-webkit-box-decoration-break: clone;
	        box-decoration-break: clone;
}

/* 3.3 Buttons on the home page get the plate too, but keep their own padding so
       they do not change size. */
html body.home.pojo-a11y-high-contrast     .a11y-bg-restored :is(.elementor-button, .button, button, a.button):not(#pojo-a11y-toolbar *),
html body.home.pojo-a11y-negative-contrast .a11y-bg-restored :is(.elementor-button, .button, button, a.button):not(#pojo-a11y-toolbar *) {
	background-color: var(--a11y-dark-bg) !important;
}

html body.home.pojo-a11y-light-background .a11y-bg-restored :is(.elementor-button, .button, button, a.button):not(#pojo-a11y-toolbar *) {
	background-color: var(--a11y-light-bg) !important;
	color: var(--a11y-light-fg) !important;
}

/* 3.4 Layout wrappers stay transparent - only the text itself is plated. */
html body.home.pojo-a11y-high-contrast     .a11y-bg-restored :is(.e-con-inner, .elementor-widget-wrap, .elementor-widget-container, .elementor-widget, .elementor-column, .elementor-row):not(#pojo-a11y-toolbar *),
html body.home.pojo-a11y-negative-contrast .a11y-bg-restored :is(.e-con-inner, .elementor-widget-wrap, .elementor-widget-container, .elementor-widget, .elementor-column, .elementor-row):not(#pojo-a11y-toolbar *),
html body.home.pojo-a11y-light-background  .a11y-bg-restored :is(.e-con-inner, .elementor-widget-wrap, .elementor-widget-container, .elementor-widget, .elementor-column, .elementor-row):not(#pojo-a11y-toolbar *) {
	background-color: transparent !important;
}


/* ==========================================================================
   4. BUTTONS & FORM CONTROLS - white border on dark, black border on light
   ========================================================================== */

/* 4.1 Dark modes -> white border. */
html body.pojo-a11y-high-contrast :is(
		button, a.button, .button, .wp-block-button__link, .elementor-button,
		.ast-button, .ast-custom-button, .menu-link.ast-custom-button,
		input[type="button"], input[type="submit"], input[type="reset"],
		input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
		input[type="number"], input[type="password"], input[type="search"], input[type="date"],
		select, textarea,
		.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
		.woocommerce .single_add_to_cart_button, .woocommerce .checkout-button,
		.woocommerce .added_to_cart, .tinvwl_add_to_wishlist_button,
		.quantity input.qty, .wc-proceed-to-checkout a
	):not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast :is(
		button, a.button, .button, .wp-block-button__link, .elementor-button,
		.ast-button, .ast-custom-button, .menu-link.ast-custom-button,
		input[type="button"], input[type="submit"], input[type="reset"],
		input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
		input[type="number"], input[type="password"], input[type="search"], input[type="date"],
		select, textarea,
		.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
		.woocommerce .single_add_to_cart_button, .woocommerce .checkout-button,
		.woocommerce .added_to_cart, .tinvwl_add_to_wishlist_button,
		.quantity input.qty, .wc-proceed-to-checkout a
	):not(#pojo-a11y-toolbar *) {
	border: var(--a11y-border-w) solid var(--a11y-dark-fg) !important;
}

/* 4.2 Light background mode -> black border. */
html body.pojo-a11y-light-background :is(
		button, a.button, .button, .wp-block-button__link, .elementor-button,
		.ast-button, .ast-custom-button, .menu-link.ast-custom-button,
		input[type="button"], input[type="submit"], input[type="reset"],
		input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
		input[type="number"], input[type="password"], input[type="search"], input[type="date"],
		select, textarea,
		.woocommerce a.button, .woocommerce button.button, .woocommerce input.button,
		.woocommerce .single_add_to_cart_button, .woocommerce .checkout-button,
		.woocommerce .added_to_cart, .tinvwl_add_to_wishlist_button,
		.quantity input.qty, .wc-proceed-to-checkout a
	):not(#pojo-a11y-toolbar *) {
	border: var(--a11y-border-w) solid var(--a11y-light-fg) !important;
}

/* 4.3 Separators / cards / tables get a matching outline so the layout is still
       readable once every surface is the same flat colour. */
html body.pojo-a11y-high-contrast     :is(table, td, th, fieldset, hr, .woocommerce-info, .woocommerce-message, .woocommerce-error, .cart_totals, .order-total):not(#pojo-a11y-toolbar *),
html body.pojo-a11y-negative-contrast :is(table, td, th, fieldset, hr, .woocommerce-info, .woocommerce-message, .woocommerce-error, .cart_totals, .order-total):not(#pojo-a11y-toolbar *) {
	border-color: var(--a11y-dark-fg) !important;
}

html body.pojo-a11y-light-background :is(table, td, th, fieldset, hr, .woocommerce-info, .woocommerce-message, .woocommerce-error, .cart_totals, .order-total):not(#pojo-a11y-toolbar *) {
	border-color: var(--a11y-light-fg) !important;
}

/* 4.4 Keyboard focus must stay obvious on top of every mode. */
html body.pojo-a11y-high-contrast     :focus-visible,
html body.pojo-a11y-negative-contrast :focus-visible {
	outline: 3px solid var(--a11y-dark-fg) !important;
	outline-offset: 2px !important;
}

html body.pojo-a11y-light-background :focus-visible {
	outline: 3px solid var(--a11y-light-fg) !important;
	outline-offset: 2px !important;
}


/* ==========================================================================
   5. The accessibility toolbar
   --------------------------------------------------------------------------
   Deliberately EMPTY. The toolbar is left entirely to the plugin - every rule
   in this file already excludes it via `:not(#pojo-a11y-toolbar *)`, so its
   own padding, borders, colours and spacing survive untouched in all three
   modes. Do not add a reset here: a previous `padding: revert !important`
   reset flattened the 10px 15px padding on every menu item.
   ========================================================================== */
