/* Spineline - "leaning spine" brand system.
   Raw brand tokens (--sl-*) + semantic aliases the components consume.
   Fern is reserved for good news and the single primary action (the "fern
   budget"); navigation, chrome, and neutral actions stay ink/surface. */

/* ---- self-hosted fonts (WOFF2, latin+latin-ext subset; no third-party origin) ---- */
@font-face {
	font-family: "Inter";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("/static/fonts/inter-400.woff2") format("woff2");
}
@font-face {
	font-family: "Inter";
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url("/static/fonts/inter-500.woff2") format("woff2");
}
@font-face {
	font-family: "Inter";
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url("/static/fonts/inter-600.woff2") format("woff2");
}
@font-face {
	font-family: "Bricolage Grotesque";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("/static/fonts/bricolage-700.woff2") format("woff2");
}

/* ---- raw brand tokens: light (base) ---- */
:root {
	--sl-bg: #faf7f2;
	--sl-surface: #ffffff;
	--sl-surface-2: #f3eee7;
	--sl-border: #e8e1d8;
	--sl-ink: #2b2622;
	--sl-sub: #6e645a;
	--sl-accent: #2f6b4f;
	--sl-accent-ui: #3e8e63;
	--sl-accent-soft: #d9ebdf;
	--sl-on-accent: #ffffff;
	--sl-warning: #8a6800;
	--sl-warning-soft: #f5e7c6;
	--sl-error: #b3392a;
	--sl-error-soft: #f7dcd6;
	--sl-shadow: 0 1px 2px rgba(43, 38, 34, 0.05), 0 8px 20px rgba(43, 38, 34, 0.06);
	/* notification type pairs (foreground on tint) + the unread row surface;
	   author release reuses the fern pair */
	--sl-type-series: #5a4a8a;
	--sl-type-series-soft: #e6e0f3;
	--sl-type-import: #4a6a8a;
	--sl-type-import-soft: #dce7f0;
	--sl-type-announcement: #8a5a2a;
	--sl-type-announcement-soft: #f5e6d3;
	--sl-surface-unread: #fcfbf8;
}

/* ---- dark palette: system default (unless an explicit light override) ---- */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--sl-bg: #201c19;
		--sl-surface: #2a2521;
		--sl-surface-2: #322c27;
		--sl-border: #3a342e;
		--sl-ink: #f2ede6;
		--sl-sub: #a89d91;
		--sl-accent: #7cc29a;
		--sl-accent-ui: #7cc29a;
		--sl-accent-soft: #2a3e32;
		--sl-on-accent: #201c19;
		--sl-warning: #e5b457;
		--sl-warning-soft: #3e3421;
		--sl-error: #f08a73;
		--sl-error-soft: #45291f;
		--sl-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.35);
		--sl-type-series: #c3b3ee;
		--sl-type-series-soft: #352d4a;
		--sl-type-import: #a6c3df;
		--sl-type-import-soft: #28363f;
		--sl-type-announcement: #e4b47e;
		--sl-type-announcement-soft: #40311f;
		--sl-surface-unread: #2f2924;
	}
}

/* ---- explicit dark override: wins regardless of OS ---- */
:root[data-theme="dark"] {
	--sl-bg: #201c19;
	--sl-surface: #2a2521;
	--sl-surface-2: #322c27;
	--sl-border: #3a342e;
	--sl-ink: #f2ede6;
	--sl-sub: #a89d91;
	--sl-accent: #7cc29a;
	--sl-accent-ui: #7cc29a;
	--sl-accent-soft: #2a3e32;
	--sl-on-accent: #201c19;
	--sl-warning: #e5b457;
	--sl-warning-soft: #3e3421;
	--sl-error: #f08a73;
	--sl-error-soft: #45291f;
	--sl-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.35);
	--sl-type-series: #c3b3ee;
	--sl-type-series-soft: #352d4a;
	--sl-type-import: #a6c3df;
	--sl-type-import-soft: #28363f;
	--sl-type-announcement: #e4b47e;
	--sl-type-announcement-soft: #40311f;
	--sl-surface-unread: #2f2924;
}

/* ---- semantic aliases + scales (defined once; follow the raw tokens) ---- */
:root {
	--type-author: var(--sl-accent);
	--type-author-soft: var(--sl-accent-soft);
	--type-series: var(--sl-type-series);
	--type-series-soft: var(--sl-type-series-soft);
	--type-import: var(--sl-type-import);
	--type-import-soft: var(--sl-type-import-soft);
	--type-announcement: var(--sl-type-announcement);
	--type-announcement-soft: var(--sl-type-announcement-soft);
	--surface-unread: var(--sl-surface-unread);
	--bg: var(--sl-bg);
	--surface: var(--sl-surface);
	--surface-2: var(--sl-surface-2);
	--border: var(--sl-border);
	--ink: var(--sl-ink);
	--sub: var(--sl-sub);
	--accent: var(--sl-accent);
	--accent-ui: var(--sl-accent-ui);
	--accent-soft: var(--sl-accent-soft);
	--on-accent: var(--sl-on-accent);
	--danger: var(--sl-error);
	--danger-soft: var(--sl-error-soft);
	--warning: var(--sl-warning);
	--warning-soft: var(--sl-warning-soft);
	--shadow: var(--sl-shadow);

	--radius-card: 14px;
	--radius-control: 12px;
	--radius-pill: 99px;

	/* Brief motion: short enough that no interaction waits on it. Nothing may
	   depend on an animation - whatever it communicates is also said by
	   something static - so dropping it under prefers-reduced-motion costs no
	   information. */
	--motion-brief: 120ms;

	/* 4px spacing grid */
	--space-1: 0.25rem;
	--space-2: 0.5rem;
	--space-3: 0.75rem;
	--space-4: 1rem;
	--space-5: 1.5rem;
	--space-6: 2rem;
	--space-7: 3rem;

	--font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
	--font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	font-family: var(--font-ui);
	color-scheme: light dark;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	line-height: 1.5;
	font-size: 16px;
	-webkit-text-size-adjust: 100%;
	/* column layout so the site footer sits at the end of every page */
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

h1, h2, h3 {
	font-family: var(--font-display);
	letter-spacing: -0.01em;
}

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

a:hover {
	text-decoration: underline;
}

/* ---- shell + top bar ---- */
.ui-shell {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
}

.ui-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2) var(--space-3);
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--border);
	background: color-mix(in srgb, var(--surface) 88%, transparent);
	position: sticky;
	top: 0;
	backdrop-filter: blur(8px);
	z-index: 20;
}

/* Mobile: brand on the left, hamburger and user pill grouped on the right. */
.ui-topbar .ui-brand {
	margin-right: auto;
}

.ui-brand a {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.05rem;
	color: var(--ink);
	letter-spacing: -0.02em;
}

.ui-brand a:hover {
	text-decoration: none;
}

.ui-brand-logo {
	display: inline-flex;
}

.ui-brand-logo svg {
	display: block;
}

/* the leaning "new arrival" spine is the one fern touch in the mark */
.ui-brand-leaning {
	stroke: var(--accent-ui);
}

/* ---- navigation: mobile-first collapsible menu ----
   A CSS-only checkbox toggle (not <details>): nav visibility is pure author
   CSS, so the desktop "always open" case can't be defeated by <details> UA
   content-hiding (::details-content / content-visibility). */
/* Not a positioning context on mobile: the dropdown is positioned against the
   full-width top bar (position: sticky) so it can span the whole screen. */
.ui-nav-disclosure {
	display: inline-flex;
}

/* the toggle checkbox: visually hidden but focusable for keyboard users */
.ui-nav-checkbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.ui-nav-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: var(--radius-control);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--ink);
	cursor: pointer;
}

.ui-nav-toggle svg {
	width: 22px;
	height: 22px;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	fill: none;
}

.ui-nav-checkbox:checked + .ui-nav-toggle {
	background: var(--surface-2);
}

.ui-nav-checkbox:focus-visible + .ui-nav-toggle {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

/* Mobile: a full-width dropdown that drops straight below the top bar. */
.ui-nav {
	display: none;
	flex-direction: column;
	gap: var(--space-1);
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	padding: var(--space-3) var(--space-4);
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow);
	z-index: 30;
}

.ui-nav-checkbox:checked ~ .ui-nav {
	display: flex;
}

.ui-nav-link {
	padding: 0.55rem 0.7rem;
	border-radius: var(--radius-control);
	color: var(--sub);
	font-size: 0.95rem;
	font-weight: 600;
	border: 1px solid transparent;
}

/* sign-out is a submit button styled as a nav link */
button.ui-nav-link {
	appearance: none;
	background: none;
	cursor: pointer;
	font: inherit;
	font-weight: 600;
	text-align: left;
	width: 100%;
}

.ui-nav-link:hover {
	background: var(--surface-2);
	color: var(--ink);
	text-decoration: none;
}

/* Active section: neutral emphasis - NOT fern (fern is for good news). */
.ui-nav-link.is-active {
	background: var(--surface-2);
	color: var(--ink);
	border-color: var(--border);
}

.ui-nav form {
	margin-top: var(--space-1);
}

/* Desktop: dissolve the toggle and show the nav inline (pure author CSS). */
@media (min-width: 761px) {
	.ui-nav-checkbox,
	.ui-nav-toggle {
		display: none;
	}

	.ui-nav,
	.ui-nav-checkbox:checked ~ .ui-nav {
		display: flex;
		position: static;
		flex-direction: row;
		align-items: center;
		flex-wrap: wrap;
		min-width: 0;
		padding: 0;
		gap: var(--space-2);
		background: none;
		border: none;
		box-shadow: none;
		z-index: auto;
	}

	.ui-nav form {
		margin-top: 0;
	}

	.ui-nav button.ui-nav-link {
		width: auto;
	}
}

/* ---- main + sections ---- */
.ui-main {
	width: min(980px, 92vw);
	margin: var(--space-6) auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}

.ui-section-header h1,
.ui-auth-card h1 {
	margin: 0;
	font-size: clamp(1.6rem, 4vw, 2.1rem);
	letter-spacing: -0.02em;
}

/* the lowercase wordmark, per brand */
.ui-wordmark {
	font-size: clamp(2rem, 6vw, 2.8rem);
	letter-spacing: -0.02em;
}

.ui-section-header p {
	margin: var(--space-1) 0 0;
	color: var(--sub);
}

.ui-stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.ui-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
	gap: var(--space-4);
}

/* ---- cards: elevation via warm border first, soft shadow second ---- */
.ui-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	padding: var(--space-4);
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.ui-card h2,
.ui-card h3 {
	margin: 0;
	font-size: 1.05rem;
}

.ui-row {
	display: flex;
	gap: var(--space-2);
	align-items: center;
	flex-wrap: wrap;
}

.ui-muted {
	color: var(--sub);
}

/* ---- media cards: generated cover beside a text body ---- */
.ui-card--media {
	flex-direction: row;
	align-items: flex-start;
	gap: var(--space-4);
}

.ui-media__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	min-width: 0;
	flex: 1;
}

/*
 * Generated book cover: a 2:3 branded panel rendered from book data (no stored
 * image). Cover tints are CONTENT, not chrome, so they range beyond the fern
 * accent without touching the fern budget. Contrast is guaranteed by pinning
 * background/foreground lightness per theme and varying only hue per tint (see
 * .cover--tint-*), so every tint clears AA in both light and dark.
 */
.cover {
	--cover-hue: 145;
	--cover-sat: 40%;
	--cover-bg-l: 86%;
	--cover-fg-l: 29%;
	--cover-w: 116px;
	position: relative;
	flex: 0 0 auto;
	width: var(--cover-w);
	aspect-ratio: 2 / 3;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: var(--space-2);
	padding: var(--space-3);
	border-radius: var(--radius-control);
	border: 1px solid rgba(0, 0, 0, 0.06);
	background: hsl(var(--cover-hue) var(--cover-sat) var(--cover-bg-l));
	color: hsl(var(--cover-hue) var(--cover-sat) var(--cover-fg-l));
}

.cover__mark {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 42%;
	height: auto;
	transform: translate(-50%, -50%);
	opacity: 0.1;
	pointer-events: none;
}

.cover__title {
	position: relative;
	margin: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 0.95rem;
	line-height: 1.15;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	overflow: hidden;
}

.cover__author {
	position: relative;
	margin: 0;
	font-family: var(--font-ui);
	font-size: 0.72rem;
	line-height: 1.2;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
}

.cover--sm {
	--cover-w: 76px;
	padding: var(--space-2);
}

/* Hotlinked external cover: an <object> sized like the generated panel; the
 * image fills it, and the nested generated cover shows if the image fails to
 * load (no JavaScript, no broken-image icon). */
.cover-hotlink {
	--cover-w: 116px;
	flex: 0 0 auto;
	display: block;
	width: var(--cover-w);
	aspect-ratio: 2 / 3;
	border-radius: var(--radius-control);
	object-fit: cover;
	background: none;
}

.cover-hotlink--sm {
	--cover-w: 76px;
}

/* Book metadata: classification tags, external ratings, and blurb. Ambient
 * chrome (neutral ink/surface), never fern - fern stays reserved for CTAs. */
.tag-list {
	list-style: none;
	margin: var(--space-2) 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1);
}

.tag {
	font-family: var(--font-ui);
	font-size: 0.72rem;
	line-height: 1;
	padding: 0.28em 0.6em;
	border-radius: var(--radius-pill);
	background: var(--surface-2);
	color: var(--sub);
	border: 1px solid var(--border);
}

.book-card__ratings {
	font-size: 0.78rem;
}

.book-card__subtitle {
	margin: 0;
	font-size: 0.9rem;
	font-style: italic;
	color: var(--sub);
}

.book-card__editions {
	margin: var(--space-1) 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.78rem;
}

.book-card__blurb {
	margin: var(--space-2) 0 0;
	font-size: 0.85rem;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	overflow: hidden;
}

.cover--sm .cover__title {
	font-size: 0.72rem;
	-webkit-line-clamp: 3;
	line-clamp: 3;
}

.cover--sm .cover__author {
	font-size: 0.62rem;
	-webkit-line-clamp: 1;
	line-clamp: 1;
}

/*
 * Curated cover-tint palette. APPEND-ONLY: never reorder or remove an entry, or
 * existing books (selected by a stable hash of book id) would change color.
 * Only the hue varies; lightness/saturation are pinned per theme above and in
 * the dark overrides below, which is what keeps text legible for every tint.
 */
