/**
 * PRIMARY TASKS MENU
 */
#block-sprat-primary-local-tasks {
  border-bottom: 2px solid var(--border-grey);
  padding-right: 2rem;

  & > ul {
    display: inline-flex;
    list-style: none;
    gap: 2rem;

    & > li > a {
      color: black;
      text-decoration: none;

      &:hover {
        border-bottom: 2px solid black;
      }
    }
  }
}

.wrapper.nav-wrapper {
  display: flex;
  flex-direction: column;
}

.menu-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  color: black;
  cursor: pointer;
  gap: 0.5rem;
  margin-right: auto;
  &::before {
    font-family: 'Material Symbols Outlined';
    content: '\e5d2';           /* menu icon */
    font-weight: 400;
    font-size: 1.75rem;
  }
  &[aria-expanded="true"]::before {
    content: '\e5cd';           /* close icon */
  }
  @media (min-width: 1200px) {
    display: none;              /* desktop uses the horizontal nav */
  }
}

.menu-close-btn {
  display: none;
}

@media (max-width: 1199px) {

  /* Drawer container — hidden until the hamburger opens it */
  #block-sprat-main-menu.is-mobile-open {
    display: block;
    position: fixed;
    inset: 0 0 0 auto; /* Right edge positioning */
    width: min(85vw, 330px);
    padding: 0 1.5rem 0.5rem;
    overflow-y: auto;
    z-index: 3;
    box-shadow: -6px 0 20px rgb(0 0 0 / 0.3);
    background: white;
  }

  /* Stack the top level */
  header #block-sprat-main-menu.is-mobile-open > ul {
    display: grid;
    padding-left: 0;
  }

  header #block-sprat-main-menu.is-mobile-open ul {
    list-style: none;
  }

  header #block-sprat-main-menu.is-mobile-open ul ul {
    padding-left: 1rem;
  }

  header #block-sprat-main-menu.is-mobile-open ul ul li {
    margin: 0;
  }

  header #block-sprat-main-menu.is-mobile-open ul ul li a {
    text-decoration: none;
    display: block;
    margin: 0.5rem 0;
  }

  header #block-sprat-main-menu.is-mobile-open ul ul li a:hover,
  header #block-sprat-main-menu.is-mobile-open ul ul li a:focus {
    color: var(--mid-green);
    text-decoration: underline;
  }

  header #block-sprat-main-menu.is-mobile-open > ul li .menu-groups {
    display: block;
  }

  header #block-sprat-main-menu.is-mobile-open > ul li > a {
    color: black;
  }

  header #block-sprat-main-menu.is-mobile-open > ul > li > a {
    color: var(--mid-green);
    text-transform: uppercase;
    text-decoration: none;
    padding-bottom: 0.15rem;
  }

  #block-sprat-main-menu > ul > li {
    display: block;
    position: relative;
    border-bottom: 1px solid rgb(255 255 255 / 0.15);
  }

  /* Chevron to the right of each expandable row */
  #block-sprat-main-menu > ul > li:has(.menu-groups)::after {
    position: absolute;
    top: 1rem;
    right: 0.5rem;
  }

  /* Top-level labels/links as full-width rows */
  #block-sprat-main-menu .menu-item__text,
  #block-sprat-main-menu > ul > li > a {
    display: block;
    padding: 0.85rem 0;
  }

  /* Groups: inline accordion instead of absolute dropdown */
  #block-sprat-main-menu > ul > li .menu-groups {
    position: static;
    display: none; /* collapsed by default */
    grid-template-columns: 1fr; /* single column */
    border: 0;
  }

  /* Overrides desktop's display:grid + position:absolute */
  #block-sprat-main-menu > ul > li.is-open .menu-groups {
    display: block;
  }

  #block-sprat-main-menu .menu-label {
    display: none;
    font-size: 0.9rem;
    font-weight: normal;
    color: grey;
    text-align: left;
    text-transform: uppercase;
    padding: 0;
    margin: 0;
    margin-bottom: 0.25rem;
    margin-left: 1rem;
  }

  #block-sprat-main-menu .menu-group a {
    color: white;
  }

  .menu-close-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    padding: 0.25rem;
    color: var(--mid-green);
    cursor: pointer;

    &::before {
      font-family: 'Material Symbols Outlined';
      content: '\e5cd';
      font-size: 1.75rem;
      font-weight: 400;
      line-height: 1;
    }

    &:focus-visible {
      outline: 2px solid var(--mid-green);
      outline-offset: 2px;
    }
  }
}

/* Optional: stop the page scrolling behind an open drawer */
body.has-menu-open {
  overflow: hidden;
}

