@layer reset, tokens, global, composition, blocks, utilities;

@layer blocks {
  .knowledge-collection-tree {
    box-sizing: border-box;
    width: 100%;
    margin: 0;

    & > .title {
      margin: 0;
      margin-block-end: var(--space-xs);
      color: var(--text-muted-color);
      font-family: var(--font-ui);
      font-size: var(--text-caption-size);
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    & > .list {
      display: flex;
      flex-direction: column;
      gap: var(--space-3xs);
      margin: 0;
      padding: 0;
      list-style: none;

      & > .item > .link {
        display: flex;
        gap: var(--space-xs);
        align-items: center;
        justify-content: space-between;
        padding: var(--space-2xs) var(--space-xs);
        border-radius: var(--radius-sm);
        color: var(--text-default-color);
        font-family: var(--font-ui);
        font-size: var(--text-caption-size);
        text-decoration: none;
        transition:
          color var(--state-entry-duration) var(--state-entry-easing),
          background-color var(--state-entry-duration) var(--state-entry-easing);

        &:hover,
        &:focus-visible {
          color: var(--text-prominent-color);
          background-color: var(--surface-inset-bg-color);
        }

        &.is-active {
          color: var(--brand-primary-color);
          background-color: var(--brand-surface-color);
          font-weight: 600;
        }

        & > .label-group {
          display: inline-flex;
          gap: var(--space-2xs);
          align-items: center;
          min-inline-size: 0;

          & > .label {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }

        & > .count {
          color: var(--text-muted-color);
          font-size: var(--text-overline-size);
          font-weight: 600;
        }
      }
    }
  }
}
