/* ===========================================================================
   SynNutra Equine — accessibility fixes, CSS layer
   Target: wp-content/themes/verdaagro-child/css/a11y.css, enqueued LAST.

   DO NOT append this to verdaagro-child/style.css. Checked on 2026-12-02: that
   stylesheet prints at position 22 of 158, and 136 stylesheets load after it,
   including the parent's main.css (which holds the *:focus{outline:none} rule
   this file overrides), responsive.css, dynamic.css and all of Elementor.
   Rules here that tie on specificity would lose.

   The enqueue is handled for you. s4s-a11y.php in this folder registers this
   file with explicit dependencies on verdaagro-main, verdaagro-responsive,
   verdaagro-dynamic and elementor-frontend, at priority 999, and skips any of
   those handles that is not registered on a given request (WordPress silently
   refuses to enqueue a stylesheet whose dependency is missing, which would
   drop this whole file). Those four handles were read off the rendered page.

   Install, in full: copy this file to verdaagro-child/css/a11y.css, copy
   a11y.js to verdaagro-child/js/a11y.js, copy s4s-a11y.php to
   verdaagro-child/inc/s4s-a11y.php, and add one line to functions.php.
   See DEPLOY-AND-ROLLBACK.md in this folder.

   Written 2026-12-02 against the Odla accessibility audit v1.0 (1 Dec 2026)
   and the live markup of synnutraequine.com fetched the same day.

   WHAT THIS FILE CLOSES
     A11Y-04  no visible focus indicator        (closes it)
     A11Y-05  sticky header hides focus         (closes it)
     A11Y-15  links shown by colour alone       (closes it)
     A11Y-18  big headings overlap with spacing (closes it)
     A11Y-08  contrast                          (theme-side only, see notes)
     A11Y-07  faint newsletter field outline    (the outline only)
     A11Y-09  motion                            (CSS motion only, see notes)
     A11Y-14  icon-only button names            (provides the utility class)
     A11Y-16  skip link                         (provides the styling)

   WHAT THIS FILE CANNOT CLOSE
     A11Y-01, 02, 03, 06, 10, 11, 12, 13, 16*, 17, 19, 20, 21, 22, 23, 24, 26
     Those need markup, PHP, plugin settings, JS config or content work.
     See FIX-PLAN.md in this folder.

   NOT YET TESTED ON THE SITE. Every rule here is written from the audit's
   named selectors and the live HTML, but nothing has been loaded in a browser
   against the real page. Test in a staging copy or via devtools before it
   goes live. The blocks marked TEST FIRST are the ones most likely to need
   adjusting.
   =========================================================================== */


/* ---------------------------------------------------------------------------
   1. FOCUS INDICATOR                                        A11Y-04, serious
   ---------------------------------------------------------------------------
   Root cause, confirmed in the theme's main.css: a global `*:focus { outline:
   none }` plus ten more specific outline:none rules. That is why 228 of 296
   measured Tab stops showed no visible change.

   !important is deliberate here. The theme's `*:focus` rule and Elementor's
   kit CSS both load after the child theme in some configurations, and a focus
   ring that loses a specificity race is the bug we are fixing.

   :focus-visible means mouse users do not see the ring; keyboard users do.
   --------------------------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex], [role="button"],
       [role="link"], [role="tab"], [role="menuitem"]):focus-visible,
.wp-block-button__link:focus-visible,
.elementor-button:focus-visible {
  outline: 3px solid #1F5F2A !important;   /* dark brand green */
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px #FFFFFF !important; /* white halo, for photo and dark backgrounds */
  border-radius: 2px;
}

/* The theme sets outline:none on these specifically. Undo it only on
   keyboard focus; the unfocused appearance is untouched. */
*:focus-visible,
input[type="submit"]:focus-visible,
button:focus-visible,
.wgl_modal-window:focus-visible,
.header_search.search_alt .header_search-field .search-button:focus-visible,
.header_search.search_standard .header_search-field .search-button:focus-visible,
body .widget_search .search-form .search-field:focus-visible,
body .widget_product_search .woocommerce-product-search .search-field:focus-visible,
body .wgl-carousel_wrapper .swiper-pagination .swiper-pagination-bullet button:focus-visible {
  outline: 3px solid #1F5F2A !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px #FFFFFF !important;
}

