/* Element defaults and layout primitives. Component classes live in components.css. */

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

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	min-height: 100dvh;
	background: var(--c-bg);
	color: var(--c-text);
	font-family: var(--font);
	font-size: var(--fs-md);
	line-height: var(--lh);
	-webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
	margin: 0;
	line-height: 1.2;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

h1 {
	font-size: var(--fs-xl);
	font-weight: 800;
}

h2 {
	font-size: var(--fs-lg);
	font-weight: 700;
}

h3 {
	font-size: var(--fs-md);
	font-weight: 700;
}

p {
	margin: 0;
	text-wrap: pretty;
}

a {
	color: var(--c-brand);
	text-underline-offset: 2px;
}

img,
video {
	max-width: 100%;
	height: auto;
}

:focus-visible {
	outline: 3px solid var(--c-brand);
	outline-offset: 2px;
	border-radius: var(--r-sm);
}

.stage :focus-visible {
	outline-color: var(--c-text);
}

/* The presenter scope paints its own ground, so it works both on <body> and on a preview embedded
   in an admin page — the tokens alone would leave it on the light background. */
.stage {
	background: var(--c-bg);
	color: var(--c-text);
}

/* --- layout primitives --------------------------------------------------- */

.stack > * + * {
	margin-top: var(--gap, var(--sp-4));
}

.row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--gap, var(--sp-3));
}

.row-end {
	justify-content: flex-end;
}

.grow {
	flex: 1;
}

.center {
	text-align: center;
}

.muted {
	color: var(--c-muted);
}

.small {
	font-size: var(--fs-sm);
}

.display {
	font-size: var(--fs-display);
	font-weight: 800;
	letter-spacing: -0.03em;
	line-height: 1.05;
}

.lede {
	color: var(--c-muted);
	font-size: var(--fs-lg);
}

/* Visible only to screen readers, until focused — the skip link uses both halves. */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link:focus {
	position: fixed;
	top: var(--sp-2);
	left: var(--sp-2);
	z-index: 100;
	width: auto;
	height: auto;
	margin: 0;
	padding: var(--sp-2) var(--sp-4);
	clip-path: none;
	border-radius: var(--r-sm);
	background: var(--c-surface);
	box-shadow: var(--shadow-2);
}

/* --- page shells --------------------------------------------------------- */

.app-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--sp-4);
	padding: var(--sp-3) var(--sp-6);
	border-bottom: 1px solid var(--c-border);
	background: var(--c-surface);
}

.app-header .brand {
	font-size: var(--fs-lg);
	font-weight: 800;
	color: var(--c-text);
	text-decoration: none;
}

.app-nav {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-4);
}

.app-nav a {
	color: var(--c-muted);
	text-decoration: none;
	font-weight: 600;
}

.app-nav a:hover,
.app-nav a[aria-current="page"] {
	color: var(--c-text);
}

.app-main {
	max-width: 72rem;
	margin: 0 auto;
	padding: var(--sp-8) var(--sp-6) var(--sp-12);
}

/* The player's phone: full height, no scrolling, tiles take whatever is left over. */
.play-shell {
	display: flex;
	flex-direction: column;
	min-height: 100dvh;
	padding: var(--sp-3);
	gap: var(--sp-3);
}

.play-main {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: center;
	gap: var(--sp-4);
	min-height: 0;
}

/* The projector: fills the screen, never scrolls, content centred. The height is fixed rather
   than a minimum — a scrollbar on a screen nobody can reach is content the room never sees. */
.stage-shell {
	display: flex;
	flex-direction: column;
	height: 100dvh;
	padding: var(--sp-8);
	gap: var(--sp-6);
	overflow: hidden;
}

.stage-main {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: center;
	gap: var(--sp-8);
	min-height: 0;
}

.stage-hud {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-6);
}

/* Nothing on the projector may scroll the page itself: a slide that overflows is a layout bug, not
   something a room can scroll past. */
body.present {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
