:root {
	--footer-background-color: #f2f9e9;
	--button-background-color: #f2f9e9;
	--solid-border-color: #ced7c2;
	--card-text-bg: rgba(255, 255, 255, 0.7);
}

@media (prefers-color-scheme: dark) {
	:root {
		--footer-background-color: #363a31;
		--button-background-color: #363a31;
		--card-text-bg: rgba(0, 0, 0, 0.7);
	}
}
/* Repeated for theme-switch */
[data-theme="light"] {
	--footer-background-color: #f2f9e9;
	--button-background-color: #f2f9e9;
	--card-text-bg: rgba(255, 255, 255, 0.7);
}
[data-theme="dark"] {
	--footer-background-color: #363a31;
	--button-background-color: #363a31;
	--card-text-bg: rgba(0, 0, 0, 0.7);
}

html {
	height: 100%;
}

body {
	display: flex;
	flex-direction: column;
	min-height: 100%;
}

main {
	flex-grow: 1;
}

blockquote {
	margin-left: 2em;
	padding-left: 1em;
	border-left: 0.25em solid var(--solid-border-color);
}

footer {
	margin-top: 2em;
	padding-top: 0;
	border-top: 0.25em solid var(--solid-border-color);
	background-color: var(--footer-background-color);
}

header nav {
	flex-grow: 1;
}

button {
	background-color: var(--button-background-color);
	border: 1px solid var(--solid-border-color);
	border-radius: 0.25em;
	line-height: 1.5;
	vertical-align: middle;
	font-size: 1em;
}

code {
	background-color: var(--footer-background-color);
	padding: 0 0.25em;
}
pre code {
	background-color: transparent;
	padding: 0;
}

code[class*="language-"],
pre[class*="language-"] {
	white-space: pre-wrap;
}

table {
	font-variant-numeric: slashed-zero tabular-nums;
}
td:last-of-type {
	text-align: right;
}

/* -- */

.post-metadata {
	margin-bottom: 1em;
}

model-viewer {
	width: 80%;
	height: auto;
	aspect-ratio: 4/3;
	margin: auto;
	border: 1px #c4c4c4 solid;
}

ul.task-list {
	list-style-type: none;
	padding-left: 1.5em;
	/* text-indent: -1.7em; */
}

li.task-list-item {
	display: flex;
	align-items: flex-start;
	align-items: first baseline;
	gap: 0.25em;
}

.task-list-item input[type="checkbox"]:disabled {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	width: 16px;
	height: 16px;
	border: 1px solid var(--text-color-link);
	border-radius: 4px;
	outline: none;
	background-color: var(--footer-background-color);
	position: relative;
}

.task-list-item input[type="checkbox"]:disabled:checked::after {
	content: "✓";
	position: absolute;
	color: var(--text-color-link);
	font-size: 14px;
	font-weight: bolder;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

nav.toc {
	padding: 0.5em 0;
	border-left: 0.25em solid var(--solid-border-color);
	margin-bottom: 1em;
}
nav.toc ol {
	margin: 0;
}

.columns {
	display: flex;
	flex-direction: column;
}

.postlist {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	padding: 0;
	list-style: none;
}
.postlist-item {
	flex: 1 0 200px; /* Flexible width with minimum of 280px */
	padding: 0;
	margin: 0;
	position: relative;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	max-width: none; /* Remove existing max-width */
}
/* Hide the counter numbers */
.postlist-item:before {
	display: none;
}
.postlist-link {
	display: block;
	text-decoration: none;
	color: inherit;
	width: 100%;
	height: 100%;
	position: relative;
}
.postlist-link picture {
	display: block;
	width: 100%;
	height: 0;
	padding-bottom: 100%; /* Creates a perfect square container */
	overflow: hidden;
	position: relative;

	transition: transform 0.2s ease;
}
.postlist-item:hover picture {
	transform: scale(1.05);
}
.postlist-link picture img,
.postlist-link picture source,
.postlist-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;

	display: block;
	aspect-ratio: 1/1 !important;
	object-fit: cover;
	object-position: center;
}
.postlist-title {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 1rem;
	background-color: var(--card-text-bg);
	color: var(--text-color);
	font-weight: bold;
	backdrop-filter: blur(2px); /* Slight blur effect for modern browsers */
}
.postlist-date {
	display: block;
	position: absolute;
	top: 0;
	right: 0;
	padding: 0.5rem;
	background-color: var(--card-text-bg);
	color: var(--text-color);
	font-size: 0.75rem;
	border-bottom-left-radius: 8px;
}

.post {
	max-width: 1024px;
}

@media (min-width: 768px) {
	.columns {
		flex-direction: row-reverse;
		gap: 1em;
	}
	article {
		flex-grow: 1;
		min-width: 0;
	}
	aside {
		flex: 0 0 14em;
	}
	nav.toc {
		position: sticky;
		top: 0;
	}
	.postlist-item {
		flex: 1 0 300px; /* Slightly wider on larger screens */
		max-width: calc(33.333% - 1rem); /* Limit to 3 per row */
	}
}
