:root {
	--ground: #ffffff;
	--ink: #666666;
	--ink-quiet: #999999;
	--ink-body: #444444;
	--accent: #bb2020;
	--rule: #dddddd;
	--pill: #666666;
	--pill-hover: #555555;
	--surface: #fafafa;
	--surface-alt: #f2f2f2;
	--surface-alt-hover: #dddddd;
	--surface-border: #e2e2e2;
	--width: 1024px;
	--font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Courier New", monospace;

	color-scheme: light;
}

/*
 * Dark is defined once and applied twice: for a device set to dark that has
 * not been overridden, and for an explicit choice from the toggle. Ground is
 * pure black rather than a softer dark grey because the illustration below
 * is inverted rather than redrawn - an inverted white background lands on
 * exactly this, with no visible seam around it.
 */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme='light']) {
		--ground: #000000;
		--ink: #d0d0d0;
		--ink-quiet: #8a8a8a;
		--ink-body: #b8b8b8;
		--accent: #ff7a63;
		--rule: #333333;
		--pill: #3a3a3a;
		--pill-hover: #4a4a4a;
		--surface: #1a1a1a;
		--surface-alt: #232323;
		--surface-alt-hover: #2d2d2d;
		--surface-border: #333333;

		color-scheme: dark;
	}
}

:root[data-theme='dark'] {
	--ground: #000000;
	--ink: #d0d0d0;
	--ink-quiet: #8a8a8a;
	--ink-body: #b8b8b8;
	--accent: #ff7a63;
	--rule: #333333;
	--pill: #3a3a3a;
	--pill-hover: #4a4a4a;
	--surface: #1a1a1a;
	--surface-alt: #232323;
	--surface-alt-hover: #2d2d2d;
	--surface-border: #333333;

	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--ground);
	color: var(--ink-body);
	font: 400 15px/1.7 var(--font-mono);
}

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

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

.skip-link {
	position: absolute;
	left: -9999px;
}

.skip-link:focus {
	left: 1rem;
	top: 1rem;
	background: var(--ground);
	color: var(--ink);
	padding: 0.6rem 1rem;
	z-index: 20;
}

/* --- Pill navigation ------------------------------------------------ */

.journal-nav {
	position: fixed;
	inset: 0.8rem 1rem auto auto;
	z-index: 100;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.5rem;
}

.journal-nav__links {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.5rem;
}

.journal-nav a {
	background: var(--pill);
	color: #ffffff;
	font-size: 0.72rem;
	padding: 0.4rem 0.95rem;
	border-radius: 999px;
	text-decoration: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.journal-nav a:hover,
.journal-nav a[aria-current='page'] {
	background: var(--pill-hover);
}

/* Icon-only, not another pill: the hamburger and the theme toggle, matching
   size and shape across the whole network. */
.nav-toggle,
.theme-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 2.2rem;
	height: 2.2rem;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--pill);
	color: #ffffff;
	font-size: 1.05rem;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.theme-toggle {
	display: inline-flex;
}

.nav-toggle:hover,
.theme-toggle:hover {
	background: var(--pill-hover);
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	background: currentColor;
	display: block;
	height: 2px;
	width: 16px;
	border-radius: 2px;
}

.nav-toggle__bars {
	position: relative;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
	content: '';
	position: absolute;
}

.nav-toggle__bars::before {
	top: -5px;
}

.nav-toggle__bars::after {
	top: 5px;
}

/* The hamburger becomes an X while the menu is open, matching the rest of
   the network - reacts to the same aria-expanded the toggle script sets. */
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
	transition: transform 0.25s ease, opacity 0.25s ease, top 0.25s ease, background-color 0.25s ease;
}

.nav-toggle[aria-expanded='true'] .nav-toggle__bars {
	background: transparent;
}

.nav-toggle[aria-expanded='true'] .nav-toggle__bars::before {
	top: 0;
	transform: rotate(45deg);
}

.nav-toggle[aria-expanded='true'] .nav-toggle__bars::after {
	top: 0;
	transform: rotate(-45deg);
}

/*
 * Below the breakpoint, the pill row collapses behind a hamburger into a
 * full-height panel over everything else - the same shape as the rest of
 * the network's mobile menu, plain bold text rather than pills so it reads
 * as a menu rather than a stack of buttons.
 */
