/*
 * Demo design switcher. Self-contained (.cvs-*), fixed palette, so it looks
 * the same on every design and no design can break it. Flat colours only:
 * a dark sheet, real screenshots of every demo in thin browser frames.
 */

.cvs-root {
	--cvs-sheet: #111113;
	--cvs-card: #1a1a1d;
	--cvs-ink: #f4f4f2;
	--cvs-muted: #9a9a9f;
	--cvs-line: rgba(255, 255, 255, 0.1);
	--cvs-line-strong: rgba(255, 255, 255, 0.28);
	--cvs-accent: #f4f4f2;
	--cvs-ease: cubic-bezier(0.22, 1, 0.36, 1);
	font: 400 14px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: var(--cvs-ink);
	-webkit-font-smoothing: antialiased;
}

.cvs-root *,
.cvs-root *::before,
.cvs-root *::after {
	box-sizing: border-box;
}

.cvs-root .cvs-panel,
.cvs-root .cvs-panel h2,
.cvs-root .cvs-panel p,
.cvs-root .cvs-panel a,
.cvs-root .cvs-panel span,
.cvs-root .cvs-fab,
.cvs-root .cvs-fab span {
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	text-transform: none;
	letter-spacing: normal;
}

.cvs-root .cvs-card:focus,
.cvs-root .cvs-fab:focus,
.cvs-root .cvs-close:focus {
	outline: none;
	box-shadow: none;
}

.cvs-root img {
	display: block;
	max-width: none;
	border: 0;
	margin: 0;
}

.cvs-open,
.cvs-open body {
	overflow: hidden;
}

/* ---------- Floating button ---------- */

.cvs-fab {
	position: fixed;
	left: 16px;
	bottom: 16px;
	z-index: 99990;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 48px;
	padding: 6px 14px 6px 6px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 14px;
	background: var(--cvs-sheet);
	color: var(--cvs-ink);
	font: 500 13px/1.2 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	text-align: left;
	cursor: pointer;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
	transition: transform 0.35s var(--cvs-ease), border-color 0.25s ease;
}

.cvs-fab:not(:has(.cvs-fab-thumb)) {
	padding-left: 14px;
}

.cvs-fab:hover {
	transform: translateY(-2px);
	border-color: rgba(255, 255, 255, 0.34);
}

.cvs-root .cvs-fab:focus-visible,
.cvs-root .cvs-close:focus-visible,
.cvs-root .cvs-card:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 3px;
}

.cvs-fab-thumb {
	width: 48px;
	height: 34px;
	border-radius: 8px;
	object-fit: cover;
	object-position: top left;
}

.cvs-fab-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.cvs-fab-name {
	font-weight: 600;
	font-size: 14px;
}

.cvs-fab-count {
	color: var(--cvs-muted);
	font-size: 12px;
}

.cvs-fab-icon {
	margin-left: 4px;
	opacity: 0.8;
}

/* ---------- Sheet ---------- */

.cvs-backdrop {
	position: fixed;
	inset: 0;
	z-index: 99991;
	background: rgba(0, 0, 0, 0.62);
	animation: cvs-fade 0.35s ease both;
}

.cvs-panel {
	position: fixed;
	z-index: 99992;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	background: var(--cvs-sheet);
	border: 1px solid var(--cvs-line);
	border-radius: 22px;
	overflow: hidden;
	box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5);
	animation: cvs-rise 0.6s var(--cvs-ease) both;
}

.cvs-panel[hidden],
.cvs-backdrop[hidden] {
	display: none;
}

.cvs-root .cvs-panel {
	/* Layout knobs: the grid is sized so all designs fit one screen, no scroll. */
	--cvs-cols: 5;
	--cvs-rows: 2;
	--cvs-inset: 16px;
	--cvs-head: 76px;
	--cvs-pad-x: 24px;
	--cvs-pad-y: 20px;
	--cvs-gap-x: 16px;
	--cvs-gap-y: 20px;
	--cvs-bar: 24px;
	--cvs-meta: 62px;
	--cvs-cardgap: 10px;
	inset: var(--cvs-inset);
	max-width: 2200px;
	/* As tall as the cards need, centred on screen. */
	height: fit-content;
	max-height: calc(100% - 2 * var(--cvs-inset));
	margin: auto;
}

.cvs-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	height: var(--cvs-head);
	padding: 0 var(--cvs-pad-x);
	border-bottom: 1px solid var(--cvs-line);
}

