/*
 * Accessibility (WCAG 2.1 AA) overrides — loaded in Pages/_Host.cshtml after all other stylesheets.
 * Hand-written, not part of the gulp build: source/css/a11y.css and dist/css/a11y.css must stay identical.
 * The older accessibility rules are in source/scss/components/_accessibility.scss (compiled into styles.min.css).
 */

/* Keyboard focus (WCAG 2.4.7): 2px instead of 1px, same brand brown #836650
   (5.27:1 on white, 3.96:1 on the beige sections, needs 3:1). The home slider draws focus differently
   (`outline: none` with a more specific rule); text fields: see "Keyboard focus, round 2" below. */
:focus-visible {
  outline-width: 2px !important;
}

/* Header: outline is drawn inside the element (see _accessibility.scss), moved 1px further in for the wider outline */
header *,
header :focus-visible {
  outline-offset: -3px;
}

/* Carousels (Owl) cut off everything outside the slides (overflow: hidden), so the outline around
   a focused tile is drawn inside it */
.owl-carousel .owl-item a:focus-visible {
  outline-offset: -2px;
}

/* Best sellers tiles: white ring inside the brown outline, so focus is visible on dark and light photos */
.landing-page .popular-products .item:focus-visible .item-content {
  box-shadow: inset 0 0 0 4px #fff;
}

/* Text contrast (WCAG 1.4.3) — Best sellers tiles: white title (24px bold, needs 3:1) and "SHOP"
   (16px, needs 4.5:1) over photos. The light marble photos gave about 1.8:1 / 2.1:1.
   A dark shade at the top and bottom (where the text is) is added to the existing diagonal one;
   measured on the 4 photos: title >= 4.85:1 (10th percentile of pixels), "SHOP" >= 5.3:1 (darkest case).
   A tight shadow around the letters is added to the existing soft one. */
.landing-page .popular-products .item .item-content {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65) 0%, transparent 30%, transparent 75%, rgba(0, 0, 0, 0.65) 100%),
              linear-gradient(134deg, rgba(0, 0, 0, 0.3) 10%, transparent 50%, rgba(0, 0, 0, 0.3) 100%);
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8), 0px 0px 6px hsla(0, 0%, 0%, 0.7);
}

/* Fallback colour behind the photo (before it loads / if it fails): white text on #292929 = 14.55:1.
   The photo covers the whole tile (Owl sets the image to display: block), so this is not visible otherwise. */
.landing-page .popular-products .item {
  background-color: #292929;
}

/* Beige sections (Education, Newsletter): the `background` gradient left no background colour.
   Same beige as the gradient start, so text contrast is known without the gradient:
   #422618 on #f2e5d9 = 11.16:1, #292929 = 11.77:1. (Education keeps its own fallback #d1c9c9.) */
.section-primary {
  background-color: #f2e5d9;
}

/* Category lists: the click handler moved from the <li> to the toggle link inside it. The link covers
   the <li>'s 8px top/bottom padding too, so the clickable area stays the same. */
.categories-list li.expandable > a[role="button"] {
  position: relative;
}

.categories-list li.expandable > a[role="button"]::before {
  content: '';
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: 0;
  right: 0;
}

/* ---------------------------------------------------------------------------------------------
   Keyboard focus, round 2: every control has a 2px outline with at least 3:1 contrast
   (brown #836650: 5.27:1 on white, 3.96:1 on the beige sections; on photos a white ring is added)
   --------------------------------------------------------------------------------------------- */

/* 2px also before focus: many links (e.g. header menu) have `transition: 0.3s` on all properties,
   so the width grew from 1px while focused and looked 1px wide. Not visible without outline-style. */
* {
  outline-width: 2px;
}

/* Text fields, selects, textareas: the darker border alone was too small a change. They now get the
   same outline as other controls (the darker border stays). Same specificity as the `outline: none`
   rules in _accessibility.scss, so this later file wins. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible,
select:focus-visible,
select.form-control:focus-visible,
textarea:focus-visible,
textarea.form-control:focus-visible,
.custom-select:focus-visible {
  outline: 2px solid #836650 !important;
}

/* Mobile menu search: the field has no border, focus is shown around its rounded box (now 2px) */
.mobile-navigation .search-wrap input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus-visible {
  outline: none !important;
}

.mobile-navigation .search-wrap .input-group:focus-within {
  box-shadow: 0 0 0 2px #836650;
}

/* Custom checkboxes / radios: the outline is drawn on the visible box */
.custom-control-input:focus-visible ~ .custom-control-label::before {
  outline-width: 2px;
}

/* Home slider slide links: white frame + brown outline drawn inside the slide (the link itself has no outline) */
.interactive-slider a.cover-bg:focus-visible::before {
  outline-width: 2px;
}

/* Photo links where the outline is drawn inside the link, over the photo (carousels, gallery):
   brown outline at the edge and a white ring inside it, so one of them stands out on any photo */
.photo-uploads .popup-trigger:focus-visible {
  outline-offset: -2px;
}

.owl-carousel .owl-item a:focus-visible img,
.photo-uploads .popup-trigger:focus-visible img {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

/* Skip link: above everything (cookie banner, notice modal), also when the page is scrolled.
   Shown only for keyboard focus: after the notice modal is closed with the mouse, focus is put on it
   (see main.js) but it stays hidden. */
.skip-link {
  position: fixed;
  z-index: 2147483647;
}

.skip-link:focus:not(:focus-visible) {
  transform: translateY(-120%);
}

/* at the top edge of the window an outline outside would be cut off */
.skip-link:focus-visible {
  outline-offset: -4px;
}
