/* title fonts */
@font-face {
	font-family: "VCR OSD Mono";
	font-display: swap;
	src: url(/static/fonts/vcr-osd-mono.latin.woff2) format("woff2");
}

@font-face {
	font-family: "VT323";
	font-display: swap;
	src: url(/static/fonts/vt323.latin.woff2) format("woff2");
}

/* body fonts */
@font-face {
	font-family: "Spectral";
	font-display: swap;
	src: url(/static/fonts/spectral/spectral.latin.woff2) format("woff2");
}

@font-face {
	font-family: "Spectral";
	font-weight: 700;
	font-display: swap;
	src: url(/static/fonts/spectral/spectral-bold.latin.woff2) format("woff2");
}

@font-face {
	font-family: "Spectral";
	font-style: italic;
	font-display: swap;
	src: url(/static/fonts/spectral/spectral-italic.latin.woff2) format("woff2");
}

@font-face {
	font-family: "Spectral";
	font-weight: 700;
	font-style: italic;
	font-display: swap;
	src: url(/static/fonts/spectral/spectral-italic.latin.woff2) format("woff2");
}

@font-face {
	font-family: "M+ 1";
	font-display: swap;
	src: url("/static/fonts/m-plus-1.latin.woff2") format("woff2");
}

@font-face {
	font-family: "Anaheim";
	font-display: swap;
	src: url("/static/fonts/anaheim-variable.latin.woff2") format("woff2");
}

/* code fonts */
@font-face {
	font-family: "Cascadia Mono";
	font-display: swap;
	src: url(/static/fonts/cascadia-mono.latin.woff2) format("woff2");
}

@font-face {
	font-family: "M+ 1 Code";
	font-display: swap;
	src: url("/static/fonts/m-plus-1-code.latin.woff2") format("woff2");
}

@font-face {
	font-family: "Iosevka";
	font-display: swap;
	src: url("/static/fonts/iosevka/iosevka.latin.woff2") format("woff2");
}

@font-face {
	font-family: "Iosevka";
	font-weight: 700;
	font-display: swap;
	src: url("/static/fonts/iosevka/iosevka-bold.latin.woff2") format("woff2");
}

@font-face {
	font-family: "Iosevka";
	font-style: italic;
	font-display: swap;
	src: url("/static/fonts/iosevka/iosevka-italic.latin.woff2") format("woff2");
}

@font-face {
	font-family: "Iosevka";
	font-weight: 700;
	font-style: italic;
	font-display: swap;
	src: url("/static/fonts/iosevka/iosevka-bold-italic.latin.woff2") format("woff2");
}

/* sitewide variables */

:root {
	--fg: hsl(284, 30%, 28%);
	--fg-faint: hsl(284, 10%, 48%);
	--fg-accent: hsl(324, 48%, 46%);
	--bg: hsl(310, 100%, 98%);
	--bg-faint: hsl(310, 45%, 93%);
	--blue: hsl(227, 72%, 44%);

	--title-font-family: "VCR OSD Mono", serif;

	--body-font-family: "Spectral", sans-serif;
	--body-font-size: 20px;

	--code-font-family: "M+ 1 Code", monospace;
	--code-font-size: 18px;
}

@media screen and (prefers-color-scheme: dark) {
	:root {
		--fg: hsl(263, 92%, 95%);
		--fg-faint: hsl(263, 72%, 75%);
		--fg-accent: hsl(329, 100%, 73%);
		--bg: hsl(290, 43%, 17%);
		--bg-faint: hsl(290, 33%, 25%);
		--blue: hsl(227, 72%, 84%);
	}
}

/* element styles */

body {
	background-color: var(--bg);
	max-width: 650px;
	margin: 0px auto;
	padding: 40px 10px;

	font-family: var(--body-font-family);
	font-size: var(--body-font-size);
	color: var(--fg);
	line-height: 1.6;
}

h1,
h2,
h3 {
	margin-top: 48px;
	margin-bottom: 0px;

	font-family: var(--title-font-family);
	font-weight: normal;
	color: var(--fg-accent);
	text-transform: uppercase;
	line-height: 1.2;
}

h1 {
	font-size: 48px;
}

h2 {
	font-size: 32px;
}

h3 {
	font-size: 24px;
}

a,
a:visited {
	color: var(--blue);
	transition:
		background-color 0.25s,
		color 0.25s;
	border-radius: 2px;
}

@media screen {
	a:hover,
	a:active {
		color: var(--bg);
		background-color: var(--blue);
		transition:
			background-color 0.25s,
			color 0.25s;
	}
}

pre,
code {
	border: 1px solid transparent;
	border-radius: 4px;
	background-color: var(--bg-faint);
}

pre {
	padding-left: 4px;
	padding-right: 4px;

	overflow: auto;
	word-wrap: normal;
	white-space: pre;
}

code {
	font-family: var(--code-font-family);
	font-size: var(--code-font-size);
}

hr {
	border-color: var(--bg-faint);
	border-top-width: 2px;
	border-top-style: solid;

	border-bottom: none;
	border-left: none;
	border-right: none;
}

blockquote {
	font-style: italic;
	border-left: 4px solid var(--bg-faint);
	margin-left: 4px;
	padding-left: 24px;
}

/* nav */
#nav {
	text-align: right;
	font-size: 20px;
	line-height: 1.6;
}

#nav a {
	color: var(--fg);
	padding: 4px;
	transition:
		color 0.2s,
		background-color 0.2s;

	font-family: var(--title-font-family);
	text-transform: uppercase;
}

@media screen {
	#nav a:hover,
	#nav a:active {
		color: var(--bg);
		background-color: var(--fg);
		transition:
			color 0.2s,
			background-color 0.2s;
	}
}

/* blog index */
.posts a {
	color: var(--fg);
	text-decoration: none;
}

@media screen {
	.posts a:hover,
	.posts a:active {
		color: var(--blue);
	}
}

@media screen {
	.posts a:hover .title,
	.posts a:active .title {
		color: var(--blue);
	}
}

.post-summary {
	display: grid;
	grid-template-columns: 3fr 1fr;
	grid-template-rows: auto;
	grid-template-areas:
		"title date"
		"description .";
	margin-top: 20px;
	margin-bottom: 20px;
}

.post-summary .title {
	grid-area: title;

	font-family: var(--title-font-family);
	font-size: 24px;
	color: var(--fg-accent);
	text-transform: uppercase;
}

.post-summary .date {
	grid-area: date;
	text-align: right;
	align-self: center;

	font-size: 16px;
}

.post-summary .description {
	grid-area: description;

	font-size: 16px;
}

#license {
	font-size: 0.5em;
}

@media screen and (max-width: 450px) {
	.post-summary {
		display: grid;
		grid-template-columns: auto 1fr;
		grid-template-rows: auto;
		grid-template-areas:
			"title title"
			"date ."
			"description description";
		margin-top: 20px;
		margin-bottom: 20px;
	}

	.post-summary .date {
		padding-right: 6px;
		border-right: 2px solid var(--bg-faint);
		text-align: left;

		font-style: italic;
	}
}

img {
	height: auto;
	width: auto;
	max-height: 75vh;
	max-width: 100%;
	margin: 0 auto;
	display: block;
	border-radius: 4px;
}

.youtube {
	position: relative;
	padding-bottom: calc(100% * 9 / 16);
}

.youtube.vertical {
	padding-bottom: min(calc(100% * 16 / 9), 75vh);
}

.youtube iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}