.cover--tint-0 { --cover-hue: 145; }
.cover--tint-1 { --cover-hue: 200; }
.cover--tint-2 { --cover-hue: 262; }
.cover--tint-3 { --cover-hue: 22; }
.cover--tint-4 { --cover-hue: 96; }
.cover--tint-5 { --cover-hue: 330; }
.cover--tint-6 { --cover-hue: 174; }
.cover--tint-7 { --cover-hue: 42; }
.cover--tint-8 { --cover-hue: 292; }
.cover--tint-9 { --cover-hue: 8; }
.cover--tint-10 { --cover-hue: 224; }
.cover--tint-11 { --cover-hue: 118; }

/* Dark theme: flip the pinned lightnesses (three-layer cascade, matching tokens). */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .cover {
		--cover-sat: 30%;
		--cover-bg-l: 26%;
		--cover-fg-l: 84%;
		border-color: rgba(255, 255, 255, 0.06);
	}
}

:root[data-theme="dark"] .cover {
	--cover-sat: 30%;
	--cover-bg-l: 26%;
	--cover-fg-l: 84%;
	border-color: rgba(255, 255, 255, 0.06);
}

/* ---- anchored overlays: an open panel says which control opened it ----
   Three cues, in order of how much work they do. The panel MEETS its trigger
   (no gap to float in), the trigger stays marked for as long as the panel is
   open, and - where motion is welcome - the panel grows as it appears. Only
   the first two are load-bearing: the animation helps for one moment, and not
   at all for a reader who has asked for less of it.

   The mark is neutral ink/surface, not fern: an open menu is chrome, not good
   news. It reuses the surface-2 + --sub emphasis the active filter chip and
   the active nav item already use, so "held open" reads like every other
   neutral emphasis in the product. It is driven from each panel's own state,
   so no markup carries it. */
.bc-actions:has(.bc-menu:popover-open) .bc-menutoggle,
.ui-user-checkbox:checked + .ui-user-pill,
.search-genre-checkbox:checked + .search-genre-summary {
	background: var(--surface-2);
	border-color: var(--sub);
}

/* ---- chips: fern only for good-news states; others stay neutral ---- */
.ui-chip {
	display: inline-flex;
	align-items: center;
	padding: 0.2rem 0.6rem;
	border-radius: var(--radius-pill);
	font-size: 0.78rem;
	font-weight: 600;
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--sub);
}

/* good news: finished a book, following, out now, import completed, invite joined */
.ui-chip-read,
.ui-chip-following,
.ui-chip-release,
.ui-chip-completed,
.ui-chip-joined,
.ui-chip-sending {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 40%, transparent);
	color: var(--accent);
}

/* neutral / in-progress / seen / unread / want-to-read: ink, not fern */
.ui-chip-reading,
.ui-chip-seen,
.ui-chip-unread,
.ui-chip-pending,
.ui-chip-want-to-read {
	background: var(--surface-2);
	border-color: var(--border);
	color: var(--ink);
}

/* a failed import: the one bad-news chip */
.ui-chip-failed {
	background: var(--danger-soft);
	border-color: color-mix(in srgb, var(--danger) 45%, transparent);
	color: var(--danger);
}

/* source label on a staging result: neutral metadata, quieter than a chip */
.ui-chip-source {
	background: transparent;
	border-color: var(--border);
	color: var(--sub);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	font-size: 0.7rem;
}

/* search: the page query form (input grows) and the compact top-bar form */
.ui-search {
	display: flex;
	gap: var(--space-2);
	align-items: center;
}

.ui-search input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
}

/* Desktop: the brand's auto margin gives way to space-between, so the nav
   sits centered between the brand and the user pill. */
@media (min-width: 761px) {
	.ui-topbar .ui-brand {
		margin-right: 0;
	}
}

.ui-search input[type="search"] {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	min-height: 40px;
	font-size: 1rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
}

.ui-search input[type="search"]:focus-visible {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.ui-search input[type="search"]:disabled {
	background: var(--surface-2);
	color: var(--sub);
	cursor: not-allowed;
}

/* ---- buttons ----
   The primary call-to-action carries the fern accent (Sign in, Save, Follow) -
   the page's colour highlight. Secondary and ghost variants stay neutral so the
   fern reads as emphasis rather than wallpaper; navigation and chrome stay
   ink/surface. */
.ui-button {
	appearance: none;
	border: 1px solid transparent;
	padding: 0.5rem 0.8rem;
	min-height: 40px;
	border-radius: var(--radius-control);
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: 0.9rem;
	cursor: pointer;
	background: var(--accent);
	color: var(--on-accent);
}

.ui-button:hover {
	filter: brightness(1.04);
}

/* alias: an explicitly good-news / primary action (same fern fill) */
.ui-button-accent {
	background: var(--accent);
	color: var(--on-accent);
}

.ui-button-secondary {
	background: var(--surface-2);
	color: var(--ink);
	border-color: var(--border);
}

.ui-button-ghost {
	background: transparent;
	color: var(--sub);
	border-color: var(--border);
}

/* ---- feedback banners ---- */
.ui-feedback {
	padding: 0.7rem 0.85rem;
	border-radius: var(--radius-control);
	font-size: 0.92rem;
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--ink);
}

.ui-feedback-error {
	border-color: color-mix(in srgb, var(--danger) 45%, transparent);
	background: var(--danger-soft);
	color: var(--danger);
}

.ui-feedback-success {
	border-color: color-mix(in srgb, var(--accent) 45%, transparent);
	background: var(--accent-soft);
	color: var(--accent);
}

/* ---- did-not-finish prompts (undo re-follow, cascade clear) ----
   Neutral by design: these are calm, reversible offers, not good news, so they
   stay on surface/ink and never spend the fern accent. */
.ui-prompt {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
	padding: 0.55rem 0.7rem;
	border-radius: var(--radius-control);
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--sub);
	font-size: 0.92rem;
}

.ui-prompt form {
	margin: 0;
}

/* ---- empty state ---- */
.ui-empty {
	padding: var(--space-5);
	background: var(--surface);
	border: 1px dashed var(--border);
	border-radius: var(--radius-card);
	text-align: left;
}

.ui-empty-art {
	display: block;
	margin-bottom: var(--space-2);
	opacity: 0.9;
}

.ui-empty h2 {
	margin: 0;
	font-size: 1.05rem;
}

.ui-empty p {
	margin: var(--space-1) 0 0;
}

.ui-empty-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

/* ---- getting-started checklist ---- */
.ui-checklist-head {
	justify-content: space-between;
}

.ui-checklist-steps {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--space-3);
}

.ui-checklist-step {
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
}

/* An open step's circle borrows the secondary text colour rather than the
   hairline border token: the border tone all but vanishes against the card
   surface in dark mode, and the empty circle is the "not done yet" signal. */
.ui-checklist-mark {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.25rem;
	height: 1.25rem;
	margin-top: 0.1rem;
	border: 2px solid var(--sub);
	border-radius: 50%;
}

/* Fern budget: a completed step is good news, so only its checkmark takes
   the accent; open steps stay neutral chrome. */
.ui-checklist-step.is-done .ui-checklist-mark {
	border-color: var(--accent-ui);
	color: var(--accent-ui);
}

.ui-checklist-step.is-done .ui-checklist-label {
	color: var(--sub);
}

.ui-checklist-body {
	display: grid;
	gap: 0.1rem;
}

.ui-checklist-label {
	font-weight: 600;
}

/* Dismiss is a bare X icon in the card's top-right corner. */
.ui-checklist-dismiss {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	padding: 0;
	border: 0;
	border-radius: var(--radius-control, 6px);
	background: transparent;
	color: var(--sub);
	cursor: pointer;
}

.ui-checklist-dismiss:hover,
.ui-checklist-dismiss:focus-visible {
	color: var(--ink);
	background: var(--surface-2);
}

/* ---- auth pages: brand motif above a centered card ---- */
.ui-auth-shell {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: var(--space-6) var(--space-4) var(--space-7);
	gap: var(--space-4);
}

.ui-auth-header {
	text-align: center;
	max-width: 44ch;
}

.ui-auth-header h1 {
	margin: 0;
	font-size: clamp(1.8rem, 5vw, 2.4rem);
	letter-spacing: -0.02em;
}

.ui-auth-header p {
	margin: var(--space-2) 0 0;
}

/* small spine-cluster motif: three ink-adjacent spines + the leaning fern one */
.ui-auth-spines {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	height: 52px;
}

.ui-auth-spine {
	width: 13px;
	border-radius: 3px 3px 1px 1px;
	background: var(--ink);
}

.ui-auth-spine-1 {
	height: 44px;
}

.ui-auth-spine-2 {
	height: 34px;
	background: color-mix(in srgb, var(--ink) 55%, var(--bg));
}

.ui-auth-spine-3 {
	height: 50px;
	background: color-mix(in srgb, var(--ink) 75%, var(--bg));
}

.ui-auth-spine-lean {
	height: 42px;
	background: var(--accent);
	transform: rotate(9deg);
	transform-origin: bottom left;
	margin-left: 5px;
}