/* Inside the dark header the white halo is the part that reads. Keep both. */
.header_wrapper :focus-visible,
.wgl-header :focus-visible {
  outline-color: #FFFFFF !important;
  box-shadow: 0 0 0 5px rgba(0, 0, 0, .55) !important;
}

/* Windows high-contrast mode: let the system ring through. */
@media (forced-colors: active) {
  *:focus-visible {
    outline: 3px solid Highlight !important;
    box-shadow: none !important;
  }
}


/* ---------------------------------------------------------------------------
   2. STICKY HEADER COVERING THE FOCUSED CONTROL             A11Y-05, serious
   ---------------------------------------------------------------------------
   Shift+Tab on a product page lands on Add to Cart, the quantity field and the
   Servings select while all three sit behind the sticky header. scroll-padding
   tells the browser to stop short of it.

   TEST FIRST: the audit measured the sticky header at about 110px. Check the
   real height at 1440px and at 768px and adjust the two values below.
   --------------------------------------------------------------------------- */

:root {
  --s4s-sticky-header: 120px;  /* measured header height + a little clearance */
}

html {
  scroll-padding-top: var(--s4s-sticky-header);
}

@media (max-width: 1024px) {
  :root { --s4s-sticky-header: 90px; }
}


/* ---------------------------------------------------------------------------
   3. LINKS IN BODY TEXT SHOWN BY COLOUR ALONE               A11Y-15, moderate
   ---------------------------------------------------------------------------
   Scoped to running text only, so buttons, menus, product tiles and cards keep
   their current look. Underline offset keeps descenders readable.
   --------------------------------------------------------------------------- */

.entry-content p a,
.entry-content li a,
.woocommerce-Tabs-panel p a,
.woocommerce-Tabs-panel li a,
.woocommerce-product-details__short-description a,
.elementor-widget-text-editor p a,
.elementor-widget-text-editor li a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: max(1px, 0.06em);
}

/* Do not underline a link that only wraps an image or a button. */
.entry-content p a:has(> img),
.entry-content li a:has(> img),
.elementor-widget-text-editor a:has(> img),
.entry-content a.button,
.entry-content a.elementor-button {
  text-decoration: none;
}


/* ---------------------------------------------------------------------------
   4. BIG HEADINGS OVERLAP WITH WCAG TEXT SPACING            A11Y-18, moderate
   ---------------------------------------------------------------------------
   On the FAQ page "Understanding SynNutra" prints over the answer beside it
   once a reader applies WCAG 1.4.12 spacing. Cause: fixed font sizes in fixed
   containers with no wrapping.

   TEST FIRST: the clamp() minimums below are a starting point. Check the
   homepage hero and the FAQ page at 1440, 768 and 390px, and with the WCAG
   text-spacing bookmarklet applied.
   --------------------------------------------------------------------------- */

.elementor-widget-heading .elementor-heading-title,
.entry-content h1,
.entry-content h2,
.entry-content h3 {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}

/* Let large display headings shrink rather than collide. */
.elementor-widget-heading .elementor-heading-title {
  font-size: clamp(1.75rem, 4.2vw, var(--s4s-heading-max, 3.5rem));
  line-height: 1.15;
}

/* Fixed heights are what force the overlap. Release them where headings live. */
.elementor-widget-heading,
.elementor-widget-heading .elementor-widget-container {
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}