.cvs-root .cvs-panel .cvs-kicker {
	margin: 0 0 4px;
	color: var(--cvs-muted);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
}

.cvs-root .cvs-panel .cvs-title {
	margin: 0;
	color: var(--cvs-ink);
	font: 600 24px/1.1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	letter-spacing: -0.02em;
	text-transform: none;
}

.cvs-close {
	display: grid;
	place-items: center;
	flex: none;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--cvs-line-strong);
	border-radius: 50%;
	background: transparent;
	color: var(--cvs-ink);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, transform 0.35s var(--cvs-ease);
}

.cvs-close:hover {
	background: var(--cvs-ink);
	color: var(--cvs-sheet);
	transform: rotate(90deg);
}

/* No scrolling: the body is exactly the space left under the head. */
.cvs-scroll {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1;
	min-height: 0;
	overflow: hidden;
	padding: var(--cvs-pad-y) var(--cvs-pad-x);
}

.cvs-grid {
	display: grid;
	grid-template-columns: repeat(var(--cvs-cols), minmax(0, 1fr));
	gap: var(--cvs-gap-y) var(--cvs-gap-x);
	/* As wide as the panel allows, but never so wide that the rows outgrow the screen height. */
	width: min(100%, calc(((100vh - 2 * var(--cvs-inset) - var(--cvs-head) - 2 * var(--cvs-pad-y) - (var(--cvs-rows) - 1) * var(--cvs-gap-y)) / var(--cvs-rows) - var(--cvs-bar) - var(--cvs-meta) - var(--cvs-cardgap) - 6px) * 1.6 * var(--cvs-cols) + (var(--cvs-cols) - 1) * var(--cvs-gap-x)));
	width: min(100%, calc(((100dvh - 2 * var(--cvs-inset) - var(--cvs-head) - 2 * var(--cvs-pad-y) - (var(--cvs-rows) - 1) * var(--cvs-gap-y)) / var(--cvs-rows) - var(--cvs-bar) - var(--cvs-meta) - var(--cvs-cardgap) - 6px) * 1.6 * var(--cvs-cols) + (var(--cvs-cols) - 1) * var(--cvs-gap-x)));
	margin: 0;
	padding: 0;
	list-style: none;
}

.cvs-item {
	min-width: 0;
	margin: 0;
	padding: 0;
	animation: cvs-card-in 0.7s var(--cvs-ease) both;
	animation-delay: calc(0.1s + var(--cvs-i, 0) * 0.04s);
}

/* ---------- Card ---------- */

.cvs-card {
	display: flex;
	flex-direction: column;
	gap: var(--cvs-cardgap);
	color: var(--cvs-ink);
	text-decoration: none;
	border-radius: 12px;
}

.cvs-card:hover,
.cvs-card:focus {
	color: var(--cvs-ink);
	text-decoration: none;
}

.cvs-shot {
	position: relative;
	display: block;
	border: 1px solid var(--cvs-line);
	border-radius: 12px;
	background: var(--cvs-card);
	overflow: hidden;
	transition: border-color 0.3s ease, transform 0.5s var(--cvs-ease);
}

.cvs-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	height: var(--cvs-bar);
	padding: 0 8px;
	border-bottom: 1px solid var(--cvs-line);
}

.cvs-bar i {
	flex: none;
	width: 16px;
	height: 5px;
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.16);
}

.cvs-root .cvs-panel .cvs-path {
	flex: 1;
	overflow: hidden;
	padding: 2px 8px;
	border-radius: 5px;
	background: rgba(255, 255, 255, 0.06);
	color: var(--cvs-muted);
	font-size: 10px;
	line-height: 1.3;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.cvs-frame {
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
}

.cvs-frame img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
	transform-origin: top center;
	transition: transform 0.9s var(--cvs-ease), opacity 0.4s ease;
}

.cvs-root .cvs-panel .cvs-badge {
	flex: none;
	padding: 3px 7px;
	border-radius: 999px;
	background: #ffffff;
	color: #111113;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.1;
}

.cvs-root .cvs-panel .cvs-go {
	position: absolute;
	right: 8px;
	bottom: 8px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 11px;
	border-radius: 999px;
	background: #ffffff;
	color: #111113;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.3s ease, transform 0.45s var(--cvs-ease);
}

.cvs-go svg {
	transition: transform 0.35s var(--cvs-ease);
}

