main {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding-bottom: var(--gap);
}

.primary-nav {
  > ul {
    display: grid;
    grid-template-columns: 1fr repeat(3, auto);
    grid-column-gap: calc(var(--gap) * 2);
    justify-items: center;
    align-items: center;

    > .nav-item {
      position: relative;
      transition:
        color var(--hover-trans-time),
        scale var(--hover-trans-time);

      &:hover,
      &:has(> a:focus) {
        color: var(--clr-accent);
        scale: var(--hover-scale);
      }

      > a {
        text-decoration: none;
      }
    }

    > .nav-item:not(.nav-home) {
      padding: 0.25rem 0.5rem;

      > a {
        font-family: var(--ff-text);
        font-size: var(--fs-text);
        outline: none;

        --dot-size: calc(var(--border-width) * 2);
        --center: calc(50% - var(--border-width));

        &::after {
          content: "";
          position: absolute;
          z-index: -1;
          bottom: 0;
          left: var(--center);
          width: var(--dot-size);
          height: var(--dot-size);
          transform: rotateZ(45deg);
          outline: var(--border-width) solid var(--clr-bg);

          transition:
            background-color var(--hover-trans-time) ease,
            scale var(--hover-trans-time) ease;
          background-color: var(--clr-text);
        }

        &::before {
          content: "";
          position: absolute;
          z-index: -2;
          bottom: calc(var(--border-width) / 2);
          left: var(--center);
          width: 0;
          border-bottom: var(--border-width) solid var(--clr-text);
          transition:
            width var(--hover-trans-time) ease,
            transform var(--hover-trans-time) ease;
          transform: translate(calc(var(--center) * -1), 0);
          transform-origin: calc(50% - var(--border-width));
        }

        &:hover::after,
        &:focus::after {
          background-color: var(--clr-accent);
        }

        &:focus::after {
          scale: 1.5;
        }

        &:hover::before,
        &:focus::before {
          border-bottom: var(--border-width) solid var(--clr-accent);
          width: 100%;
        }
      }
    }

    > .nav-home {
      justify-self: left;
      text-decoration: none;

      > a {
        position: relative;
        font-family: var(--ff-title);
        font-size: var(--fs-title);
        text-shadow: var(--text-shadow-x) var(--text-shadow-y)
          var(--text-shadow-spread) var(--clr-bg);

        &::before {
          content: "🍁";
          font-size: var(--fs-title);
          position: absolute;
          z-index: -1;
          top: 0;
          left: -1.5rem;
          text-shadow: none;
          transform: rotateZ(-30deg);
          transition: transform var(--hover-trans-time);
        }

        &:focus {
          outline: none;
        }

        &:hover::before,
        &:focus::before {
          transform: translateX(-0.5rem) rotateZ(-45deg);
        }
      }
    }
  }
}

/*
  Disable text-shadow in light mode because the text colour already constrasts
  well enough with the maple leaf to no longer need it.
*/
@media (prefers-color-scheme: light) {
  .nav-home > a {
    text-shadow: none !important;
  }
}
