/* Files as a tree: rows that link to a file, folders that fold. */
.file-tree {
    min-width: 0;
}

.file-tree__list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.file-tree__link,
.file-tree__summary {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    min-height: 2rem;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    color: var(--color-on-surface);
    font-size: var(--font-size-sm);
    text-decoration: none;
    cursor: pointer;
}

.file-tree__summary {
    list-style: none;
}

/* A branch that is a place of its own, rather than a folder in one. */
.file-tree__summary--strong {
    font-weight: var(--font-weight-medium);
}

.file-tree__count {
    margin-left: auto;
    color: var(--color-on-surface-faint);
    font-size: 0.75rem;
    font-weight: var(--font-weight-regular);
}

/* Nothing in a branch, or nothing the filter left. */
.file-tree__empty {
    margin: 0;
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--color-on-surface-muted);
    font-size: var(--font-size-sm);
}

.file-tree__summary::-webkit-details-marker {
    display: none;
}

.file-tree__link:hover,
.file-tree__summary:hover {
    background-color: var(--color-surface-highlighted);
}

.file-tree__link[aria-current="page"] {
    background-color: var(--color-primary-container);
}

.file-tree__name {
    min-width: 0;
    overflow: hidden;
    font-family: var(--font-family-mono);
    font-size: 0.8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-tree__icon,
.file-tree__chevron {
    flex-shrink: 0;
    width: 0.95rem;
    height: 0.95rem;
    color: var(--color-on-surface-muted);
}

.file-tree__chevron {
    transition: transform 180ms var(--ease-out);
}

.file-tree__folder[open] > .file-tree__summary > .file-tree__chevron {
    transform: rotate(90deg);
}

.file-tree__children {
    margin-left: 0.85rem;
    padding-left: 0.35rem;
    border-left: var(--border-width) solid var(--color-border);
}

@media (prefers-reduced-motion: reduce) {
    .file-tree__chevron {
        transition: none;
    }
}
