.category-bar {
  position: sticky;
  inset-block-start: var(--header-block-size);
  z-index: var(--z-index-category-bar);
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  min-width: 0;
  min-height: var(--category-bar-block-size);
}

/* 분류·정렬의 배치는 본문 폭에 두고 배경과 아래 선만 화면 끝까지 잇는다. */
.category-bar::before {
  content: "";
  position: absolute;
  z-index: var(--z-index-background);
  inset-block: 0;
  inset-inline-start: 50%;
  width: 100cqw;
  translate: -50% 0;
  background: rgb(var(--color-gray-50));
  border-block-end: var(--line-width-default) solid rgb(var(--color-gray-200));
  pointer-events: none;
}

@supports (backdrop-filter: blur(0)) {
  body:has(.site-header[data-scrolled]) .category-bar::before {
    background: rgb(var(--color-gray-50) / var(--navigation-background-opacity-scrolled));
    backdrop-filter: blur(var(--blur-backdrop));
  }
}

html:has(.category-bar) {
  scroll-padding-block-start: calc(var(--header-block-size) + var(--category-bar-block-size));
}

.category-bar-group {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: var(--category-bar-item-gap);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-bar-group::-webkit-scrollbar {
  display: none;
}

.category-bar-group--secondary {
  flex: none;
  margin-inline-start: auto;
}

.category-bar-item {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: rgb(var(--color-gray-500));
  font-size: var(--font-size-md);
  line-height: var(--font-line-height-md);
  font-weight: var(--font-weight-normal);
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
}

.category-bar-group--secondary .category-bar-item {
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-sm);
}

.category-bar-item:is([aria-pressed="true"], [aria-current="location"]) {
  color: rgb(var(--color-gray-900));
  font-weight: var(--font-weight-semibold);
}

.category-bar-group:not(.category-bar-group--sort) .category-bar-item:is([aria-pressed="true"], [aria-current="location"]) {
  color: rgb(var(--color-primary-start));
}

@media (forced-colors: none) {
  @supports (background-clip: text) {
    .category-bar-group:not(.category-bar-group--sort) .category-bar-item:is([aria-pressed="true"], [aria-current="location"]) {
      background: var(--gradient-primary-vertical);
      background-clip: text;
      color: transparent;
    }
  }
}

@media (hover: hover) {
  .category-bar-item:enabled:hover,
  a.category-bar-item:hover {
    color: rgb(var(--color-gray-900));
  }

  .category-bar-group:not(.category-bar-group--sort) .category-bar-item:is(:enabled, a):hover {
    color: rgb(var(--color-primary-start));
  }

  @media (forced-colors: none) {
    @supports (background-clip: text) {
      .category-bar-group:not(.category-bar-group--sort) .category-bar-item:is(:enabled, a):hover {
        background: var(--gradient-primary-vertical);
        background-clip: text;
        color: transparent;
      }
    }
  }
}
