/**
 * header.css
 * - sitewide
 */
header {
  background: var(--main-green);
  height: fit-content;
  padding: 1rem 0;
  border-bottom: 3px solid var(--secondary-green);

  & .wrapper > div {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: space-between;

    @media (min-width: 1200px) {
      flex-direction: row;
      gap: 0;
    }
  }

  & #block-sprat-main-menu {
    display: none;

    @media (min-width: 1200px) {

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

        & > li {
          position: relative;
          display: flex;
          align-items: center; 

          &:has(.menu-groups):after {
            font-family: 'Material Symbols Outlined';
            content: '\e313';
            color: white;
            font-style: normal;
            font-weight: 400;
            text-align: center;
            transition: transform 0.2s ease;
          }

          & .menu-groups {
            display: none;
            background: white;
            border: 1px solid var(--border-grey);
            border-radius: 0 0 8px 8px;
            padding: 1rem 2rem;
            background-clip: padding-box;

            & .menu-label {
              font-size: 0.9rem;
              font-weight: normal;
              color: grey;
              text-align: left;
              text-transform: uppercase;
              padding: 0;
              margin: 0;
              margin-bottom: 0.25rem;
              border-bottom: 1px solid var(--border-grey);
            }

            & .menu-group {
              min-width: 200px;

              & ul {
                list-style: none;
                padding: 0;
                & li {
                  padding: 0.5rem 0;
                  & a {
                    color: black;
                    text-decoration: none;
                    &:not(.external-link):hover {
                      text-decoration: underline;
                    }
                  }
                }
              }
              &.menu-group--ungrouped {
                /* No labels for these items */
                .menu-label {
                  border: none;
                  margin: 0;
                }
              }
            }
          }

          &.is-open {
            & .menu-groups {
              display: grid;
              grid-template-columns: 1fr 1fr; 
              position: absolute;
              top: 100%;
              left: 0;
              z-index: 100;
              &:has(.menu-group ~ .menu-group) {
                gap: 3rem;
              }
            }
            &:after {
              transform: rotate(180deg);
            }
          }

          & > a,
          & span.menu-item__text {
            color: white;
            text-decoration: none;
            padding: 0.25rem;
            cursor: pointer;
            font-weight: var(--font-weight-semibold);

            &:hover {
              border-bottom: 2px solid white;
              color: var(--highlight-green);
            }

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

          &:last-of-type > a {
            color: var(--highlight-green);
            padding: 0.5rem 2.5rem;
            border: var(--highlight-green) 2px solid;
            border-radius: 8px;
            transition: 0.3s;

            &:hover,
            &:focus {
              text-decoration: none;
              background: var(--highlight-green);
              color: black;
              transition: 0.3s;
            }
          }
        }

        @media (min-width: 1400px) {
          gap: 2rem;
        }
      }

      display: flex;
      align-items: center;
      align-self: stretch;
    }

  }

  @media (min-width: 1200px) {
    height: var(--header-height);
  }
}

#block-sprat-site-branding a[rel="home"] {
  display: flex;
  align-items: center;
  text-decoration: none;

  & img {
    filter: invert(1);
    width: 250px;
    margin-bottom: 0.25rem;

    @media (min-width: 1200px) {
      width: 320px;
    }
  }

  & p.sitename {
    display: flex;
    color: white;
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    text-decoration: none;
    width: 150px;
    align-items: center;
    align-self: stretch;
    margin: 0 0 0 1rem;
    padding: 0 0 0 1rem;
    border-left: 2px solid var(--secondary-green);

    @media (min-width: 1200px) {
      font-size: 1.15rem;
      width: 200px;
    }
  }
}

