/* Copyright 2025 Shota FUJI <pockawoooh@gmail.com>
 * SPDX-License-Identifier: MIT
 */

.tree-list {
	display: flex;
	flex-direction: column;
	list-style: none;
	padding: 0;
	margin: 0;
}

.tree-row {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr) repeat(2, max-content);
	grid-template-areas:
		"icon name name name"
		". . mode size";
	align-items: center;
	gap: var(--space-sm);
	padding: var(--space-sm) 0;
	border-block-end: 1px solid var(--color-border-subtle);
}
.tree-row[data-layout="compact"] {
	grid-template-columns: repeat(2, max-content) minmax(0, 1fr) max-content;
	grid-template-areas: "mode icon name size";
}

@media (any-hover: hover) {
	.tree-row:hover {
		text-decoration: none;
	}
	.tree-row:hover > .tree-row--name {
		text-decoration: underline;
	}
}

.tree-row--dir-icon, .tree-row--file-icon {
	grid-area: icon;
	width: auto;
	height: 1em;
}

.tree-row--dir-icon {
	color: var(--color-decoration);
}

.tree-row--file-icon {
	color: var(--color-fg-subtle);
}

.tree-row--name {
	grid-area: name;
	line-height: 1.3;

	color: var(--color-fg);
	overflow: hidden;
	text-overflow: ellipsis;
}

.tree-row--mode {
	grid-area: mode;
	font-size: var(--font-xs);
	line-height: 1.1;
	font-family: var(--font-mono);

	color: var(--color-fg-subtle);
}
.tree-row--mode[data-format="hidden"] {
	display: none;
}

.tree-row--size {
	grid-area: size;
	font-size: var(--font-sm);
	line-height: 1.1;

	color: var(--color-fg-weak);
}
.tree-row--size[data-format="hidden"] {
	display: none;
}
