:root {
	--bg: #0f0f0f;
	--surface: #161616;
	--border: #272727;
	--text: #e8e4dc;
	--muted: #7a756c;
	--accent: #c8a96e;
	--accent-dim: #7a6540;
	--tag-bg: #1e1c18;
	--tag-active: #2a2318;
	--radius: 4px;
	--font-mono: "JetBrains Mono", "Fira Mono", "Cascadia Code", monospace;
	--font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

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

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

html {
	font-size: 16px;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	line-height: 1.6;
	min-height: 100vh;
}

/* ── Layout ── */
.shell {
	max-width: 780px;
	margin: 0 auto;
	padding: 0 1.5rem;
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

/* ── Offline banner ── */
#offline-banner {
	background: var(--tag-active);
	color: var(--accent);
	border-bottom: 1px solid var(--accent-dim);
	font-family: var(--font-mono);
	font-size: 0.72rem;
	line-height: 1.4;
	text-align: center;
	padding: 0.5rem 1rem;
	margin: 0 -1.5rem;
	position: sticky;
	top: 0;
	z-index: 1;
	height: 36px;
}

/* ── Header ── */
header {
	padding: 3.5rem 0 2.5rem;
	border-bottom: 1px solid var(--border);

	h1 {
		font-size: 1.6rem;
		font-weight: 600;
		letter-spacing: -0.02em;
		color: var(--text);
	}

	p {
		margin-top: 0.4rem;
		font-size: 0.9rem;
		color: var(--muted);
	}
}

.header-eyebrow {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 0.6rem;
}

/* ── Controls ── */
.controls {
	padding: 1.5rem 0;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	background: var(--bg);
	z-index: 1;
}

body:has(#offline-banner:not([hidden])) .controls {
	top: 36px;
}

.search-wrap {
	position: relative;

	svg {
		position: absolute;
		left: 0.75rem;
		top: 50%;
		transform: translateY(-50%);
		color: var(--muted);
		pointer-events: none;
	}
}

#search {
	width: 100%;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 0.875rem;
	padding: 0.55rem 0.75rem 0.55rem 2.2rem;
	outline: none;
	transition: border-color 0.15s;
	z-index: 1;

	&:focus {
		border-color: var(--accent-dim);
	}

	&::placeholder {
		color: var(--muted);
	}
}

/* ── Tags ── */
#tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}

.tag-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	align-items: center;
}

.tag-bar-label {
	font-family: var(--font-mono);
	font-size: 0.65rem;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--muted);
	margin-right: 0.2rem;
}

.tag {
	background: var(--tag-bg);
	border: 1px solid var(--border);
	border-color: var(--heat, var(--border));
	border-radius: 2px;
	color: var(--muted);
	cursor: pointer;
	font-family: var(--font-mono);
	font-size: 0.7rem;
	letter-spacing: 0.04em;
	padding: 0.25rem 0.6rem;
	transition:
		color 0.12s,
		border-color 0.12s,
		background 0.12s;
	user-select: none;

	&:hover {
		color: var(--text);
		border-color: var(--accent-dim);
	}

	&.active {
		background: var(--heat);
		color: var(--tag-bg);
	}
}

/* ── List ── */
.list-meta {
	padding: 1.25rem 0 0.75rem;
	font-size: 0.78rem;
	color: var(--muted);
	font-family: var(--font-mono);

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

#articles {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0;
}

/* ── Article card ── */
.article {
	border-bottom: 1px solid var(--border);
	padding: 1.25rem 0;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.5rem 1rem;
	align-items: start;
	transition: background 0.12s;
	content-visibility: auto;
	contain-intrinsic-size: auto 90px;

	&:first-child {
		border-top: 1px solid var(--border);
	}
}

.article-main {
	min-width: 0;
}

.article-title {
	font-size: 0.975rem;
	font-weight: 500;
	color: var(--text);
	text-decoration: none;
	letter-spacing: -0.01em;
	line-height: 1.4;
	display: inline;

	&:hover {
		color: var(--accent);
	}

	&::after {
		content: " ↗" / "";
		font-size: 0.75em;
		color: var(--muted);
		vertical-align: super;
	}
}

