/* dl.* index — classic nginx autoindex skeleton, Catppuccin Latte/Mocha skin. */

:root {
	--bg: #eff1f5;
	--surface: #e6e9ef;
	--surface-2: #dce0e8;
	--ink: #4c4f69;
	--ink-strong: #2b192e;
	--muted: #8c8fa1;
	--accent: #ea76cb;
	--accent-2: #8839ef;
	--accent-soft: #fbe4ee;
	--hairline: #ccd0da;
	--code-bg: #e6e9ef;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #1e1e2e;
		--surface: #313244;
		--surface-2: #45475a;
		--ink: #cdd6f4;
		--ink-strong: #f5e0dc;
		--muted: #9399b2;
		--accent: #f5c2e7;
		--accent-2: #cba6f7;
		--accent-soft: #3a3146;
		--hairline: #45475a;
		--code-bg: #313244;
	}
}

* { box-sizing: border-box; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 400 15px/1.5 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	-webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--ink-strong); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#page { flex: 1 0 auto; width: min(960px, 100% - 2.5rem); margin: 0 auto; padding: 2rem 0 1.5rem; }

/* classic h1 + hr, just tidied */
#page > h1 {
	font: 500 1.15rem/1.4 inherit;
	color: var(--ink-strong);
	display: flex; align-items: center; gap: 1rem;
	margin: 0 0 .2rem;
	font-family: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
}
#page > hr { border: 0; border-top: 1px solid var(--hairline); margin: .5rem 0 0; }

/* the filter rides the h1 line */
#q {
	margin-left: auto; width: 11rem;
	font: inherit; font-size: .8rem;
	background: var(--surface); color: var(--ink);
	border: 1px solid var(--hairline); border-radius: 6px;
	padding: .25rem .55rem;
}
#q::placeholder { color: var(--muted); }
#q:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); outline: none; }

/* the listing — flat like the original, tidier */
table#list { width: 100%; border-collapse: collapse; }
#list th {
	text-align: left; font: 600 .7rem/1 inherit;
	text-transform: uppercase; letter-spacing: .06em;
	color: var(--muted);
	padding: .55rem .5rem .4rem;
	border-bottom: 1px solid var(--hairline);
}
#list th[style] { width: auto !important; }
#list th:nth-child(2), #list td.size { width: 6.5rem; }
#list th:nth-child(3), #list td.date { width: 11rem; }
#list th a { color: inherit; text-decoration: none; }
#list th a:hover { color: var(--accent-2); }
#list td { padding: .18rem .5rem; border-bottom: 1px solid var(--surface); }
#list tbody tr:hover { background: var(--surface); }
#list td.link a {
	color: var(--ink); text-decoration: none;
	display: inline-flex; align-items: center; gap: .45rem; min-width: 0; max-width: 100%;
}
#list td.link a .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#list td.link a:hover .fname { color: var(--accent-2); text-decoration: underline; text-underline-offset: 2px; }
#list td.size, #list td.date {
	font-variant-numeric: tabular-nums; color: var(--muted);
	font-size: .85rem; white-space: nowrap;
}

/* icons — quiet monochrome, folders pink */
.fic { width: 16px; height: 16px; flex: none; display: inline-grid; place-items: center; color: var(--muted); }
.fic svg { width: 15px; height: 15px; display: block; }
.fic.t-dir { color: var(--accent); }
.fic.t-up { color: var(--muted); }
#list td.link a:hover .fic { color: var(--accent-2); }

/* image thumbs */
.thumb {
	width: 30px; height: 30px; flex: none; object-fit: cover;
	border-radius: 5px; border: 1px solid var(--hairline); background: var(--surface);
	transition: transform .12s;
}
tr:hover .thumb { transform: scale(1.7); position: relative; z-index: 2; }
.thumb.broken { display: none; }
.thumb + .fic { display: none; }
.thumb.broken + .fic { display: inline-grid; }

/* README/HEADER blocks — flat panel, hairline */
.mdcard {
	margin: .9rem 0 0; padding: .9rem 1.1rem;
	border: 1px solid var(--hairline); border-radius: 8px;
	font-size: .92rem;
}
.mdcard > :first-child { margin-top: 0; }
.mdcard > :last-child { margin-bottom: 0; }
.mdcard h1, .mdcard h2, .mdcard h3 { color: var(--ink-strong); margin: .8rem 0 .3rem; line-height: 1.3; }
.mdcard h1 { font-size: 1.2rem; } .mdcard h2 { font-size: 1.05rem; } .mdcard h3 { font-size: .95rem; }
.mdcard p { margin: .35rem 0; }
.mdcard a { color: var(--accent-2); }
.mdcard code { background: var(--code-bg); border-radius: 4px; padding: .08em .3em;
	font: 400 .85em "JetBrains Mono", ui-monospace, monospace; }
.mdcard pre { background: var(--code-bg); border-radius: 6px; padding: .6rem .8rem; overflow-x: auto; margin: .4rem 0; }
.mdcard pre code { background: none; padding: 0; }
.mdcard ul, .mdcard ol { margin: .35rem 0 .35rem 1.3rem; }
.mdcard hr { border: 0; border-top: 1px solid var(--hairline); margin: .7rem 0; }
.mdcard img { max-width: 100%; border-radius: 6px; }
.mdcard strong { color: var(--ink-strong); }

/* pinned footer */
#site-foot {
	flex-shrink: 0; width: min(960px, 100% - 2.5rem); margin: auto auto 0;
	padding: .7rem 0 .9rem; border-top: 1px solid var(--hairline);
	display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
	color: var(--muted); font-size: .78rem;
}
#foot-md:empty { display: none; }
#foot-md a { color: var(--accent-2); }
#foot-md code { background: var(--code-bg); border-radius: 4px; padding: .05em .3em; }

@media (max-width: 640px) {
	#page > h1 { font-size: .95rem; flex-wrap: wrap; }
	#q { width: 100%; margin-left: 0; }
	#list th:nth-child(3), #list td.date { display: none; }
	.thumb { width: 26px; height: 26px; }
}

:root[data-theme="dark"] {
	--bg: #1e1e2e;
	--surface: #313244;
	--surface-2: #45475a;
	--ink: #cdd6f4;
	--ink-strong: #f5e0dc;
	--muted: #9399b2;
	--accent: #f5c2e7;
	--accent-2: #cba6f7;
	--accent-soft: #3a3146;
	--hairline: #45475a;
	--code-bg: #313244;
}

#themebtn {
	margin-left: .5rem; width: 1.9rem; height: 1.9rem; flex: none;
	display: inline-grid; place-items: center; cursor: pointer;
	background: var(--surface); color: var(--muted);
	border: 1px solid var(--hairline); border-radius: 6px;
}
#themebtn:hover { color: var(--accent-2); border-color: var(--accent); }
#themebtn svg { width: 14px; height: 14px; display: block; }
