:root {
	/* Typography - Natural, organic, practical */
	--font-mono: "Space Mono", "Fira Code", "Ubuntu Mono", monospace;
	--font-sans: "Montserrat", "Open Sans", system-ui, -apple-system, sans-serif;
	--font-serif: "Merriweather", "Noto Serif", serif;

	/* Spacing - Based on natural proportions */
	--space-1: 0.25rem;
	--space-2: 0.5rem;
	--space-3: 0.75rem;
	--space-4: 1rem;
	--space-6: 1.5rem;
	--space-8: 2rem;
	--space-12: 3rem;
	--space-16: 4rem;
	--space-24: 6rem;

	/* Borders - Organic, natural */
	--radius-sm: 0.125rem;
	--radius: 0.25rem;
	--radius-md: 0.375rem;
	--radius-lg: 0.5rem;
	--radius-full: 9999px;

	/* Effects */
	--shadow-sm: 0 1px 2px 0 rgba(44, 59, 45, 0.05);
	--shadow: 0 4px 6px -1px rgba(44, 59, 45, 0.1), 0 2px 4px -1px rgba(44, 59, 45, 0.06);
	--shadow-md: 0 10px 15px -3px rgba(44, 59, 45, 0.1), 0 4px 6px -2px rgba(44, 59, 45, 0.05);
	--shadow-lg: 0 20px 25px -5px rgba(44, 59, 45, 0.1), 0 10px 10px -5px rgba(44, 59, 45, 0.04);
	--shadow-inner: inset 0 2px 4px 0 rgba(44, 59, 45, 0.06);
	--glow-solar: 0 0 15px rgba(218, 215, 205, 0.5);
	--glow-earth: 0 0 20px rgba(58, 90, 64, 0.3);

	/* Transitions - Nature-inspired */
	--transition-fast: 120ms cubic-bezier(0.34, 1.56, 0.64, 1);
	--transition: 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
	--transition-slow: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

	--header-height: 4rem;
	--footer-height: 3.25rem;
	--controls-offset: var(--space-3);
}

/* Base Reset */
*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html,
body {
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: none;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: var(--font-sans);
	font-weight: 400;
	line-height: 1.7;
	color: var(--text);
	background-color: var(--bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow: hidden;
	position: relative;
}

.layer {
	overflow: hidden;
	position: sticky;
	display: contents;
}

.stack {
	position: sticky;
	display: inline-block;
	bottom: 0;
	z-index: 20;
}

.filler {
	flex-grow: 1;
}

/* Scrollbar styling */
.content::-webkit-scrollbar {
	width: 8px;
}

.content::-webkit-scrollbar-track {
	background: transparent;
}

.content::-webkit-scrollbar-thumb {
	background: var(--neutral-500);
	border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
	background: var(--accent-gray);
}

/* Main scroll container with paper grain tiling as you scroll */
.content {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	scrollbar-width: thin;
	scrollbar-color: var(--accent-dark) transparent;
	overflow-y: auto;
	overflow-x: hidden;
	width: 100%;
	height: 100%;
	position: relative;
	background-image: var(--paper-noise-bg), linear-gradient(to bottom, var(--neutral-200), var(--bg));
	background-repeat: repeat, no-repeat;
	background-size: 240px 240px, 100% 100%;
	background-attachment: local, scroll;
}

.container {
	width: 60rem;
	max-width: 92vw;
	margin: 0 auto;
	padding-top: calc(var(--header-height) + var(--space-4));
}

.container--home {
	width: 64rem;
	max-width: 94vw;
}

/* Floating controls */
.controls {
	position: sticky;
	bottom: 0;
	right: 0;
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	z-index: 10;
	padding-bottom: var(--controls-offset);
	padding-right: var(--controls-offset);
}

.controls button {
	border-radius: 5px;
	padding: 10px;
	min-width: 40px;
	min-height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
	background-color: var(--bg);
	border: 1px solid var(--accent-gray);
	color: var(--accent-gray);
	aspect-ratio: 1;
}

.controls button:hover {
	background-color: var(--accent-active);
	color: var(--neutral-900);
}

.controls button:active {
	background-color: var(--accent-alt);
}

.controls .active {
	color: var(--neutral-200);
	border: 1px solid var(--accent-dark);
	background-color: var(--accent-highlight);
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

a {
	color: var(--accent-gray);
	text-decoration: none;
	transition: color var(--transition-fast);
}

a:hover {
	color: var(--accent-highlight);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
	margin-top: var(--space-2);
	margin-bottom: var(--space-2);
	font-weight: 600;
	line-height: 1.3;
	color: var(--accent-dark);
	font-family: var(--font-sans);
	letter-spacing: -0.01em;
}

h1 {
	font-size: 2.5rem;
	letter-spacing: -0.02em;
}

h2 {
	font-size: 2rem;
	letter-spacing: -0.015em;
}

h3 {
	font-size: 1.5rem;
	letter-spacing: -0.015em;
}

h4 {
	font-size: 1.25rem;
}

h5 {
	font-size: 1.125rem;
}

h6 {
	font-size: 1rem;
}

.container p {
	margin-top: var(--space-1);
	margin-bottom: var(--space-2);
}

code,
pre {
	font-family: var(--font-mono);
	font-size: 0.9em;
}

/* Header */
header {
	display: grid;
	grid-template-columns: 4rem auto 1fr;
	align-items: center;
	top: 0;
	left: 0;
	z-index: 999;
	height: var(--header-height);
	width: 100%;
	position: fixed;
	padding-right: var(--space-4);
	background-color: var(--accent-solarized);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	mask: linear-gradient(black 10%, black 65%, transparent 100%);
	-webkit-mask: linear-gradient(black 10%, black 65%, transparent 100%);
}

.header-title {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	display: flex;
	align-items: center;
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1.2;
	font-family: var(--font-sans);
	letter-spacing: -0.02em;
	background: linear-gradient(135deg, var(--accent-gray), var(--accent-light));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	color: transparent;
}

.header-title-symbol {
	padding-left: var(--space-4);
	padding-right: var(--space-2);
}

.header-title-name {
	padding-right: var(--space-4);
}

header nav {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--space-2);
	min-width: 0;
}

.nav-prefix {
	color: var(--neutral-600);
	font-family: var(--font-mono);
	font-size: 0.9rem;
	user-select: none;
}

nav ul {
	display: flex;
	align-items: center;
	list-style: none;
	gap: var(--space-2);
	flex-wrap: nowrap;
	overflow-x: auto;
}

nav ul li {
	white-space: nowrap;
}

nav ul li:not(:last-child)::after {
	content: "/";
	padding-left: var(--space-2);
	color: var(--neutral-500);
}

header nav a {
	color: var(--neutral-700);
	font-weight: 500;
	position: relative;
	padding: var(--space-2) 0;
	transition: color var(--transition-fast);
	font-family: var(--font-sans);
	letter-spacing: 0.01em;
}

header nav a:hover {
	color: var(--accent-gray);
}

header nav a:hover::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 2px;
	background: linear-gradient(to right, var(--accent-gray), var(--accent-emphasis));
	border-radius: var(--radius-full);
}