@media (max-width: 46rem) {
	.nav-toggle {
		display: inline-flex;
		position: relative;
		z-index: 201;
	}

	.journal-nav__links {
		display: none;
	}

	.journal-nav__links.is-open {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		justify-content: center;
		position: fixed;
		inset: 0;
		background: var(--ground);
		padding: 6rem 2rem 3rem;
		z-index: 200;
		overflow-y: auto;
		gap: 0.4rem;
	}

	.journal-nav__links.is-open a {
		background: none;
		box-shadow: none;
		color: var(--ink);
		font-size: 1.8rem;
		font-weight: 700;
		padding: 0.3rem 0;
	}

	.journal-nav__links.is-open .theme-toggle {
		margin-top: 1.5rem;
	}
}

.theme-toggle__on,
.theme-toggle__off {
	display: none;
}

:root[data-theme='dark'] .theme-toggle__off,
:root[data-theme='light'] .theme-toggle__on {
	display: inline;
}

:root:not([data-theme]) .theme-toggle__on {
	display: inline;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) .theme-toggle__on {
		display: none;
	}

	:root:not([data-theme]) .theme-toggle__off {
		display: inline;
	}
}

/* --- Fixed illustration, desktop only -------------------------------- */

.journal-illustration,
.journal-figure {
	display: none;
}

@media (min-width: 64rem) {
	/*
	 * Fixed to the viewport, not to each other, at the original theme's own
	 * positions - 5% and 20% from the left - so they spread apart on a wide
	 * screen and sit closer together on a narrower one, exactly as
	 * imports/squirrel-themes/ru/custom.css had it. Two separate elements
	 * rather than one with a ::after: applying a filter to an element makes
	 * it the containing block for any fixed-position content inside it, so
	 * a filtered parent would have pulled the figure's fixed position along
	 * with it.
	 */
	.journal-illustration {
		display: block;
		position: fixed;
		left: 5%;
		bottom: 30px;
		width: 362px;
		height: 529px;
		background: url('/assets/img/journal/body-bg.jpg') no-repeat;
		z-index: 10;
	}

	.journal-figure {
		display: block;
		position: fixed;
		left: 20%;
		bottom: 0;
		width: 177px;
		height: 214px;
		background: url('/assets/img/journal/aky-silhouette.png') no-repeat;
		z-index: 15;
	}

	/*
	 * The dandelions are flipped wholesale: a white background and dark ink
	 * become black and light, and since the ground is pure black too, the
	 * inverted white background disappears into it. The figure keeps its own
	 * black fill instead - against a black ground that reads as nothing but
	 * its glow - and gets a soft white rim rather than being inverted solid
	 * white.
	 */
	@media (prefers-color-scheme: dark) {
		:root:not([data-theme='light']) .journal-illustration {
			filter: invert(1);
		}

		:root:not([data-theme='light']) .journal-figure {
			filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.45));
		}
	}

	:root[data-theme='dark'] .journal-illustration {
		filter: invert(1);
	}

	:root[data-theme='dark'] .journal-figure {
		filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 20px rgba(0, 0, 0, 0.45));
	}
}

/* --- Content ---------------------------------------------------------- */

.journal-main {
	max-width: var(--width);
	margin: 0 auto;
	padding: 6.5rem 1.5rem 5rem;
}

/*
 * The original kept a 1024px container centred on the page, with its 700px
 * content column sitting at the container's right side - the same 324px
 * inset reproduced here.
 */
@media (min-width: 64rem) {
	.journal-main {
		padding-left: 324px;
		padding-right: 0;
	}
}

.journal-title {
	font-size: 2.1rem;
	line-height: 1.25;
	font-weight: 400;
	color: var(--ink);
	margin: 0 0 1.6rem;
}

.journal-tagline {
	color: var(--ink-body);
	margin: -1rem 0 1.6rem;
}

.journal-empty {
	color: var(--ink-quiet);
}

/* --- Dated entries: the journal pages' one-liners, and single posts --- */

.journal-entries {
	list-style: none;
	margin: 0;
	padding: 0;
}

.journal-entry {
	padding: 1rem 0;
	border-bottom: 1px dotted var(--rule);
}