/* ---------------------------------------------------------------------------
   5. CONTRAST, THEME-CONTROLLED ELEMENTS ONLY               A11Y-08, serious
   ---------------------------------------------------------------------------
   The audit checked and supplied every replacement colour below; these are its
   values, not new ones.

   NOT COVERED HERE: the homepage sale banner (white on #FF8C00, 2.33:1), the
   coupon banner, "customer testimonials", and the green section labels. Those
   are Elementor content with per-element inline styles. Overriding them from a
   stylesheet is fragile and will silently break the next time someone edits
   the banner. Change them in Elementor instead, using these checked values:
       white text  ->  background no lighter than #B35F00  (4.61:1)
       white text  ->  background #4E7A2A instead of #92C83E (5.07:1)
       green label ->  #4A7330 on the cream background      (5.01:1)
   --------------------------------------------------------------------------- */

/* Unselected product tab names: 1.95:1 -> 5.63:1 */
.woocommerce-tabs ul.tabs.wc-tabs li a,
.woocommerce-tabs ul.tabs.wc-tabs li:not(.active) a {
  color: #5F6B58;
}

.woocommerce-tabs ul.tabs.wc-tabs li.active a {
  color: #1F2A17;
}

/* Struck-through old price: 2.29:1 -> passes */
.woocommerce del,
.woocommerce del .woocommerce-Price-amount,
.woocommerce-Price-amount del {
  color: #5F6B58;
  opacity: 1;              /* the theme dims this; dimming is the contrast bug */
}

/* Stock counts and product counts: 3.41:1 and 2.52:1 */
.woocommerce .stock,
.woocommerce .stock.in-stock,
.woocommerce-result-count,
.woocommerce .product .count {
  color: #4A5543;
}

.woocommerce .stock.out-of-stock {
  color: #8A2A12;          /* readable red, still reads as a warning */
}

/* "Clear options" link: 3.83:1 */
.woocommerce a.reset_variations {
  color: #4A5543;
  text-decoration: underline;
}

/* Checkout shipping message: 3.33:1 */
.woocommerce-info,
.woocommerce-message,
.wc-block-components-notice-banner {
  color: #243018;
}

/* Add to Cart before an option is chosen looked disabled but still responds.
   Keep it looking available. */
.woocommerce .single_add_to_cart_button.disabled,
.woocommerce .single_add_to_cart_button:disabled {
  opacity: 1;
  color: #FFFFFF;
  background-color: #3C6B22;
}

/* Added 2026-12-03 after the live retest measured this one at 4.14:1.
   "Read More" in the theme's blog widget, the brand green #558137 on the cream
   panel #F5F3F0. It needs 4.5:1 and is a hair short. This is theme markup, not
   Elementor content, so a stylesheet rule is stable here: the element and its
   classes come from the widget, not from whoever edits the page. #4A7330 is the
   audit's own checked replacement, 5.01:1 on the cream and 5.39:1 on white, so
   it still passes if the section background is ever changed to white.
   The same green on white already passes at 4.58:1 and is left alone. */
.elementor-widget-wgl-blog .button__text,
.wgl-blog .wgl-button .button__text {
  color: #4A7330;
}

/* Added 2026-12-03, second pass. The same brand green, same cream, same 4.14:1,
   this time on the double-heading widget's small label: "OUR PRODUCTS",
   "SYNNUTRA NEWS", "SUPPORT FOR YOUR HORSE". Measured on the live homepage.

   This one was on the Elementor list in the note above. That was wrong, and
   measuring it is what showed why: the colour is not per-element Elementor
   styling at all. It comes from the parent theme's own main.css, as
   `color: var(--verdaagro-primary-color)` on the widget's class, so it meets
   the same test as the rule above and belongs here.

   Changing --verdaagro-primary-color itself would have been the other way in,
   and it is the wrong one: that variable is the brand green for buttons, links
   and accents site-wide, so a 4.5:1 problem on one cream panel would have
   become a brand change nobody asked for.

   Specificity is deliberately left at 0,3,0, matching the theme's own rule and
   winning only on load order. Elementor's per-element rules are 0,4,0 and still
   beat it, which is what should happen: a colour somebody sets on a specific
   heading in Elementor must win over a blanket default.

   Read the next paragraph before changing this rule. A blanket default is only
   safe because every one of these labels that sits on a coloured background
   carries its own Elementor colour at 0,4,0. Verified on the live site: "Who we
   are" on the homepage and "Dr. Edwin Simpson" on /about-us/ are both white on
   #558137 (4.58:1) and both set subtitle_color per element, so this rule never
   reaches them. "ABOUT SYNNUTRA" on /about-us/ and "POPULAR QUESTIONS" on /faq/
   have no per-element colour and are picked up by this rule, which is the point.

   "CUSTOMER TESTIMONIALS" was the exception and it cost a round trip. An earlier
   version of this comment said that label was already fixed in Elementor. It was
   not: post-26764.css set only background-color on it, never a colour, so the
   label fell through to the theme default and this rule turned it dark green on
   its dark green badge, 1.09:1. Caught by re-measuring the page after deploying,
   not by reading the CSS. The fix was to give element 70e13d42 the same explicit
   subtitle_color #FFFFFF the other badge labels already had, so it now reads
   white on #4E7A2A at 5.07:1, which is the value the audit checked.

   So: any future double-heading label placed on a dark background needs its own
   Elementor colour. It will not get one from here. */
