/* IM Fell English Italic (SIL Open Font License), self-hosted beside its
   licence: the italics of the text (see "Italics" below). */
@font-face {
	font-family: "IM Fell English";
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url("fonts/woff2/IMFellEnglish-Italic-Latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* /posts — the list (posts/index.php) and a post (posts/post.php). The cards
   themselves are home-cards.css, shared with the homepage. */

/* ── The list ─────────────────────────────────────────────────────────── */
[data-component="posts"] [data-part="lead"] {
	max-width: 48rem;
}

/* Local preview only (?posts_preview=N). */
[data-component="posts"] [data-part="preview-note"] {
	display: inline-block;
	padding: var(--spacing-xx-small) var(--spacing-x-small);
	border: 0.05rem dashed var(--focus-color);
	border-radius: var(--spacing-xx-small);
	font-size: var(--font-size-small);
}

/* The list sits under a line (<hr>) like the homepage sections, its grid /
   list tab hanging from it, at the line's full gap. */
[data-component="posts"] [data-home-cards] {
	--view-tab-w: 4.5rem;
	--view-line-gap: var(--spacing-x-large);
}

/* Search and topics, above the line. */
/* Left-aligned, whatever the site's form defaults (centred forms) say. */
[data-component="posts"] [data-part="filters"] {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--spacing-small);
	width: auto;
	max-width: none;
	margin: var(--spacing-large) 0 0;
	padding: 0;
	text-align: left;
}

/* The label above, the field and its button side by side. */
[data-component="posts"] [data-part="search"] {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: stretch;
	gap: var(--spacing-xx-small) var(--spacing-x-small);
	max-width: 32rem;
	margin: 0;
	text-align: left;
}

[data-component="posts"] [data-part="search"] label {
	grid-column: 1 / -1;
	margin: 0;
	font-weight: 700;
	text-align: left;
}

[data-component="posts"] [data-part="search"] input {
	width: 100%;
	min-width: 0;
	margin: 0;
	padding: var(--spacing-x-small) var(--spacing-small);
	border: 0.05rem solid color-mix(in srgb, var(--primary-text-color) 35%, transparent);
	border-radius: var(--spacing-x-small);
	background: var(--bg-color);
	color: var(--primary-text-color);
	font: inherit;
}

[data-component="posts"] [data-part="search"] button {
	width: auto;
	margin: 0;
	padding: var(--spacing-x-small) var(--spacing-normal);
	border: 0.05rem solid var(--primary-text-color);
	border-radius: var(--spacing-x-small);
	background: var(--primary-text-color);
	color: var(--bg-color);
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

/* Topics as chips with their counts; the chosen one filled. */
[data-component="posts"] [data-part="tag-filter"] {
	display: flex;
	flex-wrap: wrap;
	gap: var(--spacing-x-small);
}

[data-component="posts"] [data-part="tag-filter"] a {
	display: inline-flex;
	align-items: center;
	gap: var(--spacing-xx-small);
	padding: var(--spacing-xx-small) var(--spacing-small);
	border: 0.05rem solid color-mix(in srgb, var(--primary-text-color) 25%, transparent);
	border-radius: 1rem;
	color: var(--primary-text-color);
	font-size: var(--font-size-small);
	text-decoration: none;
}

[data-component="posts"] [data-part="tag-filter"] a span {
	color: var(--hs-muted, currentColor);
	font-weight: 400;
}

[data-component="posts"] [data-part="tag-filter"] a:hover {
	border-color: var(--focus-color);
}

[data-component="posts"] [data-part="tag-filter"] a[aria-current="page"] {
	border-color: var(--primary-text-color);
	background: var(--primary-text-color);
	color: var(--bg-color);
}

[data-component="posts"] [data-part="tag-filter"] a[aria-current="page"] span {
	color: inherit;
	opacity: 0.75;
}

[data-component="posts"] [data-part="filter-note"] {
	margin: var(--spacing-small) 0 0;
	color: var(--hs-muted, currentColor);
}

[data-component="posts"] [data-part="filter-note"] a {
	margin-left: var(--spacing-x-small);
}

[data-component="posts"] [data-home-cards] [data-view-head] h2 {
	margin: 0;
}

/* Newer / older under the list. */
[data-component="posts"] [data-part="pager"] {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--spacing-small);
	padding-top: var(--spacing-normal);
	border-top: 0.05rem solid var(--hs-line);
}

[data-component="posts"] [data-part="pager"] [rel="next"] {
	margin-left: auto;
}

[data-component="posts"] [data-part="pager-page"] {
	color: var(--hs-muted);
}

/* The tab here holds only the switch: no divider before it. */
[data-component="posts"] [data-section-tab] > [data-view-switch]:first-child {
	padding-left: 0;
	border-left: 0;
}


/* ── A post ───────────────────────────────────────────────────────────── */
[data-component="post"] {
	--post-measure: 42rem;
	--post-muted: color-mix(in srgb, var(--primary-text-color) 70%, transparent);
	--post-line: color-mix(in srgb, var(--primary-text-color) 14%, transparent);
	--post-card: color-mix(in srgb, var(--primary-text-color) 5%, var(--bg-color));
}

/* The text at a reading width; on a wide screen the side column (contents,
   more posts) takes the room beside it and stays in view while reading. */
[data-component="post"] [data-part="layout"] {
	display: grid;
	grid-template-columns: minmax(0, var(--post-measure));
	gap: var(--spacing-xx-large);
	align-items: start;
}

@container page (min-width: 60rem) {
	[data-component="post"] [data-part="layout"] {
		grid-template-columns: minmax(0, var(--post-measure)) minmax(14rem, 18rem);
		justify-content: space-between;
	}

	[data-component="post"] [data-part="aside"] {
		position: sticky;
		top: var(--spacing-large);
	}
}

/* Under the title: who, when, how long — one quiet line, dots between. */
[data-component="post"] [data-part="byline"] {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--spacing-xx-small) var(--spacing-x-small);
	margin: var(--spacing-x-small) 0 0;
	color: var(--post-muted);
}