header nav .active::before {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 2px;
	background: linear-gradient(to right, var(--accent-gray), var(--accent-light-2));
	border-bottom: 2px solid var(--accent-active);
	border-radius: var(--radius-full);
}

@media (max-width: 700px) {
	header {
		grid-template-columns: 3.5rem 1fr;
	}

	.header-title-name {
		display: none;
	}

	header nav {
		justify-content: flex-start;
		font-size: 0.85rem;
	}
}

/* Footer */
footer {
	min-height: var(--footer-height);
	padding: var(--space-3) var(--space-4);
	border-top: 1px solid rgba(88, 129, 87, 0.15);
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.footer-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--space-4);
}

.footer-copyright {
	font-size: 0.9rem;
	background: linear-gradient(135deg, var(--accent-gray), var(--accent-light));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.social-icons {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
}

.social-icons a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background-color: rgba(58, 90, 64, 0.12);
	color: var(--accent-gray);
	border-radius: 50%;
	transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
	border: 1px solid rgba(88, 129, 87, 0.18);
}

.social-icons a img {
	width: 16px;
	height: 16px;
	opacity: 0.8;
	transition: filter var(--transition-fast), opacity var(--transition-fast);
}

[data-theme="dark"] .social-icons a img {
	filter: invert(1);
}

.social-icons a:hover {
	background-color: var(--accent-gray);
	box-shadow: var(--glow-earth);
}

.social-icons a:hover img {
	filter: brightness(0) invert(1);
	opacity: 1;
}

/* Buttons (used in interactive notebook widgets) */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: var(--space-3) var(--space-6);
	border-radius: var(--radius);
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	transition: all var(--transition-fast);
	border: none;
	outline: none;
	line-height: 1.5;
	font-family: var(--font-sans);
	letter-spacing: 0.01em;
	position: relative;
	overflow: hidden;
}

.btn::before {
	content: "";
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
	transition: left 0.7s;
}

.btn:hover::before {
	left: 100%;
}

.btn:focus-visible {
	outline: 2px solid var(--accent-highlight);
	outline-offset: 2px;
}

.btn-primary {
	background-color: var(--accent-light-2);
	color: var(--neutral-700);
	border-radius: 4px;
	padding: 0.6rem 1.2rem;
	font-weight: 500;
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(6, 17, 6, 0.3);
}

.btn-primary:hover {
	background-color: var(--accent-light);
	color: var(--text-alt);
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(6, 17, 6, 0.4);
}

.btn-primary:active {
	background-color: var(--accent-light-2);
	border-bottom: 2px solid var(--accent-active);
	transform: translateY(0);
}

