/*
	NOTE: these styles should not be global and rather live in BlogPostLayout.astro;
	However, Astro - as of 2022-06-02 - has bugs in its style computation in combination with remark/rehype plugins,
	so that the computed styles target HTML elements with classes even when the final page output does not contain them.
*/

/* selectors in here target HTML attributes  because the markdown conversion doesn't add classes */
.content > *:first-child {
	margin-block-start: 0 !important;
}

.content h1 > a,
.content h2 > a,
.content h3 > a {
	text-decoration: none;
}

.content img {
	margin-block-start: 1rem;
}

.content p {
	margin: 0;
}

.content p:not(:first-child) {
	margin-block-start: 1.5rem;
}

.content p:first-of-type {
	margin-block-start: 1rem;
}

.content blockquote {
	border-inline-start: 6px solid var(--color-accent-secondary);
	margin: 1rem 0;
	padding-block-start: 0.5rem;
	padding-inline-end: 0;
	padding-block-end: 0.5rem;
	padding-inline-start: 1rem;
	border-radius: 2px;
	font-size: 1.35rem;
	font-style: italic;
	color: var(--color-accent-secondary);
}

.content blockquote p {
	display: contents;
}

.content blockquote::first-letter {
	font-size: 2rem;
}

.content blockquote:after {
	content: open-quote;
	font-size: 2rem;
	color: var(--color-accent-secondary);
}

.content code {
	letter-spacing: -0.03ch;
	word-spacing: -0.2ch;
}

.content pre {
	font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
	border-radius: 0.6rem;
	padding: 1.5rem;
	overflow: auto;
	font-size: 0.85rem;
	text-align: start;
	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;
	letter-spacing: -0.03ch;
	word-spacing: -0.2ch;
}

.content li {
	margin-block-start: 0.4rem;
}

.content ul + p,
.content ol + p {
	margin-block-start: 0.4rem;
}

.content ul,
.content ol {
	margin: 0;
	padding-inline-start: 2ch;
}

.content hr {
	margin: 1.5rem 0;
	border-block-start: 2px solid var(--color-bg-tertiary);
}

.content table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	font-size: 0.9rem;
	border-collapse: collapse;
	border-style: hidden;
}

.content tr th {
	min-width: max-content;
	word-break: normal;
	vertical-align: baseline;
	text-align: start;
}

.content th {
	background: var(--color-bg-tertiary);
	padding: 0.4rem 1.5ch;
	word-break: break-word;
	border-radius: 0.2rem;
}

.content tr {
	border-block-end: 2px solid var(--color-bg-tertiary);
}

.content td {
	padding: 0.2rem 1.5ch;
	word-break: break-word;
}

/* mute footnotes that the user didn't jump to via the footnote's anchor */
.footnotes li:not(:target) {
	opacity: 0.4;
}

@media (min-width: 420px) {
	.content p:not(:first-child) {
		margin-block-start: 2rem;
	}

	.content blockquote {
		font-weight: normal;
		padding-block-start: 1rem;
		padding-inline-end: 0;
		padding-block-end: 1rem;
		padding-inline-start: 2rem;
	}
}