[data-component="post"] [data-part="byline"] > :first-child {
	color: var(--primary-text-color);
	font-weight: 700;
}

/* No "·" between the items (wrapped on a phone, a line began with one):
   the date and the reading time carry a small calendar and clock instead,
   in the muted colour (CSS masks of the site's icons). */
[data-component="post"] [data-part="byline"] {
	column-gap: var(--spacing-normal);
}

[data-component="post"] [data-part="byline"] > :is(time, [data-part="read-time"]) {
	display: inline-flex;
	align-items: center;
	gap: var(--spacing-xx-small);
	white-space: nowrap;
}

[data-component="post"] [data-part="byline"] > :is(time, [data-part="read-time"])::before {
	content: "";
	flex: none;
	width: 0.85em;
	height: 0.85em;
	background-color: currentColor;
	-webkit-mask: var(--byline-icon) center / contain no-repeat;
	mask: var(--byline-icon) center / contain no-repeat;
}

[data-component="post"] [data-part="byline"] > time {
	/* outline calendar and clock, drawn to match (the site icons fill in at this size) */
	--byline-icon: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%23000%27 stroke-width=%272.4%27 stroke-linecap=%27round%27%3E%3Crect x=%273.5%27 y=%275%27 width=%2717%27 height=%2715.5%27 rx=%272.5%27/%3E%3Cpath d=%27M3.5 10h17M8 3v4M16 3v4%27/%3E%3C/svg%3E");
}

[data-component="post"] [data-part="byline"] > [data-part="read-time"] {
	--byline-icon: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 24 24%27 fill=%27none%27 stroke=%27%23000%27 stroke-width=%272.4%27 stroke-linecap=%27round%27%3E%3Ccircle cx=%2712%27 cy=%2712%27 r=%278.8%27/%3E%3Cpath d=%27M12 7.5V12l3 2%27/%3E%3C/svg%3E");
}