.btn-secondary {
	background-color: rgba(255, 255, 255, 0.9);
	color: var(--accent-dark);
	box-shadow: 0 4px 10px rgba(44, 59, 45, 0.1);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
	border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-outline {
	background-color: transparent;
	border: 1px solid var(--accent-gray);
	color: var(--accent-gray);
}

/* ==========================================================================
   Landing Page: 2-Row Square Library Matrix + Compact Lead & Rows
   ========================================================================== */

.library-strip {
	padding-top: var(--space-1);
}

.library-matrix {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: 8px;
}

.library-cell {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: var(--radius);
	border: 1px solid var(--border-subtle);
	background: var(--surface);
	transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.library-cell-frame {
	width: 100%;
	height: 100%;
	border-radius: calc(var(--radius) - 1px);
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--neutral-200);
}

.library-cell-media {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 280ms ease;
}

.library-cell-fallback {
	font-family: var(--font-mono);
	font-size: 0.65rem;
	text-transform: uppercase;
	color: var(--text-dim);
}

.library-cell:not(.library-cell--empty):hover,
.library-cell:not(.library-cell--empty):focus-visible {
	z-index: 30;
	border-color: var(--accent-alt);
	transform: scale(1.07);
	box-shadow: var(--shadow-md);
	outline: none;
}

.library-cell:not(.library-cell--empty):hover .library-cell-media,
.library-cell:not(.library-cell--empty):focus-visible .library-cell-media {
	transform: scale(1.05);
}

/* Subtle empty specimen slots filling the matrix */
.library-cell--empty {
	background: transparent;
	border: 1px solid var(--border-subtle);
	opacity: 0.42;
	pointer-events: none;
}

/* Floating hover/focus inspector card for compact square cells */
.library-cell-popover {
	position: absolute;
	top: calc(100% + 10px);
	left: 50%;
	transform: translate(-50%, 4px);
	width: 260px;
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-md);
	background: var(--neutral-900);
	color: var(--neutral-100);
	border: 1px solid var(--border-strong);
	box-shadow: var(--shadow-lg);
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	z-index: 40;
	transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.library-cell:hover .library-cell-popover,
.library-cell:focus-visible .library-cell-popover {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
}

/* Edge-aware horizontal alignment for 12-column desktop matrix */
.library-cell:nth-child(12n + 1) .library-cell-popover,
.library-cell:nth-child(12n + 2) .library-cell-popover {
	left: 0;
	transform: translate(0, 4px);
}

.library-cell:nth-child(12n + 1):hover .library-cell-popover,
.library-cell:nth-child(12n + 1):focus-visible .library-cell-popover,
.library-cell:nth-child(12n + 2):hover .library-cell-popover,
.library-cell:nth-child(12n + 2):focus-visible .library-cell-popover {
	transform: translate(0, 0);
}

.library-cell:nth-child(12n + 11) .library-cell-popover,
.library-cell:nth-child(12n) .library-cell-popover {
	left: auto;
	right: 0;
	transform: translate(0, 4px);
}

.library-cell:nth-child(12n + 11):hover .library-cell-popover,
.library-cell:nth-child(12n + 11):focus-visible .library-cell-popover,
.library-cell:nth-child(12n):hover .library-cell-popover,
.library-cell:nth-child(12n):focus-visible .library-cell-popover {
	transform: translate(0, 0);
}

.popover-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.3rem;
	font-family: var(--font-mono);
	font-size: 0.68rem;
	color: var(--neutral-400);
}

.popover-title {
	font-size: 0.98rem;
	font-weight: 600;
	line-height: 1.25;
	color: var(--neutral-100);
}

.popover-desc {
	margin: 0 !important;
	font-size: 0.8rem;
	line-height: 1.4;
	color: var(--neutral-300);
}

.popover-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin-top: 0.2rem;
}

.popover-tags span {
	font-family: var(--font-mono);
	font-size: 0.64rem;
	padding: 0.08rem 0.42rem;
	border-radius: var(--radius-full);
	background: rgba(163, 177, 138, 0.2);
	color: var(--neutral-200);
}

.strip-footer {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--space-2);
}

.strip-more {
	font-family: var(--font-mono);
	font-size: 0.78rem;
	color: var(--text-dim);
	transition: color var(--transition-fast);
}

.strip-more:hover {
	color: var(--accent-alt);
}

.home-divider {
	margin: var(--space-6) 0;
}

/* Articles Section: Polished, Shorter Lead Card + Compact Rows */
.home-articles {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.article-lead {
	display: grid;
	grid-template-columns: 1fr 196px;
	align-items: stretch;
	background: var(--surface);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: var(--shadow-sm);
	transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), background-color var(--transition-fast);
}

.article-lead--text-only {
	grid-template-columns: 1fr;
}

