/*
 * Raindrop Linkblog — standalone page.
 * Loaded only on pages whose linkblog block has "standalone" on; the active
 * theme's styles are removed there. Palette and type voices are borrowed from
 * thejaymo.net: warm paper / navy, terminal green, signal amber, mono labels.
 */

:root {
	color-scheme: light;
	--lb-bg: #ffffff;
	--lb-fg: #111111;
	--lb-muted: #6b6a6a;
	--lb-surface: #f3f2f2;
	--lb-line: #e2e2e2;
	--lb-line-strong: #cfcfcf;
	--lb-primary: #368451;
	--lb-on-primary: #ffffff;
	--lb-accent: #b45309;
	--lb-selection: #bfe6cb;
	--lb-dots: rgb(17 17 17 / 0.11);

	--lb-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--lb-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
	--lb-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

	--lb-header-h: 5.375rem;
	/* Type scale borrowed from thejaymo.net (fluid between 320px and 1600px). */
	--lb-text-xxs: 0.6875rem;
	--lb-text-xs: 0.75rem;
	--lb-text-sm: clamp(0.8125rem, 0.813rem + ((1vw - 0.2rem) * 0.089), 0.875rem);
	--lb-text-base: clamp(1rem, 1rem + ((1vw - 0.2rem) * 0.09), 1.0625rem);
	--lb-text-md: clamp(1.125rem, 1.125rem + ((1vw - 0.2rem) * 0.179), 1.25rem);
	--lb-text-lg: clamp(1.375rem, 1.375rem + ((1vw - 0.2rem) * 0.536), 1.75rem);
	--lb-text-display: clamp(2.25rem, 2.25rem + ((1vw - 0.2rem) * 2.5), 4rem);
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--lb-bg: #020617;
	--lb-fg: #e5e7eb;
	--lb-muted: #9ca3af;
	--lb-surface: #111827;
	--lb-line: #1f2937;
	--lb-line-strong: #374151;
	--lb-primary: #4ade80;
	--lb-on-primary: #04140a;
	--lb-accent: #fb923c;
	--lb-selection: #064e3b;
	--lb-dots: rgb(229 231 235 / 0.08);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme]) {
		color-scheme: dark;
		--lb-bg: #020617;
		--lb-fg: #e5e7eb;
		--lb-muted: #9ca3af;
		--lb-surface: #111827;
		--lb-line: #1f2937;
		--lb-line-strong: #374151;
		--lb-primary: #4ade80;
		--lb-on-primary: #04140a;
		--lb-accent: #fb923c;
		--lb-selection: #064e3b;
		--lb-dots: rgb(229 231 235 / 0.08);
	}
}

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

html {
	background: var(--lb-bg);
	scroll-padding-top: calc(var(--lb-header-h) + 1rem);
}

