/* ==========================================================================
   DXZEMO bar — the parts that live in the page (the bar itself is in a
   Shadow DOM, see templates/bar.php). Everything here is prefixed dxz-.

   Device preview without an iframe:
   - Desktop: nothing changes, the demo is the page.
   - Tablet / Mobile (<html data-dxz-device>): the page stops scrolling and the
     demo is shown in a frame 768px / 390px wide. Inside it:
     · .dxz-demo-root is the container the demo's container queries measure,
       so the layout answers to the frame's width;
     · .dxz-demo-root scrolls, so position:sticky works inside the frame;
     · .dxz-demo-frame has a transform, so position:fixed elements of the demo
       (headers, drawers, toasts) are placed in the frame, not on the screen.
   ========================================================================== */

@font-face {
	font-family: "dxz-bar-pixel";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("bitcount-single-latin.woff2") format("woff2");
}

:root {
	--dxz-bar-space: 76px;
	--dxz-top: 0px;
}

/* Desktop: room under the content so the bar never covers the demo's end. */
html.dxz-has-bar:not([data-dxz-bar="min"]) body {
	padding-bottom: var(--dxz-bar-space);
}

/* The WordPress admin bar takes the top of the screen. */
html.dxz-device-on body.admin-bar {
	--dxz-top: 32px;
}

@media (max-width: 782px) {
	html.dxz-device-on body.admin-bar {
		--dxz-top: 46px;
	}
}

/* Tablet / Mobile ---------------------------------------------------------- */
html[data-dxz-device="tablet"] {
	--dxz-w: 768px;
	--dxz-h: 1024px;
	--dxz-radius: 18px;
	--dxz-bezel: 10px;
}

html[data-dxz-device="mobile"] {
	--dxz-w: 390px;
	--dxz-h: 844px;
	--dxz-radius: 34px;
	--dxz-bezel: 10px;
}

html.dxz-device-on,
html.dxz-device-on body {
	height: 100%;
	overflow: hidden;
}

html.dxz-device-on body {
	box-sizing: border-box;
	display: flex;
	justify-content: center;
	align-items: flex-start;
	margin: 0;
	padding: 20px 16px calc(var(--dxz-bar-space) + 8px);
	background:
		linear-gradient(rgb(255 255 255 / 0.04) 1px, transparent 1px) 0 0 / 32px 32px,
		linear-gradient(90deg, rgb(255 255 255 / 0.04) 1px, transparent 1px) 0 0 / 32px 32px,
		#0b0b0d;
}

/* The device: the demo's own page background (read by bar.js), a dark bezel. */
html.dxz-device-on .dxz-demo-frame {
	box-sizing: content-box;
	flex: none;
	width: var(--dxz-w);
	max-width: calc(100% - var(--dxz-bezel) * 2);
	height: min(var(--dxz-h), calc(100dvh - var(--dxz-top) - var(--dxz-bar-space) - 28px - var(--dxz-bezel) * 2));
	overflow: hidden;
	background: var(--dxz-demo-bg, #fff);
	border: var(--dxz-bezel) solid #17171a;
	border-radius: var(--dxz-radius);
	outline: 1px solid rgb(255 255 255 / 0.12);
	box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.8), 0 0 0 1px rgb(0 0 0 / 0.6);

	/* Makes the frame the containing block of the demo's position:fixed elements. */
	transform: translateZ(0);
	transition: width 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

html.dxz-device-on .dxz-demo-root {
	height: 100%;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;

	/* Phones and tablets draw their scrollbar over the content: keep the full width. */
	scrollbar-width: none;
}

html.dxz-device-on .dxz-demo-root::-webkit-scrollbar {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	html.dxz-device-on .dxz-demo-frame {
		transition: none;
	}
}
