/* 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;
	--title: #333333;
	--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;
}

/* Right-hand block: the work's title as large as Lucia's name and a shade
   darker, with the project and "virtueel prototype" underneath. */
.banner__meta {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 5px;
	color: var(--muted);
	white-space: nowrap;
}

.banner__project {
	padding: 0;
	border: 0;
	background: none;
	color: var(--title);
	font: 400 20px/1 "Roboto Serif", Georgia, serif;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	cursor: pointer;
	text-decoration: underline dotted var(--underline);
	text-decoration-thickness: 1px;
	text-underline-offset: 5px;
}

.banner__subtitle {
	margin: 0;
	color: var(--muted);
	font-size: 12px;
	line-height: 1;
	letter-spacing: 0.02em;
}

.banner__meta--plain .banner__project {
	cursor: default;
	text-decoration: none;
}

.banner__project:focus-visible,
.banner__name:focus-visible {
	outline: 1px solid var(--text);
	outline-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: pre-line;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.banner__meta:hover .banner__about,
.banner__meta.is-open .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%;
	top: 50%;
	transform: translate(-50%, -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: 14px;
	padding: 10px var(--gutter) 20px 10px;
	background: var(--bg);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.panel__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 30px;
}

.panel__toggle {
	display: none;
}

/* 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 {
	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 {
	text-decoration-color: var(--text);
}

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

.link: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;
}

/* 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);
}

/* One line per slider: name, slider, value. */
.tune__row {
	display: grid;
	grid-template-columns: 76px 1fr 44px;
	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"]:focus-visible {
	outline: 1px solid var(--text);
	outline-offset: 2px;
}

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

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

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

/* On/off switches (Draaien, Doorzichtig): the name on the left, a small
   pill on the right that is filled black with the knob to the right when on.
   State comes from aria-pressed, which main.js already keeps up to date. */
.toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 2px 0;
	border: 0;
	background: none;
	color: var(--text);
	text-align: left;
	cursor: pointer;
}

.toggle::after {
	content: "";
	flex: none;
	width: 30px;
	height: 18px;
	border: 1px solid var(--name);
	border-radius: 9px;
	background: radial-gradient(circle at 8px 50%, var(--name) 5px, transparent 5.5px);
	transition: background-color 0.15s, border-color 0.15s;
}

.toggle[aria-pressed="true"]::after {
	border-color: var(--text);
	background: radial-gradient(circle at 20px 50%, var(--bg) 5px, transparent 5.5px) var(--text);
}

.toggle:hover::after {
	border-color: var(--text);
}

.toggle:focus-visible {
	outline: none;
}

.toggle:focus-visible::after {
	outline: 1px solid var(--text);
	outline-offset: 3px;
}

.hint {
	margin: 0;
}

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

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

	/* No room for name and title side by side: the title block drops under
	   the name, still right-aligned. */
	.banner {
		flex-wrap: wrap;
		gap: 10px 16px;
		padding-top: calc(12px + env(safe-area-inset-top));
		padding-bottom: 12px;
	}

	.banner__meta {
		margin-left: auto;
	}

	.banner__project {
		font-size: 16px;
	}

	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 {
		padding: 6px 0;
	}

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

	.scan-list {
		gap: 0;
	}

	.label {
		margin-bottom: 4px;
	}

	.panel__toggle {
		display: block;
		padding: 4px 0;
	}

	.panel__toggle::after {
		content: " ↑";
		display: inline-block;
		text-decoration: none;
	}

	.panel__toggle[aria-expanded="false"]::after {
		content: " ↓";
	}

	#panel.is-collapsed .panel__body {
		display: none;
	}

	#panel.is-collapsed {
		max-height: none;
		padding-top: 6px;
		padding-bottom: calc(6px + env(safe-area-inset-bottom));
	}
}

@media (max-width: 440px) {
	.banner__project {
		font-size: 16px;
	}

	.banner__about {
		right: calc(-1 * var(--gutter));
	}
}

/* ---------- scan list: numbered names that pick a scan ---------- */

.scan__select {
	display: flex;
	gap: 8px;
	width: 100%;
	padding: 2px 0;
	border: 0;
	background: none;
	color: var(--text);
	font-size: 14px;
	line-height: 1.4;
	text-align: left;
	cursor: pointer;
}

.scan__number {
	flex: none;
	width: 14px;
	color: var(--faint);
	font-variant-numeric: tabular-nums;
	transition: color 0.15s;
}

.scan__title {
	text-decoration: underline;
	text-decoration-color: transparent;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
	transition: text-decoration-color 0.15s;
}

.scan__select:hover .scan__title {
	text-decoration-color: var(--underline);
}

.scan__select:focus-visible {
	outline: 1px solid var(--text);
	outline-offset: 3px;
}

/* While the toolbox is open, the scan being edited is marked in the list. */
.scan-list.is-picking .scan__select[aria-pressed="true"] .scan__number {
	color: var(--text);
}

.scan-list.is-picking .scan__select[aria-pressed="true"] .scan__title {
	text-decoration-color: var(--text);
}

/* ---------- toolbox: the controls of the picked scan ---------- */

/* Directly under the scan names it works on. */
.group--scans + .toolbox {
	margin-top: -20px;
}

.toolbox__toggle::after {
	content: " ↓";
	display: inline-block;
	margin-left: 2px;
}

.toolbox__toggle[aria-expanded="true"]::after {
	content: " ↑";
}

.toolbox__body[hidden] {
	display: none;
}

.toolbox__current {
	margin: 14px 0 12px;
	color: var(--text);
	font-size: 13px;
	line-height: 1.4;
}

.toolbox__hint {
	color: var(--muted);
	font-size: 11px;
	letter-spacing: 0.02em;
}

.toolbox .tune {
	gap: 4px;
	margin: 0;
	padding-left: 0;
	border-left: 0;
}
.hint--usage {
	color: var(--faint);
	font-size: 12px;
	margin-top: auto;
}

/* Credit at the foot of the panel, as quiet as the hint above it. */
.made-by {
	margin: -18px 0 0;
	color: var(--faint);
	font-size: 12px;
}

.made-by a {
	color: var(--muted);
	text-decoration: underline;
	text-decoration-color: var(--line);
	text-underline-offset: 3px;
	transition: color 0.15s, text-decoration-color 0.15s;
}

.made-by a:hover {
	color: var(--text);
	text-decoration-color: var(--text);
}

.made-by a:focus-visible {
	outline: 1px solid var(--text);
	outline-offset: 2px;
}

/* ---------- AR code ---------- */

.ar-qr {
	margin-top: 14px;
}

.ar-qr img {
	display: block;
	width: 112px;
	height: 112px;
}

.ar-qr p {
	margin: 8px 0 0;
	color: var(--muted);
	font-size: 12px;
	line-height: 1.4;
}

/* Share image (?og): the stage only. */
[data-og] #panel,
[data-og] .banner {
	display: none;
}

[data-og] body {
	grid-template-columns: 1fr;
	grid-template-rows: minmax(0, 1fr);
	grid-template-areas: "stage";
}

[data-og] .loader {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}