body.lb-page {
	position: relative;
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: transparent;
	color: var(--lb-fg);
	font-family: var(--lb-sans);
	font-size: var(--lb-text-base);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* A faint dot field fading down the top of the page — a quiet nod to the
   ASCII field on thejaymo.net. */
body.lb-page::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 30rem;
	z-index: -1;
	background-image: radial-gradient(var(--lb-dots) 1px, transparent 1.4px);
	background-size: 14px 14px;
	-webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
	mask-image: linear-gradient(to bottom, #000 0%, transparent 100%);
	pointer-events: none;
}

::selection {
	background: var(--lb-selection);
}

.lb-page a {
	color: var(--lb-primary);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}
.lb-page a:hover {
	color: var(--lb-accent);
}
.lb-page :where(a, button):focus-visible {
	outline: 2px solid var(--lb-primary);
	outline-offset: 2px;
}

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

.lb-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.lb-skip {
	position: absolute;
	top: -100px;
	left: 1rem;
	z-index: 200;
	padding: 0.5rem 1rem;
	border-radius: 4px;
	background: var(--lb-primary);
	color: var(--lb-on-primary) !important;
	font-weight: 500;
	text-decoration: none;
}
.lb-skip:focus {
	top: 1rem;
}

.lb-wrap {
	width: 100%;
	max-width: 73.75rem;
	margin-inline: auto;
	padding-inline: clamp(1rem, calc(0.5714rem + 2.1429vw), 2.5rem);
}

/* ---------- Header ---------- */
.lb-header {
	position: sticky;
	top: 0;
	z-index: 100;
	border-bottom: 1px solid var(--lb-line);
	background: color-mix(in srgb, var(--lb-bg) 90%, transparent);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
}
.admin-bar .lb-header {
	top: 32px;
}
@media (max-width: 782px) {
	.admin-bar .lb-header {
		top: 46px;
	}
}
@media (max-width: 600px) {
	.admin-bar .lb-header {
		top: 0;
	}
}

.lb-header__inner {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	grid-template-areas: "brand nav tools";
	align-items: center;
	gap: 0 clamp(1rem, 3vw, 2rem);
	min-height: var(--lb-header-h);
}

.lb-page .lb-wordmark {
	grid-area: brand;
	display: inline-flex;
	align-items: baseline;
	color: var(--lb-fg);
	font-size: var(--lb-text-lg);
	font-weight: 700;
	letter-spacing: -0.02em;
	text-decoration: none;
	white-space: nowrap;
}
.lb-page .lb-wordmark:hover,
.lb-page .lb-wordmark__site,
.lb-page .lb-wordmark__site:hover {
	color: var(--lb-fg);
	text-decoration: none;
}
.lb-wordmark__tld {
	color: var(--lb-primary);
}
.lb-wordmark__site:hover .lb-wordmark__tld,
a.lb-wordmark:hover .lb-wordmark__tld {
	color: var(--lb-accent);
}
.lb-page .lb-wordmark__section {
	margin-left: 0.4rem;
	color: var(--lb-muted);
	font-family: var(--lb-mono);
	font-size: var(--lb-text-sm);
	font-weight: 400;
	letter-spacing: 0.02em;
	text-decoration: none;
}
.lb-page .lb-wordmark__section:hover {
	color: var(--lb-primary);
}

.lb-header__nav {
	grid-area: nav;
	justify-self: end;
	min-width: 0;
}
.lb-header__nav ul,
.lb-footer__nav ul {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
}
.lb-header__nav ul {
	gap: clamp(1rem, 2.2vw, 1.75rem);
}
.lb-page .lb-header__nav a {
	color: var(--lb-fg);
	font-size: var(--lb-text-base);
	text-decoration: none;
	white-space: nowrap;
}
.lb-page .lb-header__nav a:hover {
	color: var(--lb-primary);
}

.lb-header__tools {
	grid-area: tools;
	display: flex;
	align-items: center;
	gap: 0.75rem;
}
.lb-page .lb-header__rss {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	color: var(--lb-fg);
	font-family: var(--lb-mono);
	font-size: var(--lb-text-sm);
	letter-spacing: 0.08em;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}
.lb-page .lb-header__rss:hover {
	color: var(--lb-primary);
}
.lb-rss-icon {
	flex: none;
	color: var(--lb-accent);
}

.lb-theme-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid var(--lb-line-strong);
	border-radius: 4px;
	background: transparent;
	color: var(--lb-fg);
	font: inherit;
	font-size: var(--lb-text-sm);
	cursor: pointer;
}
.lb-theme-btn:hover {
	border-color: var(--lb-primary);
	color: var(--lb-primary);
}

/* Narrow screens: menu drops to a second, sideways-scrolling row. */
@media (max-width: 52rem) {
	:root {
		--lb-header-h: 6rem;
	}
	.lb-header__inner {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"brand tools"
			"nav nav";
		min-height: 0;
		padding-top: 0.625rem;
	}
	.lb-header__nav {
		justify-self: stretch;
		margin-inline: calc(-1 * clamp(1rem, calc(0.5714rem + 2.1429vw), 2.5rem));
		padding: 0.5rem clamp(1rem, calc(0.5714rem + 2.1429vw), 2.5rem) 0.75rem;
		overflow-x: auto;
		scrollbar-width: none;
	}
	.lb-header__nav::-webkit-scrollbar {
		display: none;
	}
}

/* ---------- Main ---------- */
.lb-main {
	flex: 1;
	padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3rem, 8vw, 6rem);
}

/* Sticky tag rail sits below the sticky header. */
.lb-page .rlb {
	--rlb-sticky-top: calc(var(--lb-header-h) + 1.5rem);
}
.lb-page .rlb-layout {
	scroll-margin-top: calc(var(--lb-header-h) + 1rem);
}

/* ---------- Footer ---------- */
.lb-footer {
	border-top: 1px solid var(--lb-line);
	color: var(--lb-muted);
}
.lb-footer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1.25rem 3rem;
	padding-block: 2.25rem;
}
.lb-footer__id p {
	margin: 0.35rem 0 0;
	font-family: var(--lb-serif);
	font-size: var(--lb-text-sm);
}
.lb-page .lb-wordmark--small {
	font-size: var(--lb-text-md);
}
.lb-footer__nav ul {
	flex-wrap: wrap;
	gap: 0.5rem 1.5rem;
}
.lb-page .lb-footer a {
	color: inherit;
}
.lb-page .lb-footer__nav a {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-family: var(--lb-mono);
	font-size: var(--lb-text-sm);
	letter-spacing: 0.08em;
	text-decoration: none;
	text-transform: uppercase;
}
.lb-page .lb-footer a:hover {
	color: var(--lb-primary);
}
