@layer components {

/* Breadcrumbs — simple text with chevron separators */
.breadcrumbs {
  margin: 0;
  font-size: var(--font-size-sm);
}

.breadcrumbs.small {
  font-size: var(--font-size-xs);
}

.breadcrumbs ul {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

.breadcrumbs ul li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.5rem;
}

/* Chevron separator between items */
.breadcrumbs ul li + li::before {
  content: '›';
  color: var(--neutral-400);
  display: inline-flex;
  align-items: center;
  font-size: 1em;
  line-height: 1;
}

.breadcrumbs ul a {
  background: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--neutral-500);
  line-height: 1.4;
  position: relative;
}

.breadcrumbs ul a:hover {
  background: none;
  color: var(--primary-500);
  text-decoration: underline;
}

/* Remove old arrow pseudo-elements */
.breadcrumbs ul a:before,
.breadcrumbs ul a:after {
  content: none;
}

/* Home icon link */
.breadcrumbs ul li:first-child a {
  color: var(--neutral-400);
}

.breadcrumbs ul li:first-child a:hover {
  color: var(--primary-500);
}

/* Last/active item */
.breadcrumbs ul li:last-child:not(.breadcrumbs__copy) a,
.breadcrumbs ul li:nth-last-child(2):has(+ .breadcrumbs__copy) a {
  color: var(--neutral-700);
  font-weight: 500;
}

.breadcrumbs ul .active,
.breadcrumbs ul .active:hover {
  background: transparent;
  color: var(--neutral-700);
}

/* Copy link button next to last breadcrumb item */
.breadcrumbs__copy {
  align-items: center;
  margin-left: 0.15em;
}

.breadcrumbs__copy::before {
  content: none;
}

.copy-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15em 0.3em;
  line-height: 1;
  vertical-align: middle;
}

.breadcrumbs .svg-icon {
  margin-right: 0;
}

.breadcrumbs .svg-icon svg {
  display: block;
}

.copy-link-btn .svg-icon {
  display: inline-flex;
}

.copy-link-btn .svg-icon svg {
  width: 14px;
  height: 14px;
}

.copy-link-btn.copy-link-btn--copied,
.copy-link-btn.copy-link-btn--copied:hover {
  color: var(--success);
}

.copy-link-btn.copy-link-btn--copied .svg-icon svg,
.copy-link-btn.copy-link-btn--copied .svg-icon svg path {
  fill: var(--success);
}

/* Mobile: truncate long breadcrumb text */
@media (max-width: 768px) {
  .breadcrumbs ul {
    flex-wrap: nowrap;
  }

  .breadcrumbs ul a {
    max-width: 12rem;
    overflow: clip;
    overflow-clip-margin: 1em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .breadcrumbs ul li:last-child:not(.breadcrumbs__copy) a,
  .breadcrumbs ul li:nth-last-child(2):has(+ .breadcrumbs__copy) a,
  .breadcrumbs ul .active {
    max-width: 10rem;
    overflow: clip;
    overflow-clip-margin: 1em;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

}