.elementor-widget-wgl-double-heading .wgl-double-heading .dblh__subtitle {
  color: #4A7330;
}

/* Added 2026-12-03, third pass. The three homepage product cards, "CALM THE
   MIND", "EASE THE GUT" and "MAXIMIZE MOBILITY". White 18px labels sitting
   straight on a photograph with nothing behind them, measuring 2.22:1, 2.33:1
   and 2.81:1 against the band of image each one covers, where they need 4.5:1.
   Over 97% of the sampled pixels failed on every card.

   This gives the label the same badge the section headings above it already
   use, so the ratio is 5.07:1 and it no longer depends on what the photograph
   happens to be doing behind it. Swap the image and the label still passes.

   The obvious fix was a dark scrim across the top of the card, and measuring
   killed it. The label is white but the card title right underneath it is
   black, on the same photograph. The black titles pass today at 4.41:1, 6.16:1
   and 14.22:1 against the 3:1 they need. A 50% scrim takes two of those three
   to 100% of pixels below 3:1. It would have fixed three labels and broken two
   titles. Anything that darkens the photo for the white text damages the black
   text sitting 25px below it, so the fix has to be scoped to the label's own
   box, which is what a badge is.

   Two mechanisms were tried and rejected before this one. `::after` on
   `.wgl-infobox_bg_wrapper` is the theme's hover tint, going from opacity 0 to
   1 on hover, so borrowing it turns hover into a yellow wash. And restating
   `background-image` with a gradient over the url means hard-coding the
   photograph's URL into this file, which would silently pin the old image the
   day somebody swaps it in Elementor.

   Scoped to the container id on purpose. The same widget is used for the three
   white cards higher up the page, which have no photograph behind them, and an
   unscoped rule put a dark bar across those too. */
.elementor-26764 .elementor-element-3868a8d5 .wgl-infobox_subtitle {
  display: inline-block;
  background-color: #4E7A2A;
  color: #FFFFFF;
  padding: 4px 10px;
  border-radius: 10px;
}


/* ---------------------------------------------------------------------------
   6. FAINT FIELD OUTLINES                                   A11Y-07, serious
   ---------------------------------------------------------------------------
   The footer newsletter underline is white at 15% opacity, about 1.6:1 against
   the cream photo. Non-text contrast needs 3:1. This fixes the outline only.
   The missing label and the unnamed submit button are markup, in Contact Form 7.
   --------------------------------------------------------------------------- */

.footer input[type="email"],
.footer input[type="text"],
.footer input[type="search"],
.wpcf7 input[type="email"],
.wpcf7 input[type="text"] {
  border: 1px solid #FFFFFF;
  border-bottom-width: 2px;
  background-color: rgba(0, 0, 0, .28);   /* lifts the field off the photo */
  color: #FFFFFF;
}

.footer input::placeholder,
.wpcf7 input::placeholder {
  color: #F2F2F2;
  opacity: 1;
}

/* Header search field border was 15% black, about 1.4:1 */
.header_search-field input,
.widget_search .search-field,
.widget_product_search .search-field {
  border: 1px solid #6B7466;
}