[data-component="post"] [data-part="cover"] {
	margin: var(--spacing-large) 0 0;
	padding: 0; /* the site's figure padding would double the gap */
}

[data-component="post"] [data-part="cover"] video {
	display: block;
	width: 100%;
	max-height: 32rem;
	border-radius: 0.6rem;
	background: #000;
}

[data-component="post"] [data-part="cover"] figcaption {
	margin-top: var(--spacing-x-small);
	padding: 0 0.6rem; /* where the video's rounded corner ends */
	color: var(--post-muted);
	font-size: var(--font-size-small);
}

[data-component="post"] [data-part="cover"] img {
	display: block;
	width: 100%;
	max-height: 26rem;
	object-fit: cover;
	border-radius: 0.6rem;
}

[data-component="post"] [data-part="body"] {
	margin-top: var(--spacing-large);
	line-height: 1.6;
	counter-reset: post-section;
}

[data-component="post"] [data-part="body"] > :first-child {
	margin-top: 0;
}

[data-component="post"] [data-part="body"] p {
	margin: 0 0 var(--spacing-normal);
}

/* The opening paragraph: the way in, in the site's display face (Xolonium,
   as the headings) a size up, before the sections. A reader who chose a
   serif or monospace font keeps it. */
[data-component="post"] [data-part="body"] > p:first-child {
	font-family: "Xolonium", sans-serif;
	font-size: calc(var(--font-size, 1rem) * 1.1);
	line-height: 1.55;
}

[data-accessibility~="serif"] [data-component="post"] [data-part="body"] > p:first-child {
	font-family: "Sentient", serif;
}

[data-accessibility~="monospace"] [data-component="post"] [data-part="body"] > p:first-child {
	font-family: "DMMono", sans-serif;
}

/* A paragraph that introduces a list sits close to it. */
[data-component="post"] [data-part="body"] p:has(+ :is(ul, ol)) {
	margin-bottom: var(--spacing-xx-small);
}

[data-component="post"] [data-part="body"] :is(ul, ol) {
	margin-top: 0;
	margin-bottom: var(--spacing-normal);
}

/* Each section opens on a thin rule with its number above the heading, the
   same 01, 02… as "On this page", so a new topic is plain to see. */
[data-component="post"] [data-part="body"] h2 {
	counter-increment: post-section;
	margin: var(--spacing-xx-large) 0 var(--spacing-small);
	padding-top: var(--spacing-large);
	border-top: 0.05rem solid var(--post-line);
	scroll-margin-top: var(--spacing-large);
}

[data-component="post"] [data-part="body"] h2::before {
	content: counter(post-section, decimal-leading-zero);
	display: block;
	margin-bottom: var(--spacing-xx-small);
	color: var(--focus-color);
	font-size: var(--font-size-small);
	letter-spacing: 0.08em;
}

[data-component="post"] [data-part="body"] h3 {
	margin: var(--spacing-x-large) 0 var(--spacing-x-small);
	scroll-margin-top: var(--spacing-large);
}

/* Italics in an old printer's italic (IM Fell English, as in the glossary):
   the site's own italic is a distressed display face, wrong for reading. A
   reader who chose a serif or monospace font keeps it. */
[data-component="post"] [data-part="body"] :is(em, i) {
	font-family: "IM Fell English", "Sentient", serif;
	font-style: italic;
	font-weight: 400;
	font-size: 1.08em;
}

[data-accessibility~="serif"] [data-component="post"] [data-part="body"] :is(em, i),
[data-accessibility~="monospace"] [data-component="post"] [data-part="body"] :is(em, i) {
	font-family: inherit;
	font-size: inherit;
}

/* The end of the text: a filled round mark after its last line, like the
   dot in the logo. */