.article-lead:hover {
	border-color: var(--border-strong);
	background: var(--surface-hover);
	box-shadow: var(--shadow-md);
	transform: translateY(-1px);
}

.article-lead-body {
	padding: var(--space-4) var(--space-6);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--space-2);
	min-width: 0;
}

.article-lead-title {
	margin: 0;
	font-family: var(--font-serif);
	font-size: 1.55rem;
	line-height: 1.22;
	color: var(--accent-dark);
	transition: color var(--transition-fast);
}

.article-lead:hover .article-lead-title {
	color: var(--accent-light);
}

.article-lead-summary {
	margin: 0 !important;
	font-size: 0.94rem;
	line-height: 1.55;
	color: var(--neutral-600);
	max-width: 60ch;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.article-lead-media {
	width: 196px;
	height: 196px;
	flex-shrink: 0;
	overflow: hidden;
	background: var(--neutral-200);
	border-left: 1px solid var(--border-subtle);
}

.article-lead-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 350ms ease;
}

.article-lead:hover .article-lead-media img {
	transform: scale(1.04);
}

/* Compact Article Rows */
.article-compact-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	border-top: 1px solid var(--border-subtle);
}

.article-compact-item {
	border-bottom: 1px solid var(--border-subtle);
}

.article-compact {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	padding: var(--space-3) var(--space-3);
	border-radius: var(--radius);
	transition: background-color var(--transition-fast);
}

.article-compact:hover {
	background-color: var(--surface);
}

.article-compact-thumb {
	width: 64px;
	height: 64px;
	flex-shrink: 0;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--neutral-200);
	border: 1px solid var(--border-subtle);
}

.article-compact-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.article-compact-body {
	flex: 1 1 auto;
	min-width: 0;
}

.article-compact-title {
	margin: 0;
	font-size: 1.12rem;
	line-height: 1.3;
	color: var(--accent-dark);
	transition: color var(--transition-fast);
}

.article-compact:hover .article-compact-title {
	color: var(--accent-light);
}

.article-compact-desc {
	margin: 0.15rem 0 0 !important;
	font-size: 0.88rem;
	color: var(--neutral-600);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.article-compact-meta {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-shrink: 0;
	font-family: var(--font-mono);
	font-size: 0.78rem;
	color: var(--text-dim);
}

.article-compact-arrow {
	transition: transform var(--transition-fast), color var(--transition-fast);
}

.article-compact:hover .article-compact-arrow {
	transform: translateX(3px);
	color: var(--accent-alt);
}

@media (max-width: 900px) {
	.library-matrix {
		grid-template-columns: repeat(8, minmax(0, 1fr));
	}

	.library-cell:nth-child(n + 17) {
		display: none;
	}
}

@media (max-width: 640px) {
	.library-matrix {
		grid-template-columns: repeat(5, minmax(0, 1fr));
		gap: 6px;
	}

	.library-cell:nth-child(n + 11) {
		display: none;
	}

	.library-cell-popover {
		display: none;
	}

	.article-lead {
		grid-template-columns: 1fr;
	}

	.article-lead-media {
		order: -1;
		width: 100%;
		height: 170px;
		border-left: none;
		border-bottom: 1px solid var(--border-subtle);
	}

	.article-lead-body {
		padding: var(--space-4);
	}

	.article-lead-title {
		font-size: 1.35rem;
	}

	.article-compact {
		flex-wrap: wrap;
	}

	.article-compact-meta {
		width: 100%;
		padding-left: calc(64px + var(--space-4));
	}
}

/* Shared Slim Page Header Bar, Filter Pills & Editorial Metadata */
.page-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--space-3);
	padding-bottom: var(--space-3);
	margin-bottom: var(--space-4);
	border-bottom: 1px solid var(--border-subtle);
}

.page-bar-title {
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
}

.page-bar-title h1 {
	margin: 0;
	font-size: 1.55rem;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

.page-bar-count {
	font-family: var(--font-mono);
	font-size: 0.78rem;
	color: var(--text-dim);
	font-variant-numeric: tabular-nums;
}

.page-divider {
	margin: var(--space-6) 0;
}

.filter-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem;
}

.filter-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.22rem 0.65rem;
	border-radius: var(--radius-full);
	border: 1px solid var(--border-subtle);
	background: var(--surface);
	color: var(--text-dim);
	font-family: var(--font-mono);
	font-size: 0.75rem;
	line-height: 1.3;
	cursor: pointer;
	transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.filter-pill:hover {
	border-color: var(--accent-light);
	background: var(--surface-hover);
	color: var(--text);
}

.filter-pill.active {
	background: var(--accent-dark);
	color: var(--neutral-100);
	border-color: var(--accent-dark);
}

.filter-count {
	font-size: 0.68rem;
	opacity: 0.75;
	font-variant-numeric: tabular-nums;
}

