Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

1.5 KB
Raw Blame
/* The box is sized before anything loads (aspect-ratio), so attaching the
   sources never shifts the page: no layout shift, whatever the network. */

.figure {
	margin: 28px 0;
}

.box {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border-radius: 12px;
	border: 1px solid var(--os-border);
	background: var(--os-surface-1);
}

/* The poster under the video: a native lazy image, in the server HTML. The
   video sits on top and covers it from its first frame; until then a <video>
   with no poster paints nothing, so the image shows through. */
.poster,
.video {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.video {
	z-index: 1;
}

/* Top right: the bottom-right corner is where a webcam vignette sits. */
.toggle {
	position: absolute;
	z-index: 2;
	right: 10px;
	top: 10px;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: rgba(8, 10, 13, 0.62);
	color: #fff;
	cursor: pointer;
	opacity: 0.55;
	transition: opacity 0.15s;
}

/* Fully visible whenever it is the way in: paused, hovered or focused. */
.toggleIdle,
.box:hover .toggle,
.toggle:focus-visible {
	opacity: 1;
}

@media (hover: none) {
	.toggle {
		opacity: 0.85;
	}
}

/* Two loops side by side from tablet width, one above the other below it. */
.pair {
	display: grid;
	gap: 16px;
	margin: 28px 0;
}

.pair .figure {
	margin: 0;
}

@media (min-width: 760px) {
	.pair {
		grid-template-columns: 1fr 1fr;
	}
}