.ui-auth-card {
	width: min(440px, 100%);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	padding: var(--space-5);
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.ui-auth-card form {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.ui-auth-card label {
	font-size: 0.9rem;
	color: var(--sub);
	font-weight: 600;
}

.ui-auth-card input {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.6rem 0.7rem;
	min-height: 42px;
	font-size: 1rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
}

.ui-auth-card input:focus-visible,
.ui-button:focus-visible,
.ui-nav-link:focus-visible,
.ui-nav-toggle:focus-visible {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.ui-auth-alt {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
	font-size: 0.92rem;
	color: var(--sub);
}

/* ---- auth email tabs (Email link / Password) ----
   Radio-driven no-JS tabs: hidden radios + styled labels + sibling selectors,
   the same pattern as the hamburger and providers toggles (radios because the
   states are exclusive). Tabs stay neutral ink/surface per the fern budget -
   the fern emphasis belongs to the panel's primary action button. */
.ui-auth-tabs {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.ui-auth-tab-radio {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.ui-auth-tablist {
	display: flex;
	gap: var(--space-1);
	padding: 4px;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	background: var(--bg);
}

.ui-auth-tab {
	flex: 1;
	text-align: center;
	padding: 0.45rem 0.6rem;
	border-radius: calc(var(--radius-control) - 3px);
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--sub);
	cursor: pointer;
}

.ui-auth-tab-radio-email:checked ~ .ui-auth-tablist .ui-auth-tab-email,
.ui-auth-tab-radio-password:checked ~ .ui-auth-tablist .ui-auth-tab-password {
	background: var(--surface);
	color: var(--ink);
	box-shadow: var(--shadow);
}

.ui-auth-tab-radio-email:focus-visible ~ .ui-auth-tablist .ui-auth-tab-email,
.ui-auth-tab-radio-password:focus-visible ~ .ui-auth-tablist .ui-auth-tab-password {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.ui-auth-panel {
	display: none;
	flex-direction: column;
	gap: var(--space-2);
}

.ui-auth-tab-radio-email:checked ~ .ui-auth-panel-email,
.ui-auth-tab-radio-password:checked ~ .ui-auth-panel-password {
	display: flex;
}

.ui-auth-forgot {
	margin: 0;
	font-size: 0.9rem;
	text-align: right;
}

/* ---- email auth interstitials ---- */
.ui-auth-interstitial {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.ui-auth-interstitial p {
	margin: 0;
}

/* ---- theme control (settings) ---- */
.ui-theme-options {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.ui-theme-options label {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	padding: 0.4rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	cursor: pointer;
}

/* ---- preferred languages (settings): a bounded, scrollable checkbox grid ---- */
.ui-language-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
	gap: var(--space-1) var(--space-2);
	max-height: 16rem;
	overflow-y: auto;
	padding: var(--space-2);
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
}

.ui-language-grid label {
	cursor: pointer;
}

/* ---- ratings: five half-fill stars; fern = a rating you gave is good news ----
   Stars are CSS clip-path polygons, not font glyphs, so left and right halves
   compose into identical shapes on every platform.
   Display: each .ui-star is a muted star-shaped box; the fern fill is an
   absolute overlay clipped to 0/50%/100% width by the parent clip-path.
   Input: ten radios rendered 10 -> 1 inside a row-reversed flex container, so
   the general-sibling selector fills the checked half-star and every half
   below it (DOM-after = visually-left). Odd values are a star's left half;
   even values are the right half (a full-star shape shifted left inside an
   overflow-hidden label). Radios stay keyboard-operable and the form submits
   without JavaScript. Assistive and tooltip text speaks in stars ("3.5
   stars"); the 1-10 integer is internal. */
.ui-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.ui-stars {
	display: inline-flex;
	gap: 0.12em;
}

.ui-star {
	position: relative;
	width: 1em;
	height: 1em;
	background: color-mix(in srgb, var(--sub) 35%, transparent);
	clip-path: polygon(50% 2%, 61% 36%, 98% 36%, 68% 58%, 79% 92%, 50% 71%, 21% 92%, 32% 58%, 2% 36%, 39% 36%);
}

.ui-star::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	width: 0;
	background: var(--accent);
}

.ui-star-full::after {
	width: 100%;
}

.ui-star-half::after {
	width: 50%;
}

.ui-rate {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.ui-rate-form {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
}

/* the explicit save button exists only for the no-JS fallback; an enhanced
   client saves on click via the form's on-change binding */
@media (scripting: enabled) {
	.ui-rate-save {
		display: none;
	}
}

.ui-rate-stars {
	display: inline-flex;
	align-items: center;
	flex-direction: row-reverse;
	font-size: 1.35rem;
}

.ui-rate-stars input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.ui-rate-half {
	position: relative;
	width: 0.5em;
	height: 1em;
	overflow: hidden;
	cursor: pointer;
	color: color-mix(in srgb, var(--sub) 35%, transparent);
}

.ui-rate-half::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 1em;
	height: 1em;
	background: currentColor;
	clip-path: polygon(50% 2%, 61% 36%, 98% 36%, 68% 58%, 79% 92%, 50% 71%, 21% 92%, 32% 58%, 2% 36%, 39% 36%);
}

.ui-rate-right::before {
	left: -0.5em;
}

/* a right half closes a star: small gap before the next one */
.ui-rate-right {
	margin-right: 0.12em;
}

/* the checked half-star and every half below it take the fern fill. Each
   label wraps its own radio (no id pairing, so two cards for one work cannot
   collide), which is why these read the checked state through :has() rather
   than as an input sibling. */
.ui-rate-half:has(input:checked),
.ui-rate-half:has(input:checked) ~ .ui-rate-half {
	color: var(--accent);
}

/* while previewing a new rating, the saved one recedes to the soft shade... */
.ui-rate-stars:hover .ui-rate-half:has(input:checked),
.ui-rate-stars:hover .ui-rate-half:has(input:checked) ~ .ui-rate-half {
	color: var(--accent-soft);
}

/* ...and the hovered half plus everything below it takes full fern (the
   extra :hover on the container outranks the soft rule above) */
.ui-rate-stars:hover .ui-rate-half:hover,
.ui-rate-stars:hover .ui-rate-half:hover ~ .ui-rate-half {
	color: var(--accent);
}

.ui-rate-half:has(input:focus-visible) {
	outline: 2px solid var(--accent-ui);
	outline-offset: 1px;
	border-radius: 2px;
}

/* ---- top-bar user menu: a CSS-only checkbox disclosure (same pattern as the
   hamburger). The pill shows the fern-wash avatar + name; the panel holds
   Preferences, admin links, and sign-out. Fern here is the avatar wash only. ---- */
.ui-user {
	position: relative;
	display: inline-flex;
}

.ui-user-checkbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.ui-user-pill {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	padding: 4px 10px 4px 4px;
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--ink);
	font-weight: 500;
	font-size: 0.9rem;
	cursor: pointer;
	min-height: 40px;
}

.ui-user-pill:hover {
	background: var(--surface-2);
}

.ui-user-checkbox:focus-visible + .ui-user-pill {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.ui-avatar {
	width: 30px;
	height: 30px;
	border-radius: var(--radius-pill);
	background: var(--accent-soft);
	color: var(--accent);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 600;
	font-size: 0.85rem;
	flex: none;
}

/* the name hides on narrow screens; the avatar circle stays */
.ui-user-name {
	display: none;
	max-width: 10rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media (min-width: 761px) {
	.ui-user-name {
		display: inline;
	}
}

.ui-user-chevron {
	display: inline-flex;
	transition: transform 0.2s;
	color: var(--sub);
}

.ui-user-chevron svg {
	width: 14px;
	height: 14px;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	fill: none;
}

.ui-user-checkbox:checked + .ui-user-pill .ui-user-chevron {
	transform: rotate(180deg);
}

.ui-user-menu {
	display: none;
	position: absolute;
	right: 0;
	/* Meets its pill (see the anchored-overlay origin rule). */
	top: 100%;
	min-width: 12rem;
	flex-direction: column;
	gap: 2px;
	padding: var(--space-2);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow);
	z-index: 40;
}

.ui-user-checkbox:checked ~ .ui-user-menu {
	display: flex;
}

.ui-user-item {
	display: block;
	padding: 0.55rem 0.7rem;
	border-radius: var(--radius-control);
	color: var(--ink);
	font-size: 0.92rem;
	font-weight: 500;
	text-align: left;
}

.ui-user-item:hover {
	background: var(--surface-2);
	text-decoration: none;
}

.ui-user-item.is-active {
	background: var(--surface-2);
}

.ui-user-menu form {
	margin: 0;
}

button.ui-user-item {
	appearance: none;
	background: none;
	border: none;
	cursor: pointer;
	font: inherit;
	font-weight: 500;
	width: 100%;
}

.ui-user-signout {
	color: var(--danger);
}

.ui-user-signout:hover {
	background: var(--danger-soft);
}

/* ---- unseen-notification indicator on the Notifications nav item ---- */
.ui-nav-link {
	position: relative;
}

.ui-nav-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: var(--radius-pill);
	background: var(--accent-ui);
	margin-left: 6px;
	vertical-align: super;
}

/* ---- site footer (every page) ---- */
.ui-footer {
	margin-top: auto;
	border-top: 1px solid var(--border);
	background: var(--bg);
}

.ui-footer-inner {
	width: min(980px, 92vw);
	margin: 0 auto;
	padding: var(--space-4) 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
	font-size: 0.85rem;
	color: var(--sub);
}

.ui-footer-brand {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-family: var(--font-display);
	font-weight: 700;
	color: var(--ink);
	letter-spacing: -0.02em;
}

.ui-footer-brand svg {
	width: 20px;
	height: 20px;
}

.ui-footer-links {
	display: flex;
	gap: var(--space-4);
}

/* placeholder links: visibly inert, with no page behind them */
.ui-footer-links span {
	cursor: default;
	opacity: 0.75;
}

/* ---- auth provider buttons + no-JS overflow expander ---- */
.ui-provider-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.ui-provider {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	padding: 0.65rem;
	border-radius: var(--radius-control);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--ink);
	font-weight: 600;
	font-size: 0.95rem;
}

.ui-provider:hover {
	background: var(--surface-2);
	text-decoration: none;
}

.ui-provider-badge {
	width: 20px;
	height: 20px;
	border-radius: var(--radius-pill);
	background: var(--surface-2);
	color: var(--sub);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.7rem;
	font-weight: 700;
	flex: none;
}

.ui-providers-checkbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.ui-providers-more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-1);
	padding: var(--space-1);
	color: var(--sub);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
}

.ui-providers-more:hover {
	color: var(--ink);
}

.ui-providers-checkbox:focus-visible ~ .ui-providers-more {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.ui-provider-overflow {
	display: none;
	flex-direction: column;
	gap: var(--space-2);
}

.ui-providers-checkbox:checked ~ .ui-provider-overflow {
	display: flex;
}

.ui-providers-checkbox:checked ~ .ui-providers-more .ui-user-chevron {
	transform: rotate(180deg);
}

/* ---- divider between provider buttons and the login form ---- */
.ui-divider {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	color: var(--sub);
	font-size: 0.78rem;
	font-weight: 500;
}

.ui-divider::before,
.ui-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--border);
}

.ui-auth-note {
	margin: 0;
	text-align: center;
	font-size: 0.82rem;
}

/* consent line on every door that creates an account */
.ui-auth-consent {
	margin: 0;
	font-size: 0.82rem;
	line-height: 1.5;
	text-align: center;
}

.ui-auth-consent a {
	color: inherit;
	text-decoration: underline;
}

/* ---- legal pages (Privacy Policy, Terms of Service) ----
   Static policy text: a reading measure, a numbered-heading rhythm, and
   roomy lists. Colors come from the semantic tokens, so both themes apply. */
.ui-legal {
	width: min(68ch, 100%);
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
	line-height: 1.65;
	color: var(--ink);
}

.ui-legal-header h1 {
	margin: 0 0 var(--space-1);
	font-size: clamp(1.8rem, 4.5vw, 2.4rem);
	letter-spacing: -0.02em;
}

.ui-legal-effective {
	margin: 0;
	font-size: 0.9rem;
}

.ui-legal section {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.ui-legal h2 {
	margin: 0;
	font-size: 1.15rem;
	letter-spacing: -0.01em;
}

.ui-legal p {
	margin: 0;
}

.ui-legal ul {
	margin: 0;
	padding-left: 1.2rem;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.ui-legal a {
	color: inherit;
	text-decoration: underline;
}

/* ---- the guide (/help) ----
   The article beside the guide sidebar: an eyebrow (the section), the page
   title, the summary as the lead, then the rendered markdown, each "##"
   section a card (help.wrapSections; the heading's classes ride on the
   card: "callout" is the fern-tinted card, "nots" the crossed rows), the
   Next card. Colors come from the semantic tokens, so
   both themes apply. */
.help-article {
	gap: 20px;
}

.help-body {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.help-head {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.help-eyebrow {
	margin: 0;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--accent-ui);
}

.help-title {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.5rem;
	letter-spacing: -0.02em;
}

.help-lead {
	margin: 0;
	max-width: 640px;
	font-size: 1rem;
	line-height: 1.55;
	color: var(--sub);
}

.help-prose {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.help-prose a {
	color: var(--accent);
}

.help-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 20px 18px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--surface);
	font-size: 0.906rem;
	line-height: 1.6;
}

.help-card > * {
	margin: 0;
}

.help-card h2,
.help-card h3 {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.0625rem;
	letter-spacing: normal;
}

.help-card h4 {
	margin-top: 6px;
	font-size: 0.95rem;
}

.help-card ul {
	padding-left: 1.2rem;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.help-card blockquote {
	padding-left: var(--space-3);
	border-left: 3px solid var(--border);
	color: var(--sub);
}

.help-card code {
	font-size: 0.9em;
	padding: 1px 5px;
	border-radius: 5px;
	background: var(--surface-2);
}

.help-card table {
	border-collapse: collapse;
	width: 100%;
}

.help-card th,
.help-card td {
	text-align: left;
	padding: var(--space-1) var(--space-2);
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}

/* The fern-tinted card: the page's summary in a few lines. */
.help-card.callout {
	gap: 8px;
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent-ui) 25%, var(--accent-soft));
}

.help-card.callout h3 {
	color: var(--accent);
}

/* An ordered list is a set of numbered tiles, each item's leading bold text
   its title; two columns once the card has room. */
.help-card ol {
	list-style: none;
	padding: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 12px;
	margin-top: 6px;
	counter-reset: help-step;
}

.help-card ol > li {
	position: relative;
	counter-increment: help-step;
	padding: 16px 16px 16px 60px;
	border: 1px solid color-mix(in srgb, var(--border) 60%, var(--bg));
	border-radius: 12px;
	background: var(--bg);
	font-size: 0.844rem;
	line-height: 1.5;
	color: var(--sub);
}

.help-card ol > li::before {
	content: counter(help-step);
	position: absolute;
	left: 16px;
	top: 16px;
	width: 30px;
	height: 30px;
	border-radius: 99px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--accent);
	color: var(--on-accent);
	font-size: 0.8125rem;
	font-weight: 600;
}

.help-card ol > li > strong:first-child,
.help-card.nots li > strong:first-child {
	display: block;
	margin-bottom: 4px;
	font-size: 0.906rem;
	font-weight: 600;
	color: var(--ink);
}

/* "nots": list rows, each with a crossed badge (U+00D7 by CSS escape). */
.help-card.nots {
	gap: 6px;
}

.help-card.nots h3 {
	margin-bottom: 6px;
}

.help-card.nots ul {
	list-style: none;
	padding: 0;
	gap: 0;
}

.help-card.nots li {
	position: relative;
	min-height: 28px;
	padding: 12px 0 12px 42px;
	border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, var(--bg));
	font-size: 0.844rem;
	line-height: 1.5;
	color: var(--sub);
}

.help-card.nots li:first-child {
	padding-top: 0;
}

.help-card.nots li:last-child {
	padding-bottom: 0;
	border-bottom: none;
}

.help-card.nots li::before {
	content: "\00d7";
	position: absolute;
	left: 0;
	top: 12px;
	width: 28px;
	height: 28px;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--surface-2);
	color: var(--type-announcement);
	font-size: 1.1rem;
	line-height: 1;
}

.help-card.nots li:first-child::before {
	top: 0;
}

.help-card.nots li > strong:first-child {
	margin-bottom: 2px;
	font-size: 0.875rem;
}

.help-next {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 22px;
	border: 1.5px solid var(--border);
	border-radius: 16px;
	background: var(--surface);
	color: var(--ink);
	text-decoration: none;
}

.help-next:hover {
	border-color: var(--accent-ui);
	background: var(--bg);
	text-decoration: none;
}

.help-next-text {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.help-next-label {
	font-size: 0.75rem;
	color: var(--sub);
}

.help-next-title {
	font-size: 0.9375rem;
	font-weight: 600;
}

.help-next-arrow {
	display: flex;
	flex: none;
	color: var(--accent);
}

@media (min-width: 761px) {
	.help-card ol {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.help-card {
		padding: 24px 26px;
	}

	.help-card.callout {
		padding: 22px 26px;
	}
}

/* ---- marketing landing page ----
   Layout mirrors the app shell widths; fern spends only on the primary CTAs,
   the callout dot, the leaning spine, and the quote band wash. Spine tints are
   illustration content (like cover tints): fixed hues, pinned lightness. */
.mk-page {
	flex: 1 0 auto;
	display: flex;
	flex-direction: column;
}

.mk-topbar {
	border-bottom: 1px solid var(--border);
}

.mk-topbar-inner {
	width: min(1100px, 92vw);
	margin: 0 auto;
	padding: var(--space-3) 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.mk-brand {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.15rem;
	color: var(--ink);
	letter-spacing: -0.02em;
}

.mk-brand:hover {
	text-decoration: none;
}

.mk-nav {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	font-size: 0.92rem;
	font-weight: 500;
	flex-wrap: wrap;
}

.mk-nav a {
	color: var(--sub);
}

.mk-nav a:hover {
	color: var(--ink);
	text-decoration: none;
}

.mk-nav a.ui-button,
.mk-nav a.mk-cta {
	color: var(--on-accent);
	border-radius: var(--radius-pill);
}

.mk-nav a.ui-button-secondary {
	color: var(--ink);
}

.mk-hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: var(--space-4);
	padding: var(--space-7) var(--space-4) 0;
}

.mk-hero h1 {
	margin: 0;
	max-width: 20ch;
	font-size: clamp(2.2rem, 7vw, 3.9rem);
	line-height: 1.05;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

.mk-hero-sub {
	margin: 0;
	max-width: 56ch;
	font-size: 1.1rem;
	line-height: 1.6;
	color: var(--sub);
	text-wrap: pretty;
}

.mk-hero-actions {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	flex-wrap: wrap;
	justify-content: center;
}

.mk-hero-actions .ui-button {
	border-radius: var(--radius-pill);
	padding: 0.75rem 1.6rem;
	font-size: 1rem;
}

.mk-hero-note {
	margin: 0;
	font-size: 0.85rem;
}

/* the CSS bookshelf: spines on a rail, one leaning fern spine w/ callout */
.mk-shelf {
	position: relative;
	display: flex;
	align-items: flex-end;
	gap: 10px;
	margin: var(--space-6) 0 var(--space-7);
	padding: 0 var(--space-4);
}

.mk-spine {
	--spine-h: 145 35% 45%;
	width: 34px;
	border-radius: 5px 5px 2px 2px;
	background: hsl(var(--spine-h));
}

.mk-spine-1 { --spine-h: 22 45% 45%; height: 130px; }
.mk-spine-2 { --spine-h: 26 15% 20%; width: 42px; height: 160px; }
.mk-spine-3 { --spine-h: 42 52% 50%; width: 30px; height: 116px; }
.mk-spine-4 { --spine-h: 212 28% 48%; width: 38px; height: 150px; }
.mk-spine-5 { --spine-h: 292 20% 45%; width: 32px; height: 128px; }
.mk-spine-6 { --spine-h: 96 22% 42%; width: 40px; height: 168px; }

/* dark: lift spine lightness so the shelf reads against the dark ground */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .mk-spine-1 { --spine-h: 22 40% 58%; }
	:root:not([data-theme="light"]) .mk-spine-2 { --spine-h: 26 12% 65%; }
	:root:not([data-theme="light"]) .mk-spine-3 { --spine-h: 42 45% 60%; }
	:root:not([data-theme="light"]) .mk-spine-4 { --spine-h: 212 30% 60%; }
	:root:not([data-theme="light"]) .mk-spine-5 { --spine-h: 292 22% 60%; }
	:root:not([data-theme="light"]) .mk-spine-6 { --spine-h: 96 24% 55%; }
}

:root[data-theme="dark"] .mk-spine-1 { --spine-h: 22 40% 58%; }
:root[data-theme="dark"] .mk-spine-2 { --spine-h: 26 12% 65%; }
:root[data-theme="dark"] .mk-spine-3 { --spine-h: 42 45% 60%; }
:root[data-theme="dark"] .mk-spine-4 { --spine-h: 212 30% 60%; }
:root[data-theme="dark"] .mk-spine-5 { --spine-h: 292 22% 60%; }
:root[data-theme="dark"] .mk-spine-6 { --spine-h: 96 24% 55%; }

.mk-spine-lean {
	position: relative;
	width: 38px;
	height: 152px;
	border-radius: 5px 5px 2px 2px;
	background: var(--accent);
	transform: rotate(9deg);
	transform-origin: bottom left;
	margin-left: 14px;
}

.mk-callout {
	position: absolute;
	top: -56px;
	left: 16px;
	display: flex;
	align-items: center;
	gap: var(--space-2);
	white-space: nowrap;
	padding: 0.5rem 0.9rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow);
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--ink);
	transform: rotate(-9deg);
}