/* Library search, collection filters, and grouped results */
.library-tools {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.library-search {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.24rem 0.7rem;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-full);
	background: var(--surface);
	transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.library-search:focus-within {
	border-color: var(--accent-light);
	background: var(--surface-hover);
}

.library-search-icon {
	color: var(--text-dim);
	font-size: 0.85rem;
	line-height: 1;
}

.library-search input {
	width: 15rem;
	max-width: 52vw;
	border: none;
	outline: none;
	background: transparent;
	color: var(--text);
	font-family: var(--font-mono);
	font-size: 0.78rem;
}

.library-search input::placeholder {
	color: var(--text-dim);
	opacity: 0.7;
}

.library-group-select {
	padding: 0.28rem 0.6rem;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-full);
	background: var(--surface);
	color: var(--text-dim);
	font-family: var(--font-mono);
	font-size: 0.74rem;
	cursor: pointer;
}

.library-group-select:hover,
.library-group-select:focus {
	border-color: var(--accent-light);
	color: var(--text);
}

.library-toolbar {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	margin-bottom: var(--space-2);
}

.collection-filters .filter-pill {
	font-size: 0.72rem;
}

.library-search-status {
	min-height: 1.1em;
	margin: 0 0 var(--space-2);
	font-family: var(--font-mono);
	font-size: 0.72rem;
	color: var(--text-dim);
	font-variant-numeric: tabular-nums;
}

.library-group {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.library-group-title {
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
	margin: var(--space-2) 0 0;
	font-size: 0.78rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-dim);
}

.library-group-count {
	font-size: 0.68rem;
	font-weight: 400;
	color: var(--text-dim);
	opacity: 0.75;
	font-variant-numeric: tabular-nums;
}

.library-card-collections {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin-top: 0.1rem;
	font-family: var(--font-mono);
	font-size: 0.68rem;
	color: var(--accent-light);
}

.library-card-collections span {
	padding: 0.02rem 0.4rem;
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-full);
}

.meta-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-2);
	font-family: var(--font-mono);
	font-size: 0.78rem;
	color: var(--text-dim);
}

.meta-category {
	color: var(--accent-light);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.meta-dot {
	opacity: 0.55;
}

.meta-spec {
	font-family: var(--font-mono);
	font-size: 0.72rem;
	color: var(--text-dim);
}

.tag-container {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.tag {
	display: inline-block;
	background-color: rgba(58, 90, 64, 0.12);
	color: var(--accent-gray);
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-full);
	font-size: 0.875rem;
	font-weight: 500;
	font-family: var(--font-sans);
	border: 1px solid var(--border-subtle);
}

.tag-pill {
	display: inline-block;
	background-color: rgba(58, 90, 64, 0.1);
	color: var(--accent-gray);
	padding: 0.12rem 0.55rem;
	border-radius: var(--radius-full);
	font-size: 0.72rem;
	font-weight: 500;
	font-family: var(--font-mono);
	border: 1px solid var(--border-subtle);
}

.empty-state {
	color: var(--text-dim);
	font-style: italic;
	padding: var(--space-4) 0;
}

.hidden {
	display: none !important;
}

/* Visible only to assistive tech (e.g. the homepage's page heading). */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Lets keyboard users jump past the header navigation. */
.skip-link {
	position: absolute;
	top: var(--space-2);
	left: var(--space-2);
	z-index: 1000;
	padding: var(--space-2) var(--space-4);
	background: var(--accent-dark);
	color: var(--text-alt);
	border-radius: var(--radius);
	transform: translateY(-200%);
}

.skip-link:focus {
	transform: translateY(0);
}

/* Articles Page (/articles/): Slim Editorial Index */
.article-index {
	list-style: none;
	display: flex;
	flex-direction: column;
}

.article-index-item {
	border-bottom: 1px solid var(--border-subtle);
}

.article-index-item:last-child {
	border-bottom: none;
}

.article-index-row {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	padding: var(--space-3) var(--space-2);
	border-radius: var(--radius);
	transition: background-color var(--transition-fast);
}

.article-index-row:hover {
	background-color: var(--surface);
}

.article-index-thumb {
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	border-radius: var(--radius);
	overflow: hidden;
	background: var(--neutral-200);
	border: 1px solid var(--border-subtle);
}

.article-index-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.article-index-body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.article-index-title {
	margin: 0;
	font-family: var(--font-serif);
	font-size: 1.08rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--accent-dark);
	transition: color var(--transition-fast);
}

.article-index-row:hover .article-index-title {
	color: var(--accent-light);
}

