/* Menu */
.menu-desktop {
  font-family: "Mark-Pro", sans-serif;
  font-weight: 500;
  color: var(--wp--preset--color--sherpa);
  display: none;

  .wp-block-button__link {
    display: inline-block;
    border-radius: 9999px;
    cursor: pointer;
  }

  @media only screen and (min-width: 768px) {
    display: block;
  }
}

.menu-desktop,
.menu-mobile {
  /** https://easingwizard.com/ **/
  --transition-overshoot: linear(
    0,
    0.199 2.7%,
    0.379 5.6%,
    0.532 8.6%,
    0.66 11.7%,
    0.768 15%,
    0.813 16.7%,
    0.855 18.5%,
    0.893 20.4%,
    0.924 22.3%,
    0.952 24.3%,
    0.976 26.4%,
    1.002 29.6%,
    1.021 33%,
    1.032 36.8%,
    1.037 41.1%,
    1.037 44.1%,
    1.034 47.6%,
    1.013 63.6%,
    1.005 72.8%,
    1.001 83.3%,
    1
  );
  --transition-duration: 0.4s;
}

.jc-menu {
  background-color: var(--wp--preset--color--beige);
  gap: 20px;
  border-bottom: 1px solid #d9d9d9;
  padding: 0 40px;
  display: flex;
  flex-direction: row;
  align-items: center;
  .jc-menu-icon {
    display: inline-block;
    flex-shrink: 0;
    margin-bottom: 4px;
  }

  @media only screen and (min-width: 960px) {
    padding: 0 60px;
  }
  @media only screen and (min-width: 1280px) {
    gap: 46px;
  }
}

.jc-header-logo {
  height: 40px;
  position: relative;
  img {
    height: 100%;
  }

  @media only screen and (min-width: 768px) {
    height: 60px;
  }
}

.jc-menu-content {
  height: auto;

  .main-menu,
  .side-menu {
    display: flex;
    gap: 0.5rem;
  }

  .wp-block-search__button {
    background-color: #fcdcbb;
    padding: 1rem;
    transform: scaleX(-1);
  }

  @media only screen and (min-width: 960px) {
    height: 90px;
  }
}

.menu-link {
  flex-wrap: wrap;
  flex-grow: 1;
  column-gap: 20px;
  row-gap: 4px;
  padding: 20px 0;

  @media only screen and (min-width: 1280px) {
    gap: 32px;
  }
}
#menu-right {
  position: relative;
  padding-right: 87px;
  flex-shrink: 0;
  gap: 20px;

  #work-in-sector-link {
    display: inline-block;
    max-width: 90px;
  }
  a {
    font-weight: 400;
  }

  @media only screen and (min-width: 960px) {
    #work-in-sector-link {
      max-width: none;
    }
  }
  @media only screen and (min-width: 1280px) {
    gap: 32px;
  }
}
.menu-link,
#menu-right {
  display: flex;
  align-items: center;

  a {
    color: black;
    text-decoration: none;
    font-size: 1.125rem;
    position: relative;
  }

  a:hover {
    text-decoration: underline;
    text-decoration-color: var(--wp--preset--color--chardonnay);
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
  }
}

.menu-divider {
  margin-top: 1rem;
  margin-right: 0.5rem;
  top: 1rem;
  display: block;
  width: 1px;
  height: 50%;
  background-color: #004d60;
  opacity: 0.5;
  transition: all 0.3s ease;
}

.jc-submenu {
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  position: absolute;
  top: 90px;
  left: 0;
  width: 100%;
  height: auto;
  min-height: 415px;
  background: #fff;
  border-bottom: 1px solid #d9d9d9;
  padding: 2rem 3.75rem;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;

  /* Invisible hover buffer above submenu */
  &::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    height: 2rem;
    background: transparent;
  }

  .row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    justify-content: flex-start;
  }
}

body.logged-in .jc-submenu {
  top: calc(90px + 2rem);
}

#donate-button {
  display: block;
  border-radius: 100px;
  padding: 9px 2rem 10px 2rem;
  transition: all 0.2s ease;
  z-index: 1;
  height: fit-content;
}