.journal-entry:last-child {
	border-bottom: 0;
}

.journal-entry__date {
	margin: 0 0 0.2rem;
	color: var(--ink-quiet);
	font-size: 0.8rem;
}

.journal-entry__title {
	font-size: 1.2rem;
	font-weight: 400;
	margin: 0 0 0.3rem;
}

.journal-entry__title a {
	color: var(--ink);
	text-decoration: none;
}

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

.journal-entry__content {
	color: var(--ink-body);
}

.journal-entry__content p {
	margin: 0 0 0.6em;
}

.journal-entry__content p:last-child {
	margin-bottom: 0;
}

/* A single post reads like one large entry: no bottom rule, roomier title. */
.journal-entry--single {
	border-bottom: 0;
	padding: 0 0 1.5rem;
}

.journal-entry--single .journal-entry__title {
	font-size: 1.8rem;
	margin-bottom: 1rem;
}

/* --- Blog listing and archives: a two-column grid of teasers ------ */

.entry-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0 2.4rem;
}

@media (max-width: 46rem) {
	.entry-grid {
		grid-template-columns: 1fr;
	}
}

.entry-card {
	padding: 0 0 1.1rem;
	margin-bottom: 1.4rem;
	border-bottom: 1px dotted var(--rule);
	overflow: hidden;
}

.entry-card__title {
	font-size: 1.15rem;
	font-weight: 400;
	margin: 0 0 0.3rem;
}

.entry-card__title a {
	color: var(--ink);
	text-decoration: none;
}

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

.entry-card__date {
	margin: 0 0 0.8rem;
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ink-quiet);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.entry-card__thumb {
	float: right;
	margin: 0 0 0.5rem 0.7rem;
}

.entry-card__thumb img {
	display: block;
	width: 90px;
	height: 90px;
	object-fit: cover;
	box-shadow: 0 0 0 3px var(--ground), 0 0 0 4px var(--rule);
}

.entry-card__excerpt {
	margin: 0 0 0.9rem;
	font-size: 0.92rem;
	color: var(--ink-body);
}

.entry-card__more {
	display: inline-block;
	background: var(--surface-alt);
	color: var(--ink-body);
	padding: 0.3rem 0.9rem;
	border-radius: 10px;
	font-size: 0.78rem;
	text-decoration: none;
}

.entry-card__more:hover {
	background: var(--surface-alt-hover);
}

.journal-postnav {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 0;
	border-top: 1px dotted var(--rule);
	border-bottom: 1px dotted var(--rule);
	font-size: 0.9rem;
	margin-bottom: 2.5rem;
}

.journal-postnav a {
	text-decoration: none;
}

.journal-postnav a:hover {
	text-decoration: underline;
}

/* --- Share icons and related posts ----------------------------------- */

.share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-top: 2rem;
	padding-top: 1rem;
	border-top: 1px dotted var(--rule);
}

.share__label {
	color: var(--ink-quiet);
	font-size: 0.8rem;
	font-family: var(--font-mono);
	margin-right: 0.4rem;
}

.share__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.2rem;
	height: 2.2rem;
	border: 1px solid var(--surface-border);
	border-radius: 50%;
	background: var(--surface);
	color: var(--ink);
	cursor: pointer;
	padding: 0;
}

.share__link:hover,
.share__link:focus-visible {
	color: var(--accent);
	border-color: var(--accent);
}

.journal-related {
	margin-bottom: 2.5rem;
}

.journal-related__title {
	font-size: 1rem;
	font-family: var(--font-mono);
	font-weight: 400;
	color: var(--ink-quiet);
	margin: 0 0 1rem;
}

/* Print keeps the site name, the post title and the post content, marked
   .print-keep in the template, and nothing else. Only on pages that mark
   something, so any other page prints as it always has. */
.print-site {
	display: none;
}

