@use "global/acms-common" as acms;
@use "global/common" as global;

/* ------------------------------
　　グローバルナビゲーション
------------------------------ */
.global-nav {
  display: flex;
  align-items: center;
  height: 100%;
}

.global-nav-list {
  display: flex;
  padding: 0;
  margin: 0;
  font-weight: bold;
  list-style: none;
}

.global-nav-list li {
  position: relative;
  display: flex;
}

.global-nav-list li a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: global.$header-height;
  padding: 0 1rem;
  color: global.$color-text;
  text-decoration: none;

  &:visited,
  &:active,
  &:hover,
  &:focus {
    color: global.$color-text;
  }

  &::before {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    content: "";
    background: global.$color-primary;
    transition: transform 0.2s;
    transform: scaleX(0);
  }

  &:hover {
    text-decoration: none;

    &::before {
      transform: scaleX(1);
    }
  }
}

.global-nav-list li[data-has="true"] > a::after {
  display: inline-block;
  width: 6px;
  height: 12px;
  margin-left: 16px;
  content: "";
  background-image: url("#{global.$root-theme-img}arrow-border-black.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  transform: rotate(90deg);
}

.global-nav-list li > ul {
  position: absolute;
  top: 100%;
  left: 1rem;
  display: none;
  flex-direction: column;
  min-width: 14rem;
  overflow: hidden;
  border-radius: global.$border-radius-sm;
  box-shadow: global.$elevation04;

  li {
    width: 100%;
    margin: 0;
    border-top: global.$border-width-sm solid global.$color-gray30;
  }

  li > a {
    position: relative;
    display: inline-block;
    width: 100%;
    height: auto;
    padding: 1rem 1.5rem;
    margin: 0;
    color: global.$color-text-side;
    text-align: left;
    background: #fff;

    &:visited {
      color: global.$color-text-side;
    }

    &:focus-visible::before {
      position: absolute;
      inset: 0;
      content: "";
      border: 2px solid global.$color-focus;
    }

    &:hover,
    &:active,
    &:focus {
      color: global.$color-text;
      background-color: global.$color-gray10;
    }

    &:hover::before {
      content: none;
    }

    &::after {
      content: none;
    }

    &:focus-visible {
      outline: 0;
    }
  }
}

.global-nav-list li:hover > ul,
.global-nav-list li:focus-within > ul {
  display: flex;
}
