/* =========================================================
   ScrumCraft header menu
   Appearance > Customise > Additional CSS
   Replace everything in Additional CSS with this block.
   ========================================================= */

/* 1. Services and Community link to sections of the home page, so
      WordPress marks them as the current page there. Show them normally. */
.main-navigation > div > ul > li.menu-item-has-children.current-menu-item > a {
  color: #3a2359 !important;
  text-decoration: none !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
}
.main-navigation > div > ul > li.menu-item-has-children.current-menu-item > a:hover {
  color: #692fb9 !important;
}

/* 2. "Book a chat" as a pink button.
      Give that menu item the CSS class: sc-nav-cta */
.main-navigation .sc-nav-cta > a {
  margin-left: 8px;
  padding: 12px 22px !important;
  border-radius: 999px;
  background: #ed174c;
  color: #ffffff !important;
  font-weight: 700;
  line-height: 1.2 !important;
  text-decoration: none !important;
}
.main-navigation .sc-nav-cta > a:hover {
  background: #d2143f;
}

/* 3. Dropdown panels */

/* Remove the theme's dashes */
.main-navigation .sub-menu .menu-item a::before {
  content: none !important;
  counter-increment: none !important;
}

@media only screen and (min-width: 560px) {
  /* Open each dropdown right under its own menu item */
  .main-navigation > div > ul > li {
    position: relative !important;
  }
  .main-navigation > div > ul > li > .sub-menu {
    display: block !important;
    left: auto !important;
    right: 0 !important;
    top: 100% !important;
    width: max-content;
    min-width: 220px;
    max-width: 340px;
    margin-top: 6px !important;
    padding: 14px !important;
    border: 1px solid #eee6f4;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 28px 56px -24px rgba(62, 34, 92, .4) !important;
    /* Closed: hidden. It waits only a short grace period before closing,
       long enough for the pointer to reach the panel */
    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateY(8px);
    transition: opacity .14s ease .18s, transform .14s ease .18s, visibility 0s linear .32s !important;
  }
  /* An invisible margin around the open panel: it covers the gap under
     the menu item and forgives the pointer drifting a little past the
     panel's edges, so the panel doesn't close by accident */
  .main-navigation > div > ul > li > .sub-menu::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -10px; left: -16px; right: -16px; bottom: -24px;
  }
  /* Open: straight away on hover or keyboard focus */
  .main-navigation > div > ul > li:hover > .sub-menu,
  .main-navigation > div > ul > li:focus-within > .sub-menu {
    visibility: visible !important;
    opacity: 1 !important;
    transform: none;
    transition: opacity .14s ease, transform .18s cubic-bezier(.22, .9, .3, 1), visibility 0s !important;
  }
  /* Moving onto another menu item that has its own dropdown
     closes the previous panel quickly */
  .main-navigation > div > ul:has(> li.menu-item-has-children:hover) > li:not(:hover):not(:focus-within) > .sub-menu {
    transition-delay: 0s, 0s, .1s !important;
    transition-duration: .1s, .1s, 0s !important;
  }
  .main-navigation > div > ul > li > .sub-menu li {
    width: auto;
  }
  /* the menu link stays above everything else in the bar, so it always takes the hover */
  .main-navigation > div > ul > li > a {
    position: relative;
    z-index: 3;
  }
}

/* Every dropdown link: smaller, calmer text */
.main-navigation .sub-menu .menu-item a {
  padding: 8px 12px !important;
  border-radius: 10px;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.35 !important;
  color: #3a2359 !important;
  text-decoration: none !important;
}
.main-navigation .sub-menu .menu-item a:hover {
  background: #f6f1fa;
  color: #692fb9 !important;
}

/* First level inside a dropdown, e.g. Training, Consulting, About */
.main-navigation > div > ul > li > .sub-menu > li.menu-item > a {
  font-size: 16px !important;
  font-weight: 700 !important;
}
.main-navigation > div > ul > li > .sub-menu > li.menu-item-has-children > a {
  font-weight: 800 !important;
}

/* Lists inside a dropdown (training types, then courses):
   indent the whole group and tie it to its heading with a line */
.main-navigation .sub-menu .sub-menu {
  margin: 2px 0 8px 14px !important;
  padding: 0 0 0 10px !important;
  border-left: 2px solid #eee6f4;
}

/* Training types, e.g. Instructor-led training */
.main-navigation .sub-menu .sub-menu > li > a {
  font-size: 15px !important;
  font-weight: 700 !important;
}

/* Individual courses */
.main-navigation .sub-menu .sub-menu .sub-menu > li > a {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  font-size: 14.5px !important;
  font-weight: 500 !important;
  color: #584a68 !important;
}

/* 4. Services: Training on the left, the other services on the right,
      on wider screens. Found by its shape (the only dropdown with lists
      inside it), so it keeps working wherever Services sits in the menu */
@media only screen and (min-width: 1000px) {
  .main-navigation > div > ul > li:has(> .sub-menu .sub-menu) > .sub-menu {
    display: grid !important;
    grid-template-columns: 330px 210px;
    column-gap: 18px;
    max-width: none;
    align-items: start;
  }
  .main-navigation > div > ul > li:has(> .sub-menu .sub-menu) > .sub-menu > li:first-child {
    grid-row: span 20;
    padding-right: 18px;
    border-right: 1px solid #eee6f4;
  }
}

/* 5. A compact header on every page: a smaller logo and less padding,
      so the top of each page shows more content */
@media only screen and (min-width: 560px) {
  :is(#masthead, .site-header, #site-header) {
    padding-top: 16px !important;
    padding-bottom: 16px !important;
  }
  :is(#masthead, .site-header, #site-header) :is(.custom-logo, .site-logo img, .wp-block-site-logo img) {
    max-height: 76px !important;
    width: auto !important;
    height: auto !important;
  }
}

/* 6. Readable text on blog pages (posts, blog list, archives, search, 404).
      The theme's Foreground colour is white, the same as the background.
      Pages rely on that white inside their dark sections, so Foreground stays
      as it is and blog content gets ScrumCraft purple here instead. */
:is(body.single-post, body.blog, body.archive, body.search, body.error404) .site-main {
  --wp--preset--color--foreground: #3e225c;
  --wp--preset--color--foreground-low-contrast: #3e225c;
  --wp--preset--color--foreground-high-contrast: #3e225c;
  color: #3e225c;
}
/* Dark blocks inside a post keep their white text */
:is(body.single-post, body.blog, body.archive, body.search, body.error404) .site-main :is(.has-foreground-color, .has-primary-background-color, .has-primary-dark-background-color, .has-secondary-background-color, .has-black-background-color) {
  --wp--preset--color--foreground: #ffffff;
  --wp--preset--color--foreground-low-contrast: #ffffff;
  --wp--preset--color--foreground-high-contrast: #ffffff;
  color: #ffffff;
}

/* 7. Readable tables on regular pages, e.g. the course dates and prices on
      Training. These tables inherit the white Foreground colour (see section 6).
      A table given its own text colour in the editor keeps it. */
body.page .site-main .wp-block-table:not(.has-text-color) {
  color: #3e225c;
}