/* Minimal theme, matched to lucialuptakova.nl.
   Titles are small grey labels (never clickable).
   Everything clickable is black text with an underline. */
:root {
	--bg: #ffffff;
	--stage: #f2f2f0;
	--line: #e6e6e6;
	--text: #000000;
	--name: #666666;
	--muted: #999999;
	--faint: #c4c4c4;
	--underline: #cfcfcf;
	--panel-width: 250px;
	--banner-height: 64px;
	--gutter: 28px;
}

* {
	box-sizing: border-box;
}

html,
body {
	height: 100%;
	margin: 0;
}

body {
	height: 100dvh;
	display: grid;
	grid-template-columns: 1fr var(--panel-width);
	grid-template-rows: var(--banner-height) minmax(0, 1fr);
	grid-template-areas:
		"banner banner"
		"stage  panel";
	background: var(--bg);
	color: var(--text);
	font: 15px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
}

button {
	font: inherit;
}

/* ---------- banner ---------- */

.banner {
	grid-area: banner;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 0 var(--gutter);
	padding-top: env(safe-area-inset-top);
	background: var(--bg);
}

.banner__name {
	color: var(--name);
	font: 400 20px/1 "Roboto Serif", Georgia, serif;
	letter-spacing: 0.4px;
	text-decoration: none;
	white-space: nowrap;
}

.banner__meta {
	position: relative;
	color: var(--muted);
	white-space: nowrap;
	cursor: help;
}

.banner__project {
	text-decoration: underline dotted var(--underline);
	text-underline-offset: 4px;
}

.banner__about {
	position: absolute;
	top: calc(100% + 12px);
	right: 0;
	z-index: 10;
	width: min(320px, 80vw);
	margin: 0;
	padding: 14px 16px;
	background: var(--bg);
	border: 1px solid var(--line);
	color: var(--name);
	font-size: 13px;
	line-height: 1.5;
	white-space: normal;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.banner__meta:hover .banner__about,
.banner__meta:focus-within .banner__about {
	opacity: 1;
	visibility: visible;
	transform: none;
}

/* ---------- stage ---------- */

#stage {
	grid-area: stage;
	position: relative;
	min-width: 0;
	min-height: 0;
	background: var(--stage);
}

#canvas {
	display: block;
	width: 100%;
	height: 100%;
	touch-action: none;
}

.loader {
	position: absolute;
	left: 50%;
	bottom: 28px;
	transform: translateX(-50%);
	width: min(240px, 60vw);
	text-align: center;
}

.loader__bar {
	height: 1px;
	background: var(--line);
	overflow: hidden;
}

.loader__bar span {
	display: block;
	height: 100%;
	width: 0;
	background: var(--name);
	transition: width 0.15s linear;
}

.loader p {
	margin: 8px 0 0;
	color: var(--muted);
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.error {
	position: absolute;
	inset: auto var(--gutter) var(--gutter) var(--gutter);
	margin: 0;
	color: #b0413e;
	font-size: 13px;
	white-space: pre-wrap;
}

/* ---------- panel ---------- */

#panel {
	grid-area: panel;
	display: flex;
	flex-direction: column;
	gap: 30px;
	padding: 10px var(--gutter) 20px 10px;
	background: var(--bg);
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* Titles: small, grey, spaced capitals. Not interactive. */
.label {
	margin: 0 0 10px;
	color: var(--muted);
	font-size: 11px;
	font-weight: 400;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

/* Links: black text, light underline; darker on hover; active = solid black line. */
.link,
.scan__toggle {
	padding: 0;
	border: 0;
	background: none;
	color: var(--text);
	text-align: left;
	text-decoration: underline;
	text-decoration-color: var(--underline);
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
	cursor: pointer;
	transition: text-decoration-color 0.15s;
}

.link:hover,
.scan__toggle:hover {
	text-decoration-color: var(--text);
}

.link[aria-pressed="true"],
.link[aria-checked="true"],
.scan__toggle[aria-pressed="true"] {
	text-decoration-color: var(--text);
	text-decoration-thickness: 2px;
}

.link:focus-visible,
.scan__toggle:focus-visible,
.switch input:focus-visible {
	outline: 1px solid var(--text);
	outline-offset: 3px;
}

.link--small {
	color: var(--name);
	font-size: 13px;
}

/* ---------- scan list ---------- */

.scan-list {
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.scan__toggle {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	text-decoration: none;
}

/* Underline only the name, not the file size next to it. */
.scan__toggle > span:first-child {
	text-decoration: underline;
	text-decoration-color: inherit;
	text-decoration-thickness: inherit;
	text-underline-offset: 4px;
	text-decoration-color: var(--underline);
}

.scan__toggle:hover > span:first-child {
	text-decoration-color: var(--text);
}

.scan__toggle[aria-pressed="true"] > span:first-child {
	text-decoration-color: var(--text);
	text-decoration-thickness: 2px;
}

.scan-list .meta {
	color: var(--faint);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* A class rule beats the UA stylesheet's [hidden] { display: none }. */
.tune[hidden] {
	display: none;
}

.tune {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin: 6px 0 10px;
	padding-left: 10px;
	border-left: 1px solid var(--line);
}

.tune__row {
	display: grid;
	grid-template-columns: 72px 1fr 42px;
	align-items: center;
	gap: 8px;
	color: var(--muted);
	font-size: 12px;
}

.tune__row output {
	color: var(--name);
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.tune input[type="range"] {
	width: 100%;
	height: 18px;
	margin: 0;
	accent-color: var(--name);
	cursor: ew-resize;
}

/* ---------- controls ---------- */

.row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 16px;
}

.switch {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	cursor: pointer;
}

.switch input {
	accent-color: var(--text);
	margin: 0;
}

.segmented {
	display: flex;
	gap: 18px;
}

.buttons {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
}

/* ---------- info (collapsed dev readout) ---------- */

.debug {
	margin-top: auto;
	color: var(--faint);
	font-size: 12px;
}

.debug summary {
	cursor: pointer;
	list-style: none;
	width: max-content;
}

.debug summary::-webkit-details-marker {
	display: none;
}

.debug summary:hover {
	color: var(--muted);
}

.stats {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	gap: 0 8px;
	margin: 8px 0;
	font-variant-numeric: tabular-nums;
}

.stats dd {
	margin: 0;
	text-align: right;
}

.hint {
	margin: 0;
}

/* ---------- tablet / phone ---------- */

@media (max-width: 760px) {
	:root {
		--gutter: 16px;
		--banner-height: 52px;
	}

	body {
		grid-template-columns: 1fr;
		grid-template-rows: var(--banner-height) minmax(0, 1fr) auto;
		grid-template-areas:
			"banner"
			"stage"
			"panel";
	}

	.banner__name {
		font-size: 16px;
	}

	#panel {
		max-height: 42dvh;
		padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom));
		gap: 20px;
		border-top: 1px solid var(--line);
	}

	/* Bigger tap targets; controls flow in rows instead of a tall column. */
	.link,
	.scan__toggle {
		padding: 6px 0;
	}

	.buttons {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 0 18px;
	}

	.scan-list {
		gap: 0;
	}

	.label {
		margin-bottom: 4px;
	}

	.debug {
		display: none;
	}
}

@media (max-width: 440px) {
	.banner__meta {
		display: none;
	}
}
