/* @font-face declarations for local Merriweather files */
@font-face {
	font-family: 'Merriweather';
	src: url('/merriweather/merriweather-light.woff2') format('woff2'),
		url('/merriweather/merriweather-light.woff') format('woff');
	font-weight: 300;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Merriweather';
	src: url('/merriweather/merriweather-light-italic.woff2') format('woff2'),
		url('/merriweather/merriweather-light-italic.woff') format('woff');
	font-weight: 300;
	font-style: italic;
	font-display: swap;
}

@font-face {
	font-family: 'Merriweather';
	src: url('/merriweather/merriweather-black.woff2') format('woff2'),
		url('/merriweather/merriweather-black.woff') format('woff');
	font-weight: 900;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Merriweather';
	src: url('/merriweather/merriweather-black-italic.woff2') format('woff2'),
		url('/merriweather/merriweather-black-italic.woff') format('woff');
	font-weight: 900;
	font-style: italic;
	font-display: swap;
}

/* @font-face declarations for local Fira Sans Condensed files */
@font-face {
	font-family: 'Fira Sans Condensed';
	src: url('/fira/fira-sans-condensed-v11-latin-regular.woff2') format('woff2');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Fira Sans Condensed';
	src: url('/fira/fira-sans-condensed-v11-latin-italic.woff2') format('woff2');
	font-weight: 400;
	font-style: italic;
	font-display: swap;
}

@font-face {
	font-family: 'Fira Sans Condensed';
	src: url('/fira/fira-sans-condensed-v11-latin-700.woff2') format('woff2');
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Fira Sans Condensed';
	src: url('/fira/fira-sans-condensed-v11-latin-700italic.woff2') format('woff2');
	font-weight: 700;
	font-style: italic;
	font-display: swap;
}

/* Defaults */
:root {
	--font-family: "Merriweather", "charter", "georgia", serif;
	--font-family-headers: "Fira Sans Condensed", 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;
	--font-scale: 1.1em;
	--font-scale-monospace: .8em;
	--font-scale-small: 0.8125em;
	/* 13px /16 */
	--font-scale-sup: 0.7em;
}

/* Theme colors */
:root {
	--bg-baty: #fafaf8;
	--orange-peel: #ff9f1c;
	--code-background-color: #F0F0F0;

	/* Rosé Pine theme */
	--rose-pine-surface-main: #1f1d2e;
	--rose-pine-gold-main: #f6c177;

	--color-gray-20: #e0e0e0;
	--color-gray-50: #c0c0c0;
	--color-gray-90: #333;

	--background-color: var(--bg-baty);

	--text-color: var(--color-gray-90);
	--text-color-link: #082840;
	--text-color-link-active: #5f2b48;
	--text-color-link-visited: #17050f;

	--syntax-tab-size: 2;

	--accent-color: var(--orange-peel);

	--img-border-color: #ccc;
}

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

		--background-color: #232136;
		--text-color: #fff;
		--text-color-link: var(--text-color);
		--heading-color: var(--text-color);
		--accent-color: var(--rose-pine-gold-main);
		--blockquote-color: var(--text-color);
		--bold-color: #fff;
		--code-background-color: #38355A;
		--img-border-color: #333;
	}
}

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

a {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--accent-color);
	text-decoration-thickness: 0.1rem;
}

a:hover {
	color: var(--accent-color);
}

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

html {
	overflow-y: scroll;
}

body {
	max-width: 40em;
	font-weight: 300;
	/* Merriweather Light */
}

/* https://www.a11yproject.com/posts/how-to-hide-content/ */
.visually-hidden:not(:focus):not(:active) {
	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%;
	border: 1px solid var(--img-border-color);
}

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;
}

p:last-child {
	margin-bottom: 0;
}

p {
	line-height: 1.5;
}

li {
	line-height: 1.5;
}

ol.footnotes-list {

	li::marker,
	a.footnote-backref {
		font-size: var(--font-scale-small);
	}
}

main,
footer {
	padding: 1rem;
}

main :first-child {
	margin-top: 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--font-family-headers);
	font-optical-sizing: auto;
	font-weight: 700;
	/* Fira Sans Condensed Bold */
	font-style: normal;
	font-size: var(--font-scale);
}

h1 {
	font-size: 3rem;
	margin-top: 2em;
}

h2 {
	font-size: 2rem;
	margin-top: 2em;
}

