@import '//y14e.github.io/common/stylesheets/common.css';

.path {
  ol {
    display: flex;
    flex-wrap: wrap;
  }
  li {
    display: flex;
    gap: 0.8rem;
    white-space: nowrap;
  }
  a {
    display: block;
    padding-inline: 0.8rem;
    &:has(~ [data-menu-trigger]) {
      padding-right: 3.2rem;
      margin-right: -3.2rem;
    }
  }
}

[data-menu-trigger] {
  align-items: center;
  border-radius: 0.4rem;
  display: flex;
  font-weight: bold;
  gap: 0.8rem;
  padding: 0.7rem;
  transition-duration: 0.3s;
  transition-property: background-color, color;
  &::after {
    aspect-ratio: 1;
    background-color: currentColor;
    clip-path: polygon(0 30%, 25% 30%, 50% 55%, 75% 30%, 100% 30%, 50% 80%);
    content: '';
    transition: 0.3s rotate;
    rotate: -90deg;
    width: 1rem;
  }
  [aria-expanded='true'] + & {
    background-color: rgb(0 0 0 / 0.1);
    &::after {
      rotate: 0deg;
    }
  }
  &:hover {
    background-color: rgb(0 0 0 / 0.1);
  }
}
[role='menu'] {
  background-color: #fff;
  border-radius: 0.4rem;
  box-shadow:
    0 0 0.2rem rgb(0 0 0 / 0.1),
    0 0.4rem 0.8rem rgb(0 0 0 / 0.2);
  padding: 0.4rem;
  white-space: nowrap;
  :is([data-menu-trigger], [aria-haspopup]) + &,
  &[data-portaled] {
    display: none;
    position: absolute;
    transition: 0.3s transform cubic-bezier(0.33, 1, 0.68, 1);
    z-index: calc(infinity);
  }
  &:not([data-menu-open]) {
    transform: scale(0.9);
  }
  & & {
    display: none;
  }
}
[role^='menuitem'] {
  border-radius: 0.4rem;
  cursor: pointer;
  display: block;
  outline-offset: -2px;
  padding: 0.8rem 1.6rem;
  position: relative;
  transition: 0.3s background-color;
  width: 100%;
  z-index: 1;
  &[aria-haspopup] {
    align-items: center;
    display: flex;
    gap: 0.8rem;
    justify-content: space-between;
    padding: 0.8rem 1.6rem;
    position: relative;
    &::after {
      aspect-ratio: 1;
      background-color: currentColor;
      clip-path: polygon(30% 0%, 80% 50%, 30% 100%, 30% 75%, 55% 50%, 30% 25%);
      content: '';
      width: 1rem;
    }
  }
  &:is([data-menu-disabled], [disabled]) {
    color: rgb(0 0 0 / 0.35);
  }
  &:hover {
    background-color: rgb(0 0 0 / 0.1);
  }
  &[aria-expanded='true'] {
    background-color: rgb(0 0 0 / 0.1);
  }
}
[data-menu-arrow] {
  aspect-ratio: 1;
  background-color: #fff;
  box-shadow: -0.1rem -0.1rem 0.1rem rgb(0 0 0 / 0.1);
  position: absolute;
  visibility: hidden;
  width: 0.8rem;
  :is([data-menu-trigger], [aria-haspopup]) + * > &,
  [data-portaled] > & {
    visibility: visible;
  }
  [data-menu-placement^='top'] & {
    box-shadow: -0.1rem -0.1rem 0.1rem rgb(0 0 0 / 0.2);
  }
  :is([data-menu-placement^='left'], [data-menu-placement^='right']) & {
    margin-top: 4px;
  }
}