/* ---------------------------------------------------------------------------
   7. REDUCED MOTION                                         A11Y-09, serious
   ---------------------------------------------------------------------------
   This stops CSS-driven motion only. The Swiper carousels autoplay from
   JavaScript and will keep running: that needs the Swiper config change and a
   real Pause button, both in the fix plan. Do not treat this block as closing
   A11Y-09 on its own.
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }

  /* The scrolling text band is a CSS marquee; this does stop it. */
  .wgl-scrolling-text,
  .wgl-marquee,
  .elementor-widget-wgl-scrolling-text * {
    animation: none !important;
    transform: none !important;
  }
}


/* ---------------------------------------------------------------------------
   8. UTILITY CLASSES THE OTHER FIXES NEED
   ---------------------------------------------------------------------------
   The theme has no screen-reader-text class (checked: zero occurrences in the
   live HTML). Several fixes in the plan need one, so it is defined here.
   Use it in PHP/templates, for example:
       <button class="..."><span class="screen-reader-text">Compare SynChill Gel</span></button>
   --------------------------------------------------------------------------- */

.screen-reader-text,
.s4s-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link. The anchor itself must be added as the first element in the
   child theme's header.php, pointing at <main id="main">:
       <a class="skip-link" href="#main">Skip to content</a>          A11Y-16 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100000;
  padding: 12px 20px;
  background: #FFFFFF;
  color: #1F5F2A;
  font-weight: 700;
  text-decoration: underline;
}

.skip-link:focus,
.skip-link:focus-visible {
  left: 8px;
  top: 8px;
  outline: 3px solid #1F5F2A !important;
  outline-offset: 2px !important;
}


/* ---------------------------------------------------------------------------
   9. CLOSED MOBILE MENU TAKING TAB STOPS           A11Y-03 / A11Y-02, serious
   ---------------------------------------------------------------------------
   TEST FIRST, AND EXPECT TO ADJUST.

   The audit's preferred fix is the `inert` attribute, applied from JavaScript.
   visibility:hidden is the documented CSS alternative and does remove children
   from the Tab order. The risk is the open/close animation: if the menu slides
   with a transform, visibility must be delayed on the way out or the animation
   is cut off. The pattern below does that.

   This only helps if the open state is signalled by a class on an ancestor.
   Confirm the real class name before relying on it; `.mobile-menu-open` is a
   guess from the markup and has not been verified.

   CONFIRMED 2026-12-02: the drawer carries
   data-elementor-settings='{"mobile_drawer_container_animation":"translate"}',
   so it does animate with a transform, and the delayed-visibility dance below
   is required if you go this route at all.

   Prefer `inert` applied from JavaScript instead. It has none of these
   problems. See THEME-WORK-PLAN.md, A11Y-03. Leave this block commented out.
   --------------------------------------------------------------------------- */

/*
.wgl-menu_outer {
  visibility: hidden;
  transition: visibility 0s linear .35s, transform .35s ease;
}

.mobile-menu-open .wgl-menu_outer,
.wgl-menu_outer.is-open {
  visibility: visible;
  transition-delay: 0s;
}
*/


/* ---------------------------------------------------------------------------
   10. WHAT DELIBERATELY IS NOT HERE
   ---------------------------------------------------------------------------
   - No `outline: none` anywhere. If a future rule needs to hide a ring, give
     the element a different visible focus style instead.
   - No fix for the off-screen carousel slides taking focus (A11Y-03). Hiding
     non-active Swiper slides with CSS breaks the transitions. Use Swiper's
     `watchSlidesProgress` with `inert`, per the fix plan.
   - No contrast overrides for Elementor-authored banners (A11Y-08). Those
     belong in Elementor, for the reason given in section 5. The two contrast
     rules that are here, the double-heading label and the product-card badge,
     are the exceptions and each says in its own comment why it could not be
     done in Elementor.
   - No `maximum-scale` fix (A11Y-06). That is a meta tag in the theme, not CSS.
   =========================================================================== */
