/*
 * Highlighted menu entry (class named after the Black Week campaign at the owner's request): any entry of the site's menus that has the CSS class `black-week` (typed in the admin
 * menu screen) is drawn as a filled pill. The header is on every page, so this file loads everywhere; the catalog
 * stylesheet does not. Every value lives in the :root block; rules below only use var(--*).
 */

:root {
  --menu-highlight-bg: #d52701; /* the campaign sale red (--color-sale in catalog.css); white on it 5.1:1 */
  --menu-highlight-bg-hover: #a81f01; /* white on it 7.3:1 */
  --menu-highlight-text: #ffffff;
  --menu-highlight-ring: #ffffff; /* the ring is drawn twice: light inside, dark outside, so it shows on a photo and on white */
  --menu-highlight-ring-outer: #00263a;
  --menu-highlight-radius: 999px;
  --menu-highlight-pad-y: 4px;
  --menu-highlight-pad-x: 16px;
  --menu-highlight-weight: 600;
  --menu-highlight-time: 150ms;
  --menu-hover-text: #ffffff; /* the header is transparent over a photo, then navy once it sticks: its entries are white */
  --menu-hover-underline: 2px;
  --menu-hover-underline-offset: 6px;
}

/*
 * Hover of the header entries. The parent theme turns the text navy on hover with `!important` (`.sub-menu li a:hover`),
 * which is hard to read over the hero photo and invisible on the navy sticky header. The top-level entries keep their
 * white text and get an underline instead; the drop-down lists (white panels) keep the theme's navy.
 */
.akin-main-menu nav > ul > li:not(.black-week) > a:hover {
  color: var(--menu-hover-text) !important;
  text-decoration: underline;
  text-decoration-thickness: var(--menu-hover-underline);
  text-underline-offset: var(--menu-hover-underline-offset);
}

/* Specific enough to win over the parent's own menu rules (colour, padding) except its hover colour, which is `!important`. */
.menu-item.black-week > a,
.menu-item.black-week > a:visited {
  display: inline-block;
  padding: var(--menu-highlight-pad-y) var(--menu-highlight-pad-x);
  border-radius: var(--menu-highlight-radius);
  background: var(--menu-highlight-bg);
  color: var(--menu-highlight-text);
  font-weight: var(--menu-highlight-weight);
  line-height: 24px;
  text-decoration: none;
  transition: background-color var(--menu-highlight-time) ease;
}

.menu-item.black-week > a:hover,
.menu-item.black-week.current-menu-item > a {
  background: var(--menu-highlight-bg-hover);
  color: var(--menu-highlight-text) !important; /* the parent's hover colour (navy) is `!important` */
}

/*
 * The theme blanks the background of an entry while the pointer is anywhere over its list item (`.akin_menu>ul>li:hover>a`),
 * and the item is 108px tall around a 32px pill: the pill would go transparent in the gap and only darken once the
 * pointer reaches it. The fill is pinned on the item's hover; only the pill's own hover (or the current page) darkens it.
 */
.akin_menu > ul > li.black-week:hover > a {
  background: var(--menu-highlight-bg);
}

.akin_menu > ul > li.black-week > a:hover,
.akin_menu > ul > li.black-week.current-menu-item > a {
  background: var(--menu-highlight-bg-hover);
}

.menu-item.black-week > a:focus-visible {
  outline: 2px solid var(--menu-highlight-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--menu-highlight-ring-outer);
}

/*
 * Mobile menu (the theme's meanmenu list): entries are full-width rows and the plugin's own rule
 * `.mean-container .mean-nav ul li a` is more specific than the one above, so the highlighted row repeats the colours
 * with a selector that wins. A row stays a row (no pill shape, the padding is the plugin's).
 */
.mean-container .mean-nav ul li.black-week > a,
.mean-container .mean-nav ul li.black-week > a:visited {
  border-radius: 0;
  background: var(--menu-highlight-bg);
  color: var(--menu-highlight-text);
  font-weight: var(--menu-highlight-weight);
}

.mean-container .mean-nav ul li.black-week > a:hover,
.mean-container .mean-nav ul li.black-week.current-menu-item > a {
  background: var(--menu-highlight-bg-hover);
  color: var(--menu-highlight-text) !important;
}

.mean-container .mean-nav ul li.black-week > a:focus-visible {
  outline-offset: -4px; /* inside the row: a ring outside it would be clipped by the menu panel */
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .menu-item.black-week > a {
    transition: none;
  }
}