[data-component="post"] [data-part="body"] > :last-child::after {
	content: "";
	display: inline-block;
	width: 0.75em;
	height: 0.75em;
	margin-left: 0.4em;
	border-radius: 50%;
	background: currentColor;
	vertical-align: baseline;
}

/* Lists in the text: the site's lists (base.css) are bulleted with a
   hanging "●" and spaced for menus (line-height 2); here they read as prose.
   A numbered list keeps its numbers, without the bullet, and in the text's
   font (base.css only sets it for ul items). */
[data-component="post"] [data-part="body"] li {
	margin-bottom: var(--spacing-x-small);
	line-height: 1.6;
}

[data-component="post"] [data-part="body"] ol {
	margin-left: 0;
	padding-left: var(--spacing-large);
	list-style: decimal;
}

[data-component="post"] [data-part="body"] ol li {
	padding-left: var(--spacing-xx-small);
	text-indent: 0;
	font-family: "ApfelGrotezk", sans-serif;
	font-size: var(--font-size);
	letter-spacing: var(--letter-spacing-normal);
}

[data-accessibility~="serif"] [data-component="post"] [data-part="body"] ol li {
	font-family: "Sentient", serif;
}

[data-accessibility~="monospace"] [data-component="post"] [data-part="body"] ol li {
	font-family: "DMMono", sans-serif;
}

[data-component="post"] [data-part="body"] ol li::before {
	content: none;
}

[data-component="post"] [data-part="body"] ol li::marker {
	font-weight: 700;
}

[data-component="post"] [data-part="body"] img {
	max-width: 100%;
	height: auto;
}

[data-component="post"] [data-part="body"] pre {
	overflow-x: auto;
	padding: var(--spacing-small);
	border-radius: var(--spacing-x-small);
	background: var(--post-card);
}

/* The site's quote (base.css: ⚡ and a rule) needs a box to hang the ⚡ in. */
[data-component="post"] [data-part="body"] blockquote {
	position: relative;
	margin: var(--spacing-large) 0;
}

[data-component="post"] [data-part="body"] blockquote p {
	margin-bottom: 0;
}

/* "Filed under" and the tags as chips, each the list of its posts. */
[data-component="post"] [data-part="tags"] {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--spacing-x-small);
	margin: var(--spacing-x-large) 0 0;
	color: var(--post-muted);
	font-size: var(--font-size-small);
}

[data-component="post"] [data-part="tag"] {
	padding: var(--spacing-xx-small) var(--spacing-small);
	border: 0.05rem solid var(--post-line);
	border-radius: 1rem;
	color: var(--primary-text-color);
	text-decoration: none;
}

[data-component="post"] [data-part="tag"]:hover {
	border-color: var(--focus-color);
	color: var(--focus-color);
}

/* The older and newer post: two boxes side by side, newer on the right. */
[data-component="post"] [data-part="post-nav"] {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--spacing-normal);
	margin-top: var(--spacing-x-large);
	padding-top: var(--spacing-large);
	border-top: 0.05rem solid var(--post-line);
}

[data-component="post"] [data-part="post-nav"] a {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-xx-small);
	padding: var(--spacing-normal);
	border: 0.05rem solid var(--post-line);
	border-radius: 0.6rem;
	color: var(--primary-text-color);
	text-decoration: none;
}

[data-component="post"] [data-part="post-nav"] a:hover {
	border-color: var(--primary-text-color);
}

[data-component="post"] [data-part="post-nav"] [data-part="newer"] {
	grid-column: 2;
	text-align: right;
}

[data-component="post"] [data-part="dir"] {
	color: var(--post-muted);
	font-size: var(--font-size-small);
}

/* ── The side column ─────────────────────────────────────────────────── */
[data-component="post"] [data-part="aside"] {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-normal);
}

[data-component="post"] [data-part="aside"] > * {
	padding: var(--spacing-normal);
	border: 0.05rem solid var(--post-line);
	border-radius: 0.6rem;
	background: var(--post-card);
}