.cvs-card:hover .cvs-shot,
.cvs-card:focus-visible .cvs-shot {
	border-color: var(--cvs-line-strong);
	transform: translateY(-3px);
}

.cvs-card:hover .cvs-frame img,
.cvs-card:focus-visible .cvs-frame img {
	transform: scale(1.05);
}

.cvs-card:hover .cvs-go,
.cvs-card:focus-visible .cvs-go {
	opacity: 1;
	transform: none;
}

.cvs-card:hover .cvs-go svg {
	transform: translateX(3px);
}

.cvs-card.is-current .cvs-shot {
	border-color: rgba(255, 255, 255, 0.6);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.cvs-card.is-loading .cvs-frame img {
	opacity: 0.45;
}

/* ---------- Meta ---------- */

.cvs-meta {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: baseline;
	column-gap: 8px;
	row-gap: 3px;
	height: var(--cvs-meta);
	overflow: hidden;
	padding: 0 2px;
}

.cvs-root .cvs-panel .cvs-num {
	color: var(--cvs-muted);
	font-size: 11px;
	font-variant-numeric: tabular-nums;
}

.cvs-root .cvs-panel .cvs-name {
	overflow: hidden;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: -0.01em;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.cvs-root .cvs-panel .cvs-label {
	justify-self: end;
	padding: 2px 7px;
	border: 1px solid var(--cvs-line);
	border-radius: 999px;
	color: var(--cvs-muted);
	font-size: 11px;
	line-height: 1.3;
	white-space: nowrap;
}

.cvs-root .cvs-panel .cvs-tagline {
	grid-column: 1 / -1;
	display: -webkit-box;
	overflow: hidden;
	color: var(--cvs-muted);
	font-size: 12.5px;
	line-height: 1.45;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ---------- Motion ---------- */

@keyframes cvs-fade {
	from {
		opacity: 0;
	}
}

@keyframes cvs-rise {
	from {
		opacity: 0;
		transform: translateY(24px) scale(0.985);
	}
}

@keyframes cvs-card-in {
	from {
		opacity: 0;
		transform: translateY(18px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cvs-root *,
	.cvs-backdrop,
	.cvs-panel {
		animation: none !important;
		transition: none !important;
	}
}

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
	.cvs-root .cvs-panel {
		--cvs-gap-x: 12px;
		--cvs-gap-y: 16px;
	}

	.cvs-root .cvs-panel .cvs-label {
		display: none;
	}
}

/* Short screens: drop the description so two rows still fit. */
@media (max-height: 720px) {
	.cvs-root .cvs-panel {
		--cvs-meta: 22px;
		--cvs-head: 64px;
		--cvs-pad-y: 14px;
	}

	.cvs-root .cvs-panel .cvs-tagline {
		display: none;
	}
}

@media (max-width: 860px) {
	.cvs-root .cvs-panel {
		height: auto;
		--cvs-cols: 2;
		--cvs-rows: 5;
		--cvs-inset: 0px;
		--cvs-head: 64px;
		--cvs-pad-x: 14px;
		--cvs-pad-y: 12px;
		--cvs-gap-x: 10px;
		--cvs-gap-y: 10px;
		--cvs-bar: 0px;
		--cvs-meta: 20px;
		--cvs-cardgap: 6px;
		border: 0;
		border-radius: 0;
	}

	.cvs-root .cvs-panel .cvs-title {
		font-size: 20px;
	}

	.cvs-bar,
	.cvs-root .cvs-panel .cvs-tagline,
	.cvs-root .cvs-panel .cvs-label {
		display: none;
	}

	.cvs-root .cvs-panel .cvs-name {
		font-size: 14px;
	}

	.cvs-root .cvs-panel .cvs-go {
		display: none;
	}

	.cvs-shot,
	.cvs-card {
		border-radius: 10px;
	}

	.cvs-fab {
		left: 12px;
		bottom: 12px;
		min-height: 44px;
		gap: 8px;
		padding: 5px 10px 5px 5px;
	}

	.cvs-fab-text {
		display: none;
	}

	.cvs-fab-thumb {
		width: 40px;
		height: 30px;
	}

	.cvs-fab-icon {
		margin-left: 0;
	}
}

/* Phones on their side: too short for any grid, so let it scroll. */
@media (max-height: 460px) {
	.cvs-scroll {
		align-items: flex-start;
		overflow-y: auto;
	}

	.cvs-grid {
		width: 100%;
	}
}
