:root {
	color-scheme: light dark;

	--bg: hsl(0, 0%, 98%);
	--bg-faint: hsl(0, 0%, 92%);
	--border: hsl(0, 0%, 75%);
	--text: hsl(220, 15%, 20%);

	/* Pastel tints using color-mix for a "rubber pastel" flavor */
	--special-red: color-mix(in srgb, #ff6f61 70%, white);
	--special-green: color-mix(in srgb, #6fcf97 70%, white);
	--special-blue: color-mix(in srgb, #4f8cff 90%, white);
	--special-yellow: color-mix(in srgb, #ffe066 70%, white);
	--special-purple: color-mix(in srgb, #b39ddb 70%, white);
	--special-gray: color-mix(in srgb, #b0b0b0 60%, white);

	--special: var(--special-green);
	--special-hover: color-mix(in srgb, var(--special) 60%, white);
	--on-special: hsl(0, 0%, 98%);
	--error: #ff6f61;

	--padding: 0.4rem;
	--padding-reduced: 0.25rem;
	--padding-compact: 0.125rem;
	--thickness: 0.25rem;
	--line-height: 1.5rem;

	--min-menu-width: 12rem;

	--fa-style: "fa-light";
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: hsl(220, 15%, 15%);
		--bg-faint: hsl(220, 15%, 22%);
		--border: hsl(0, 0%, 25%);
		--text: hsl(0, 0%, 98%);

		--special-red: color-mix(in srgb, #ff6f61 60%, #222 40%);
		--special-green: color-mix(in srgb, #6fcf97 60%, #222 40%);
		--special-blue: color-mix(in srgb, #4f8cff 100%, #222 0%);
		--special-yellow: color-mix(in srgb, #ffe066 60%, #222 40%);
		--special-purple: color-mix(in srgb, #b39ddb 60%, #222 40%);
		--special-gray: color-mix(in srgb, #b0b0b0 50%, #222 50%);
	}
}

html {
	background: var(--bg);
	color: var(--text);
	height: 100vh;
}

body {
	font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
	font-size: inherit;
	display: grid;
	grid-template-rows: auto 1fr auto;
	min-height: 100vh;
	background-color: var(--bg);
	margin: 0;
}

body.stwStudioPage {
	height: 100vh;
	overflow: hidden;
}

body:not(.stwStudioPage) > #header {
	position: sticky;
	top: 0;
	z-index: 1001;
	background-color: var(--bg);
}

h1 {
	font-size: larger;
	color: var(--special);
	margin: var(--padding);
}

aside,
main,
article {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
}
aside {
	max-width: 20rem;
}

article>h1,
article>header,
article>footer {
	flex: 0 0 auto;
	margin: 0 var(--padding);
}

article>section {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 0;
	overflow: auto;
}

body:not(.stwStudioPage) #frame article>section {
	overflow: visible;
}

dialog[open] {
	padding: 0;
	border: thin solid var(--border);
	z-index: 1002;
	min-width: 30rem;
	max-width: 40rem;
}

dialog h1 {
	background-color: var(--special);
	color: var(--on-special);
	margin: 0;
	padding: var(--padding);
	font-size: smaller;
}

dialog > article > h1 {
	cursor: grab;
	touch-action: none;
	user-select: none;
}

dialog > article > h1.stwDragging {
	cursor: grabbing;
}

article:focus {
	outline: none;
	border: none;
}

input {
	padding: var(--padding-compact);
	margin: 0;
}

button:has(i[class*="fa-"]),
:is(.stwForm, .stwTable) button:has(i[class*="fa-"]) {
	box-sizing: border-box;
	width: 2.5rem;
	min-width: 0;
}

.stwForm button:has(i[class*="fa-"]) > i {
	width: auto;
}

a {
	color: CanvasText;
}