.article-index-desc {
	margin: 0 !important;
	font-size: 0.87rem;
	line-height: 1.48;
	color: var(--neutral-600);
	max-width: 64ch;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.article-index-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: center;
	gap: 0.15rem;
	flex-shrink: 0;
	font-family: var(--font-mono);
	font-size: 0.74rem;
	color: var(--text-dim);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.article-index-cat {
	color: var(--accent-gray);
	font-weight: 500;
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.article-index-sub {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.article-index-arrow {
	display: inline-block;
	transition: transform var(--transition-fast), color var(--transition-fast);
}

.article-index-row:hover .article-index-arrow {
	transform: translateX(3px);
	color: var(--accent-alt);
}

/* Library Asset Kind Badges */
.kind-badge {
	display: inline-flex;
	align-items: center;
	padding: 0.08rem 0.45rem;
	border-radius: var(--radius-full);
	font-family: var(--font-mono);
	font-size: 0.64rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	background: rgba(88, 129, 87, 0.16);
	color: var(--accent-dark);
	border: 1px solid var(--border-subtle);
	line-height: 1.4;
}

.kind-software {
	background: rgba(88, 129, 87, 0.16);
	color: var(--accent-gray);
}

.kind-video {
	background: rgba(187, 90, 65, 0.16);
	color: var(--accent-alt);
}

.kind-3d {
	background: rgba(233, 196, 106, 0.22);
	color: var(--accent-dark);
}

.kind-audio {
	background: rgba(128, 177, 146, 0.2);
	color: var(--accent-gray);
}

.kind-art {
	background: rgba(163, 177, 138, 0.2);
	color: var(--accent-dark);
}

/* Dedicated Library Page (/library/): Slim Horizontal Catalog */
.library-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.library-card {
	display: grid;
	grid-template-columns: 184px 1fr auto;
	align-items: stretch;
	background: var(--surface);
	border: 1px solid var(--border-subtle);
	border-radius: var(--radius-md);
	overflow: hidden;
	box-shadow: var(--shadow-sm);
	transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.library-card:hover {
	border-color: var(--border-strong);
	background: var(--surface-hover);
	box-shadow: var(--shadow);
}

.library-card-media {
	position: relative;
	width: 184px;
	min-height: 108px;
	overflow: hidden;
	background: var(--neutral-200);
	border-right: 1px solid var(--border-subtle);
	display: flex;
	align-items: center;
	justify-content: center;
}

.library-media-link {
	display: block;
	width: 100%;
	height: 100%;
}

.library-card-media img,
.media-video-player {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.media-audio-glyph {
	font-size: 1.9rem;
	color: var(--accent-gray);
	opacity: 0.65;
}

.media-audio-player {
	width: 100%;
	max-width: 26rem;
	height: 32px;
	margin-top: 0.2rem;
}

.media-placeholder {
	font-family: var(--font-mono);
	font-size: 0.78rem;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--text-dim);
}

.library-card-body {
	padding: var(--space-3) var(--space-4);
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 0.25rem;
	min-width: 0;
}

.library-card-head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.library-card-title {
	margin: 0;
	font-size: 1.06rem;
	font-weight: 600;
	line-height: 1.25;
	color: var(--accent-dark);
}

.library-card-title a {
	color: inherit;
}

.library-card-title a:hover {
	color: var(--accent-light);
}

.library-card-desc {
	margin: 0 !important;
	font-size: 0.87rem;
	line-height: 1.48;
	color: var(--neutral-600);
	max-width: 60ch;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.library-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 0.6rem;
	margin-top: 0.1rem;
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text-dim);
}

.library-card-tags span::before {
	content: "#";
	opacity: 0.55;
}

.library-card-actions {
	padding: var(--space-3) var(--space-4) var(--space-3) 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-end;
	gap: 0.35rem;
	flex-shrink: 0;
}

.action-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.3rem;
	padding: 0.25rem 0.65rem;
	border-radius: var(--radius);
	font-family: var(--font-mono);
	font-size: 0.75rem;
	font-weight: 500;
	white-space: nowrap;
	border: 1px solid var(--border-strong);
	color: var(--accent-dark);
	background: transparent;
	transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.action-link:hover {
	background: var(--accent-dark);
	color: var(--neutral-100);
	border-color: var(--accent-dark);
}

.action-link--primary {
	background: var(--accent-gray);
	color: var(--neutral-100);
	border-color: var(--accent-gray);
}

.action-link--primary:hover {
	background: var(--accent-alt);
	border-color: var(--accent-alt);
	color: #fff;
}

@media (max-width: 720px) {
	.article-index-row {
		flex-wrap: wrap;
		gap: var(--space-3);
	}

	.article-index-meta {
		width: 100%;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		padding-left: calc(56px + var(--space-3));
	}

	.library-tools {
		width: 100%;
	}

	.library-search {
		flex: 1;
	}

	.library-search input {
		width: 100%;
		max-width: none;
	}

	.library-card {
		grid-template-columns: 120px 1fr;
	}

	.library-card-media {
		width: 120px;
		min-height: 96px;
	}

	.library-card-actions {
		grid-column: 1 / -1;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		padding: 0 var(--space-4) var(--space-3);
	}
}

@media (max-width: 500px) {
	.article-index-meta {
		padding-left: 0;
	}

	.library-card {
		grid-template-columns: 1fr;
	}

	.library-card-media {
		width: 100%;
		height: 150px;
		border-right: none;
		border-bottom: 1px solid var(--border-subtle);
	}
}

/* About Page */
.about-section {
	padding: var(--space-4) 0;
}

.about-content h1 {
	font-size: 2rem;
	letter-spacing: -0.015em;
	margin-bottom: var(--space-6);
	position: relative;
}

.about-content h1::after {
	content: "";
	position: absolute;
	width: 60px;
	height: 3px;
	bottom: -10px;
	left: 0;
	background: linear-gradient(90deg, var(--accent-gray), var(--accent-highlight));
	border-radius: var(--radius);
}

.about-content h3 {
	margin-top: var(--space-8);
	margin-bottom: var(--space-3);
	font-size: 1.5rem;
}

.about-content .bio p {
	margin-bottom: var(--space-4);
	max-width: 68ch;
}

.skills-grid {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

/* Decorative Dividers */
hr {
	margin: var(--space-8) 0;
	border: none;
	height: 2px;
	background: linear-gradient(90deg, transparent 10%, var(--neutral-700), transparent 90%);
	position: relative;
	overflow: visible;
}

hr::before {
	font-size: 20px;
	content: "⾋";
	color: var(--neutral-800);
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
}

/* Inline notebook outputs */
.inline-output-area {
	display: inline;
	vertical-align: middle;
}

/* Collection cells in the landing matrix */
.library-cell-frame {
	position: relative;
}

.library-cell--collection .library-cell-frame::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(6, 12, 7, 0) 38%, rgba(6, 12, 7, 0.86) 100%);
	pointer-events: none;
}

.library-cell-collection-label {
	position: absolute;
	inset: auto 0 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	padding: 0.65rem 0.7rem;
	pointer-events: none;
}

.library-cell-collection-name {
	font-size: 0.72rem;
	font-weight: 600;
	line-height: 1.2;
	color: #f6f7f4;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.75);
}

.library-cell-collection-count {
	font-family: var(--font-mono);
	font-size: 0.58rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: rgba(246, 247, 244, 0.72);
}

/* ==========================================================================
   Library Modal Media Viewer
   ========================================================================== */

html.viewer-open .content {
	overflow: hidden;
}

.media-viewer {
	width: min(1100px, calc(100vw - 2rem));
	max-width: none;
	max-height: calc(100dvh - 2rem);
	margin: auto;
	padding: 0;
	border: 1px solid rgba(163, 177, 138, 0.34);
	border-radius: var(--radius-lg);
	background: #111711;
	color: #f0f0e8;
	box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
	overflow: hidden;
}

.media-viewer::backdrop {
	background: rgba(4, 9, 5, 0.82);
	backdrop-filter: blur(5px);
}

.media-viewer-shell {
	position: relative;
	display: flex;
	flex-direction: column;
	max-height: calc(100dvh - 2rem);
	background: #111711;
}

.media-viewer-close {
	position: absolute;
	top: 0.8rem;
	right: 0.9rem;
	z-index: 5;
	width: 2rem;
	height: 2rem;
	border: 1px solid rgba(240, 240, 232, 0.22);
	border-radius: var(--radius-full);
	background: rgba(6, 12, 7, 0.72);
	color: #f0f0e8;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.media-viewer-close:hover,
.media-viewer-close:focus-visible {
	background: var(--accent-alt);
	border-color: var(--accent-alt);
	outline: none;
}

.media-viewer-head {
	padding: 1.15rem 4rem 0.7rem 1.35rem;
	flex-shrink: 0;
}

.media-viewer-kicker {
	margin: 0 0 0.2rem;
	font-family: var(--font-mono);
	font-size: 0.66rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--accent-highlight);
}

.media-viewer-title {
	margin: 0;
	font-size: clamp(1.05rem, 2vw, 1.5rem);
	line-height: 1.25;
	color: #f6f7f4;
}

.media-viewer-meta {
	margin: 0.25rem 0 0;
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: #a7b397;
}

.media-viewer-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	height: min(56vh, 560px);
	min-height: 260px;
	background: #050805;
	overflow: hidden;
	flex-shrink: 0;
}

.media-viewer-slide {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-width: 0;
}

.media-viewer-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #050805;
}