.paragraph--type--alert {
  /* Not visible by default, controlled by cache value in alert.js */
  display: none;
  background-color: var(--alert-orange);

  .alert-wrap {
    margin: 0 auto;
    padding: 1.25rem 0;
    position: relative;
    display: flex;
    gap: 0.5rem;
    flex-direction: row;
    width: calc(100% - 2rem);
  }

  @media (min-width: 1420px) {
    .alert-wrap {
      width: 100%;
      max-width: 1400px;
    }
  }

  .alert-wrap::before {
    font-family: 'Material Symbols Outlined';
    content: '\e8b5';
    font-style: normal;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    font-size: 1.35rem;
    margin-top: 0.15rem;
    margin-right: 0.5rem;
  }

  > div > div:first-of-type {
    margin-right: 2rem;
  }

  > div > div:last-of-type {
    display: flex;
  }

  .alert-close-trigger {
    position: absolute;
    display: inline-block;
    right: 0;
  }

  .alert-close-trigger::before {
    font-family: 'Material Symbols Outlined';
    content: '\e5cd';
    font-style: normal;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    font-size: 1.75rem;
    margin-left: 0.5rem;
  }

  p {
    margin: 0.5rem 0;
  }

  a { 
    color: black 
  }

  &.beta {
    background-color: var(--mid-green);
    color: white;
    border-top: 2px solid var(--highlight-green);
    /* Fix to bottom of page */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    /* Change to "BETA" label */
    .alert-wrap {
      align-items: center;
      flex-wrap: wrap;
      &::before {
        font-family: inherit;
        content: 'BETA';
        margin: 0;
        margin-right: 2.5rem;  
        font-size: 1rem;
        font-weight: var(--font-weight-strong);
        background-color: var(--highlight-green);
        color: var(--main-green);
        padding: 0rem 0.5rem;
        border-radius: 14px;
      }
      .styled-link {
        display: flex;
        align-items: center;
        background: var(--main-green);
        border-radius: 8px;
        margin-right: 3.5rem;
        & a {
          color: white;
          min-width: 10px;
          height: 0;
          font-size: 0;
          padding: 0;
          margin: 0;
          @media (min-width: 1420px) {
            font-size: 1rem;
            width: auto;
            height: auto;
            padding: 0.65rem 1.75rem;
            padding-left: 0;
            font-weight: var(--font-weight-semibold);
            padding-left: 0;
          }
        }
      }
      .styled-link::before {
        content: '\f075';
        -webkit-font-smoothing: antialiased;
        font-family: 'Font Awesome 7 Free';
        font-size: 1.35rem;
        color: white;
        display: inline-block;
        width: 2rem;
        text-align: center;
        padding: 0.5rem;
        padding-left: 1.25rem;
      }
      &.alert-close-trigger::before {
        color: white;
      }
    }

    > div > div:last-of-type {
      align-items: center;
      margin-left: auto;
    }

  }

  &.beta_top {
    background: rgb(119, 187, 224, 0.35);
    .alert-wrap {
      align-items: center;
      flex-wrap: wrap;
      gap: 0;
      &::before {
        font-family: inherit;
        content: 'BETA';
        margin: 0;
        margin-right: 1.5rem;  
        font-size: 1rem;
        font-weight: var(--font-weight-strong);
        background-color: var(--main-green);
        color: var(--highlight-green);
        padding: 0rem 0.5rem;
        border-radius: 14px;
      }
      > div:first-of-type {
        margin-right: auto;
      }
      > div:last-of-type {
        min-width: 200px;
      }
      &.alert-close-trigger::before {
        color: white;
      }
      .styled-link a {
        background: none;
        text-decoration: underline;
        color: var(--mid-green);
        padding: 0;
        margin-right: 1rem;
        &:hover {
          text-decoration: none;
        }
      }
      .alert-close-trigger::before {
        display: none;
      }
    }
    @media (min-width: 768px) {
      .alert-wrap {
        flex-wrap: nowrap;
        padding: 0.5rem 0;
        gap: 1rem;
        &::before {
          margin-left: 1rem;
        }
        .styled-link a {
          min-width: 200px;
        }
      }
    }
  }

  &.error {
    background-color: var(--alert-red);
    /* Change to "Error" icon */
    .alert-wrap::before {
      content: '\e002';
    }
  }
}