@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;
  margin: 0;
  padding: 0;
  font-weight: bold;
  list-style: none;
}

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

.global-nav-list li a {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: 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;
    background: global.$color-primary;
    transform: scaleX(0);
    transition: transform 0.2s;
    content: "";
  }

  &: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;
  background-image: url("#{global.$root-theme-img}arrow-border-black.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  transform: rotate(90deg);
  content: "";
}

.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;
    margin: 0;
    padding: 1rem 1.5rem;
    color: global.$color-text-side;
    text-align: left;
    background: #fff;

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

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

    &: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;
}
