/**
 * okaidia theme for JavaScript, CSS and HTML
 * Loosely based on Monokai textmate theme by http://www.monokai.nl/
 * @author ocodia
 */

code[class*="language-"],
pre[class*="language-"] {
	color: #f8f8f2;
	background: none;
	text-shadow: 0 1px rgba(0, 0, 0, 0.3);
	font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
	font-size: 1em;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	word-wrap: normal;
	line-height: 1.5;

	-moz-tab-size: 4;
	-o-tab-size: 4;
	tab-size: 4;

	-webkit-hyphens: none;
	-moz-hyphens: none;
	-ms-hyphens: none;
	hyphens: none;
}

/* Code blocks */
pre[class*="language-"] {
	padding: 1em;
	margin: .5em 0;
	overflow: auto;
	border-radius: 0.3em;
}

:not(pre) > code[class*="language-"],
pre[class*="language-"] {
	background: #272822;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
	padding: .1em;
	border-radius: .3em;
	white-space: normal;
}

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
	color: #8292a2;
}

.token.punctuation {
	color: #f8f8f2;
}

.token.namespace {
	opacity: .7;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
	color: #f92672;
}

.token.boolean,
.token.number {
	color: #ae81ff;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
	color: #a6e22e;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable {
	color: #f8f8f2;
}

.token.atrule,
.token.attr-value,
.token.function,
.token.class-name {
	color: #e6db74;
}

.token.keyword {
	color: #66d9ef;
}

.token.regex,
.token.important {
	color: #fd971f;
}

.token.important,
.token.bold {
	font-weight: bold;
}
.token.italic {
	font-style: italic;
}

.token.entity {
	cursor: help;
}
/* Defaults */
:root {
	--font-family: -apple-system, system-ui, sans-serif;
	--font-family-monospace:
		Consolas, Menlo, Monaco, Andale Mono WT, Andale Mono, Lucida Console, Lucida Sans Typewriter,
		DejaVu Sans Mono, Bitstream Vera Sans Mono, Liberation Mono, Nimbus Mono L, Courier New,
		Courier, monospace;
}

/* Theme colors */
:root {
	--color-gray-20: #e0e0e0;
	--color-gray-50: #c0c0c0;
	--color-gray-90: #333;

	--background-color: #fefffb;

	--text-color: var(--color-gray-90);
	--text-color-link: #005d39;
	--text-color-link-active: #5f2b48;
	--text-color-link-visited: #004229;

	--syntax-tab-size: 2;
}

@media (prefers-color-scheme: dark) {
	:root {
		--color-gray-20: #e0e0e0;
		--color-gray-50: #c0c0c0;
		--color-gray-90: #dad8d8;

		/* --text-color is assigned to --color-gray-_ above */
		--text-color-link: #1493fb;
		--text-color-link-active: #6969f7;
		--text-color-link-visited: #a6a6f8;

		--background-color: #1b200d;
	}
}

/* Repeated for theme-switch */
[data-theme="light"] {
	--color-gray-20: #e0e0e0;
	--color-gray-50: #c0c0c0;
	--color-gray-90: #333;

	--background-color: #fefffb;

	--text-color: var(--color-gray-90);
	--text-color-link: #005d39;
	--text-color-link-active: #5f2b48;
	--text-color-link-visited: #004229;

	--syntax-tab-size: 2;
}
[data-theme="dark"] {
	--color-gray-20: #e0e0e0;
	--color-gray-50: #c0c0c0;
	--color-gray-90: #dad8d8;

	--text-color-link: #1493fb;
	--text-color-link-active: #6969f7;
	--text-color-link-visited: #a6a6f8;

	--background-color: #1b200d;
}

/* Global stylesheet */
* {
	box-sizing: border-box;
}

@view-transition {
	navigation: auto;
}

html,
body {
	padding: 0;
	margin: 0 auto;
	font-family: var(--font-family);
	color: var(--text-color);
	background-color: var(--background-color);
}
html {
	overflow-y: scroll;
}

/* https://www.a11yproject.com/posts/how-to-hide-content/ */
.visually-hidden {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* Fluid images via https://www.zachleat.com/web/fluid-images/ */
img {
	max-width: 100%;
}
img[width][height] {
	height: auto;
}
img[src$=".svg"] {
	width: 100%;
	height: auto;
	max-width: none;
}
video,
iframe {
	width: 100%;
	height: auto;
}
iframe {
	aspect-ratio: 16/9;
	border-width: 0;
}

p:last-child {
	margin-bottom: 0;
}
p {
	line-height: 1.5;
}

li {
	line-height: 1.5;
}

a[href] {
	color: var(--text-color-link);
}
a[href]:visited {
	color: var(--text-color-link-visited);
}
a[href]:hover,
a[href]:active {
	color: var(--text-color-link-active);
}

main,
footer {
	padding: 1rem;
}
main :first-child {
	margin-top: 0;
}

header {
	border-bottom: 1px dashed var(--color-gray-20);
}
header:after {
	content: "";
	display: table;
	clear: both;
}

.links-nextprev {
	display: flex;
	justify-content: space-between;
	gap: 0.5em 1em;
	list-style: "";
	border-top: 1px dashed var(--color-gray-20);
	padding: 1em 0;
}
.links-nextprev > * {
	flex-grow: 1;
}
.links-nextprev-next {
	text-align: right;
}

table {
	margin: 1em 0;
}
table td,
table th {
	padding-right: 1em;
}

pre,
code {
	font-family: var(--font-family-monospace);
}
pre:not([class*="language-"]) {
	margin: 0.5em 0;
	line-height: 1.375; /* 22px /16 */
	-moz-tab-size: var(--syntax-tab-size);
	-o-tab-size: var(--syntax-tab-size);
	tab-size: var(--syntax-tab-size);
	-webkit-hyphens: none;
	-ms-hyphens: none;
	hyphens: none;
	direction: ltr;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	overflow-x: auto;
}
code {
	word-break: break-word;
}

/* Header */
header {
	display: flex;
	gap: 1em 0.5em;
	flex-wrap: wrap;
	align-items: center;
	padding: 1em;
}
.home-link {
	font-size: 1em; /* 16px /16 */
	font-weight: 700;
	margin-right: 2em;
}
.home-link:link:not(:hover) {
	text-decoration: none;
}

/* Nav */
.nav {
	display: flex;
	padding: 0;
	margin: 0;
	list-style: none;
}
.nav-item {
	display: inline-block;
	margin-right: 1em;
}
.nav-item a[href]:not(:hover) {
	text-decoration: none;
}
.nav a[href][aria-current="page"] {
	text-decoration: underline;
}

/* Posts list */
.postlist {
	list-style: none;
	padding: 0;
}
.postlist-date,
.postlist-item:before {
	font-size: 0.8125em; /* 13px /16 */
	color: var(--color-gray-90);
}
.postlist-date {
	word-spacing: -0.5px;
}
.postlist-link {
}
.postlist-item-active .postlist-link {
	font-weight: bold;
}

/* Tags */
.post-tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-style: italic;
}
.postlist-item > .post-tag {
	align-self: center;
}

/* Tags list */
.post-metadata {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 0.5em;
	list-style: none;
	padding: 0;
	margin-block-end: 1em;
}
.post-metadata time {
	margin-right: 1em;
}
: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;
}

/* A markdown paragraph of only images, laid out side by side */
.image-row {
	display: flex;
	gap: 0.5em;
	align-items: flex-start;
}
.image-row picture {
	display: block;
	flex: 1 1 0;
	min-width: 0;
}
.image-row img {
	display: block;
	width: 100%;
	height: auto;
}

@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 */
	}
}