/* Layout */

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

html {
	scroll-behavior: smooth;
}

body {
	margin: 0;
	font-family: system-ui;
}

.layout {
	display: grid;
	min-block-size: 100vh;
}

.header {
	grid-area: header;
}

.sidebar {
	grid-area: sidebar;
}

.main {
	grid-area: main;
	margin-bottom: 1.5rem;
	border-top: 1px inset #808080;
}

.main header h1 {
	text-align: center;
}

.main header p {
	font-weight: bold;
}

figure {
	margin: 1rem 0;
	display: flex;
	flex-flow: row;
	align-items: start;
	justify-content: flex-start;
	gap: 1rem;
}

figure img {
	width: 25rem;
	object-fit: scale-down;
}

nav ul {
	list-style: none;
	padding-left: 0;
	gap: 1rem;
}

nav li ul {
	margin-top: 0.125rem
}

nav li:not(:nth-child(1 of li)) {
	margin-top: 0.3rem;
}

nav li:not(:nth-last-child(1 of li)) {
	margin-bottom: 0.3rem;
}

nav a {
	display: block;
	padding: 0.075rem 0.5rem;
	border-radius: 1rem;
	text-decoration: none;
	border-color: #808080;
	border-width: 0.0625rem;
	border-style: ridge;
}

nav a:hover,
nav .active {
	background-color: #00567c39;
}

nav a,
nav a:visited,
nav a:hover,
nav a:active {
	color: inherit;
}

@media (max-width: 47.5rem) {
	.layout {
		grid-template-areas:
			"header"
			"sidebar"
			"main";
		grid-template-rows: min-content min-content 1fr;
		margin: 1rem;
	}

	.header img {
		display: none;
	}

	nav li {
		padding-left: 0.5rem;
	}
}

@media (min-width: 47.5rem) {
	.layout {
		grid-template-rows: 10rem 1fr;
		inline-size: 74rem;
		max-inline-size: 100%;
	}

	nav {
		text-align: right;
		margin-right: 0.5rem;
	}

	nav li {
		margin-right: 0.5rem;
	}

	.header p {
		display: none;
	}

	.sidebar,
	.layout::after {
		background-image: url('/style_bg.png');
		background-repeat: repeat-y;
		background-position: left -2.5rem;
	}

	.main {
		padding-left: 1rem;
		padding-right: 1rem;
		margin-top: -1.5rem;
	}
}

@media (min-width: 47.5rem) and (max-width: 60rem) {
	.layout {
		grid-template-areas:
			"header header"
			"sidebar main";
		grid-template-columns: 11rem 1fr;
	}
}

@media(max-width: 60rem) {
	.back-to-top {
		border-radius: 1rem;
		background-color: white;
		padding: 0.5rem 1rem;
		position: fixed;
	}
}

@media(min-width: 60rem) {
	.layout {
		grid-template-areas:
			"header header background"
			"sidebar main background";
		grid-template-columns: 11rem 1fr 11rem;
	}

	.layout::after {
		content: "";
		grid-area: background;
		scale: -1 1;
	}

	.back-to-top {
		z-index: 1;
		grid-area: background;
		position: sticky;
		justify-self: center;
		align-self: end;
	}
}

/* Style */
table {
	width: 100%;
	border-collapse: collapse;
}

thead {
	border-bottom: 2px solid black;
}

th:first-child,
td:first-child {
	border-left: 1px solid rgba(0, 0, 0, 0.2);
}

th:last-child,
td:last-child {
	border-right: 1px solid rgba(0, 0, 0, 0.2);
}

tr:nth-child(even) {
	background-color: rgba(0, 0, 0, 0.1);
}

th,
td {
	/* Added padding for better layout after collapsing */
	padding: 4px 8px;
}

/* Home, Changelog Table */
table.changelog ul {
	margin: 0;
	padding-left: 1rem;
}

table.changelog td:first-child {
	vertical-align: top;
	text-align: end;
}

/* Utils */

.back-to-top {
	right: 0;
	bottom: 1rem;
}