/* the page the game plays on, as on Stake's game pages: the game in a 16:9 frame with a bar
   under it. regular leaves the scene around the frame; theatre widens the frame to the window
   and darkens everything else; full screen gives the frame the whole screen. a phone held
   upright plays the game on the whole screen, as Stake's phone view does. */

.frame-page {
	--bar-height: 3.25rem;
	--gap: 1.25rem;
	--regular-width: 75rem;
	--frame-width: min(
		100vw - 2 * var(--gap),
		(100svh - var(--bar-height) - 3 * var(--gap)) * 16 / 9,
		var(--regular-width)
	);

	min-height: 100svh;
	background:
		linear-gradient(rgb(3 25 29 / 78%), rgb(3 25 29 / 92%)),
		url('/play/game/loading.webp') center / cover fixed,
		var(--teal-deep);
	transition: background-color 250ms ease;
}

.frame-page[data-view='theatre'] {
	--gap: 0.5rem;
	--frame-width: min(100vw - 2 * var(--gap), (100svh - var(--bar-height) - 2 * var(--gap)) * 16 / 9);

	background: #000;
}

.theatre {
	display: grid;
	justify-items: center;
	padding-top: var(--gap);
}

.stage {
	width: var(--frame-width);
	aspect-ratio: 16 / 9;
	overflow: hidden;
	border: 1px solid rgb(255 226 122 / 25%);
	border-radius: 0.75rem;
	background: #000;
	box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 55%);
}

.frame-page[data-view='theatre'] .stage {
	border-color: transparent;
	border-radius: 0.25rem;
}

.stage:fullscreen {
	width: 100%;
	height: 100%;
	border: 0;
	border-radius: 0;
}

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

/* the bar under the frame: the game's name, which leads back to its page, and the views. */

.frame-bar {
	display: flex;
	width: var(--frame-width);
	min-height: var(--bar-height);
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.frame-page[data-view='theatre'] .frame-bar {
	opacity: 0.6;
	transition: opacity 200ms ease;
}

.frame-page[data-view='theatre'] .frame-bar:hover,
.frame-page[data-view='theatre'] .frame-bar:focus-within {
	opacity: 1;
}

.frame-title {
	display: grid;
	line-height: 1.1;
	text-decoration: none;
}

.frame-name {
	color: var(--gold-light);
	font-family: var(--display);
	font-size: 1.1rem;
}

.frame-studio {
	color: var(--text-quiet);
	font-size: 0.85rem;
}

.frame-views {
	display: flex;
	gap: 0.35rem;
}

.frame-views button {
	display: inline-flex;
	align-items: center;
	padding: 0.35rem 0.7rem;
	border: 1px solid rgb(255 226 122 / 25%);
	border-radius: 999px;
	background: rgb(10 58 74 / 70%);
	color: var(--cream);
	font: inherit;
	font-size: 0.9rem;
	gap: 0.4rem;
	cursor: pointer;
}

.frame-views button[aria-pressed='true'] {
	border-color: var(--gold);
	color: var(--gold-light);
}

.frame-views svg {
	width: 1.15rem;
	height: 1.15rem;
	fill: none;
	stroke: currentcolor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2;
}

@media (max-width: 40rem) {
	.frame-views span {
		display: none;
	}
}

/* a phone held upright: the game takes the whole screen, and the frame and its bar step aside. */

@media (orientation: portrait) and (max-width: 48rem) {
	.theatre {
		padding: 0;
	}

	.stage {
		position: fixed;
		inset: 0;
		width: 100%;
		height: 100%;
		aspect-ratio: auto;
		border: 0;
		border-radius: 0;
	}

	.frame-bar {
		display: none;
	}
}