.menu-desktop:has(#get-help-link:hover) #get-help,
.menu-desktop:has(#what-we-do-link:hover) #what-we-do,
.menu-desktop:has(#who-we-are-link:hover) #who-we-are,
.menu-desktop:has(#latest-news-link:hover) #latest-news,
.menu-desktop:has(#work-in-sector-link:hover) #work-in-sector,
.menu-desktop:has(#get-help:hover) #get-help,
.menu-desktop:has(#what-we-do:hover) #what-we-do,
.menu-desktop:has(#who-we-are:hover) #who-we-are,
.menu-desktop:has(#latest-news:hover) #latest-news,
.menu-desktop:has(#work-in-sector:hover) #work-in-sector {
  opacity: 1;
  visibility: visible;
}

.submenu-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.submenu-link {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;

  a {
    color: var(--wp--preset--color--sherpa);
    text-decoration: none;
    font-size: 1.5rem;
    position: relative;
    display: inline-block;
    padding-bottom: 0.3rem;
    z-index: 1;
  }

  a::before {
    content: "";
    position: absolute;
    left: -4px;
    right: -4px;
    bottom: 25%;
    top: 30%;
    background-color: var(--wp--preset--color--powder-blue);
    opacity: 0;
    transform: translateY(-4px);
    transition-property: opacity, transform;
    transition-timing-function: ease;
    transition-duration: 0.25s;
    pointer-events: none;
    z-index: -1;
  }

  a:hover::before,
  &.is-active a::before {
    transform: translateY(0);
    opacity: 1;
  }
}

.submenu-left {
  height: 100%;
  border-right: 2px solid var(--wp--preset--color--powder-blue);
  border-radius: 2px;
  min-height: 280px;
}

.get-help-card {
  flex: 1 1 calc(25% - 1.25rem);
  box-sizing: border-box;
  position: relative;
  display: flex;
  justify-content: space-between;
  border-radius: 20px;
  height: 9rem;
  max-width: 20rem;
  background: var(--wp--preset--color--picton-10);
  text-decoration: none;
  transition: background 0.25s ease;
}

#get-help-work-in-the-sector {
  background: var(--wp--preset--color--deco);
}

#get-help-work-in-the-sector-icon {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  width: 3rem;
  height: 3rem;
}

#get-help-work-in-the-sector-icon svg {
  width: 48px;
  height: 48px;
  stroke: #004d60;
  transition: transform 0.2s ease;
}

.get-help-card:hover {
  background: #afdfe4;
}

.get-help-card:hover .get-help-card-image,
#get-help-work-in-the-sector:hover svg {
  transform: translate(4px, -2px);
}

.get-help-card-text {
  padding: 1.5rem;
  color: var(--wp--preset--color--sherpa);
  font: 1.5rem 700 Bold;
}

.get-help-card-image {
  position: absolute;
  bottom: 0.25rem;
  right: 0.25rem;
  max-height: 7rem;
  display: block;
  max-width: 7rem;
  height: auto;
  transition: transform 0.2s ease;
}

.what-we-do-card {
  flex: 1 1 calc(33% - 1.25rem);
  flex-direction: column;
  box-sizing: border-box;
  position: relative;
  display: flex;
  border-radius: 20px;
  height: 9rem;
  max-width: 20rem;
  color: var(--wp--preset--color--sherpa);
  font: 400 Medium 1.25rem;
  line-height: 100%;
  letter-spacing: 0%;
}

.join-us-container,
.stay-up-to-date-main,
.referral-card-container {
  position: relative;
  background-color: var(--wp--preset--color--jaffa-10);
  border-radius: 20px;
  padding: 30px 30px 44px 36px;
  overflow: hidden;
}
.join-us-card,
.stay-up-to-date-main-card,
.referral-card {
  position: relative;
  max-width: 300px;
  z-index: 1;
  h2 {
    margin: 0 0 12px 0;
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
  }
  p {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.5;
    margin-bottom: 20px;
    color: var(--wp--preset--color--black);
  }
  .wp-block-button__link {
    font-size: 18px;
    font-weight: 500;
    padding-top: 7px;
    padding-bottom: 8px;
  }
  & + img {
    position: absolute;
    z-index: 0;
    right: 0;
    top: 0;
    height: 100%;
    width: auto;
  }
}
.join-the-justice-connect-team {
  padding-left: 48px;
}

.stay-up-to-date-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  column-gap: 16px;
  row-gap: 20px;
  padding-left: 48px;
  .stay-up-to-date-main-card {
    & + img {
      top: auto;
      bottom: 0;
      width: 100%;
      height: auto;
    }
  }
  .stay-up-to-date-card {
    padding: 24px 24px 30px 24px;
    border-radius: 20px;
    .tag-pills {
      display: inline-flex;
      flex-direction: row;
      margin-bottom: 4px;
      gap: 5px;
    }
    .tag-pill {
      border-radius: 20px;
      border-color: var(--wp--preset--color--sherpa);
      border-width: 0.8px;
      border-style: solid;
      font-size: 13px;
      font-weight: 500;
      display: inline-block;
      line-height: 1.5;
      padding: 5px 12px;
      color: var(--wp--preset--color--sherpa);
      margin: 0 4px 6px 0;
      transition-duration: 0.2s;
      transition-property: color, border-color;
      transition-timing-function: ease;
      text-decoration: none;
      &:hover {
        background-color: #004559;
        color: #ffffff;
      }
    }
    p {
      color: var(--wp--preset--color--black);
      font-size: 16px;
      font-weight: 700;
      line-height: 1.5;
    }
  }
  .stay-up-to-date-main {
    grid-row: span 3 / span 3;
  }
}

.referral-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 16px;
  row-gap: 20px;
  padding-left: 44px;
  .referral-card {
    padding-bottom: 215px;
    & + img {
      top: auto;
      bottom: 0;
      width: 100%;
      height: auto;
    }
  }
}
.referral-links {
  .submenu-title {
    margin-top: 52px;
    &:first-child {
      margin-top: 0.5rem;
    }
  }
  a {
    display: block;
    font-size: 18px;
    font-weight: 400;
    color: var(--wp--preset--color--black);
    line-height: 1.5;
    text-decoration: none;
    margin-bottom: 8px;
    &:hover {
      text-decoration: underline;
    }
  }
}

.what-we-do-image {
  max-width: 100%;
  display: block;
  padding-bottom: 1rem;
}

.jc-search {
  color: var(--wp--preset--color--sherpa);
  background-color: var(--wp--preset--color--beige);
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  transition-property: max-width;
  transition-duration: var(--transition-duration);
  transition-timing-function: var(--transition-overshoot);
  width: 1000%;
  max-width: 67px;
  z-index: 1;
  padding-left: 20px;
  border-left: 1px var(--wp--preset--color--sherpa) solid;
  form {
    background-color: #fcdcbb;
    border-radius: 40px;
    display: flex;
    flex-direction: row;
    overflow: hidden;
  }
}
.jc-search.is-active {
  max-width: calc(100% + 21px);
  .jc-search-submit {
    opacity: 100;
    transform: translate3d(0, 0, 0);
  }
}

/* search styling */
.jc-search-icon {
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background-color: #fcdcbb;
  color: var(--wp--preset--color--sherpa);
  font-size: 1.1rem;
  border: none;
  position: relative;
  z-index: 10;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

#jc-search-input {
  background-color: transparent;
  color: var(--wp--preset--color--sherpa);
  border: 0;
  padding: 0 12px 0 0;
  flex-grow: 1;
  outline: none;
}

.jc-search-submit {
  border-radius: 100%;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  color: var(--wp--preset--color--sherpa);
  border: 1px var(--wp--preset--color--sherpa) solid;
  background-color: transparent;
  margin: 5px 11px 0 0;
  opacity: 0;
  transform: translate3d(12px, 0, 0);
  transition-duration: 0.3s;
  transition-property: opacity, transform;
  transition-timing-function: ease-in-out;
}

body:has(.menu-mobile) #wpadminbar {
  position: fixed;
  top: 0;
}
.wp-site-blocks:has(.menu-mobile) {
  --mobile-menu-header-height: 80px;
  padding-top: var(--mobile-menu-header-height);
  @media only screen and (min-width: 768px) {
    padding-top: 0;
  }
}
.menu-mobile {
  position: fixed;
  z-index: 2;
  top: var(--wp-admin--admin-bar--height, 0px);
  left: 0;
  right: 0;
  @media only screen and (min-width: 768px) {
    display: none;
  }
  &.is-open {
    .menu-mobile-dialog {
      transform: translate3d(0, 0, 0);
      opacity: 100;
    }
  }
  .submenu-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    & > span {
      flex-grow: 1;
    }
    & > button {
      border: none;
      background-color: transparent;
      padding-bottom: 0.3rem;
      cursor: pointer;
      transition: 0.2s transform ease;
    }
    & + ul {
      display: none;
    }
    &.is-active {
      & + ul {
        display: flex;
      }
      & > button {
        transform: translate3d(-2px, 2px, 0) rotate(90deg);
      }
    }
  }
  ul {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
    margin-bottom: 0;
    &.underlined-titles {
      padding-left: 16px;
      ul {
        padding-left: 16px;
        padding-bottom: 8px;
      }
      li > span {
        display: block;
        position: relative;
        padding-bottom: 5px;
        &::before {
          position: absolute;
          bottom: 0;
          left: 0;
          right: 60px;
          display: block;
          content: "";
          border-top: 1px var(--wp--preset--color--powder-blue) solid;
        }
      }
    }
  }
  li {
    list-style: none;
    padding: 0;
    ul {
      padding: 12px 0 0 36px;
      a {
        color: var(--wp--preset--color--black);
        font-size: 18px;
        font-weight: 500;
        line-height: 1.25;
        text-decoration: none;
        &:hover {
          text-decoration: underline;
        }
      }
      ul {
        padding-left: 28px;
      }
    }
    > span {
      font-size: 1rem;
      line-height: 1.5;
      font-weight: 700;
      color: var(--wp--preset--color--sherpa);
    }
  }
}
.menu-mobile-header {
  display: flex;
  flex-direction: row;
  height: var(--mobile-menu-header-height);
  justify-content: space-between;
  position: relative;
  background-color: var(--wp--preset--color--beige);
  padding: 17px 24px 23px 26px;
  box-shadow: 0px 4px 8px 0px #0000000d;
  z-index: 2;
  button {
    border: none;
    background-color: transparent;
  }
}
.menu-mobile-dialog {
  background-color: var(--wp--preset--color--white);
  height: calc(
    100svh - var(--mobile-menu-header-height) -
      var(--wp-admin--admin-bar--height, 0px)
  );
  position: absolute;
  z-index: 1;
  top: calc(var(--mobile-menu-header-height));
  left: 0;
  right: 0;
  transform: translate3d(0, -100%, 0);
  transition-property: opacity, transform;
  transition-timing-function: ease-in-out;
  transition-duration: 0.2s;
  opacity: 0;
  display: flex;
  flex-direction: column;
}
.menu-mobile-content {
  flex-grow: 1;
  padding: 40px 24px 0 36px;
  overflow-y: auto;
}
.menu-mobile-footer {
  padding: 0 36px;
  .menu-mobile-footer-container {
    padding: 24px 96px 40px 0;
    display: flex;
    flex-direction: row;
    position: relative;
  }
  .jc-search {
    position: absolute;
    right: 0;
    top: 17px;
    height: 48px;
    width: 1000%;
    max-width: 48px;
    z-index: 1;
    background-color: transparent;
    border-left: none;
    padding: 0;
    form {
      background-color: var(--wp--preset--color--beige);
      border-radius: 40px;
      display: flex;
      flex-direction: row;
      overflow: hidden;
    }
    .jc-search-icon {
      cursor: pointer;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      width: 48px;
      height: 48px;
      background-color: var(--wp--preset--color--beige);
    }
    &.is-active {
      max-width: 100%;
    }
  }
  .wp-block-button {
    flex-grow: 1;
    a#donate-button {
      font-size: 16px;
      font-weight: 500;
      padding: 5px 2rem 6px 2rem;
    }
  }
}