[data-component="post"] [data-part="aside"] h2 {
	margin: 0 0 var(--spacing-x-small);
	font-size: var(--font-size-small);
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--post-muted);
}

[data-component="post"] [data-part="aside"] :is(ol, ul) {
	display: flex;
	flex-direction: column;
	gap: var(--spacing-x-small);
	margin: 0;
	padding: 0;
	list-style: none;
}

[data-component="post"] [data-part="aside"] li {
	margin: 0;
	padding: 0;
	line-height: 1.35;
	text-indent: 0; /* the site's list hangs its bullet with a negative indent */
}

[data-component="post"] [data-part="aside"] li::before {
	content: none;
}

/* "On this page": a rail down the left with the sections numbered on it;
   the one you are reading (posts.js) is marked on the rail in orange and
   set in full colour, the rest a step quieter. */
[data-component="post"] [data-part="toc"] ol {
	gap: 0;
	counter-reset: toc;
	border-left: 0.1rem solid var(--post-line);
}

[data-component="post"] [data-part="toc"] li a {
	display: grid;
	grid-template-columns: 1.5rem minmax(0, 1fr);
	align-items: baseline;
	margin-left: -0.1rem;
	padding: var(--spacing-x-small) 0 var(--spacing-x-small) var(--spacing-small);
	border-left: 0.1rem solid transparent;
	color: var(--post-muted);
	transition:
		color 150ms,
		border-color 150ms;
}

[data-component="post"] [data-part="toc"] [data-level="2"] a::before {
	content: counter(toc, decimal-leading-zero);
	counter-increment: toc;
	color: var(--post-muted);
	font-size: 0.65rem;
	font-variant-numeric: tabular-nums;
}

[data-component="post"] [data-part="toc"] [data-level="3"] a {
	padding-left: calc(var(--spacing-small) + 1.5rem);
	grid-template-columns: minmax(0, 1fr);
	font-size: var(--font-size-small);
}

[data-component="post"] [data-part="toc"] li a:hover {
	color: var(--primary-text-color);
	text-decoration: none;
}

[data-component="post"] [data-part="toc"] li a[aria-current] {
	border-left-color: var(--focus-color);
	color: var(--primary-text-color);
	/* Heavier without bold: a hairline stroke round the letters adds weight
	   but not width, so the lines break where they did (bold would re-wrap
	   the item and make the list jump while scrolling). */
	-webkit-text-stroke: 0.03em currentColor;
}

[data-component="post"] [data-part="toc"] li a[aria-current]::before {
	color: var(--focus-color);
}

@media (prefers-reduced-motion: reduce) {
	[data-component="post"] [data-part="toc"] li a {
		transition: none;
	}
}

/* The language of a post that is not in English: a small mark on its card
   and a note in its byline. */
[data-home-cards] [data-part="lang"] {
	flex: none;
	padding: 0 var(--spacing-xx-small);
	border: 0.05rem solid var(--hs-line);
	border-radius: 0.25rem;
	color: var(--hs-muted);
	font-size: 0.6rem;
	font-weight: 700;
	letter-spacing: 0.06em;
}

[data-component="post"] [data-part="lang-note"] {
	color: var(--post-muted);
}

[data-component="post"] [data-part="aside"] li a {
	font-weight: 400;
	text-decoration: none;
	line-height: 1.35;
}

[data-component="post"] [data-part="aside"] li a:hover {
	text-decoration: underline;
}

/* More posts: a small picture (or the post drawing) beside each title and
   date, the whole row a link. */
[data-component="post"] [data-part="more"] ul {
	gap: 0;
}

[data-component="post"] [data-part="more"] li + li {
	border-top: 0.05rem solid var(--post-line);
}

[data-component="post"] [data-part="more"] li a {
	display: flex;
	align-items: center;
	gap: var(--spacing-small);
	padding: var(--spacing-x-small) 0;
	color: var(--primary-text-color);
}

[data-component="post"] [data-part="more"] li a:hover {
	text-decoration: none;
}