.media-viewer-video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}

.media-viewer-model,
.media-viewer-model model-viewer {
	display: block;
	width: 100%;
	height: 100%;
	background: #050805;
	--poster-color: #050805;
}

.media-viewer-model-fallback {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.8rem;
	width: 100%;
	height: 100%;
	padding: 1.5rem;
	text-align: center;
}

.media-viewer-model-fallback img {
	max-width: min(70%, 520px);
	max-height: 65%;
	object-fit: contain;
	border-radius: var(--radius);
}

.media-viewer-model-fallback p {
	margin: 0;
	font-size: 0.85rem;
	color: #a7b397;
}

.media-viewer-audio {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.2rem;
	width: min(560px, 88%);
}

.media-viewer-audio-art {
	width: min(300px, 58vw);
	aspect-ratio: 1 / 1;
	object-fit: cover;
	border-radius: var(--radius-md);
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.media-viewer-audio-glyph {
	font-size: 4rem;
	color: var(--accent-highlight);
	opacity: 0.8;
}

.media-viewer-audio-player {
	width: 100%;
}

.media-viewer-info {
	padding: 2rem;
	font-family: var(--font-mono);
	font-size: 0.82rem;
	color: #a7b397;
	text-align: center;
}

.media-viewer-nav {
	position: absolute;
	top: 50%;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.6rem;
	height: 2.6rem;
	border: 1px solid rgba(240, 240, 232, 0.24);
	border-radius: var(--radius-full);
	background: rgba(6, 12, 7, 0.7);
	color: #f6f7f4;
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.media-viewer-nav:hover,
.media-viewer-nav:focus-visible {
	background: var(--accent-alt);
	border-color: var(--accent-alt);
	outline: none;
}

.media-viewer-nav--prev {
	left: 0.75rem;
}

.media-viewer-nav--next {
	right: 0.75rem;
}

.media-viewer-nav[hidden] {
	display: none;
}

.media-viewer-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	transform: translate(-50%, -50%);
	padding: 0.4rem 0.75rem;
	border-radius: var(--radius-full);
	background: rgba(6, 12, 7, 0.78);
	font-family: var(--font-mono);
	font-size: 0.7rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #f0f0e8;
	pointer-events: none;
}

.media-viewer-loading[hidden],
.media-viewer-foot [hidden] {
	display: none;
}

.media-viewer-foot {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-4);
	padding: 0.9rem 1.35rem 1.1rem;
	border-top: 1px solid rgba(163, 177, 138, 0.16);
	flex-shrink: 0;
	min-height: 0;
	overflow-y: auto;
}

