:root {
	color-scheme: light dark;
	--paper: #f8f6f1;
	--ink: #232a25;
	--muted: #58625a;
	--rule: #cecfc5;
	--hover: #eeeee6;
	--accent: #725123;
	--folder: #f3e5c4;
	--focus: #155e66;
	--sans: "Inter", "Helvetica Neue", Arial, sans-serif;
	--serif:
		"Instrument Serif", "Iowan Old Style", "Palatino Linotype", Palatino,
		Georgia, serif;
	--mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
	:root {
		--paper: #1d211e;
		--ink: #eef0e7;
		--muted: #aab4a8;
		--rule: #495149;
		--hover: #272e28;
		--accent: #caa66c;
		--folder: #453b2b;
		--focus: #89d3d5;
	}
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	color: var(--ink);
	background: var(--paper);
	font: 1rem/1.5 var(--sans);
}

.directory {
	width: min(100% - 2.5rem, 55rem);
	margin: clamp(2.5rem, 9vw, 7rem) auto 5rem;
}

.directory-header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	padding-bottom: clamp(1.3rem, 4vw, 2.5rem);
	border-bottom: 1px solid var(--ink);
}

.directory h1 {
	margin: 0;
	font: 400 clamp(2.7rem, 6vw, 5rem)/1.05 var(--serif);
	letter-spacing: -0.055em;
}

.directory a {
	color: inherit;
}

.directory-switch {
	font-size: 0.92rem;
	text-underline-offset: 0.25em;
	text-decoration-thickness: 1px;
	padding-block: 0.7rem;
}

.directory a:hover {
	color: var(--focus);
}

.directory :is(a, summary):focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 3px;
}

.sites,
.pages {
	list-style: none;
	margin: 0;
	padding: 0;
}
.site {
	border-bottom: 1px solid var(--rule);
}

.site > summary {
	display: grid;
	grid-template-columns: 1.5rem minmax(0, 1fr) auto 0.65rem;
	align-items: center;
	gap: clamp(0.55rem, 2vw, 1rem);
	padding: 1rem 0.35rem;
	list-style: none;
	cursor: pointer;
}

.site > summary::-webkit-details-marker {
	display: none;
}
.site > summary:hover,
.pages a:hover {
	background: var(--hover);
}

.folder-icon {
	position: relative;
	isolation: isolate;
	width: 1.3rem;
	height: 0.9rem;
	margin-top: 0.2rem;
	color: var(--accent);
	border: 1.5px solid currentColor;
	border-radius: 2px;
	background: var(--folder);
}

.folder-icon::before {
	content: "";
	position: absolute;
	left: -1.5px;
	bottom: 100%;
	width: 0.55rem;
	height: 0.18rem;
	background: var(--folder);
	border: 1.5px solid currentColor;
	border-bottom: 0;
	border-radius: 2px 3px 0 0;
}

.site-identity {
	display: grid;
	gap: 0.1rem;
}
.site-name,
.page-name {
	overflow-wrap: anywhere;
}
.site-name {
	font: 400 clamp(1.25rem, 2.3vw, 1.6rem)/1.2 var(--serif);
}

.site-host,
.page-path,
.page-count {
	font: 400 0.76rem/1.45 var(--mono);
	color: var(--muted);
}

.site-host,
.page-path {
	overflow-wrap: anywhere;
}
.page-count {
	white-space: nowrap;
}

.disclosure {
	width: 0.45rem;
	height: 0.45rem;
	border: solid var(--muted);
	border-width: 1.5px 1.5px 0 0;
	transform: rotate(45deg);
}

.site[open] > summary .disclosure {
	transform: rotate(135deg);
}

.pages {
	margin: 0 0.35rem 1rem 1rem;
	padding-left: clamp(0.85rem, 2vw, 1.45rem);
	border-left: 1px solid var(--rule);
}

.pages a {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	justify-content: space-between;
	column-gap: 1rem;
	row-gap: 0.12rem;
	padding: 0.62rem 0.5rem;
	font-size: 0.94rem;
	text-decoration: none;
}

.page-name {
	text-decoration: underline;
	text-decoration-color: var(--rule);
	text-underline-offset: 0.2em;
}
.pages a:hover .page-name {
	text-decoration-color: currentColor;
}
.empty-directory {
	margin: 1.5rem 0;
	color: var(--muted);
}

@media (max-width: 36rem) {
	.pages a {
		display: grid;
	}
}

@media (forced-colors: active) {
	.folder-icon,
	.disclosure {
		color: ButtonText;
		border-color: ButtonText;
	}
}
