/*
 * Base typography and content element styles. The rich text editors load this file into the editing area (via the
 * layout's WYSIWYG CSS), so content styles are written for plain elements rather than under a wrapper class:
 * the same rules then style a post on the site and in the editor. Page structure belongs in layout.css.
 */

:root {
	--paper: #F6F7F9;
	--ink: #1A1E26;
	--muted: #5B6473;
	--rule: #DCE0E7;
	--accent: #2B4BC2;
	--accent-ink: #FFFFFF;
	--code-bg: #ECEFF4;

	--font: "Literata", Georgia, "Times New Roman", serif;
	--measure: 40rem;
	--leading: 1.7;
}

@media (prefers-color-scheme: dark) {
	:root {
		--paper: #14171C;
		--ink: #E4E7EC;
		--muted: #98A1B0;
		--rule: #2A2F38;
		--accent: #93A8FF;
		--accent-ink: #14171C;
		--code-bg: #1E222A;
	}
}

*, *::before, *::after { box-sizing: border-box; }

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font);
	font-size: 1.125rem;
	line-height: var(--leading);
	font-optical-sizing: auto;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 2px;
}

img { max-width: 100%; height: auto; }

/* Content: vertical rhythm comes from bottom margins, so blocks space evenly in posts and in the editor */
p, ul, ol, blockquote, pre, figure, table {
	margin-top: 0;
	margin-bottom: 1.25em;
}

h2, h3, h4 {
	color: var(--ink);
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -0.01em;
	margin: 2em 0 0.6em;
}
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

ul, ol { padding-left: 1.4em; }
li + li { margin-top: 0.4em; }

blockquote {
	margin-left: 0;
	margin-right: 0;
	padding-left: 1.2em;
	border-left: 3px solid var(--accent);
	font-style: italic;
	color: var(--muted);
}
blockquote > :last-child { margin-bottom: 0; }

code {
	font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
	font-size: 0.85em;
	background: var(--code-bg);
	padding: 0.1em 0.35em;
	border-radius: 3px;
}
pre {
	background: var(--code-bg);
	padding: 1em 1.2em;
	overflow-x: auto;
	border-radius: 4px;
	line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: 0.85rem; }

hr {
	border: 0;
	border-top: 1px solid var(--rule);
	margin: 2.5em 0;
}

figure { margin-left: 0; margin-right: 0; }
figure img { display: block; }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.5em; }

table { border-collapse: collapse; width: 100%; font-size: 1rem; }
th, td { border-bottom: 1px solid var(--rule); padding: 0.5em 0.6em; text-align: left; }

/* a block of long-form content: no trailing space after the last element */
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
