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

@import "../base/media-queries.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(--sp2);
    content: "";
    background: linear-gradient(to left, var(--color--white) 0%, rgb(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%, rgb(255, 255, 255, 0) 100%);
}

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

  @media (--lg) {
    margin-inline-end: 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;
    width: auto;
    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-45);
    border-inline-end: 2px solid var(--color--gray-45);
  }

  &: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-text-primary-medium);

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