/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
	box-sizing: border-box;
}

/* 2. Remove default margin */
*:not(dialog) {
	margin: 0;
}

:root {
	--panel: #333030;
	--text-color: #333030;
	--panel-text-color: #e7e3e3;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
	html {
		interpolate-size: allow-keywords;
	}
}

body {
	/* 4. Increase line-height */
	line-height: 1.5;
	/* 5. Improve text rendering */
	-webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
	display: block;
	max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
	font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
	text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: 'Climate Crisis', sans-serif;
	font-optical-sizing: auto;
	font-weight: 400;
	font-style: normal;
	font-variation-settings: 'YEAR' 1979;
	color: var(--text-color);
	text-wrap: balance;
	text-box-trim: trim-both;
	text-box-edge: cap alphabetic;
}

h1 {
	font-size: 3rem;
	letter-spacing: -1px;
	line-height: 0.85;
	margin-block: 1rem;

	@media (min-width: 500px) {
		font-size: 3.5rem;
		letter-spacing: -1.5px;
		line-height: 0.85;
		margin-block: 1.5rem;
	}

	@media (min-width: 640px) {
		font-size: 5rem;
		letter-spacing: -2px;
		line-height: 0.85;
	}
}

h2 {
	font-size: 2rem;
	letter-spacing: 0px;
	line-height: 0.85;
	margin-bottom: 2rem;

	@media (min-width: 500px) {
		font-size: 2.5rem;
		letter-spacing: -0.5px;
		line-height: 0.85;
	}

	@media (min-width: 640px) {
		font-size: 3rem;
		letter-spacing: -0.5px;
		line-height: 0.85;
	}
}

p {
	font-family: 'Elms Sans', sans-serif;
	font-optical-sizing: auto;
	font-weight: 400;
	font-style: normal;
	color: var(--text-color);
	font-size: 0.8rem;
	letter-spacing: -0.9px;
	line-height: 1.2;

	@media (min-width: 500px) {
		font-size: 1rem;
		letter-spacing: -0.8px;
	}
}

p + p {
	margin-top: 2rem;
}

a {
	font-family: 'Inter', sans-serif;
	font-optical-sizing: auto;
	font-weight: 400;
	font-style: normal;
	text-decoration: underline;
	color: var(--text-color);
	font-size: 0.8rem;
	letter-spacing: -0.9px;
	line-height: 1.2;

	@media (min-width: 500px) {
		font-size: 1rem;
		letter-spacing: -0.8px;
	}

	&:hover {
		text-decoration: none;
	}
}

label {
	font-family: 'Inter', sans-serif;
	font-optical-sizing: auto;
	font-weight: 400;
	font-style: normal;
	color: #181818;
	font-size: 0.8rem;
	letter-spacing: -0.9px;
	line-height: 1.2;
}

/*
  10. Create a root stacking context
*/
#app {
	display: grid;
	isolation: isolate;
	position: absolute;
	inset: 0;
	background-color: black;
	scroll-snap-type: y mandatory;
	width: 100dvw;
	height: 100dvh;
	overflow-y: scroll;

	section {
		display: grid;
		place-items: center;
		position: relative;
		width: 100dvw;
		height: 100dvh;
		z-index: 2;
		text-align: center;
		scroll-snap-align: start;
		padding: 1rem;

		@media only screen and (min-width: 600px) {
			padding: 4rem;
		}

		> div {
			max-width: 800px;
		}
	}

	canvas {
		position: fixed;
		z-index: 1;
		top: 0;
		left: 0;
		width: 100dvw;
		height: 100dvh;
	}

	#settingsPanelOpenButton {
		all: unset;
		cursor: pointer;
		position: fixed;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		top: 0;
		right: 0;
		margin: 10px;
		z-index: 3;
		font-size: 1.5rem;
		border-radius: 50%;
		width: 50px;
		height: 50px;
		background-color: var(--panel);
	}

	#settingsPanel {
		position: fixed;
		display: flex;
		flex-direction: column;
		top: 0;
		right: 0;
		z-index: 3;
		background: var(--panel);
		border-bottom-left-radius: 8px;

		&[hidden] {
			display: none;
		}

		fieldset {
			display: flex;
			flex-direction: column;
			border: none;
			align-items: flex-start;
			gap: 1rem;

			label {
				color: var(--panel-text-color);
				width: 100%;
				display: flex;
				flex-direction: row-reverse;
				justify-content: space-between;
				align-items: center;
				gap: 2rem;
			}

			input[type='color'] {
				all: unset;
				width: 40px;
				height: 40px;
				cursor: pointer;
			}
		}

		#settingsPanelCloseButton {
			all: unset;
			cursor: pointer;
			font-size: 1rem;
			margin: 10px;
			align-self: flex-end;
		}
	}
}