/* narrow screens: grow the callout leftward from the leaning spine so it
   never pushes past the viewport edge */
@media (max-width: 760px) {
	.mk-callout {
		left: auto;
		right: -6px;
	}
}

.mk-callout-dot {
	width: 8px;
	height: 8px;
	border-radius: var(--radius-pill);
	background: var(--accent-ui);
	flex: none;
}

.mk-shelf-rail {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -16px;
	height: 8px;
	background: var(--ink);
	border-radius: 4px;
}

/* how-it-works band */
.mk-band {
	background: var(--surface);
	border-top: 1px solid var(--border);
}

.mk-band-inner {
	width: min(1100px, 92vw);
	margin: 0 auto;
	padding: var(--space-7) 0;
}

.mk-eyebrow {
	margin: 0 0 var(--space-2);
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--accent-ui);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.mk-band-inner h2 {
	margin: 0 0 var(--space-5);
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	letter-spacing: -0.02em;
}

.mk-steps {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
	gap: var(--space-4);
}

.mk-step {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	padding: var(--space-5);
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.mk-step-num {
	width: 32px;
	height: 32px;
	border-radius: var(--radius-pill);
	background: var(--accent);
	color: var(--on-accent);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 0.95rem;
}

.mk-step h3 {
	margin: 0;
	font-size: 1.2rem;
}

.mk-step p {
	margin: 0;
	color: var(--sub);
	line-height: 1.55;
}

/* features rows */
.mk-features {
	border-top: 1px solid var(--border);
}

.mk-features-inner {
	width: min(1100px, 92vw);
	margin: 0 auto;
	padding: var(--space-7) 0;
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--space-5);
	align-items: start;
}

@media (min-width: 761px) {
	.mk-features-inner {
		grid-template-columns: 280px 1fr;
	}

	.mk-features-title {
		position: sticky;
		top: var(--space-4);
	}
}

.mk-features-title {
	margin: 0;
	font-size: clamp(1.6rem, 4vw, 2.1rem);
	letter-spacing: -0.02em;
}

.mk-feature-rows {
	display: flex;
	flex-direction: column;
}

.mk-feature {
	display: grid;
	grid-template-columns: 44px 1fr;
	gap: var(--space-4);
	padding: var(--space-5) 0;
	border-bottom: 1px solid var(--border);
}

.mk-feature:last-child {
	border-bottom: none;
}

.mk-feature-icon {
	color: var(--accent-ui);
	margin-top: 2px;
}

.mk-feature-icon svg {
	width: 24px;
	height: 24px;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	fill: none;
}

.mk-feature h3 {
	margin: 0 0 var(--space-1);
	font-size: 1.2rem;
}

.mk-feature p {
	margin: 0;
	color: var(--sub);
	line-height: 1.55;
	max-width: 60ch;
}

/* quote band: fern-wash background = a good-news moment */
.mk-quote {
	background: var(--accent-soft);
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: var(--space-3);
	padding: var(--space-7) var(--space-4);
}

.mk-quote blockquote {
	margin: 0;
	max-width: 34ch;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: clamp(1.3rem, 3.5vw, 1.8rem);
	line-height: 1.4;
	color: var(--ink);
}

.mk-quote-attr {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--accent);
}

/* closing call to action */
.mk-cta-band {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: var(--space-4);
	padding: var(--space-7) var(--space-4);
}

.mk-cta-band h2 {
	margin: 0;
	font-size: clamp(1.7rem, 5vw, 2.4rem);
	letter-spacing: -0.02em;
}

.mk-cta-band .ui-button {
	border-radius: var(--radius-pill);
	padding: 0.8rem 1.9rem;
	font-size: 1rem;
}

.mk-cta-band p {
	margin: 0;
	font-size: 0.85rem;
}

/* ---- search: filter bar ----
   The whole bar lives inside the search GET form, so a plain submission carries
   every filter in the URL. Chips are radios/checkboxes with visually hidden
   inputs, keeping them keyboard-operable; the genre dropdown is the same
   checkbox-toggle disclosure the nav and user menu use. Chrome here stays
   neutral - fern is reserved for the good-news chip and the follow CTA. */
.search-form {
	gap: var(--space-3);
}

.search-filters {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-2) var(--space-4);
	padding: var(--space-3) var(--space-4);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
}

.search-filtergroup {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.search-filterlabel {
	font-size: 0.78rem;
	font-weight: 600;
	color: var(--sub);
}

.search-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	padding: 0.4rem 0.8rem;
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	background: var(--bg);
	color: var(--ink);
	font-size: 0.82rem;
	font-weight: 500;
	cursor: pointer;
	user-select: none;
}

.search-chip:hover {
	border-color: var(--accent-ui);
}

/* Active filter state is neutral emphasis, matching the active nav item. */
.search-chip.is-active {
	background: var(--surface-2);
	border-color: var(--sub);
	font-weight: 600;
}

.search-chip:focus-within {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.search-toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	font-size: 0.85rem;
	cursor: pointer;
}

.search-clear {
	margin-left: auto;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--danger);
}

/* The apply button is the no-JavaScript path only: an enhanced client applies
   filters on change (the form's data-on:change binding). Same technique as the
   rating form's save button. */
@media (scripting: enabled) {
	.search-apply {
		display: none;
	}
}

/* genre multi-select: checkbox-toggle disclosure */
.search-genre {
	position: relative;
	display: inline-flex;
}

.search-genre-checkbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.search-genre-summary .ui-user-chevron svg {
	width: 12px;
	height: 12px;
}

.search-genre-checkbox:checked + .search-genre-summary .ui-user-chevron {
	transform: rotate(180deg);
}

.search-genre-checkbox:focus-visible + .search-genre-summary {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.search-genre-panel {
	display: none;
	position: absolute;
	left: 0;
	/* Meets its summary (see the anchored-overlay origin rule). */
	top: 100%;
	min-width: 13rem;
	max-height: 16rem;
	overflow-y: auto;
	flex-direction: column;
	gap: 2px;
	padding: var(--space-2);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	box-shadow: var(--shadow);
	z-index: 30;
}

.search-genre-checkbox:checked ~ .search-genre-panel {
	display: flex;
}

.search-genre-option {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	padding: 0.4rem 0.5rem;
	border-radius: var(--radius-control);
	font-size: 0.85rem;
	cursor: pointer;
}

.search-genre-option:hover {
	background: var(--surface-2);
}

.search-genre-clear {
	margin-top: var(--space-1);
	padding: 0.4rem 0.5rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--danger);
}

/* ---- search: results ---- */
.search-resultshead {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.search-resultshead h2 {
	margin: 0;
	font-size: clamp(1.3rem, 3vw, 1.6rem);
}

.search-groupheading {
	margin: 0;
	font-size: 1.1rem;
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
}

.search-groupheading .ui-muted {
	font-size: 0.85rem;
	font-weight: 400;
}

/* Result cards reflow from one column to a responsive grid. */
.search-cardgrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
	gap: var(--space-4);
}

.search-entitycard {
	flex-direction: row;
	align-items: flex-start;
}

.search-titlerow {
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
}

.search-cardtitle {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1rem;
	line-height: 1.25;
}

.search-metaline {
	font-size: 0.85rem;
}

/* Cards lift on hover: the border takes the accent and the entity name warms
   with it, so the whole card reads as one target (the name is the link). */
.search-entitycard {
	gap: var(--space-3);
	transition: border-color 0.15s ease;
}

.search-entitycard:hover {
	border-color: var(--accent-ui);
}

.search-cardlink {
	color: var(--ink);
}

.search-cardlink:hover {
	color: var(--accent);
	text-decoration: none;
}

.search-entitycard:hover .search-cardlink {
	color: var(--accent);
}

/* author initials avatar */
.search-avatar {
	width: 44px;
	height: 44px;
	flex: none;
	border-radius: var(--radius-pill);
	background: var(--surface-2);
	color: var(--ink);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1rem;
}

/* series spine glyph: the shelf mark standing in for a series cover */
.search-spines {
	width: 44px;
	height: 44px;
	flex: none;
	border-radius: var(--radius-control);
	background: var(--surface-2);
	display: inline-flex;
	align-items: flex-end;
	justify-content: center;
	gap: 3px;
	padding-bottom: 8px;
}

.search-spine {
	width: 6px;
	border-radius: 2px;
	background: var(--sub);
}

.search-spine-1 { height: 18px; }
.search-spine-2 { height: 24px; background: var(--ink); }
.search-spine-3 { height: 14px; }

/* provenance badge: the sources a result or page draws on */
.search-provenance {
	position: relative;
	flex: none;
	width: 20px;
	height: 20px;
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--sub);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: help;
}

.search-provenance svg {
	width: 12px;
	height: 12px;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	fill: none;
}

/* The source name as a small popup above the badge - it names where the
   result came from, nothing more. CSS-only, so it needs no JavaScript. */
.search-provenance-tip {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.15s ease;
	padding: 0.3rem 0.6rem;
	border-radius: 7px;
	background: var(--ink);
	color: var(--bg);
	font-size: 0.72rem;
	font-weight: 600;
	white-space: nowrap;
	pointer-events: none;
	z-index: 60;
}

.search-provenance:hover .search-provenance-tip,
.search-provenance:focus-visible .search-provenance-tip {
	visibility: visible;
	opacity: 1;
}

/* ---- dashboard ----
   The authenticated home: search entry, currently-reading cards with their
   three controls, and the release strip. The card's shelf menu is a native
   popover and the progress editor a checkbox-toggle disclosure (the
   nav/user-menu pattern), so every control works with no JavaScript. Fern
   goes to primary CTAs and good-news badges; the shelf control and card
   chrome stay neutral; the progress fill uses the same signal green as the
   rating stars. */
.dash-search {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-4) 0 var(--space-2);
}

.dash-searchform {
	width: min(720px, 100%);
}

.dash-searchform input[type="search"] {
	border-radius: var(--radius-pill);
	padding: 0.85rem 1.1rem;
	min-height: 52px;
	font-size: 1rem;
}

.dash-searchform .ui-button {
	border-radius: var(--radius-pill);
	padding: 0.6rem 1.4rem;
}

.dash-suggestions {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
	justify-content: center;
	font-size: 0.85rem;
}

.dash-chip {
	padding: 0.3rem 0.8rem;
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	background: var(--surface);
	color: var(--ink);
	font-size: 0.82rem;
	font-weight: 500;
}

.dash-chip:hover {
	border-color: var(--accent-ui);
	text-decoration: none;
}

.dash-sectionhead {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.dash-sectionhead h2 {
	margin: 0;
	font-size: clamp(1.3rem, 3vw, 1.6rem);
}

.dash-sectionintro {
	margin: calc(var(--space-2) * -1) 0 0;
	font-size: 0.9rem;
}

.dash-cardgrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
	gap: var(--space-4);
}

.dash-readingcard,
.dash-releasecard {
	gap: var(--space-3);
}

/* ---- progress bar + editor ---- */
.dash-progress {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.dash-progressbar {
	flex: 1 1 8rem;
	min-width: 6rem;
	height: 6px;
	border-radius: var(--radius-pill);
	background: var(--surface-2);
	overflow: hidden;
}

/* Signal green: progress is good news, same as a rating you gave. */
.dash-progressfill {
	display: block;
	height: 100%;
	border-radius: var(--radius-pill);
	background: var(--accent-ui);
}

.dash-progresslabel {
	font-size: 0.8rem;
	flex: none;
}

.dash-progressedit {
	flex: 1 1 100%;
}

.dash-progresscheckbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.dash-progresstoggle {
	display: inline-block;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--sub);
	cursor: pointer;
}

.dash-progresstoggle:hover {
	color: var(--ink);
}

