@font-face {
	font-family: Pixeloid;
	font-weight: 400;
	src:
		local("Pixeloid"),
		url("./fonts/pixeloid/PixeloidSans.woff2") format("woff2"),
		url("./fonts/pixeloid/PixeloidSans.otf") format("opentype"),
		url("./fonts/pixeloid/PixeloidSans.ttf") format("truetype");
}

@font-face {
	font-family: Pixeloid;
	font-weight: 800;
	src:
		local("Pixeloid Bold"),
		url("./fonts/pixeloid/PixeloidSans-Bold.woff2") format("woff2"),
		url("./fonts/pixeloid/PixeloidSans-Bold.otf") format("opentype"),
		url("./fonts/pixeloid/PixeloidSans-Bold.ttf") format("truetype");
}

* {
	box-sizing: border-box;
	image-rendering: pixelated;
}

:root,
html {
	font-size: 16px;
	font-family:
		Inter, Roboto, "Helvetica Neue", Helvetica, "Arial Nova", "Nimbus Sans",
		"Liberation Sans", Arial, sans-serif;
}

body,
html {
	min-height: 100vh;
}

body {
	display: grid;
	grid-template-rows: 288px auto 1fr;
	grid-template-columns:
		[full-start] 1rem
		[expanded-start] minmax(2rem, 1fr)
		[main-start] minmax(auto, 80ch) [main-end]
		minmax(2rem, 1fr) [expanded-end]
		1rem [full-end];
	margin: 0;
	background: var(--world-bg);
	background-repeat: repeat;

	> * {
		grid-column: full;
	}
}

body > header {
	align-items: start;
	background-image: var(--world-header);
	background-position-y: bottom;
	background-repeat: no-repeat;
	background-size: cover;
	display: flex;
	flex-direction: column;
	grid-column: full;

	> h1 {
		animation-delay: 1.5s;
		color: cyan;
		font-size: 3.5rem;
		margin: var(--world-heading-position);
		margin-bottom: 0;
		margin-right: 0;
		position: relative;
		-webkit-text-stroke: 2px black;

		@media screen and (max-width: 479px) {
			font-size: 2.5rem;
		}

		@media screen and (max-width: 359px) {
			font-size: 2em;
		}

		&,
		&::before {
			animation: 2s ease infinite alternate-reverse wobble;
		}

		&::before {
			animation-delay: 0s;
			color: lemonchiffon;
			content: attr(title);
			position: absolute;
			left: -4px;
			top: -4px;
		}
	}

	> h2 {
		color: white;
		font-weight: normal;
		hyphens: auto;
		margin-left: 13rem;
		margin: var(--world-slogan-position, .5rem 13rem);
		margin-right: 0;
		margin-bottom: 0;
		padding: 1.25rem 1.75rem;
		position: relative;
		text-wrap: balance;

		--shadow-dist: 2.6px;
		text-shadow:
			var(--shadow-dist) 0 0 black,
			calc(-1 * var(--shadow-dist)) 0 0 black,
			0 var(--shadow-dist) 0 black,
			0 calc(-1 * var(--shadow-dist)) 0 black;

		border-image-source: url(dialog.png);
		border-image-slice: 30 fill;
		border-image-width: 30px;
		border-image-repeat: repeat;

		@media screen and (max-width: 571px) {
			font-size: 1em;
			--shadow-dist: 1.75px;
		}

		@media screen and (max-width: 359px) {
			font-size: 0.75em;
			--shadow-dist: 1.35px;
		}
	}
}

body > nav {
	display: flex;
	height: 4rem;
	grid-column: expanded;
	position: sticky;
	top: 0;
	z-index: 1000;
	text-shadow:
		2.6px 0 0 black,
		-2.6px 0 0 black,
		0 2.6px 0 black,
		0 -2.6px 0 black;

	&::before,
	&::after {
		background: url(./sign-border.png) repeat;
		content: "";
		display: block;
		width: 32px;
	}

	&::after {
		scale: -1 1;
	}

	> ul {
		align-items: center;
		background: url(./sign-center.png) repeat-x;
		display: flex;
		flex: 1;
		gap: 1rem;
		list-style-type: none;
		margin: 0;
		padding: 0.825rem 1rem 1rem;
	}

	a {
		color: white;
		font-family: Pixeloid, sans-serif;
		text-decoration: none;
		font-size: 1.5rem;

		&:hover {
			text-decoration: underline 2.6px;
		}
	}
}

body > main,
body > section,
body > footer {
	display: grid;
	grid-template-columns: subgrid;
	grid-column: expanded;

	> * {
		grid-column: main;
	}
}

body > main,
body > section {
	align-content: start;
	background: var(--section-bg);
	color: var(--section-color);
	background-repeat: repeat;
	min-height: 6rem;
	padding-block: calc(1.5rem * var(--section-border-factor, 1));
	position: relative;

	border-image-source: var(--section-border-tileset);
	border-image-slice: calc(48 * var(--section-border-factor, 1)) fill;
	border-image-width: calc(3rem * var(--section-border-factor, 1));
	border-image-repeat: repeat;

	> * {
		z-index: 1;
	}

	&::after {
		border-image-source: var(--section-border-overlay-tileset);
		border-image-repeat: repeat;
		border-image-slice: calc(48 * var(--section-border-factor, 1)) fill;
		border-image-width: calc(3rem * var(--section-border-factor, 1));
		content: "";
		display: block;
		height: 100%;
		pointer-events: none;
		position: absolute;
		width: 100%;
		z-index: 2;
	}
}

body > footer {
	padding-bottom: 0.5rem;

	a {
		color: var(--world-color);
		text-decoration: none;

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

/* prettier-ignore */
@keyframes wobble {
	0% { transform: translateY(-2px); }
	100% { transform: translateY(2px); }
}

/******************************************* BASE ELEMENTS *********************************************/

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: Pixeloid, sans-serif;
	font-weight: bold;
	clear: both;
}


dt {
	font-weight: bold;
	margin-top: 1rem;
}

p {
	hyphens: auto;
	text-align: justify;
}

figure {
	text-align: center;
}

figcaption {
	opacity: 0.8;
}

/******************************************* CLASSES *********************************************/

.expanded {
	grid-column: expanded;
}

a.zola-anchor {
	color: var(--section-color);
	text-decoration: none;
	margin-left: 0.5em;
	opacity: 0.6;
	&:hover {
		text-decoration: underline;
		opacity: 1;
	}

	.noanchor & {
		display: none;
	}
}

.block {
	display: block;
	margin: 2ch auto;
	max-width: 100%;
	max-height: 100%;
}

.shape-hex {
	shape-outside: polygon(-50% 50%, 50% 100%, 150% 50%, 50% 0);
}

.shape-circle {
	shape-outside: circle();
}

.shape-self {
	/* The following doesn't work. The class will be filled using JS instead.
	 * shape-outside: url(attr(src)); */
	shape-margin: 2ch;
}

@media screen and (min-width: 480px) {
	.float-left {
		float: left;
		margin: 2ch 2ch 2ch 0;
	}

	.float-right {
		float: right;
		margin: 2ch 0 2ch 2ch;
	}
}
