/**
 * @file
 * Breadcrumb region.
 */

@import "../base/variables.pcss.css";

.breadcrumb {
  position: relative;
  font-size: 14px;
  font-weight: bold;
  line-height: var(--sp1);

  /* Shadow on the right side of breadcrumbs for narrow screens. */
  &:after {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: calc(var(--sp1) * -1);
    width: var(--sp3);
    height: var(--sp1);
    content: "";
    background: linear-gradient(to left, var(--color--white) 0%, rgba(255, 255, 255, 0) 100%); /* LTR */

    @media (--lg) {
      content: none;
    }
  }

  @media (--lg) {
    position: static;
  }
}

[dir="rtl"] .breadcrumb:after {
  background: linear-gradient(to right, var(--color--white) 0%, rgba(255, 255, 255, 0) 100%);
}

.breadcrumb__content {
  overflow: auto;
  margin-inline-end: calc(var(--sp1) * -1);
  -webkit-overflow-scrolling: touch;

  @media (--lg) {
    margin: 0;
  }
}

.breadcrumb__list {
  overflow-x: auto;
  width: max-content;
  margin-block: 0;
  margin-inline-start: calc(var(--sp1) * -1);
  margin-inline-end: calc(var(--sp1) * -1);
  padding-block: 0 var(--sp1);
  padding-inline-start: var(--sp1);
  padding-inline-end: 0;
  list-style: none;
  white-space: nowrap;

  @media (--lg) {
    overflow: visible;
    margin-inline-start: 0;
    margin-inline-end: 0;
    padding-block-end: 0;
    padding-inline-start: 0;
    white-space: normal;
  }
}

.breadcrumb__item {
  display: inline-block;

  &:nth-child(n+2):before {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-inline: 16px 20px;
    content: "";
    transform: rotate(45deg); /* LTR */
    border-block-start: 2px solid var(--color--gray-25);
    border-inline-end: 2px solid var(--color--gray-25);
  }

  &:last-child {
    margin-inline-end: var(--sp3);

    @media (--lg) {
      margin-inline-end: 0;
    }
  }
}

[dir="rtl"] .breadcrumb__item:nth-child(n+2):before {
  transform: rotate(-45deg);
}

.breadcrumb__link {
  text-decoration: none;
  color: var(--color--blue-20);

  &:hover,
  &:focus {
    text-decoration: underline;
  }
}
