/**
 * @file
 * Button which expands the navigation at wide viewport widths.
 */

@import "../../base/variables.pcss.css";

.wide-nav-expand {
  display: none;

  @media (--nav) {
    display: flex;
    visibility: hidden;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: var(--content-left);
    height: var(--sp6);
    cursor: pointer;
    pointer-events: auto;
    color: var(--color--white);
    border: 0;
    background-color: var(--color--blue-50);

    &:focus {
      outline: solid 2px currentColor;
      outline-offset: -4px;
    }
  }
}

body:not(.is-always-mobile-nav) .is-fixed .wide-nav-expand {
  @media (--nav) {
    visibility: visible;
  }
}

body.is-always-mobile-nav .wide-nav-expand {
  @media (--nav) {
    visibility: hidden;
  }
}

.wide-nav-expand__icon {
  position: relative;
  width: var(--sp2);
  height: 21px;
  transition: opacity 0.2s;
  pointer-events: none;
  opacity: 0;
  transform-style: preserve-3d;

  & > span {
    display: block;
    height: 0;
    /* Intentionally not using CSS logical properties. */
    border-top: solid 3px currentColor;

    &:nth-child(1) {
      position: absolute;
      inset-block-start: 0;
      inset-inline-start: 0;
      width: 100%;
      height: 0;
      transition: transform 0.2s;
      background-color: currentColor;
    }

    &:nth-child(2) {
      position: absolute;
      inset-block-start: 9px;
      inset-inline-start: 0;
      width: 100%;
      height: 0;
      transition: opacity 0.2s;
      background-color: currentColor;
    }

    &:nth-child(3) {
      position: absolute;
      inset-block: auto 0;
      inset-inline-start: 0;
      width: 100%;
      height: 0;
      transition: transform 0.2s;
      background-color: currentColor;
    }
  }
}

.is-fixed .wide-nav-expand__icon {
  opacity: 1;
}

[aria-expanded="true"] .wide-nav-expand__icon {
  & > span:nth-child(1) {
    inset-block-start: 9px;
    transform: rotate(-45deg);
  }

  & > span:nth-child(2) {
    opacity: 0;
  }

  & > span:nth-child(3) {
    inset-block-start: 9px;
    transform: rotate(45deg);
  }
}