.dash-progresscheckbox:focus-visible + .dash-progresstoggle {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.dash-progressform {
	display: none;
	align-items: center;
	gap: var(--space-2);
	margin-top: var(--space-2);
}

.dash-progresscheckbox:checked ~ .dash-progressform {
	display: flex;
}

.dash-progressform input[type="number"] {
	width: 6rem;
	appearance: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.4rem 0.5rem;
	min-height: 36px;
	font-family: var(--font-ui);
	font-size: 0.9rem;
	background: var(--surface);
	color: var(--ink);
}

/* ---- Following page and follow controls ----
   Rows of followed authors and series, each with a bell (mute) and a
   Following button that reveals Unfollow on hover. The bell and the button
   are shared components (ui.FollowBell, ui.FollowStateButton) that the
   author and series page hero renders too. Fern marks the two
   affirmative states - the notifying bell and the Following label - matching
   the existing "following" chip; muting is a neutral outline and the
   destructive hover uses the error red already reserved for it. */
.follow-intro {
	max-width: 60ch;
}

.follow-filter {
	max-width: 26rem;
}

/* The explicit submit is the no-JavaScript path; an enhanced client filters
   as you type (debounced input binding). */
@media (scripting: enabled) {
	.follow-filter-submit {
		display: none;
	}
}

.follow-groupheading {
	margin: 0;
	font-size: 1.1rem;
	display: flex;
	align-items: baseline;
	gap: var(--space-2);
}

.follow-groupheading .ui-muted {
	font-size: 0.85rem;
	font-weight: 400;
}

.follow-rows {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.follow-row {
	flex-direction: row;
	align-items: center;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.follow-name {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1rem;
	line-height: 1.25;
}

.follow-meta {
	font-size: 0.85rem;
}

.follow-actions {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin-left: auto;
}

.follow-undonote {
	font-size: 0.85rem;
}

/* the bell: filled fern while notifying, neutral outline while muted */
.follow-bell {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: var(--radius-pill);
	border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
	background: var(--accent-soft);
	color: var(--accent);
	cursor: pointer;
}

.follow-bell svg {
	width: 17px;
	height: 17px;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	fill: none;
}

.follow-bell.is-muted {
	border-color: var(--border);
	background: var(--surface-2);
	color: var(--sub);
}

/* Hovering previews the flip: a notifying bell dims, a muted one lights up. */
.follow-bell:hover {
	background: var(--surface-2);
	border-color: var(--border);
	color: var(--sub);
}

.follow-bell.is-muted:hover {
	background: var(--accent-soft);
	border-color: color-mix(in srgb, var(--accent) 40%, transparent);
	color: var(--accent);
}

.follow-bell:focus-visible {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

/* Following -> Unfollow on hover, so the destructive action announces itself
   before it is clicked. */
.follow-button {
	appearance: none;
	position: relative;
	padding: 0.4rem 1rem;
	min-height: 36px;
	border-radius: var(--radius-pill);
	border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
	background: var(--accent-soft);
	color: var(--accent);
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: 0.82rem;
	cursor: pointer;
}

.follow-button-hover {
	display: none;
}

.follow-button:hover,
.follow-button:focus-visible {
	border-color: color-mix(in srgb, var(--danger) 45%, transparent);
	background: var(--danger-soft);
	color: var(--danger);
}

.follow-button:hover .follow-button-rest,
.follow-button:focus-visible .follow-button-rest {
	display: none;
}

.follow-button:hover .follow-button-hover,
.follow-button:focus-visible .follow-button-hover {
	display: inline;
}

.follow-button:focus-visible {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

/* Narrow screens: the controls drop below the name rather than crowding it. */
@media (max-width: 560px) {
	.follow-actions {
		margin-left: 0;
		width: 100%;
	}
}

/* ---- author and series detail pages ----
   A hero (avatar or spine tile, name, derived stats), an optional fern-wash
   release banner, and the book list. Fern is spent on the banner wash, its
   want-to-read CTA, the hero Follow button, and good-news chips; ordinals,
   stats, and row meta stay neutral. */
.entity-hero {
	display: flex;
	align-items: flex-start;
	gap: var(--space-4);
	flex-wrap: wrap;
}

.entity-herobody {
	flex: 1 1 20rem;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}

.entity-name {
	margin: 0;
	font-size: clamp(1.8rem, 5vw, 2.4rem);
	letter-spacing: -0.02em;
	line-height: 1.1;
}

.entity-byline,
.entity-stats,
.entity-aliases,
.entity-progress {
	margin: 0;
	font-size: 0.92rem;
}

.entity-bio {
	margin: var(--space-2) 0 0;
	max-width: 64ch;
	line-height: 1.55;
	text-wrap: pretty;
}

/* Paragraphs after the first need separating, not just stacking. */
.entity-bio + .entity-bio {
	margin-top: var(--space-3);
}

/* ---- hero disclosures (long bios, long alias lists) ----
   Source bios run from a sentence to several paragraphs, and alias lists to a
   dozen transliterations. Both collapse by default so the hero stays a hero
   and the books list stays above the fold; the full text is always in the
   markup, revealed by a checkbox toggle - no request, no JavaScript. */
.entity-disclosure {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.entity-disclosure-checkbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.entity-disclosure-toggle {
	margin-top: var(--space-1);
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--accent-ui);
	cursor: pointer;
}

.entity-disclosure-toggle:hover {
	text-decoration: underline;
}

.entity-disclosure-checkbox:focus-visible + * + .entity-disclosure-toggle,
.entity-disclosure-checkbox:focus-visible + * + * + .entity-disclosure-toggle {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

/* Collapsed by default: the short form and the "expand" label show. */
.entity-expanded,
.entity-expanded-inline {
	display: none;
}

/* The alias line's toggle sits inline in the sentence (the "5 more" itself),
   so it reads as part of the text rather than a control beneath it. */
.entity-inlinetoggle {
	color: var(--accent-ui);
	font-weight: 600;
	cursor: pointer;
}

.entity-inlinetoggle:hover {
	text-decoration: underline;
}

.entity-disclosure-checkbox:focus-visible ~ * .entity-inlinetoggle {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.entity-disclosure-checkbox:checked ~ .entity-collapsed,
.entity-disclosure-checkbox:checked ~ .entity-disclosure-toggle .entity-collapsed-inline {
	display: none;
}

.entity-disclosure-checkbox:checked ~ .entity-expanded {
	display: inline;
}

/* The bio's expanded state is a stack of paragraphs, not an inline run. */
.entity-disclosure-checkbox:checked ~ .entity-biowrap > .entity-expanded,
.entity-biowrap .entity-disclosure-checkbox:checked ~ .entity-expanded {
	display: block;
}

.entity-disclosure-checkbox:checked ~ .entity-disclosure-toggle .entity-expanded-inline {
	display: inline;
}

/* The bio is one element, so expanding it removes the clamp rather than
   swapping in a second copy. */
.entity-bio-clamped {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	line-clamp: 4;
	overflow: hidden;
}

.entity-disclosure-checkbox:checked ~ .entity-bio-clamped {
	display: block;
	-webkit-line-clamp: none;
	line-clamp: none;
	overflow: visible;
}

.entity-follow {
	flex: none;
	margin-left: auto;
}

/* identity marks: fern-wash initials for authors, a shelf for series */
.entity-avatar {
	width: 84px;
	height: 84px;
	flex: none;
	border-radius: var(--radius-pill);
	background: var(--accent-soft);
	color: var(--accent);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.8rem;
}

.entity-spines {
	width: 84px;
	height: 84px;
	flex: none;
	border-radius: var(--radius-card);
	background: var(--surface-2);
	display: inline-flex;
	align-items: flex-end;
	justify-content: center;
	gap: 5px;
	padding-bottom: 16px;
}

.entity-spine {
	width: 11px;
	border-radius: 3px;
	background: var(--accent);
}

.entity-spine-1 { height: 34px; }
.entity-spine-2 { height: 46px; background: var(--ink); }
.entity-spine-3 { height: 28px; }

/* the next-up banner: good news, so it gets the fern wash */
.entity-banner {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	flex-wrap: wrap;
	padding: var(--space-4) var(--space-5);
	border-radius: var(--radius-card);
	background: var(--accent-soft);
}

.entity-bannerbody {
	flex: 1 1 16rem;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}

.entity-bannereyebrow {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--accent);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.entity-bannertitle {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.15rem;
	line-height: 1.25;
}

.entity-bannermeta {
	font-size: 0.85rem;
	color: var(--accent);
}

.entity-booksheading {
	margin: 0;
	font-size: 1.25rem;
}

/* The entity pages' book listing is the shared row container (see
   .book-card-rows); the alias keeps the page's own name in the markup. */

@media (max-width: 560px) {
	.entity-follow {
		margin-left: 0;
	}
}

/* ---- custom lists (dashboard "Your lists", all-lists page, detail page) ----
   Fern budget: the New-list tile and primary Create/Add buttons carry fern
   (they are the section's calls-to-action) and the "N out now" chip reuses the
   good-news release chip; card chrome, spines, and secondary controls stay
   neutral. Spine hues are a fixed 8-slot palette (list-spine-h0..h7) chosen
   deterministically from member work ids, with lightness lifted in dark mode
   like the marketing shelf. */

.list-cardgrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
	gap: var(--space-4);
}

/* Shelf arrangement grids (the dashboard's home shelves, both groups on the
   shelves index): one column on small screens, rows of four from the nav
   breakpoint, so the four home shelves read as one row and the index groups
   line up with it. */
.list-shelfgrid {
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 761px) {
	.list-shelfgrid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.list-shelfgrid .list-cardname {
	overflow-wrap: anywhere;
}

/* The home boundary on the shelves index: shelves below the line stay off
   the home page. */
.list-groupmore {
	border-top: 1px solid var(--border);
	padding-top: var(--space-5);
}

/* ---- arrange page (shelf-arrangement) ----
   One column at every width, the line between the groups being the home
   boundary. Move controls are ghost buttons: neutral chrome, no fern. Each
   row keeps a 44px slot per control (a spacer where an end has none) so the
   controls stay aligned down the column. */
.arrange-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}

.arrange-group h2 {
	margin: 0 0 var(--space-3);
	font-size: clamp(1.1rem, 2.5vw, 1.3rem);
}

.arrange-groupmore {
	border-top: 1px solid var(--border);
	padding-top: var(--space-5);
}

.arrange-rows {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	margin: 0;
	padding-left: 2.25rem;
}

.arrange-item::marker {
	color: var(--sub);
	font-variant-numeric: tabular-nums;
}

.arrange-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-3);
	padding: var(--space-2) var(--space-3);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
}

.arrange-name {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.arrange-title {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.arrange-count {
	font-size: 0.85rem;
}

.arrange-controls {
	display: flex;
	flex-shrink: 0;
	gap: var(--space-2);
}

.arrange-form {
	margin: 0;
}

.arrange-move,
.arrange-spacer {
	width: 44px;
	height: 44px;
}

.arrange-move {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.arrange-spacer {
	display: inline-block;
}

.list-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	color: var(--ink);
	padding: var(--space-4);
}

.list-card:hover {
	text-decoration: none;
	border-color: var(--accent-ui);
}

.list-cardname {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.25;
}

.list-cardmeta {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
	font-size: 0.85rem;
}

/* spine cluster: a tiny CSS bookshelf; no cover images on cards */
.list-spines {
	display: flex;
	align-items: flex-end;
	gap: 4px;
	height: 56px;
	padding: 0 var(--space-1);
	border-bottom: 2px solid var(--border);
}

.list-spine {
	--spine-h: 30 10% 62%;
	width: 12px;
	border-radius: 3px 3px 1px 1px;
	background: hsl(var(--spine-h));
}

.list-spine--empty {
	background: var(--surface-2);
	border: 1px dashed var(--border);
	height: 40px;
	width: 14px;
}

/* five width/height slots so a cluster reads as books, not a bar chart */
.list-spine-s0 { height: 44px; }
.list-spine-s1 { height: 52px; width: 14px; }
.list-spine-s2 { height: 38px; width: 10px; }
.list-spine-s3 { height: 48px; }
.list-spine-s4 { height: 42px; width: 13px; }

/* muted book-cloth palette; deliberately adjacent to the marketing shelf */
.list-spine-h0 { --spine-h: 22 45% 45%; }
.list-spine-h1 { --spine-h: 26 15% 30%; }
.list-spine-h2 { --spine-h: 42 52% 46%; }
.list-spine-h3 { --spine-h: 212 28% 48%; }
.list-spine-h4 { --spine-h: 292 20% 45%; }
.list-spine-h5 { --spine-h: 96 22% 42%; }
.list-spine-h6 { --spine-h: 355 35% 47%; }
.list-spine-h7 { --spine-h: 180 25% 40%; }

/* dark: lift spine lightness so clusters read against the dark ground */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .list-spine-h0 { --spine-h: 22 40% 58%; }
	:root:not([data-theme="light"]) .list-spine-h1 { --spine-h: 26 12% 65%; }
	:root:not([data-theme="light"]) .list-spine-h2 { --spine-h: 42 45% 60%; }
	:root:not([data-theme="light"]) .list-spine-h3 { --spine-h: 212 30% 60%; }
	:root:not([data-theme="light"]) .list-spine-h4 { --spine-h: 292 22% 60%; }
	:root:not([data-theme="light"]) .list-spine-h5 { --spine-h: 96 24% 55%; }
	:root:not([data-theme="light"]) .list-spine-h6 { --spine-h: 355 32% 62%; }
	:root:not([data-theme="light"]) .list-spine-h7 { --spine-h: 180 26% 55%; }
}

:root[data-theme="dark"] .list-spine-h0 { --spine-h: 22 40% 58%; }
:root[data-theme="dark"] .list-spine-h1 { --spine-h: 26 12% 65%; }
:root[data-theme="dark"] .list-spine-h2 { --spine-h: 42 45% 60%; }
:root[data-theme="dark"] .list-spine-h3 { --spine-h: 212 30% 60%; }
:root[data-theme="dark"] .list-spine-h4 { --spine-h: 292 22% 60%; }
:root[data-theme="dark"] .list-spine-h5 { --spine-h: 96 24% 55%; }
:root[data-theme="dark"] .list-spine-h6 { --spine-h: 355 32% 62%; }
:root[data-theme="dark"] .list-spine-h7 { --spine-h: 180 26% 55%; }

/* the "+ New list" tile: the section's call-to-action, so it carries fern */
.list-newtile {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-1);
	min-height: 120px;
	padding: var(--space-4);
	border: 2px dashed var(--accent-ui);
	border-radius: var(--radius-card);
	color: var(--accent-ui);
	font-weight: 600;
}

.list-newtile:hover {
	text-decoration: none;
	background: var(--accent-soft);
}

.list-newplus {
	font-size: 1.6rem;
	line-height: 1;
}

/* The add flow's pager. Short page, but every match reachable. */
.list-addpager {
	align-items: center;
	gap: var(--space-3);
	padding-top: var(--space-2);
	flex-wrap: wrap;
}

/* The admin curated-list pages' inline create forms. */
.list-createcard {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

/* Shelf create and edit pages. Creation and editing are their own intents
   with their own addresses, so each is a single-purpose form page rather than
   a strip above the card grid. */
.shelf-formcard {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	max-width: 34rem;
}

.shelf-form label {
	font-size: 0.9rem;
	font-weight: 600;
}

.shelf-dangercard h2 {
	margin: 0;
	font-size: 1.05rem;
}

.shelf-form input[type="text"] {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	min-height: 40px;
	font-size: 1rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
	/* The form is a column stack, so a flex-basis here would size the
	   input's HEIGHT, not its width. */
	width: 100%;
	max-width: 24rem;
}

/* detail page: head, manage row, member rows */
.list-detailhead {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.list-detailtitle {
	display: flex;
	align-items: baseline;
	gap: var(--space-3);
	flex-wrap: wrap;
}

.list-detailtitle h1 {
	margin: 0;
	font-size: 1.6rem;
}

.list-deletebutton {
	color: var(--danger);
}

.list-memberrows {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.list-memberrow {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding: var(--space-3);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
}

.list-memberbody {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.list-memberrow form,
.list-memberrow .ui-chip {
	margin-left: auto;
	flex: none;
}

.list-membertitle {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 0.98rem;
	line-height: 1.25;
}

.list-membermeta {
	font-size: 0.82rem;
}

.list-addcard {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

@media (max-width: 560px) {
	.list-memberrow {
		flex-wrap: wrap;
	}

	.list-memberrow form,
	.list-memberrow .ui-chip {
		margin-left: 0;
	}
}

/* ---- explore: browse panel, filter chips, card grid, paging ----
   Fern budget: the cards' want-to-read action and good-news shelf chips keep
   their existing (already budgeted) styles; the browse controls stay neutral
   - a checked filter chip reads as pressed ink, not as good news. Stars stay
   signal green via the shared rating fragment. */

.explore-panel {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	padding: var(--space-4);
}

.explore-textrow {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.explore-textrow input[type="search"] {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	min-height: 40px;
	font-size: 1rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
	flex: 1 1 14rem;
	min-width: 0;
}

.explore-filtergroup {
	margin: 0;
	padding: 0;
	border: 0;
}

.explore-filtergroup legend {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--sub);
	padding: 0;
	margin-bottom: var(--space-1);
}

.explore-chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

/* filter chips: checkbox/radio inputs styled as pressable pills (the repo's
   checkbox-control precedent), fully keyboard-operable */
.explore-chip input {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.explore-chip span {
	display: inline-flex;
	align-items: center;
	padding: 0.25rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: var(--radius-pill);
	background: var(--surface);
	color: var(--ink);
	font-size: 0.85rem;
	cursor: pointer;
	user-select: none;
}

.explore-chip span:hover {
	border-color: var(--ink);
}

.explore-chip input:checked + span {
	background: var(--ink);
	border-color: var(--ink);
	color: var(--bg);
}

.explore-chip input:focus-visible + span {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.explore-sortrow {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.explore-sortrow label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--sub);
}

.explore-sort {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.4rem 2rem 0.4rem 0.7rem;
	min-height: 36px;
	font-size: 0.95rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.5rem center;
	background-size: 1rem;
}

.explore-count {
	margin: 0;
	font-size: 0.9rem;
}

.explore-cardgrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
	gap: var(--space-4);
}

.explore-paging {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-3);
}

/* ---- explore recommendations: pick cards, reading-list cards ----
   Fern budget: reason and source badges are neutral chips; the add action
   keeps the quiet secondary treatment; fern appears only on good-news chips
   (the "Out now" entries inside because-you-follow lists reuse
   ui-chip-release). */

.rec-badge {
	align-self: flex-start;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rec-card .ui-media__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	align-items: flex-start;
	min-width: 0;
}

.xplist-card {
	gap: var(--space-2);
}

.xplist-grid {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

.xplist-preview {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	font-size: 0.85rem;
}

.xplist-preview li {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.xplist-worktitle {
	font-weight: 600;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---- admin email settings: current-state facts and the settings form ---- */

.admemail-facts,
.admsource-facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: var(--space-1) var(--space-3);
	margin: 0;
}

.admemail-facts dt,
.admsource-facts dt {
	color: var(--sub);
	font-weight: 600;
}

.admemail-facts dd,
.admsource-facts dd {
	margin: 0;
	overflow-wrap: anywhere;
}

/* The staged records panel: Refresh data sits clear of the table on the
   right, greys out and goes inert while a request waits for the count job;
   the count's time closes the panel, bottom right. A rule splits the panel
   from the source regions below it. */
.admsource-refresh {
	display: flex;
	justify-content: flex-end;
	margin-top: var(--space-3);
}

.admsource-refresh .ui-button {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.admsource-refresh svg {
	width: 16px;
	height: 16px;
	flex: none;
}

.admsource-counts .ui-button:disabled {
	background: var(--surface-2);
	color: var(--sub);
	cursor: not-allowed;
	filter: none;
}

.admsource-updated {
	margin: 0;
	text-align: right;
	font-size: 0.85rem;
}

.admsource-split {
	align-self: stretch;
	margin: var(--space-2) 0;
	border: 0;
	border-top: 1px solid var(--border);
}

.admemail-form {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.admemail-form fieldset {
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: var(--space-2) var(--space-3) var(--space-3);
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.admemail-form legend {
	font-weight: 600;
	padding: 0 var(--space-1);
}

.admemail-form label {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--sub);
}

.admemail-providers label {
	flex-direction: row;
	align-items: center;
	font-size: 1rem;
	font-weight: 400;
	color: var(--ink);
}

.admemail-providers input[type="radio"] {
	accent-color: var(--ink);
}

.admemail-form input:not([type="radio"]),
.admemail-form select {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	min-height: 40px;
	font-size: 1rem;
	font-family: var(--font-ui);
	font-weight: 400;
	background: var(--surface);
	color: var(--ink);
	min-width: 0;
}

@media (max-width: 560px) {
	.admemail-facts,
	.admsource-facts {
		grid-template-columns: 1fr;
	}

	.admemail-facts dd,
	.admsource-facts dd {
		margin-bottom: var(--space-1);
	}
}

/* ---- admin curated lists: create/edit forms, ordered member rows ---- */

.admlist-createform {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.admlist-createform input[type="text"] {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	min-height: 40px;
	font-size: 1rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
	flex: 1 1 12rem;
	min-width: 0;
}

.admlist-metaform {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.admlist-metaform label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--sub);
}

.admlist-metaform input[type="text"],
.admlist-metaform textarea {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	font-size: 1rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
}

.admlist-head {
	justify-content: space-between;
}

.admlist-rowactions {
	margin-left: auto;
	flex: none;
	gap: var(--space-1);
}

@media (max-width: 560px) {
	.admlist-rowactions {
		margin-left: 0;
	}
}

/* ---- release lifecycle (feed badges, series TBA rows, status lines) ----
   Fern budget: "Out today" / "Out this week" / "Preorder open" reuse the
   good-news release chip; "Announced" is the one amber chip - a fact, not a
   celebration - built on the warning tokens so both themes resolve it. */

.ui-chip-announced {
	background: var(--warning-soft);
	border-color: color-mix(in srgb, var(--warning) 40%, transparent);
	color: var(--warning);
}

/* A TBA row is a real volume we cannot show a cover or firm date for yet:
   the whole card dims (see .book-card--tba) and the cover slot renders as a
   dashed placeholder sized like the small generated cover. */
.entity-cover-tba {
	flex: 0 0 auto;
	width: 76px;
	aspect-ratio: 2 / 3;
	border: 2px dashed var(--border);
	border-radius: var(--radius-control);
	background: var(--surface-2);
}

.entity-footnote {
	font-size: 0.82rem;
}

/* System shelf pages: the remove-from-shelf confirm flow. The checkbox
   toggle keeps the destructive submit behind an explicit step with no
   JavaScript, mirroring the nav and user-menu toggles. */
.shelf-remove {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.shelf-removecheckbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.shelf-removecheckbox:focus-visible + .shelf-removelabel {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.shelf-removelabel {
	cursor: pointer;
	/* The disclosure is a flex column, so a button-styled label would stretch
	   full width; size it to its content like every other button. */
	align-self: flex-start;
}

.shelf-removeconfirm {
	display: none;
}

.shelf-removecheckbox:checked ~ .shelf-removeconfirm {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding: var(--space-2) var(--space-3);
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	background: var(--surface-2);
}

/* Sectioned sidenav layout, shared by the preferences and admin page
   families: page title + sidebar navigation + content column. The sidebar
   is sticky on wide viewports and reflows to a horizontal link row on
   narrow ones (mobile-first). The active link takes the same neutral
   emphasis as the primary nav's active section - navigation is never fern.
   The preference controls below (theme tiles, chips) take the fern wash
   when selected: a selection is the user's affirmed choice, inside the
   accent budget. */
.ui-sidenav-title {
	font-family: var(--font-display);
	font-size: 1.7rem;
	letter-spacing: -0.02em;
	margin: 0;
}

.ui-sidenav-layout {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	align-items: stretch;
}

/* A headed layout (the admin pages but the dashboard) names the active page
   at the top of the content column, level with the family title above the
   sidebar, so the page opens on its own name. Narrow viewports stack it
   title, sidebar, heading, content. */
.ui-sidenav-layout--headed {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-areas: "title" "nav" "heading" "content";
}

.ui-sidenav-layout--headed > .ui-sidenav-title {
	grid-area: title;
}

.ui-sidenav-layout--headed > .ui-sidenav-pagetitle {
	grid-area: heading;
}

.ui-sidenav-layout--headed > .ui-sidenav {
	grid-area: nav;
}

.ui-sidenav-layout--headed > .ui-sidenav-content {
	grid-area: content;
}

.ui-sidenav-pagetitle {
	font-size: 1.35rem;
	letter-spacing: -0.02em;
	margin: 0;
}

.ui-sidenav {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 4px;
}

.ui-sidenav-link {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 9px 13px;
	border: 1px solid transparent;
	border-radius: 10px;
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--ink);
	text-decoration: none;
}

.ui-sidenav-link:hover {
	background: var(--surface-2);
}

/* Active section: neutral emphasis, like the primary nav - NOT fern. */
.ui-sidenav-link.is-active {
	font-weight: 600;
	color: var(--ink);
	background: var(--surface-2);
	border-color: var(--border);
}

.ui-sidenav-icon {
	width: 18px;
	height: 18px;
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ui-sidenav-icon svg {
	width: 17px;
	height: 17px;
}

/* Grouped sidebar (the guide): a group per section - an icon badge and
   uppercase label, its topics hanging from a rule beneath. The current topic
   and its group's badge take fern, as the guide's design asks: a deliberate
   exception to the neutral active state above, kept to this sidebar. On
   narrow viewports the whole guide follows the content rather than pushing
   it below twenty links; on wide ones it is the sticky sidebar, scrolling on
   its own when taller than the viewport. */
.ui-sidenav-head {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ui-sidenav-subtitle {
	margin: 0;
	font-size: 0.875rem;
	color: var(--sub);
}

.ui-sidenav--grouped {
	order: 2;
	flex-direction: column;
	flex-wrap: nowrap;
	gap: 22px;
}

.ui-sidenav-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ui-sidenav-grouplabel {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ink);
}

.ui-sidenav-group.is-current .ui-sidenav-grouplabel {
	color: var(--accent);
}

.ui-sidenav-groupbadge {
	width: 24px;
	height: 24px;
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 7px;
	background: var(--accent-soft);
	color: var(--accent);
}

.ui-sidenav-group.is-current .ui-sidenav-groupbadge {
	background: var(--accent);
	color: var(--on-accent);
}

.ui-sidenav-groupbadge .ui-sidenav-icon,
.ui-sidenav-groupbadge .ui-sidenav-icon svg {
	width: 14px;
	height: 14px;
}

.ui-sidenav-grouplinks {
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-left: 11px;
	border-left: 2px solid var(--border);
}

.ui-sidenav-grouplink {
	display: block;
	margin-left: -2px;
	padding: 8px 12px 8px 20px;
	border-left: 2px solid transparent;
	border-radius: 0 10px 10px 0;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.35;
	color: color-mix(in srgb, var(--ink) 80%, var(--sub));
	text-decoration: none;
}

.ui-sidenav-grouplink:hover {
	background: var(--surface-2);
	text-decoration: none;
}

.ui-sidenav-grouplink.is-active {
	border-left-color: var(--accent);
	font-weight: 600;
	color: var(--accent);
	background: var(--accent-soft);
}

.ui-sidenav-content {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

.prefs-card {
	border-radius: 16px;
	padding: 24px 26px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.prefs-cardtitle {
	font-size: 1.05rem;
	margin: 0;
}

.prefs-cardhint {
	font-size: 0.85rem;
	margin: 0 0 10px;
	line-height: 1.5;
}

/* danger zone (Security): the confirm step is a CSS-only checkbox disclosure,
   so requesting deletion takes two deliberate clicks with no JavaScript */
.prefs-danger {
	border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.prefs-danger .prefs-cardhint {
	margin-bottom: 0;
}

.prefs-confirm-checkbox {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.prefs-confirm-open {
	align-self: flex-start;
	display: inline-flex;
	align-items: center;
}

.prefs-confirm {
	display: none;
	flex-direction: column;
	gap: var(--space-3);
	margin-top: var(--space-2);
	padding: var(--space-3);
	border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
	border-radius: var(--radius-control);
	background: var(--danger-soft);
	font-size: 0.9rem;
	line-height: 1.5;
}

.prefs-confirm p {
	margin: 0;
}

.prefs-confirm-checkbox:checked ~ .prefs-confirm-open {
	display: none;
}

.prefs-confirm-checkbox:checked ~ .prefs-confirm {
	display: flex;
}

.prefs-confirm .ui-row {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	align-items: center;
}

.prefs-confirm .ui-button-ghost {
	display: inline-flex;
	align-items: center;
}

.prefs-danger-button {
	background: var(--danger);
	color: var(--on-accent);
}

.ui-sidenav-placeholder {
	align-items: center;
	text-align: center;
	padding: 40px 26px;
	color: var(--sub);
	font-size: 0.9rem;
}

.prefs-themetiles {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
}

.prefs-themetile {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 14px 0;
	width: 110px;
	border-radius: 12px;
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: 500;
	font-family: inherit;
	border: 1.5px solid var(--border);
	background: var(--bg);
	color: var(--ink);
}

.prefs-themetile:hover {
	border-color: var(--accent-ui);
}

.prefs-themetile.is-selected {
	font-weight: 600;
	border-color: var(--accent);
	background: var(--accent-soft);
	color: var(--accent);
}

.prefs-tileicon svg {
	width: 18px;
	height: 18px;
	display: block;
}

.prefs-chips {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.prefs-chips form {
	display: contents;
}

.prefs-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border-radius: 99px;
	cursor: pointer;
	font-size: 0.82rem;
	font-weight: 500;
	font-family: inherit;
	border: 1.5px solid var(--border);
	background: var(--bg);
	color: var(--ink);
}

.prefs-chip:hover {
	border-color: var(--accent-ui);
}

.prefs-chip.is-selected {
	font-weight: 600;
	border-color: var(--accent);
	background: var(--accent-soft);
	color: var(--accent);
}

.prefs-chipcheck {
	width: 13px;
	height: 13px;
	flex: none;
}

/* "More languages" disclosure: checkbox-toggle like the nav and user
   menus, so the full supported set is reachable without JavaScript. */
.prefs-more {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 4px;
}

.prefs-morecheckbox {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
}

.prefs-morelabel {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	align-self: flex-start;
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--accent-ui);
}

.prefs-morecheckbox:focus-visible + .prefs-morelabel {
	outline: 2px solid var(--accent-ui);
	outline-offset: 2px;
}

.prefs-morelabel .ui-user-chevron svg {
	width: 12px;
	height: 12px;
}

.prefs-morelabel-hide,
.prefs-morechips {
	display: none;
}

.prefs-morecheckbox:checked ~ .prefs-morechips {
	display: flex;
}

.prefs-morecheckbox:checked ~ .prefs-morelabel .prefs-morelabel-show {
	display: none;
}

.prefs-morecheckbox:checked ~ .prefs-morelabel .prefs-morelabel-hide {
	display: inline;
}

.prefs-morecheckbox:checked ~ .prefs-morelabel .ui-user-chevron {
	transform: rotate(180deg);
}

/* Auto-follow switch: a submit button styled as a track + knob, so flipping
   it is a plain form submission with no JavaScript required. */
.prefs-switchcard {
	flex-direction: row;
	align-items: center;
	gap: 16px;
}

.prefs-switchbody {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
	min-width: 0;
}

.prefs-switchbody .prefs-cardhint {
	margin-bottom: 0;
}

.prefs-switch {
	flex: none;
	width: 46px;
	height: 26px;
	border-radius: 99px;
	border: none;
	cursor: pointer;
	position: relative;
	padding: 0;
	background: var(--border);
	transition: background 0.2s;
}

.prefs-switch.is-on {
	background: var(--accent);
}

.prefs-switchknob {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 99px;
	background: var(--surface);
	box-shadow: 0 1px 3px rgba(43, 38, 34, 0.25);
	transition: left 0.2s;
}

.prefs-switch.is-on .prefs-switchknob {
	left: 23px;
}

@media (min-width: 761px) {
	.ui-sidenav-layout {
		flex-direction: row;
		gap: 36px;
		align-items: flex-start;
	}

	.ui-sidenav-layout--headed {
		grid-template-columns: 200px minmax(0, 1fr);
		grid-template-areas: "title heading" "nav content";
		gap: var(--space-4) 36px;
	}

	.ui-sidenav-layout--headed > .ui-sidenav-title,
	.ui-sidenav-layout--headed > .ui-sidenav-pagetitle {
		align-self: baseline;
	}

	/* stretched to the row, the sticky sidebar would never stick */
	.ui-sidenav-layout--headed > .ui-sidenav {
		align-self: start;
	}

	.ui-sidenav {
		flex: none;
		width: 200px;
		flex-direction: column;
		position: sticky;
		top: var(--space-4);
	}

	.ui-sidenav--grouped {
		order: 0;
		width: 260px;
		max-height: calc(100vh - 2 * var(--space-4));
		overflow-y: auto;
	}
}

/* ---- library import: progress hero + grouped skipped-row report ---- */

/* Centered hero while an import runs: headline, determinate bar, counts.
   The bar stays neutral ink - fern arrives with the completed state. */
.ui-import-hero {
	display: grid;
	justify-items: center;
	gap: var(--space-3);
	padding: var(--space-6) var(--space-4);
	text-align: center;
}

.ui-progress {
	width: 100%;
	max-width: 28rem;
	height: 0.6rem;
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	background: var(--surface-2);
	overflow: hidden;
}

.ui-progress-fill {
	position: relative;
	height: 100%;
	border-radius: inherit;
	background: var(--ink);
	transition: width 0.6s ease;
}

/* Liveness shimmer sweeping the filled portion; the surface tone keeps it
   visible against the ink fill in both themes. */
.ui-progress-fill::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		90deg,
		transparent,
		color-mix(in srgb, var(--surface) 45%, transparent),
		transparent
	);
	animation: ui-progress-shimmer 1.6s linear infinite;
}

@keyframes ui-progress-shimmer {
	from {
		transform: translateX(-100%);
	}

	to {
		transform: translateX(100%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ui-progress-fill {
		transition: none;
	}

	.ui-progress-fill::after {
		animation: none;
	}
}

/* Report: the next-step banner heading a completed import - the message on
   the left, the call-to-action wrapping below it on narrow screens. */
.ui-import-next {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2) var(--space-3);
}

.ui-import-next p {
	flex: 1 1 18rem;
	margin: 0;
}

.ui-import-next .ui-button {
	text-decoration: none;
}

/* Report: the library-lookup panel - the background search explained, or its
   outcome summarized. Neutral by design: ongoing work is not good news, so it
   stays on surface/ink and never spends the fern accent. The icon tile sits
   beside the copy at every width. */
.ui-import-lookups {
	flex-direction: row;
	align-items: flex-start;
	gap: var(--space-3);
}

.ui-import-lookups-icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: var(--radius-control);
	border: 1px solid var(--border);
	background: var(--surface-2);
	color: var(--ink);
}

.ui-import-lookups-icon svg {
	width: 1.25rem;
	height: 1.25rem;
}

.ui-import-lookups-body {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	min-width: 0;
}

.ui-import-lookups-body h3,
.ui-import-lookups-body p {
	margin: 0;
}

/* Report: the "Still looking" mark beside a skipped row's title. */
.ui-import-row-chip {
	margin-left: var(--space-2);
	white-space: nowrap;
}

/* Report: count-chip summary linking into the reason groups. */
.ui-import-skip-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
}

.ui-import-skip-summary a.ui-chip {
	text-decoration: none;
}

/* Compact tables for the skipped-row groups. Wide content scrolls inside
   the wrapper, never the page. */
.ui-table-scroll {
	overflow-x: auto;
}

.ui-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}

.ui-table th,
.ui-table td {
	padding: var(--space-1) var(--space-2);
	text-align: left;
	border-bottom: 1px solid var(--border);
}

.ui-table th {
	color: var(--sub);
	font-weight: 600;
}

/* ---- shared book card (book-card capability) ----
   One card renders books on every surface: identity zone (cover, title,
   authors, badges), state zone (rating slot, shelf action/status), and an
   optional per-surface extras zone. Surfaces add only sizing hooks. */
.book-card {
	gap: var(--space-3);
	transition: border-color 0.15s ease;
}

.book-card:hover {
	border-color: var(--accent-ui);
}

.bc-titlerow {
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
}

.bc-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1rem;
	line-height: 1.25;
}

.bc-authors {
	margin: 0;
	font-size: 0.85rem;
}

/* the series line: one muted line, clamped so a long series name never
   pushes a grid card taller than its neighbours */
.bc-series {
	margin: 0;
	font-size: 0.85rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bc-meta {
	font-size: 0.85rem;
}

.bc-ordinal {
	width: 1.5rem;
	flex: none;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 0.95rem;
	color: var(--sub);
	text-align: right;
}

.bc-state {
	gap: var(--space-2);
}

.bc-raterow {
	align-items: center;
	gap: var(--space-2);
}

.bc-community {
	font-size: 0.85rem;
	white-space: nowrap;
}

.book-card--tba {
	opacity: 0.7;
}

/* Row container: one card-like list rather than separate cards. Every
   surface that renders .book-card--row rows (shelf pages, entity pages,
   custom list detail) wraps them in this, so the rows never sit bare on the
   page background. The list-style reset lets a <ul> carry it directly. */
.book-card-rows,
.entity-rows {
	display: flex;
	flex-direction: column;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius-card);
	overflow: hidden;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Dense row variant for list-like surfaces (shelves, entity pages, custom
   lists): the row keeps the media layout but drops the card chrome - the
   shadow included, so the variant is self-contained even on a surface that
   forgets the container. */
.book-card--row {
	border: none;
	border-radius: 0;
	background: none;
	box-shadow: none;
	padding: var(--space-3) var(--space-4);
	border-bottom: 1px solid var(--border);
}

.book-card--row:last-child {
	border-bottom: none;
}

/* Rows wrapped in <li> are each their own :last-child, so the rule above
   would strip every separator; re-assert it for all but the final item. */
.book-card-rows > li:not(:last-child) > .book-card--row {
	border-bottom: 1px solid var(--border);
}

/* Pick-reason badge on the shared card (the machine-derived "why" chip). */
.ui-chip-pick {
	align-self: flex-start;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---- work detail page ---- */
.wk-hero {
	gap: var(--space-4);
}

.wk-title {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1.5rem;
	line-height: 1.2;
	display: flex;
	align-items: flex-start;
	gap: var(--space-2);
}

.wk-subtitle {
	margin: 0;
	font-size: 1rem;
}

.wk-authors {
	margin: 0;
	font-size: 0.95rem;
}

.wk-metaline {
	margin: 0;
	font-size: 0.85rem;
}

.wk-sectionhead {
	margin: 0;
	font-family: var(--font-display);
	font-size: 1.1rem;
}

.wk-ratingrow {
	align-items: center;
	gap: var(--space-2);
	font-size: 0.9rem;
}

.wk-editionrows {
	display: flex;
	flex-direction: column;
}

.wk-editionrow {
	display: flex;
	align-items: baseline;
	gap: var(--space-3);
	padding: var(--space-2) 0;
	border-bottom: 1px solid var(--border);
	font-size: 0.9rem;
	flex-wrap: wrap;
}

.wk-editionrow:last-child {
	border-bottom: none;
}

.wk-editionformat {
	font-weight: 600;
	min-width: 6rem;
}

.wk-memberships {
	margin: 0;
	padding-left: var(--space-4);
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}

/* Card title/cover click-through to the work detail page. The card lifts on
   hover (see .book-card); the title link warms with it. */
.bc-titlelink {
	color: var(--ink);
}

.bc-titlelink:hover,
.book-card:hover .bc-titlelink {
	color: var(--accent);
	text-decoration: none;
}

.bc-coverlink {
	display: block;
	flex: none;
	line-height: 0;
}

/* ---- card shelf-action menu (split button + popover) ----
   Fern budget: primary segment and menu chrome stay neutral (secondary
   button, surface/ink); checkmarks are ink glyphs, not fern affordances. */
.bc-actions {
	align-items: center;
	/* Fused capsule: the segments join into one control, so no gap. */
	gap: 0;
}

.bc-menutoggle {
	padding: var(--space-1) var(--space-2);
	display: inline-flex;
	align-items: center;
}

/* The two segments sit on the plain surface (chips stay on the tinted
   surface-2), so the control reads as a button rather than another chip. */
.bc-primary,
.bc-menutoggle {
	background: var(--surface);
	border-color: var(--border);
}

.bc-primary:not([disabled]):hover,
.bc-menutoggle:hover {
	background: var(--surface-2);
}

/* The did-not-finish prompts always render, empty or not, because a patch
   needs a target to replace when one appears. An empty flex child still takes
   the stack's gap, so it collapses until it has something to say. */
.bc-prompts:empty {
	display: none;
}

/* The primary segment is wrapped so it can be patched independently of the
   skeleton around it (the toggle and popover carry instance-unique ids that a
   patch must not replace). display:contents keeps the button itself as the
   flex item, so the fused capsule lays out as if the wrapper were absent. */
.bc-primaryslot {
	display: contents;
}

/* Rounding only on the control's outer corners, and the toggle drops its
   start border so the pair share one line. */
.bc-primary {
	border-start-end-radius: 0;
	border-end-end-radius: 0;
}

.bc-menutoggle {
	border-start-start-radius: 0;
	border-end-start-radius: 0;
	border-inline-start: none;
}

/* Terminal state (read): the primary segment reports where the book landed
   instead of offering the next step, so it greys out and goes inert - it
   keeps the control's shape rather than degrading to a chip, which would look
   out of place beside the toggle. The toggle stays live: the menu is the way
   back off the shelf. */
.bc-primary[disabled] {
	background: var(--surface-2);
	color: var(--sub);
	cursor: not-allowed;
}

.bc-menutoggle .ui-user-chevron svg {
	width: 16px;
	height: 16px;
}

/* The menu is a native popover: top layer, light dismiss, Esc-to-close, no
   JavaScript. Hidden with a plain display:none so a browser WITHOUT popover
   support never shows it inline (its toggle is inert there; the primary
   segment still works); :popover-open re-reveals it on supporting engines.
   Positioning is two-tier. The base below is a bottom sheet: pure CSS cannot
   anchor a top-layer popover to its invoker without CSS anchor positioning,
   so engines lacking it (older Firefox) keep the sheet, which is also the
   intended mobile presentation. The @supports block further down upgrades
   supporting engines to a dropdown anchored to the toggle that opened it. */
.bc-menu {
	display: none;
}

.bc-menu:popover-open {
	display: flex;
	flex-direction: column;
	position: fixed;
	inset: auto 0 0 0;
	margin: 0 auto;
	width: min(100%, 22rem);
	max-height: 70vh;
	overflow-y: auto;
	background: var(--surface);
	color: var(--ink);
	border: 1px solid var(--border);
	border-bottom: none;
	border-radius: var(--radius-control) var(--radius-control) 0 0;
	padding: var(--space-2);
	box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}

.bc-menu::backdrop {
	background: rgba(0, 0, 0, 0.25);
}

/* Tier two: anchor the menu to the toggle that opened it. The toggle carries
   anchor-name and the menu position-anchor (per-instance, emitted by the card
   component); everything else is here. position-try-fallbacks flips the menu
   above or to the other inline side when the viewport edge would clip it. No
   dimmed backdrop - a scrim reads as modal, wrong for a dropdown; light
   dismiss still works. */
@supports (anchor-name: --a) {
	.bc-menu:popover-open {
		/* fixed, not absolute: position-try-fallbacks resolve against the
		   containing block, and only a viewport-sized one makes the flip
		   trigger at the viewport edge. Anchor positioning keeps the menu
		   glued to its toggle across scroll either way. */
		position: fixed;
		position-area: block-end span-inline-start;
		position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
		inset: auto;
		/* No gap: the menu MEETS its toggle. A flipped menu that floats clear
		   of its toggle can land between two cards for the same work and read
		   as belonging to neither - contact is what makes it attributable,
		   flipped or not. */
		margin: 0;
		width: max-content;
		min-width: 12rem;
		max-width: min(20rem, 90vw);
		max-height: min(60vh, 22rem);
		border: 1px solid var(--border);
		border-radius: var(--radius-control);
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	}

	.bc-menu::backdrop {
		background: none;
	}
}

/* The entrance. display and the top layer are discrete properties, so this
   needs @starting-style and allow-discrete; a browser without them shows the
   panel instantly, with no transition. The scale
   is from the panel's own centre rather than from the edge nearest its
   trigger: @position-try cannot carry transform-origin and CSS exposes no
   selector for which fallback applied, so a directional origin would point
   the wrong way in exactly the flipped case. Direction is the job of contact
   and the trigger's active state, which cannot point the wrong way. */
.bc-menu,
.ui-user-menu,
.search-genre-panel {
	transition:
		display var(--motion-brief) allow-discrete,
		overlay var(--motion-brief) allow-discrete,
		opacity var(--motion-brief) ease-out,
		transform var(--motion-brief) ease-out;
	opacity: 1;
	transform: scale(1);
}

@starting-style {
	.bc-menu:popover-open,
	.ui-user-checkbox:checked ~ .ui-user-menu,
	.search-genre-checkbox:checked ~ .search-genre-panel {
		opacity: 0;
		transform: scale(0.96);
	}
}

/* The entrance is polish, so it goes - stated here rather than with the other
   reduced-motion rules because it has to outrank the transition above, and
   equal specificity means the later rule wins. Contact with the trigger and
   the trigger's active state carry the origin rule on their own, so a reader
   who asked for less motion loses nothing but the motion. */
@media (prefers-reduced-motion: reduce) {
	.bc-menu,
	.ui-user-menu,
	.search-genre-panel {
		transition: none;
	}
}

.bc-menusection {
	display: flex;
	flex-direction: column;
}

.bc-menusection form {
	display: contents;
}

.bc-menuitem {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	width: 100%;
	padding: var(--space-2) var(--space-3);
	border: none;
	background: none;
	color: var(--ink);
	font: inherit;
	text-align: left;
	border-radius: 6px;
	cursor: pointer;
}

button.bc-menuitem:hover {
	background: var(--surface-2);
}

.bc-menuitem--current {
	cursor: default;
	color: var(--sub);
}

.bc-menucheck {
	width: 16px;
	height: 16px;
	flex: none;
	display: inline-flex;
}

.bc-menucheck svg {
	width: 16px;
	height: 16px;
}

.bc-menudivider {
	border: none;
	border-top: 1px solid var(--border);
	margin: var(--space-1) 0;
}

/* ---- admin dashboard: read-only health panels ----
   Bad news reads in the error and warning tokens; fern only marks the
   good-news "all clear" and a caught-up consumer. Tables scroll inside
   their wrapper on narrow screens, never the page. */
.admin-refresh {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: var(--space-1);
	font-size: 0.85rem;
}

.admin-refresh .ui-muted {
	margin-right: var(--space-1);
}

.admin-refresh-option {
	padding: 0.15rem 0.6rem;
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	color: var(--sub);
	text-decoration: none;
}

.admin-refresh-option:hover {
	color: var(--ink);
}

/* the current rate: neutral emphasis, not fern (active state, not good news) */
.admin-refresh-option.is-current {
	background: var(--surface-2);
	border-color: var(--sub);
	color: var(--ink);
	font-weight: 600;
}

.admin-panel h3 {
	margin: var(--space-2) 0 0;
	font-size: 0.95rem;
}

.admin-all-clear {
	margin: 0;
	padding: 0.6rem 0.85rem;
	border-radius: var(--radius-control);
	border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 600;
}

.admin-findings {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
}

.admin-finding {
	display: flex;
	gap: var(--space-3);
	align-items: flex-start;
	padding: var(--space-2) var(--space-3);
	border-radius: var(--radius-control);
	border: 1px solid var(--border);
	background: var(--surface-2);
}

.admin-finding-fix {
	border-color: color-mix(in srgb, var(--danger) 45%, transparent);
	background: var(--danger-soft);
}

.admin-finding-warn {
	border-color: color-mix(in srgb, var(--warning) 45%, transparent);
	background: var(--warning-soft);
}

.admin-severity {
	flex: none;
	padding: 0.1rem 0.5rem;
	border-radius: var(--radius-pill);
	border: 1px solid var(--border);
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--sub);
}

.admin-severity-fix {
	border-color: color-mix(in srgb, var(--danger) 45%, transparent);
	color: var(--danger);
}

.admin-severity-warn {
	border-color: color-mix(in srgb, var(--warning) 45%, transparent);
	color: var(--warning);
}

.admin-finding-body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	color: var(--ink);
}

.admin-finding-body p {
	margin: 0;
	overflow-wrap: anywhere;
}

.admin-finding-title {
	font-weight: 600;
}

.admin-remedy code {
	font-size: 0.82rem;
}

.admin-num {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ui-table th.admin-num,
.ui-table td.admin-num {
	text-align: right;
}

.admin-panel .ui-table th[scope="row"],
.admin-panel .ui-table td.admin-paused {
	white-space: nowrap;
}

.admin-good {
	color: var(--accent);
	font-weight: 600;
}

.admin-paused,
.admin-unavailable {
	color: var(--warning);
	font-weight: 600;
}

.admin-error-text {
	min-width: 12rem;
	overflow-wrap: anywhere;
	color: var(--sub);
}

.admin-facts {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: var(--space-1) var(--space-3);
	margin: 0;
}

.admin-facts dt {
	color: var(--sub);
}

.admin-facts dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.admin-notes {
	margin: 0;
	padding-left: 1.1rem;
	font-size: 0.85rem;
}

/* ---- the invites page: a new link, shown once, with copy ---- */
.invite-link {
	display: flex;
	gap: var(--space-2);
	align-items: center;
}

.invite-link input {
	appearance: none;
	flex: 1;
	min-width: 0;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	min-height: 40px;
	font-size: 0.95rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
}

/* ---- admin invites: the allowance form ---- */
.adminv-settings {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	max-width: 24rem;
}

.adminv-settings label {
	font-size: 0.9rem;
	font-weight: 600;
}

.adminv-settings input[type="number"] {
	appearance: none;
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	min-height: 40px;
	font-size: 1rem;
	font-family: var(--font-ui);
	background: var(--surface);
	color: var(--ink);
	max-width: 8rem;
}

.adminv-settings button {
	align-self: flex-start;
}

/* ---- notifications page (the "Spineline Notifications" mockup) ----
   Header with the unread summary and a SECONDARY Mark all button (the page's
   only fern is the unread signal: the dot, the author-release pair, the
   active chip, and the action links), a row of type filter chips, and one
   bordered card of rows separated by hairlines. */
.notif-page {
	width: 100%;
	max-width: 880px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}

.notif-header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--space-4);
	flex-wrap: wrap;
}

.notif-heading {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
}

.notif-heading h1 {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 1.875rem;
	letter-spacing: -0.02em;
}

.notif-summary {
	margin: 0;
	font-size: 0.875rem;
	color: var(--sub);
}

.notif-markall:empty {
	display: none;
}

.notif-markall-button {
	padding: 0.5rem 1rem;
	border-width: 1.5px;
	background: var(--surface);
	font-size: 0.8125rem;
	font-weight: 600;
}

.notif-markall-button:hover {
	border-color: var(--accent-ui);
	color: var(--accent);
	background: var(--surface);
}

/* type filter chips: plain links; the active one takes the fern pair */
.notif-filters {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.notif-chip {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 7px 13px;
	border-radius: var(--radius-pill);
	border: 1.5px solid var(--border);
	background: var(--surface);
	color: var(--ink);
	font-size: 0.8125rem;
	font-weight: 500;
	text-decoration: none;
	transition: border-color var(--motion-brief);
}

.notif-chip:hover {
	border-color: var(--accent-ui);
	color: var(--ink);
}

.notif-chip.is-active {
	border-color: var(--accent);
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 600;
}

.notif-chip-count {
	font-size: 0.6875rem;
	font-weight: 600;
	padding: 1px 7px;
	border-radius: var(--radius-pill);
	background: var(--surface-2);
	color: var(--sub);
}

.notif-chip.is-active .notif-chip-count {
	background: var(--surface);
}

/* the list card */
.notif-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 16px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.notif-empty {
	margin: 0;
	padding: var(--space-7) var(--space-5);
	text-align: center;
	color: var(--sub);
	font-size: 0.875rem;
}

/* row anatomy: dot | icon tile | text column | right column */
.notif-row {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 14px 18px 14px 14px;
	border-top: 1px solid var(--border);
	background: var(--surface);
	transition: background var(--motion-brief);
}

.notif-row:first-child {
	border-top: none;
}

.notif-row:hover {
	background: var(--surface-2);
}

.notif-row.is-unread {
	background: var(--surface-unread);
	cursor: pointer;
}

.notif-dot {
	width: 8px;
	height: 8px;
	border-radius: var(--radius-pill);
	flex: none;
	margin-top: 13px;
	background: transparent;
}

.notif-row.is-unread .notif-dot {
	background: var(--accent-ui);
}

.notif-icon {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	opacity: 0.6;
}

.notif-icon svg {
	width: 17px;
	height: 17px;
}

.notif-row.is-unread .notif-icon {
	opacity: 1;
}

.notif-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	flex: 1;
	min-width: 0;
}

.notif-title-row {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	flex-wrap: wrap;
}

.notif-title {
	font-size: 0.90625rem;
	font-weight: 500;
	line-height: 1.3;
	color: var(--sub);
}

.notif-row.is-unread .notif-title {
	font-weight: 600;
	color: var(--ink);
}

.notif-tag {
	font-size: 0.6875rem;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: var(--radius-pill);
	opacity: 0.7;
}

.notif-row.is-unread .notif-tag {
	opacity: 1;
}

.notif-detail {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--sub);
}

.notif-aside {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	flex: none;
}

.notif-when {
	font-size: 0.75rem;
	color: color-mix(in srgb, var(--sub) 70%, var(--surface));
	white-space: nowrap;
}

.notif-action-form {
	margin: 0;
}

.notif-action {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0;
	border: none;
	background: transparent;
	font: inherit;
	font-size: 0.78125rem;
	font-weight: 600;
	color: var(--accent);
	cursor: pointer;
	white-space: nowrap;
}

.notif-action:hover {
	text-decoration: underline;
}

.notif-action-arrow {
	width: 13px;
	height: 13px;
}

.notif-dismiss {
	color: var(--sub);
	font-weight: 500;
}

.notif-dismiss:hover {
	color: var(--ink);
	text-decoration: none;
}

/* type colour pairs, shared by the icon tile and the tag */
.notif-type-author-release {
	color: var(--type-author);
	background: var(--type-author-soft);
}

.notif-type-series-release {
	color: var(--type-series);
	background: var(--type-series-soft);
}

.notif-type-import {
	color: var(--type-import);
	background: var(--type-import-soft);
}

.notif-type-announcement {
	color: var(--type-announcement);
	background: var(--type-announcement-soft);
}

@media (max-width: 640px) {
	.notif-row {
		flex-wrap: wrap;
	}

	.notif-aside {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding-left: calc(8px + 34px + 28px);
	}
}

/* ---- preferences: Email card (release email switch + frequency tiles) ---- */
.prefs-emailcard .prefs-switchrow {
	display: flex;
	align-items: center;
	gap: 16px;
}

.prefs-emaillabel {
	margin: 0;
	font-size: 0.9rem;
	font-weight: 500;
}

.prefs-frequencytiles {
	margin-top: 2px;
}

/* a disabled tile keeps its selection but reads as inactive */
.prefs-themetile:disabled {
	cursor: default;
	opacity: 0.5;
}

.prefs-themetile:disabled:hover {
	border-color: var(--border);
}

.prefs-themetile.is-selected:disabled:hover {
	border-color: var(--accent);
}

/* ---- notifications: the pinned announcement card (amber, above the list) ---- */
.notif-pinned-slot:empty {
	display: none;
}

.notif-pinned {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 16px 18px;
	border-radius: var(--radius-card);
	border: 1.5px solid var(--type-announcement);
	background: var(--type-announcement-soft);
}

.notif-pinned .notif-icon {
	opacity: 1;
	color: var(--surface);
	background: var(--type-announcement);
}

.notif-pinned .notif-title {
	font-weight: 600;
	color: var(--ink);
}

.notif-pinned .notif-tag {
	opacity: 1;
	background: var(--surface);
}

.notif-pinned-actions {
	display: flex;
	gap: 12px;
	align-items: center;
}

@media (max-width: 640px) {
	.notif-pinned {
		flex-wrap: wrap;
	}

	.notif-pinned .notif-aside {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding-left: calc(34px + 14px);
	}
}

/* ---- admin: announcements compose form ---- */
.admann-form textarea {
	border: 1px solid var(--border);
	border-radius: var(--radius-control);
	padding: 0.5rem 0.7rem;
	min-height: 120px;
	font: inherit;
	font-size: 1rem;
	resize: vertical;
	background: var(--surface);
	color: var(--ink);
}

.admann-count {
	font-size: 0.78rem;
	color: var(--sub);
	font-weight: 500;
	align-self: flex-end;
}

.admann-pair {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-3);
}

@media (max-width: 640px) {
	.admann-pair {
		grid-template-columns: 1fr;
	}
}

.admann-row .ui-row {
	flex-wrap: wrap;
	gap: var(--space-2);
}
