@import "../pages/mixins";

.nav-fixed {
  /* positioning */
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  /* theming */
  background-color: color(var(--black) a(0.975)); /* fallback */
  /* subtle translucence */
  /* background: linear-gradient(
    var(--black),
    color(var(--black) a(0.975)) 50%,
    color(var(--black) a(0.95)) 100%
  ); */
  background: var(--black);
  /* sizing */
  width: 100%;
  min-height: 88px;
  padding: 0 var(--gutter);
  /* transitions */
  transform: none;
  transition: transform 0.4s;

  &.hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
  }

  & .nav-titles img,
  & .nav-topic svg {
    display: block;
    margin: 0 auto;
  }

  & .nav-entity {
    min-height: 88px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
  }

  & .nav-titles {
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  & .nav-titles-action {

    & .menu-button {
      display: block;
      width: 22px;
      margin-right: 1em;
    }
  }

  & .datachile {
    @add-mixin nav-logo;
    /* positioning */
    margin-right: 5px;
    top: -1px; /* fudge into place */
  }

  & .title {
    flex: 1;
    display: block;
    margin-left: 0.5em;
  }

  & a.search-toggle-nav {
    padding: 10px;
    cursor: pointer;
  }

  & .nav-topic {
    text-align: center;

    & .topics {
      /* no icon on small screens */
      @add-mixin for-sm {
        text-align: right;

        & .topic-link {
          display: inline-block;

          & + .topic-link {
            margin-left: 1em;
          }
        }
      }
      /* position icons on big screens */
      @add-mixin from-sm {
        display: flex;
        flex-direction: row;
        align-content: stretch;
        justify-content: space-around;
        height: 100%;

        & .topic-link + .topic-link {
          margin-left: 1em;
        }
      }
    }

    & .topic-link {
      display: block;
      text-decoration: none;
      color: var(--white);
      border-bottom: 2px solid transparent;
      opacity: 0.9;
      transition: opacity 0.2s;
      cursor: pointer;
      line-height: 100%;
      padding: 0.5em;

      /* interactions */
      &.active,
      &:hover,
      &:focus {
        color: var(--accent);
        opacity: 1;
        transition: color 0.2s ease-out;

        & .svg-image {
          transform: translateY(-3px);
        }
      }
      &.active {
        border-color: var(--accent);
      }

      & .svg-image {
        @add-mixin for-sm {
          display: none;
        }
        @add-mixin from-sm {
          padding-top: 1em;
          padding-bottom: 0.5em;
          transition: transform 0.2s ease-out;
        }
      }
    }
  }
}

@add-mixin from-sm {
  .nav-fixed {
    & .nav-entity {
      flex-direction: row;
    }

    & .nav-titles {
      flex: 1;
    }

    & .nav-topic {

      & .topic-link {

        & .svg-image {
          display: block;
          margin-bottom: 2px;
        }

        & svg {
          height: 40px;

          & path,
          & line,
          & rect,
          & circle {
            fill: none;
            stroke: var(--white);
            stroke-width: 1.5;
            transition: stroke 0.2s ease-out;
          }
        }

        &.active,
        &:hover {
          & svg {
            & path,
            & line,
            & rect,
            & circle {
              fill: none;
              stroke: var(--accent);
            }
          }
        }
      }
    }
  }
}