[data-component="post"] [data-part="more"] li a:hover strong {
	color: var(--focus-color);
}

[data-component="post"] [data-part="thumb"] {
	flex: none;
	display: grid;
	place-items: center;
	width: 4.5rem;
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: var(--spacing-x-small);
	color: color-mix(in srgb, var(--focus-color) 80%, var(--primary-text-color));
	background: color-mix(in srgb, var(--focus-color) 10%, var(--post-card));
}

[data-component="post"] span[data-part="thumb"] > svg {
	width: 85%;
	height: 85%;
}

[data-component="post"] [data-part="thumb"] [data-solid] {
	fill: color-mix(in srgb, var(--focus-color) 10%, var(--post-card));
}

[data-component="post"] [data-part="more-text"] {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
}

[data-component="post"] [data-part="more-text"] strong {
	font-size: var(--font-size-small);
	line-height: 1.3;
	transition: color 150ms;
}

[data-component="post"] [data-part="more"] time {
	color: var(--post-muted);
	font-size: 0.65rem;
}

/* "All posts": the same quiet full-width button as The Socialite's Mask's
   "All profiles". */
[data-component="post"] [data-part="more"] [data-part="all"] {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--spacing-x-small);
	margin-top: var(--spacing-small);
	padding: var(--spacing-x-small) var(--spacing-small);
	border: 0.05rem solid var(--post-line);
	border-radius: 0.5rem;
	background: var(--bg-color);
	color: var(--primary-text-color);
	font-size: var(--font-size-small);
	font-weight: 700;
	text-decoration: none;
	transition:
		border-color 150ms,
		color 150ms;
}

[data-component="post"] [data-part="more"] [data-part="all"]:hover {
	border-color: var(--focus-color);
	color: var(--focus-color);
}

@container page (max-width: 30.72rem) {
	[data-component="post"] [data-part="post-nav"] {
		grid-template-columns: 1fr;
	}

	[data-component="post"] [data-part="post-nav"] [data-part="newer"] {
		grid-column: 1;
	}
}

/* A confession's title is usually a sentence: a step smaller than a section
   page's one-word title, so it reads in two or three lines, not five. */
[data-component="post"] [data-type="title"] h1 {
	font-size: calc(var(--title-1-size) * 0.62);
	line-height: 1.1;
	text-wrap: balance;
}

/* "In Estonian" as a small chip, not one more "·" item: wrapped onto its
   own line on a phone, a leading "·" looked stray. */
[data-component="post"] [data-part="byline"] > [data-part="lang-note"]::before {
	content: none;
}

[data-component="post"] [data-part="byline"] > [data-part="lang-note"] {
	padding: 0 var(--spacing-x-small);
	border: 0.05rem solid var(--post-line);
	border-radius: 0.3rem;
	font-size: var(--font-size-small);
}

/* Pictures in the text (Markdown ![alt](file) with an indented caption line
   under it): the picture at its own shape, a tall one capped so it does not
   fill the screen, the caption small under it. The picture opens large in
   the site's lightbox (main.js opens every "figure a"). */
[data-component="post"] [data-part="body"] figure {
	margin: var(--spacing-normal) 0 var(--spacing-large);
	padding: 0;
}

[data-component="post"] [data-part="body"] figure img {
	display: block;
	width: auto;
	max-width: 100%;
	max-height: 34rem;
	border-radius: 0.6rem;
}

[data-component="post"] [data-part="body"] figcaption {
	/* in from the picture's edge by its corner radius, like the links under
	   the boxes elsewhere: clear of the curve, not indented like text */
	padding: 0 0.6rem;
	margin-top: var(--spacing-x-small);
	color: var(--post-muted);
	font-size: var(--font-size-small);
	line-height: 1.45;
}

/* Under a picture or video at the top, the text follows its caption a
   little closer than it follows the byline. */
[data-component="post"] [data-part="cover"] + [data-part="body"] {
	margin-top: var(--spacing-normal);
}