.media-viewer-caption {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.media-viewer-counter {
	margin: 0;
	font-family: var(--font-mono);
	font-size: 0.68rem;
	letter-spacing: 0.04em;
	color: #a7b397;
}

.media-viewer-desc {
	margin: 0;
	font-size: 0.84rem;
	line-height: 1.5;
	color: #d8ded4;
	max-width: 70ch;
}

.media-viewer-tags,
.media-viewer-collections {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
}

.media-viewer-tag {
	font-family: var(--font-mono);
	font-size: 0.62rem;
	padding: 0.1rem 0.4rem;
	border: 1px solid rgba(163, 177, 138, 0.25);
	border-radius: var(--radius-full);
	color: #a7b397;
}

.media-viewer-collection-chip {
	padding: 0.16rem 0.55rem;
	border: 1px solid rgba(187, 90, 65, 0.6);
	border-radius: var(--radius-full);
	background: transparent;
	color: #e9b5a5;
	font-family: var(--font-mono);
	font-size: 0.64rem;
	cursor: pointer;
	transition: background-color var(--transition-fast), color var(--transition-fast);
}

.media-viewer-collection-chip:hover,
.media-viewer-collection-chip:focus-visible {
	background: var(--accent-alt);
	color: #fff;
	outline: none;
}

.media-viewer-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 0.4rem;
	flex-shrink: 0;
}

.media-viewer-action {
	color: #d8ded4;
	border-color: rgba(163, 177, 138, 0.34);
}

.media-viewer-action:hover {
	color: #111711;
	background: #d8ded4;
	border-color: #d8ded4;
}

.media-viewer-action.action-link--primary {
	background: var(--accent-gray);
	color: #fff;
	border-color: var(--accent-gray);
}

.media-viewer-action.action-link--primary:hover {
	background: var(--accent-alt);
	border-color: var(--accent-alt);
}

.action-link--viewer {
	cursor: pointer;
}

@media (max-width: 720px) {
	.media-viewer {
		width: calc(100vw - 0.75rem);
		max-height: calc(100dvh - 0.75rem);
	}

	.media-viewer-shell {
		max-height: calc(100dvh - 0.75rem);
	}

	.media-viewer-head {
		padding: 1rem 3.4rem 0.6rem 1rem;
	}

	.media-viewer-stage {
		height: 44vh;
		min-height: 210px;
	}

	.media-viewer-foot {
		flex-direction: column;
		gap: 0.65rem;
		padding: 0.8rem 1rem 1rem;
	}

	.media-viewer-actions {
		justify-content: flex-start;
	}

	.media-viewer-nav {
		width: 2.2rem;
		height: 2.2rem;
		font-size: 1.3rem;
	}

	.media-viewer-nav--prev {
		left: 0.4rem;
	}

	.media-viewer-nav--next {
		right: 0.4rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.media-viewer,
	.media-viewer * {
		scroll-behavior: auto;
	}
}
