/* demo-stage: a demo in its own window, its controls outside it.
   Markup: templates/components/demo-stage.php
   Specimen: /design-system/components/demo-stage

   The window's height is fixed, so nothing in the demo moves the page. */

demo-stage {
	--demo-height: min(600px, 75svh);
	--handle-width: var(--target-min);
	--stage-line: 1px;
	--grip-width: 3px;

	display: grid;
	gap: var(--space-medium);

	.choice-list {
		display: flex;
		flex-wrap: wrap;
		gap: var(--space-small) var(--space-large);
		max-width: none;
		margin: 0;
	}

	.window {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		width: var(--demo-width, 100%);
		max-width: 100%;
		height: var(--demo-height);
		border: var(--stage-line) solid var(--stroke-primary);
	}

	iframe {
		display: block;
		width: 100%;
		height: 100%;
		border: 0;
	}

	.handle {
		display: grid;
		place-items: center;
		width: var(--handle-width);
		background: var(--fill-auxiliary);
		cursor: ew-resize;
		touch-action: none; /* a finger drags it, instead of scrolling the page */

		&::before {
			content: '';
			width: var(--grip-width);
			height: var(--space-large);
			background: var(--ink-auxiliary);
		}

		&:focus-visible {
			outline: var(--control-focus-ring);
			outline-offset: var(--control-focus-offset);
		}
	}

	/* Last, so it wins over each part's own display. */
	[hidden] {
		display: none;
	}
}