strong,
b {
	font-weight: 900;
	/* Merriweather Black */
}

footer {
	font-size: var(--font-scale-small);
	margin-top: 1rem;
	border-top: 1px dashed var(--color-gray-20);
	text-align: center;
}

.post-footer {
	padding-top: 1rem;
	border-top: 1px dashed var(--color-gray-20);
	text-align: center;
	margin-top: 2rem;
}

.post-footer .post-tag {
	margin: 0 0.25rem;
}

.links-nextprev {
	display: flex;
	justify-content: space-between;
	gap: 0.5em 1em;
	list-style: none;
	padding: 1em 0;
	margin-top: 1rem;
	border-top: 1px dashed var(--color-gray-20);
	font-family: var(--font-family-headers);
}

.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);
	font-size: var(--font-scale-monospace);
	white-space: pre;
}

/* Styles only code elements that are NOT inside a <pre> tag */
:not(pre)>code {
	background-color: var(--code-background-color);
	padding: 2px 6px;
	border-radius: 4px;
	font-size: var(--font-scale-monospace) !important;
}

code[class*="language-"],
pre[class*="language-"] {
	font-size: var(--font-scale-monospace) !important;
}

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-all;
}

p>code:not([class*="language-"]) {
	background-color: #fff;
}

header {
	display: flex;
	gap: 1em;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	padding: 1em;
	margin-top: 1em;

	.home-link {
		font-family: var(--font-family-headers);
		flex-grow: 1;
		font-size: 2rem;
		font-weight: 700;
		/* Fira Sans Condensed Bold */

		&:link {
			text-decoration: none;
		}
	}
}

/* blockquote styling */
blockquote {
	quotes: "\201C" "\201D" "\2018" "\2019";
	font-style: italic;
	margin-right: 0;
	margin-left: 2.4em;
}

blockquote:before {
	color: var(--accent-color);
	content: "“";
	font-size: 1.6em;
	line-height: 0.1em;
	margin-right: -.5em;
	vertical-align: -0.2em;
	position: relative;
	left: -.8em;
}

blockquote p {
	display: inline;
}

sub,
sup {
	line-height: 0;
	font-size: var(--font-scale-sup);
}

/* Posts list */
.postlist {
	list-style: none;
	padding: 0;
}

.postlist-item {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	margin-bottom: 3rem;
}

.postlist-description,
.postlist-item:before {
	font-size: var(--font-scale-small);
	color: var(--color-gray-90);
}

.postlist-description {
	word-spacing: -0.5px;
	width: 100%;
	margin-top: .2rem;
}

.postlist-date {
	font-family: var(--font-family-headers);
	font-weight: 400;
	/* Fira Sans Condensed Regular */
	font-size: var(--font-scale-small);
	color: var(--color-gray-90);
	word-spacing: -0.5px;
	width: 100%;
	margin: 0 0 0.5rem 0;
}

.postlist-link {
	font-family: var(--font-family-headers);
	font-weight: 700;
	font-size: 1.5rem;
	flex-basis: calc(100% - 1.5rem);
	text-underline-position: from-font;
	text-underline-offset: 0;
}

.postlist-item-active .postlist-link {
	font-weight: bold;
}

/* Tags */
.post-tag {
	font-family: var(--font-family-headers);
	font-weight: 400;
	/* Fira Sans Condensed Regular */
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-style: italic;
	color: var(--text-color);
	font-size: var(--font-scale-small);
}

.post-tag:hover {
	color: var(--accent-color);
	text-decoration: underline;
	text-decoration-color: var(--accent-color);
}

/* Tags list */
.post-metadata {
	font-family: var(--font-family-headers);
	font-weight: 400;
	margin: -1.5rem 0 2rem 0;
}

.post-metadata time {
	margin-right: 1em;
}

/* Custom class styling for markdown attributes */
.avatar {
	border-radius: 50%;
	width: 150px;
	height: 150px;
	object-fit: cover;
	display: block;
	margin-bottom: 1.5rem;
	border: 2px solid var(--text-color);
	background: var(--accent-color);
}

a.reply-button {
	font-size: 1.6rem;
	font-family: var(--font-family-headers);
	border: 2px solid var(--accent-color);
	color: var(--accent-color);
	text-decoration: none;
	padding: 0.5rem 1rem;
}

a.reply-button:hover {
	border-color: var(--text-color);
	color: var(--text-color);
	background: var(--accent-color);
}