.article-notes {
	margin-top: 0.3rem;
	font-size: 0.82rem;
	color: var(--muted);
	line-height: 1.5;
}

.article-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin-top: 0.6rem;
}

.article-tag {
	background: var(--tag-bg);
	border: 1px solid var(--border);
	border-radius: 2px;
	color: var(--muted);
	cursor: pointer;
	font-family: var(--font-mono);
	font-size: 0.65rem;
	letter-spacing: 0.04em;
	padding: 0.15rem 0.45rem;
	transition:
		color 0.12s,
		border-color 0.12s;

	&:hover {
		color: var(--accent);
		border-color: var(--accent-dim);
	}

	&.active {
		color: var(--accent);
		border-color: var(--accent);
	}
}

.article-date {
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--text);
	white-space: nowrap;
	padding-top: 0.15rem;
}

/* ── Empty state ── */
.empty {
	padding: 3rem 0;
	text-align: center;
	color: var(--muted);
	font-size: 0.875rem;

	strong {
		color: var(--text);
		display: block;
		margin-bottom: 0.25rem;
	}

	.error {
		color: mediumvioletred;
	}
}

/* ── Footer ── */
footer {
	padding: 2.5rem 0 3rem;
	font-size: 0.75rem;
	color: var(--muted);
	font-family: var(--font-mono);
	position: sticky;
	bottom: 0;
	background: var(--bg);
	margin-top: auto;

	p {
		display: flex;
		align-items: center;
		gap: 4px;
	}

	a {
		color: var(--accent-dim);
		text-decoration: none;

		/* biome-ignore lint/style/noDescendingSpecificity: footer links and .tag never match the same element */
		&:hover {
			color: var(--accent);
		}
	}

	.love {
		color: hotpink;
		font-size: 16px;
		line-height: 1;
		letter-spacing: -1px;
		text-shadow: 0 -1px lightpink;
		display: inline-block;
	}
}

/* ── Skeletons ── */
@keyframes shimmer {
	from {
		background-position: -200% 0;
	}
	to {
		background-position: 200% 0;
	}
}

.skeleton {
	background: linear-gradient(
		90deg,
		var(--surface) 25%,
		var(--border) 50%,
		var(--surface) 75%
	);
	background-size: 200% 100%;
	animation: shimmer 1.4s ease infinite;
	border-radius: 3px;
}

.skeleton-meta {
	display: block;
	width: 9rem;
	height: 0.75rem;
}
.skeleton-title {
	height: 0.95rem;
	width: 70%;
	margin-bottom: 0.5rem;
}
.skeleton-notes {
	height: 0.75rem;
	width: 50%;
	margin-bottom: 0.65rem;
}
.skeleton-date {
	height: 0.65rem;
	width: 3.5rem;
}
.skeleton-tag {
	height: 1.1rem;
	border-radius: 2px;
	width: calc(100vw / 7);
}

.skeleton-tags-row {
	display: flex;
	gap: 0.3rem;
}
.skeleton-tags-bar {
	display: flex;
	gap: 0.4rem;
	flex-wrap: wrap;
	justify-content: space-around;
}

#tags-skeleton {
	display: none;
}

.article-skeleton {
	border-bottom: 1px solid var(--border);
	padding: 1.25rem 0;
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.5rem 1rem;
	align-items: start;
}

.skeleton-meta-count {
	display: inline-block;
	width: 2rem;
	height: 0.7rem;
	vertical-align: middle;
}

/* ── Highlight match ── */
mark {
	background: none;
	color: var(--accent);
	font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 520px) {
	header {
		padding: 2rem 0 1.5rem;

		h1 {
			font-size: 1.3rem;
		}
	}

	.article {
		grid-template-columns: 1fr;
	}

	.article-date {
		order: -1;
	}
}