@media print {
	body:has(.print-keep) :not(.print-keep, .print-keep *, :has(.print-keep)) {
		display: none !important;
	}

	body:has(.print-keep),
	body:has(.print-keep) :has(.print-keep),
	body:has(.print-keep) .print-keep {
		position: static !important;
		float: none !important;
		width: auto !important;
		max-width: none !important;
		margin: 0 !important;
		padding: 0 !important;
		border: 0 !important;
		border-radius: 0 !important;
		box-shadow: none !important;
		background: none !important;
		transform: none !important;
		opacity: 1 !important;
		overflow: visible !important;
		color: #000000 !important;
	}

	body:has(.print-keep) .print-site {
		display: block !important;
		font-size: 10pt;
		margin-bottom: 0.5em !important;
	}

	body:has(.print-keep) h1.print-keep {
		margin-bottom: 1em !important;
	}
}

/* --- Copyright line -------------------------------------------------- */

.journal-copyright {
	position: fixed;
	left: 50%;
	bottom: 0;
	transform: translateX(-50%);
	z-index: 14;
	margin: 0;
	width: max-content;
	background: var(--surface-alt);
	border: 1px solid var(--surface-border);
	border-bottom: 0;
	border-radius: 6px 6px 0 0;
	color: var(--ink-quiet);
	font-size: 0.75rem;
	padding: 0.4rem 1rem;
}

.journal-copyright a {
	color: var(--ink-quiet);
}


/* --- Comments, in the same dated-entry language ------------------- */

.comments {
	margin-top: 1rem;
	padding-bottom: 3rem;
}

.comments__title {
	font-size: 1.1rem;
	font-weight: 400;
	color: var(--ink);
	margin: 0 0 1.2rem;
	padding-bottom: 0.6rem;
	border-bottom: 1px dotted var(--rule);
}

.comment-list,
.comment-reply {
	list-style: none;
	margin: 0;
	padding: 0;
}

.comment-list--nested {
	margin: 0.8rem 0 0;
	padding-left: clamp(1rem, 4vw, 2rem);
	border-left: 2px solid var(--rule);
}

.comment {
	padding: 0.9rem 0;
	border-bottom: 1px dotted var(--rule);
}

.comment__meta {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin-bottom: 0.4rem;
}

.comment__avatar {
	width: 32px;
	height: 32px;
	border-radius: 50%;
}

.comment__author {
	font-weight: 700;
	color: var(--ink);
}

.comment__date {
	color: var(--ink-quiet);
	font-size: 0.8rem;
}

.comment__date::before {
	content: '\00b7';
	margin-right: 0.6rem;
}

.comment__body {
	margin-bottom: 0.4rem;
}

.comment__reply,
.comment-form__cancel {
	background: none;
	border: 1px solid var(--rule);
	border-radius: 999px;
	padding: 0.25rem 0.85rem;
	font: inherit;
	font-size: 0.75rem;
	color: var(--ink-quiet);
	cursor: pointer;
}

.comment-form__cancel {
	border: 0;
	padding: 0;
	text-decoration: underline;
}

.comment__reply:hover,
.comment-form__cancel:hover {
	color: var(--accent);
}

.comment-form {
	background: var(--surface);
	border: 1px solid var(--rule);
	padding: 1.3rem 1.4rem;
	margin-top: 1.4rem;
}

.comment-form--reply {
	padding: 1rem 1.1rem;
}

.comment-form label {
	display: block;
	font-size: 0.85rem;
	color: var(--ink-quiet);
	margin-bottom: 1rem;
}

.comment-form input,
.comment-form textarea {
	display: block;
	width: 100%;
	margin-top: 0.35rem;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--rule);
	background: var(--ground);
	color: var(--ink-body);
	font: inherit;
}

.comment-form input:focus,
.comment-form textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: 1px;
}

.comment-form__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 1.2rem;
}

@media (max-width: 40rem) {
	.comment-form__row {
		grid-template-columns: 1fr;
	}
}

.comment-form__trap {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.comment-form__submit {
	background: var(--pill);
	color: #ffffff;
	border: 0;
	border-radius: 999px;
	padding: 0.45rem 1.3rem;
	font: inherit;
	font-size: 0.85rem;
	cursor: pointer;
}

.comment-form__submit:hover {
	background: var(--pill-hover);
}

.comment-form__actions {
	display: flex;
	align-items: center;
	gap: 1.1rem;
}

.comment-form__status {
	display: block;
	margin: 0.7rem 0 0;
	font-size: 0.85rem;
	color: var(--ink-quiet);
}
