/*
 * @file
 * The mobile navigation button is complicated enough to have its own stylesheet.
 */

.mobile-nav-button {
  --mobile-nav-button-line-color: var(--theme-text-color-loud);

  position: relative;
  z-index: 11; /* Appear over the expanded mobile menu. */
  overflow: clip;
  flex-shrink: 0;
  width: 2rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  appearance: none;
}

.mobile-nav-button__icon {
  --line-width: 3px;
  --icon-size: 80%;

  position: absolute;
  top: calc(50% - var(--line-width) / 2);
  left: calc((100% - var(--icon-size)) / 2);
  width: var(--icon-size);
  height: 0;
  transition: border-top-color 0.2s;
  border-top: solid var(--line-width) var(--mobile-nav-button-line-color);

  [aria-expanded="true"] & {
    border-top-color: transparent;
  }

  &::before,
  &::after {
    position: absolute;
    left: 0;
    width: 100%;
    height: 0;
    content: "";
    transition: all 0.2s;
  }

  &::before {
    top: -11px;
    border-top: solid var(--line-width) var(--mobile-nav-button-line-color);
  }

  [aria-expanded="true"] &::before {
    top: calc(50% - var(--line-width) / 2);
    transform: rotate(-45deg);
  }

  &::after {
    top: 5px;
    border-bottom: solid var(--line-width) var(--mobile-nav-button-line-color);
  }

  [aria-expanded="true"] &::after {
    top: calc(50% - var(--line-width) / 2);
    transform: rotate(45deg);
  }
}
