@use "@/styles/variables";

.Block {
  border-bottom: 1px solid var(--cmm-color-border-base);
  height: variables.$headerHeight;
  z-index: 50;
  position: sticky;
  top: 0;
  background: var(--cmm-color-surface-0);
}

.inner {
  @include variables.container;

  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.left {
  display: flex;
  align-items: center;
  column-gap: 1rem;
}

.right {
  display: flex;
  align-items: center;
  column-gap: 0.5rem;

  hr {
    height: 1rem;
    border: none;
    border-left: 1px solid var(--cmm-color-border-base);
    margin-right: 0.5rem;
  }
}

@mixin mobileOnly($display: inline) {
  display: none;

  @include variables.mq("md") {
    display: inline;
  }
}

@mixin desktopOnly($display: inline) {
  display: $display;

  @include variables.mq("md") {
    display: none;
  }
}

.logo {
  @include desktopOnly();
}

.nav {
  display: flex;
  align-items: center;
  column-gap: 1.25rem;

  .list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }

  .link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--cmm-color-font-base);
    background: var(--cmm-color-surface-0);
    font-weight: var(--cmm-font-weight-semibold);
    font-size: var(--cmm-font-size-sm);
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: var(--cmm-radius-md);
    transition: var(--cmm-transition-bg);

    svg {
      width: 1.2rem;
      height: 1.2rem;
      stroke-width: 2;
    }

    &:hover {
      background-color: var(--cmm-color-surface-2);
    }
  }
}

%menuButton {
  --cmm-IconButton-icon-size: 1.5rem;
  margin-left: -0.5rem;
}

// FIXME
.menuButtonOpen {
  @extend %menuButton;
  display: none !important;

  @include variables.mq("md") {
    display: grid !important;
  }
}

.menuButtonClose {
  @extend %menuButton;
}

.menu {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: 0 0 0.75rem 0;
  margin: 0;
  overflow-y: auto;
  border: none;
  scrollbar-width: none;
  left: 0;
  background: var(--cmm-color-surface-0);

  &::-webkit-scrollbar {
    display: none;
  }

  &::backdrop {
    background-color: rgba(0, 0, 0, 0.85);
  }

  &__header {
    position: sticky;
    top: 0;
    height: variables.$headerHeight;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0 1rem;
    background-color: var(--cmm-color-surface-0);
    z-index: 10;
    border-bottom: 1px solid var(--cmm-color-border-base);
  }

  &__content {
    margin-top: 0.5rem;
  }
}

.navMobile {
  padding: 0 0.5rem;
  display: none !important;

  &__buttonList {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin: 1rem 0;
  }

  &__button {
    border-radius: var(--cmm-radius-md) !important;
    width: 100% !important;
  }

  @include variables.mq("md") {
    display: block !important;
  }
}

.desktopOnly {
  @include variables.mq("md") {
    display: none !important;
  }
}

.templateLink {
  display: flex;
  align-items: center;
  gap: 0.25em;
}

.searchBar {
  margin-inline-end: 0.5rem;
}
