/**
 * WC PDF Library — front-end styles.
 *
 * Direction: a marine instrument panel rendered in ink and paper — verdigris
 * (oxidised deck-fitting green) for controls, brass (nameplate gold) for
 * citations and provenance. It's the material language of the subject this
 * plugin actually serves: offshore engineering documents, not a generic
 * dashboard template. The one deliberate signature is the reader's page
 * counter, styled as a recessed gauge with a live progress ring.
 *
 * Everything here is scoped under .wcpdl and deliberately avoids @layer:
 * unlayered host-theme CSS always outranks layered CSS regardless of
 * specificity, so layering our own rules would make them *more* fragile
 * against an arbitrary WordPress theme, not less.
 */

.wcpdl {
	/* ---- tier 1: literal tokens ---- */
	--wcpdl-ink: #0b1420;
	--wcpdl-ink-soft: #4c5a6b;
	--wcpdl-ink-faint: #7c8a99;
	--wcpdl-paper: #f3f5f4;
	--wcpdl-surface: #ffffff;
	--wcpdl-surface-sunk: #eef2f1;
	--wcpdl-line: #d7dedb;
	--wcpdl-line-strong: #bfc9c5;
	--wcpdl-verdigris: #0b7d6a;
	--wcpdl-verdigris-deep: #075c4f;
	--wcpdl-verdigris-bright: #14a389;
	--wcpdl-verdigris-wash: #e1f1ed;
	--wcpdl-brass: #a9791f;
	--wcpdl-brass-deep: #7e5a15;
	--wcpdl-brass-wash: #faf1de;
	--wcpdl-danger: #a63328;
	--wcpdl-danger-wash: #fbeae7;

	/* ---- tier 2: semantic roles ---- */
	--wcpdl-accent: var(--wcpdl-verdigris);
	--wcpdl-accent-deep: var(--wcpdl-verdigris-deep);
	--wcpdl-accent-bright: var(--wcpdl-verdigris-bright);
	--wcpdl-accent-wash: var(--wcpdl-verdigris-wash);
	--wcpdl-cite: var(--wcpdl-brass);
	--wcpdl-cite-deep: var(--wcpdl-brass-deep);
	--wcpdl-cite-wash: var(--wcpdl-brass-wash);

	--wcpdl-radius: 12px;
	--wcpdl-radius-sm: 7px;
	--wcpdl-radius-lg: 16px;
	--wcpdl-shell-height: 78vh;

	--wcpdl-shadow-xs: 0 1px 1px rgb(11 20 32 / 0.04);
	--wcpdl-shadow-sm:
		0 1px 2px rgb(11 20 32 / 0.06),
		0 1px 1px rgb(11 20 32 / 0.04);
	--wcpdl-shadow-md:
		0 4px 10px rgb(11 20 32 / 0.08),
		0 1px 3px rgb(11 20 32 / 0.06);
	--wcpdl-shadow-lg:
		0 14px 28px rgb(11 20 32 / 0.12),
		0 4px 10px rgb(11 20 32 / 0.06);
	--wcpdl-shadow-inset: inset 0 1px 2px rgb(11 20 32 / 0.08);

	--wcpdl-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

	--wcpdl-display: ui-serif, "Iowan Old Style", "Source Serif Pro", Palatino, Georgia, serif;
	--wcpdl-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--wcpdl-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	container-type: inline-size;
	container-name: wcpdl;

	/* A flex or grid parent in the host theme can otherwise squeeze this to
	   zero inline size, which collapses every pane and reads as "nothing
	   rendered" — this has bitten us before. */
	display: block;
	inline-size: 100%;
	min-inline-size: 0;
	flex: 1 1 100%;

	font-family: var(--wcpdl-body);
	color: var(--wcpdl-ink);
	line-height: 1.5;
	font-size: 15px;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	.wcpdl {
		color-scheme: dark;
		--wcpdl-ink: #e9edf0;
		--wcpdl-ink-soft: #a7b2bc;
		--wcpdl-ink-faint: #76828c;
		--wcpdl-paper: #12181c;
		--wcpdl-surface: #1a2226;
		--wcpdl-surface-sunk: #10161a;
		--wcpdl-line: #2c363b;
		--wcpdl-line-strong: #3c484e;
		--wcpdl-verdigris: #3fc4ab;
		--wcpdl-verdigris-deep: #7fe0cb;
		--wcpdl-verdigris-bright: #59d9be;
		--wcpdl-verdigris-wash: #143430;
		--wcpdl-brass: #dbaa4e;
		--wcpdl-brass-deep: #f0c876;
		--wcpdl-brass-wash: #2e2412;
		--wcpdl-danger: #e3766a;
		--wcpdl-danger-wash: #331714;
		--wcpdl-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.3), 0 1px 1px rgb(0 0 0 / 0.24);
		--wcpdl-shadow-md: 0 4px 10px rgb(0 0 0 / 0.36), 0 1px 3px rgb(0 0 0 / 0.28);
		--wcpdl-shadow-lg: 0 14px 28px rgb(0 0 0 / 0.44), 0 4px 10px rgb(0 0 0 / 0.28);
	}
}

.wcpdl *,
.wcpdl *::before,
.wcpdl *::after {
	box-sizing: border-box;
}

/* Themes commonly set their own default margin on bare header/section/aside
   tags and on buttons, as part of generic content-area or form styling.
   Every rule below that touches these elements sets its own padding,
   background, and border, but until now none of them touched margin — and
   CSS only resolves a conflict on a property both rules actually declare.
   A silent property lets a theme default straight through regardless of
   specificity. This is what was showing up as dead space above the reader
   toolbar. */
.wcpdl section,
.wcpdl header,
.wcpdl aside,
.wcpdl button,
.wcpdl input,
.wcpdl select,
.wcpdl textarea {
	margin: 0 !important;
}

.wcpdl .screen-reader-text {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.wcpdl :focus-visible {
	outline: 2px solid var(--wcpdl-accent);
	outline-offset: 2px;
	border-radius: 3px;
}

.wcpdl ::selection {
	background: var(--wcpdl-accent-wash);
	color: var(--wcpdl-accent-deep);
}

.wcpdl *:where(.wcpdl-list, .wcpdl-reader__stage, .wcpdl-chat) {
	scrollbar-color: var(--wcpdl-line-strong) transparent;
	scrollbar-width: thin;
}

@supports (corner-shape: squircle) {
	.wcpdl-item__cover,
	.wcpdl-btn,
	.wcpdl-pagejump,
	.wcpdl-cite,
	.wcpdl-search__field,
	.wcpdl-catalog,
	.wcpdl-reader,
	.wcpdl-assistant {
		corner-shape: squircle;
	}
}

/* ---------------------------------------------------------------- search */

.wcpdl-search {
	display: flex;
	flex-flow: row wrap;
	gap: 0.55rem;
	align-items: center;
	margin-block-end: 0.85rem;
}

.wcpdl-search__field {
	position: relative;
	display: flex;
	align-items: center;
	flex: 1 1 22rem;
	min-inline-size: 0;
	background: var(--wcpdl-surface);
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius);
	box-shadow: var(--wcpdl-shadow-xs);
	transition: border-color 160ms var(--wcpdl-ease), box-shadow 160ms var(--wcpdl-ease);
}

.wcpdl-search__field:hover {
	border-color: var(--wcpdl-line-strong);
}

.wcpdl-search__field:focus-within {
	border-color: var(--wcpdl-accent);
	box-shadow: 0 0 0 4px var(--wcpdl-accent-wash), var(--wcpdl-shadow-xs);
}

.wcpdl-search__icon {
	inline-size: 18px;
	block-size: 18px;
	margin-inline: 0.85rem 0;
	color: var(--wcpdl-ink-faint);
	flex: none;
	transition: color 160ms var(--wcpdl-ease);
}

.wcpdl-search__field:focus-within .wcpdl-search__icon {
	color: var(--wcpdl-accent);
}

.wcpdl-search__field input[type="search"] {
	flex: 1 1 auto;
	min-inline-size: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	padding: 0.75rem 0.75rem;
	outline: none;
	appearance: none;
}

.wcpdl-search__field input[type="search"]::-webkit-search-cancel-button {
	display: none;
}

.wcpdl-search__field input[type="search"]::placeholder {
	color: var(--wcpdl-ink-faint);
}

.wcpdl-kbd {
	flex: none;
	font-family: var(--wcpdl-mono);
	font-size: 11px;
	line-height: 1;
	color: var(--wcpdl-ink-faint);
	background: var(--wcpdl-surface-sunk);
	border: 1px solid var(--wcpdl-line);
	border-block-end-width: 2px;
	border-radius: 5px;
	padding: 0.3rem 0.45rem;
	margin-inline-end: 0.5rem;
}

@media (pointer: coarse) {
	.wcpdl-kbd {
		display: none;
	}
}

.wcpdl-search__clear {
	border: 0;
	background: transparent;
	color: var(--wcpdl-ink-faint);
	font-size: 20px;
	line-height: 1;
	padding-inline: 0.7rem;
	cursor: pointer;
	border-radius: var(--wcpdl-radius-sm);
	transition: color 140ms var(--wcpdl-ease), background 140ms var(--wcpdl-ease);
}

.wcpdl-search__clear:hover {
	color: var(--wcpdl-danger);
	background: var(--wcpdl-danger-wash);
}

.wcpdl-select select {
	appearance: none;
	font: inherit;
	color: inherit;
	padding: 0.65rem 2rem 0.65rem 0.75rem;
	background-color: var(--wcpdl-surface);
	background-image:
		linear-gradient(45deg, transparent 50%, var(--wcpdl-ink-faint) 50%),
		linear-gradient(135deg, var(--wcpdl-ink-faint) 50%, transparent 50%);
	background-position: calc(100% - 17px) center, calc(100% - 12px) center;
	background-size: 5px 5px, 5px 5px;
	background-repeat: no-repeat;
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius);
	box-shadow: var(--wcpdl-shadow-xs);
	max-inline-size: 14rem;
	cursor: pointer;
	transition: border-color 160ms var(--wcpdl-ease), box-shadow 160ms var(--wcpdl-ease);
}

.wcpdl-select select:hover {
	border-color: var(--wcpdl-line-strong);
}

.wcpdl-select select:focus-visible {
	border-color: var(--wcpdl-accent);
	box-shadow: 0 0 0 4px var(--wcpdl-accent-wash);
}

/* ------------------------------------------------------------------ tabs */

.wcpdl-tabs {
	display: none;
	position: relative;
	gap: 0.2rem;
	margin-block-end: 0.85rem;
	background: var(--wcpdl-surface-sunk);
	padding: 0.25rem;
	border-radius: var(--wcpdl-radius);
	border: 1px solid var(--wcpdl-line);
}

.wcpdl-tabs::after {
	content: "";
	position: absolute;
	inset-block: 0.25rem;
	inset-inline-start: var(--wcpdl-tab-x, 0.25rem);
	inline-size: var(--wcpdl-tab-w, 0px);
	background: var(--wcpdl-surface);
	border-radius: var(--wcpdl-radius-sm);
	box-shadow: var(--wcpdl-shadow-sm);
	transition: inset-inline-start 280ms var(--wcpdl-ease), inline-size 280ms var(--wcpdl-ease);
	z-index: 0;
}

.wcpdl-tabs button {
	position: relative;
	z-index: 1;
	flex: 1 1 0;
	border: 0;
	background: transparent;
	font: inherit;
	font-weight: 500;
	color: var(--wcpdl-ink-soft);
	padding: 0.55rem 0.75rem;
	border-radius: var(--wcpdl-radius-sm);
	cursor: pointer;
	transition: color 200ms var(--wcpdl-ease);
}

.wcpdl-tabs button[aria-selected="true"] {
	color: var(--wcpdl-ink);
	font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
	.wcpdl-tabs::after {
		transition: none;
	}
}

/* ----------------------------------------------------------------- shell */

.wcpdl-shell {
	display: grid;
	grid-template-columns: var(--wcpdl-catalog-w, 21rem) minmax(0, 1fr);
	gap: 0.85rem;
	block-size: var(--wcpdl-shell-height) !important;
	min-block-size: 30rem;
	max-block-size: var(--wcpdl-shell-height) !important;
	position: relative;
}

.wcpdl-shell[data-catalog="collapsed"] {
	--wcpdl-catalog-w: 3.6rem;
}

.wcpdl-catalog,
.wcpdl-reader,
.wcpdl-assistant {
	background: var(--wcpdl-surface);
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-lg);
	box-shadow: var(--wcpdl-shadow-sm);
	min-inline-size: 0;
	min-block-size: 0 !important;
	padding: 0 !important;
	display: flex;
	flex-direction: column;
	overflow: hidden !important;
}

.wcpdl-catalog {
	transition: inline-size 260ms var(--wcpdl-ease);
}

.wcpdl-catalog__head {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.55rem 0.6rem !important;
	border-block-end: 1px solid var(--wcpdl-line);
	flex: none;
}

.wcpdl-catalog__toggle {
	flex: none;
	display: grid;
	place-items: center;
	inline-size: 2rem;
	block-size: 2rem;
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-sm);
	background: var(--wcpdl-surface);
	color: var(--wcpdl-ink-soft);
	cursor: pointer;
	transition: border-color 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-catalog__toggle:hover {
	border-color: var(--wcpdl-accent);
	color: var(--wcpdl-accent);
}

.wcpdl-catalog__head .wcpdl-count {
	border-block-end: 0;
	padding: 0;
	flex: 1 1 auto;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wcpdl-selection {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	background: var(--wcpdl-accent-wash);
	border-block-end: 1px solid var(--wcpdl-line);
	flex: none;
}

.wcpdl-selection span {
	font-family: var(--wcpdl-mono);
	font-size: 11px;
	letter-spacing: 0.04em;
	color: var(--wcpdl-accent-deep);
	font-weight: 600;
}

.wcpdl-selection button {
	font: inherit;
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	background: transparent;
	border: 0;
	color: var(--wcpdl-accent-deep);
	cursor: pointer;
	padding: 0.15rem 0.4rem;
	border-radius: var(--wcpdl-radius-sm);
	transition: background 140ms var(--wcpdl-ease);
}

.wcpdl-selection button:hover {
	background: rgb(255 255 255 / 0.5);
}

@container wcpdl (inline-size >= 62rem) {
	.wcpdl-shell[data-catalog="collapsed"] .wcpdl-list,
	.wcpdl-shell[data-catalog="collapsed"] .wcpdl-pager,
	.wcpdl-shell[data-catalog="collapsed"] .wcpdl-count {
		display: none;
	}

	.wcpdl-shell[data-catalog="collapsed"] .wcpdl-catalog__head {
		justify-content: center;
	}
}

/* The reader's own way back to the list, shown only once the rail has
   collapsed down to a sliver — otherwise the full catalog is already
   sitting right there and a second way to reach it would be clutter. */
.wcpdl-reader__browse {
	display: none;
	align-items: center;
	gap: 0.35rem;
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--wcpdl-ink-soft);
	background: var(--wcpdl-surface);
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-sm);
	padding: 0.4rem 0.65rem;
	cursor: pointer;
	flex: none;
	margin-inline-end: 0.5rem;
	transition: border-color 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-reader__browse:hover {
	border-color: var(--wcpdl-accent);
	color: var(--wcpdl-accent);
}

@container wcpdl (inline-size >= 62rem) {
	.wcpdl-shell[data-catalog="collapsed"] .wcpdl-reader__browse {
		display: inline-flex;
	}
}

/* The assistant overlays the reader on wide layouts instead of permanently
   occupying a third column — see the layout comparison worked through
   earlier. On narrow layouts the existing tab system below already gives
   it a full pane, so this positioning only applies once there's a sidebar
   to overlay in the first place. */
@container wcpdl (inline-size >= 62rem) {
	.wcpdl-assistant {
		position: absolute;
		inset-block: 0;
		inset-inline-end: 0;
		inline-size: min(26rem, 94%);
		z-index: 5;
		box-shadow: var(--wcpdl-shadow-lg);
		transform: translateX(100%);
		opacity: 0;
		pointer-events: none;
		transition: transform 280ms var(--wcpdl-ease), opacity 200ms var(--wcpdl-ease);
	}

	.wcpdl-shell[data-assistant="open"] .wcpdl-assistant {
		transform: translateX(0);
		opacity: 1;
		pointer-events: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpdl-catalog,
	.wcpdl-assistant {
		transition: none;
	}
}

/* --------------------------------------------------------------- catalog */

.wcpdl-count {
	margin: 0;
	padding: 0.7rem 1rem;
	border-block-end: 1px solid var(--wcpdl-line);
	font-family: var(--wcpdl-mono);
	font-size: 11px;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--wcpdl-ink-faint);
}

.wcpdl-list {
	list-style: none;
	margin: 0;
	padding: 0;
	overflow-y: auto !important;
	overscroll-behavior: contain !important;
	touch-action: pan-y;
	scrollbar-gutter: stable;
	flex: 1 1 auto;
}

.wcpdl-list > li {
	border-block-end: 1px solid var(--wcpdl-line);
	content-visibility: auto;
	contain-intrinsic-size: auto 8rem;
	animation: wcpdl-item-in 360ms var(--wcpdl-ease) both;
	animation-delay: calc(var(--i, 0) * 26ms);
}

@keyframes wcpdl-item-in {
	from {
		opacity: 0;
		transform: translateY(5px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpdl-list > li {
		animation: none;
	}
}

.wcpdl-item {
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	padding: 0.9rem 1rem;
	position: relative;
	transition: background 160ms var(--wcpdl-ease);
}

.wcpdl-item::before {
	content: "";
	position: absolute;
	inset-block: 0.35rem;
	inset-inline-start: 0;
	inline-size: 3px;
	border-radius: 0 3px 3px 0;
	background: var(--wcpdl-accent);
	transform: scaleY(0);
	transform-origin: center;
	transition: transform 200ms var(--wcpdl-ease);
}

.wcpdl-item:hover {
	background: var(--wcpdl-surface-sunk);
}

.wcpdl-item:hover::before {
	transform: scaleY(0.5);
}

.wcpdl-item[aria-current="true"] {
	background: var(--wcpdl-accent-wash);
}

.wcpdl-item[aria-current="true"]::before {
	transform: scaleY(1);
}

.wcpdl-item__select {
	flex: none;
	display: flex;
	align-items: center;
	block-size: 3.5rem;
	cursor: pointer;
}

.wcpdl-item__select input[type="checkbox"] {
	inline-size: 16px;
	block-size: 16px;
	accent-color: var(--wcpdl-accent);
	cursor: pointer;
}

.wcpdl-item__open {
	flex: 1 1 auto;
	min-inline-size: 0;
	inline-size: 100%;
	text-align: start;
	display: grid;
	grid-template-columns: 3.5rem minmax(0, 1fr);
	gap: 0.8rem;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.wcpdl-item:hover .wcpdl-item__cover {
	transform: scale(1.04);
	box-shadow: var(--wcpdl-shadow-sm);
}

.wcpdl-item__cover {
	inline-size: 3.5rem;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	border-radius: 4px;
	background: var(--wcpdl-surface-sunk);
	border: 1px solid var(--wcpdl-line);
	box-shadow: var(--wcpdl-shadow-xs);
	transition: transform 220ms var(--wcpdl-ease), box-shadow 220ms var(--wcpdl-ease);
}

.wcpdl-item__cover--blank {
	display: grid;
	place-content: center;
	font-family: var(--wcpdl-mono);
	font-size: 9px;
	letter-spacing: 0.09em;
	color: var(--wcpdl-ink-faint);
}

.wcpdl-item__title {
	font-family: var(--wcpdl-display);
	font-size: 1.03rem;
	font-weight: 600;
	line-height: 1.28;
	margin: 0 0 0.22rem;
	color: var(--wcpdl-ink);
	text-wrap: balance;
}

.wcpdl-item__meta {
	font-family: var(--wcpdl-mono);
	font-size: 10.5px;
	letter-spacing: 0.045em;
	color: var(--wcpdl-ink-faint);
	margin: 0 0 0.4rem;
	text-transform: uppercase;
}

.wcpdl-item__summary {
	margin: 0;
	font-size: 13px;
	color: var(--wcpdl-ink-soft);
	text-wrap: pretty;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	line-clamp: 2;
	overflow: clip;
}

.wcpdl-hits {
	margin: 0 1rem 0.85rem;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0.32rem;
}

.wcpdl-hit__page {
	display: block;
	font-family: var(--wcpdl-mono);
	font-size: 10px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wcpdl-cite-deep);
	margin-block-end: 0.18rem;
}

.wcpdl-hit {
	inline-size: 100%;
	text-align: start;
	font: inherit;
	font-size: 12.5px;
	color: var(--wcpdl-ink-soft);
	background: var(--wcpdl-surface-sunk);
	border: 0;
	border-inline-start: 2px solid var(--wcpdl-cite);
	border-radius: 0 var(--wcpdl-radius-sm) var(--wcpdl-radius-sm) 0;
	padding: 0.4rem 0.55rem;
	cursor: pointer;
	transition: background 140ms var(--wcpdl-ease);
	text-wrap: pretty;
}

.wcpdl-hit:hover {
	background: var(--wcpdl-cite-wash);
}

.wcpdl mark {
	background: var(--wcpdl-accent-wash);
	color: inherit;
	padding: 0 2px;
	border-radius: 3px;
	font-weight: 600;
}

.wcpdl-badge {
	display: inline-block;
	font-family: var(--wcpdl-mono);
	font-size: 9.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 0.18rem 0.45rem;
	border-radius: 999px;
	border: 1px solid currentColor;
	color: var(--wcpdl-ink-faint);
	margin-inline-end: 0.35rem;
}

.wcpdl-badge--locked {
	color: var(--wcpdl-cite);
	background: var(--wcpdl-cite-wash);
	border-color: transparent;
}

.wcpdl-pager {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.55rem 1rem;
	border-block-start: 1px solid var(--wcpdl-line);
	font-family: var(--wcpdl-mono);
	font-size: 11px;
	color: var(--wcpdl-ink-faint);
}

.wcpdl-pager button {
	font: inherit;
	font-size: 11px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	background: transparent;
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-sm);
	color: var(--wcpdl-ink-soft);
	padding: 0.32rem 0.65rem;
	cursor: pointer;
	transition: border-color 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-pager button:not(:disabled):hover {
	border-color: var(--wcpdl-accent);
	color: var(--wcpdl-accent);
}

.wcpdl-pager button:disabled {
	opacity: 0.4;
	cursor: default;
}

/* -------------------------------------------------------------- skeleton */

.wcpdl-skel {
	display: grid;
	grid-template-columns: 3.5rem minmax(0, 1fr);
	gap: 0.8rem;
	padding: 0.9rem 1rem;
	border-block-end: 1px solid var(--wcpdl-line);
}

.wcpdl-skel__cover,
.wcpdl-skel__bar {
	border-radius: 4px;
	background: linear-gradient(
		90deg,
		var(--wcpdl-surface-sunk) 25%,
		color-mix(in oklab, var(--wcpdl-surface-sunk), white 70%) 50%,
		var(--wcpdl-surface-sunk) 75%
	);
	background-size: 200% 100%;
	animation: wcpdl-shimmer 1.7s ease-in-out infinite;
}

.wcpdl-skel__cover {
	inline-size: 3.5rem;
	aspect-ratio: 3 / 4;
}

.wcpdl-skel__lines {
	display: grid;
	align-content: start;
	gap: 0.5rem;
	padding-block-start: 0.15rem;
}

.wcpdl-skel__bar {
	block-size: 0.6rem;
}

.wcpdl-skel__bar--title {
	inline-size: 78%;
	block-size: 0.85rem;
}

.wcpdl-skel__bar--meta {
	inline-size: 45%;
}

.wcpdl-skel__bar--body {
	inline-size: 95%;
}

@keyframes wcpdl-shimmer {
	from {
		background-position: 200% 0;
	}
	to {
		background-position: -200% 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpdl-skel__cover,
	.wcpdl-skel__bar {
		animation: none;
		background: var(--wcpdl-surface-sunk);
	}
}

/* ---------------------------------------------------------------- reader */

.wcpdl-reader__bar {
	display: flex;
	flex-flow: row wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.6rem;
	padding: 0.7rem 1rem !important;
	border-block-end: 1px solid var(--wcpdl-line);
	background: var(--wcpdl-surface);
}

.wcpdl-reader__title {
	min-inline-size: 0;
	flex: 1 1 14rem;
}

.wcpdl-reader__title h2 {
	font-family: var(--wcpdl-display);
	font-size: 1.1rem;
	font-weight: 600;
	margin: 0;
	line-height: 1.28;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wcpdl-reader__title p {
	margin: 0.15rem 0 0;
	font-family: var(--wcpdl-mono);
	font-size: 10.5px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--wcpdl-ink-faint);
}

.wcpdl-reader__controls {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	flex-wrap: wrap;
}

.wcpdl-zoomgroup {
	display: flex;
	align-items: stretch;
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-sm);
	overflow: hidden;
	background: var(--wcpdl-surface);
}

.wcpdl-zoomgroup button {
	font: inherit;
	font-size: 14px;
	background: transparent;
	border: 0;
	color: var(--wcpdl-ink-soft);
	padding: 0.4rem 0.6rem;
	min-inline-size: 2.1rem;
	cursor: pointer;
	transition: background 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-zoomgroup button + button {
	border-inline-start: 1px solid var(--wcpdl-line);
}

.wcpdl-zoomgroup button:hover {
	background: var(--wcpdl-surface-sunk);
	color: var(--wcpdl-accent);
}

.wcpdl-zoom {
	font-family: var(--wcpdl-mono);
	font-size: 11px;
	color: var(--wcpdl-ink-faint);
	min-inline-size: 3.2rem;
	text-align: center;
	display: grid;
	place-items: center;
	font-variant-numeric: tabular-nums;
}

.wcpdl-reader__controls > button:not(.wcpdl-zoomgroup button) {
	font: inherit;
	font-size: 13px;
	background: var(--wcpdl-surface);
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-sm);
	color: var(--wcpdl-ink-soft);
	padding: 0.4rem 0.7rem;
	cursor: pointer;
	transition: border-color 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-reader__controls > button:not(.wcpdl-zoomgroup button):hover {
	border-color: var(--wcpdl-accent);
	color: var(--wcpdl-accent);
}

.wcpdl-reader__select {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--wcpdl-ink-soft);
	background: var(--wcpdl-surface);
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-sm);
	padding: 0.4rem 0.65rem;
	cursor: pointer;
	transition: border-color 140ms var(--wcpdl-ease), background 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-reader__select:hover {
	border-color: var(--wcpdl-accent);
}

.wcpdl-reader__select input[type="checkbox"] {
	inline-size: 14px;
	block-size: 14px;
	accent-color: var(--wcpdl-accent);
	cursor: pointer;
	margin: 0;
}

/* Checked reads as a confirmed, filled state — the same visual family as
   the primary buttons — not just another idle toggle sitting in the row. */
.wcpdl-reader__select:has(input:checked) {
	background: var(--wcpdl-accent-wash);
	border-color: var(--wcpdl-accent);
	color: var(--wcpdl-accent-deep);
}

/* The signature element: the page counter as a recessed instrument gauge,
   with a live conic-gradient ring tracking read progress through the
   document. Pure CSS on markup that already existed for the page-jump
   control — no extra elements, just a --wcpdl-progress custom property
   that JS keeps in sync with the current page. */
.wcpdl-pagejump {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.25rem 0.6rem 0.25rem 0.3rem;
	border-radius: 999px;
	background: conic-gradient(
		var(--wcpdl-accent) calc(var(--wcpdl-progress, 0) * 1turn),
		var(--wcpdl-line) 0
	);
	transition: background 240ms var(--wcpdl-ease);
}

.wcpdl-pagejump::before {
	content: "";
	position: absolute;
	inset: 2px;
	border-radius: inherit;
	background: var(--wcpdl-surface);
	box-shadow: var(--wcpdl-shadow-inset);
}

.wcpdl-pagejump > * {
	position: relative;
	z-index: 1;
}

.wcpdl-pagejump input {
	inline-size: 2.6rem;
	font: inherit;
	font-family: var(--wcpdl-mono);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	padding: 0.15rem 0;
	text-align: center;
	border: 0;
	background: transparent;
	color: var(--wcpdl-ink);
	appearance: textfield;
}

.wcpdl-pagejump input::-webkit-outer-spin-button,
.wcpdl-pagejump input::-webkit-inner-spin-button {
	appearance: none;
	margin: 0;
}

.wcpdl-pagejump [data-wcpdl-pagetotal] {
	font-family: var(--wcpdl-mono);
	font-size: 11px;
	color: var(--wcpdl-ink-faint);
	white-space: nowrap;
}

.wcpdl-btn--ghost {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.wcpdl-reader__stage {
	flex: 1 1 auto;
	overflow: auto !important;
	overscroll-behavior: contain !important;
	touch-action: pan-y;
	scrollbar-gutter: stable;
	background: var(--wcpdl-surface-sunk);
	padding: 0.85rem;
	display: block;
}

.wcpdl-page {
	position: relative;
	margin: 0 auto 0.85rem;
	background: #fff;
	box-shadow: var(--wcpdl-shadow-md);
	border-radius: 2px;
	max-inline-size: 100%;
	content-visibility: auto;
}

.wcpdl-page canvas {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	border-radius: inherit;
}

.wcpdl-page__label {
	position: absolute;
	inset-block-start: 0.4rem;
	inset-inline-end: 0.4rem;
	font-family: var(--wcpdl-mono);
	font-size: 10px;
	letter-spacing: 0.06em;
	background: rgb(11 20 32 / 0.66);
	color: #fff;
	padding: 0.12rem 0.4rem;
	border-radius: 3px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 180ms var(--wcpdl-ease);
}

.wcpdl-page:hover .wcpdl-page__label,
.wcpdl-page--flash .wcpdl-page__label {
	opacity: 1;
}

.wcpdl-page--flash::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 3px solid var(--wcpdl-cite);
	box-shadow: 0 0 0 6px color-mix(in oklab, var(--wcpdl-cite), transparent 84%);
	border-radius: inherit;
	animation: wcpdl-flash 1.7s ease-out forwards;
	pointer-events: none;
}

@keyframes wcpdl-flash {
	0% {
		opacity: 1;
	}
	65% {
		opacity: 1;
	}
	100% {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpdl-page--flash::after {
		animation: none;
		opacity: 1;
	}
	.wcpdl-page__label {
		transition: none;
	}
}

.wcpdl-empty {
	display: grid;
	place-content: center;
	text-align: center;
	block-size: 100%;
	min-block-size: 14rem;
	color: var(--wcpdl-ink-faint);
	padding: 2rem;
}

.wcpdl-empty p {
	margin: 0.3rem 0;
	text-wrap: pretty;
}

.wcpdl-empty__title {
	font-family: var(--wcpdl-display);
	font-size: 1.12rem;
	color: var(--wcpdl-ink-soft);
}

/* ------------------------------------------------------------- assistant */

.wcpdl-assistant__head {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.5rem 0.5rem 0.5rem 0.7rem !important;
	border-block-end: 1px solid var(--wcpdl-line);
	flex: none;
}

.wcpdl-assistant__modes {
	display: flex;
	gap: 0.2rem;
	flex: 1 1 auto;
	min-inline-size: 0;
	overflow-x: auto;
	scrollbar-width: none;
}

.wcpdl-assistant__modes::-webkit-scrollbar {
	display: none;
}

.wcpdl-assistant__modes button {
	flex: none;
	font: inherit;
	font-size: 12px;
	font-weight: 500;
	color: var(--wcpdl-ink-faint);
	background: transparent;
	border: 0;
	border-radius: var(--wcpdl-radius-sm);
	padding: 0.4rem 0.6rem;
	cursor: pointer;
	white-space: nowrap;
	transition: background 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-assistant__modes button:hover {
	color: var(--wcpdl-ink);
}

.wcpdl-assistant__modes button[aria-selected="true"] {
	background: var(--wcpdl-accent-wash);
	color: var(--wcpdl-accent-deep);
	font-weight: 600;
}

.wcpdl-assistant__close {
	flex: none;
	display: grid;
	place-items: center;
	inline-size: 1.9rem;
	block-size: 1.9rem;
	border: 0;
	border-radius: var(--wcpdl-radius-sm);
	background: transparent;
	color: var(--wcpdl-ink-faint);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-assistant__close:hover {
	background: var(--wcpdl-danger-wash);
	color: var(--wcpdl-danger);
}

/* Author styles always beat the UA default for [hidden], so the mode
   panels need an explicit rule pair rather than relying on the attribute
   alone — otherwise the flex declaration below would force every panel
   visible regardless of the hidden attribute. */
.wcpdl-assistant__body {
	display: none;
	flex-direction: column;
	flex: 1 1 auto;
	min-block-size: 0 !important;
}

.wcpdl-assistant__body:not([hidden]) {
	display: flex;
}

.wcpdl-assistant__state {
	margin: 0;
	padding: 0.7rem 1rem 0;
	font-size: 12px;
	color: var(--wcpdl-ink-faint);
	text-wrap: pretty;
}

[data-wcpdl-briefinggenerate] {
	align-self: flex-start;
	margin: 0.7rem 1rem 0;
}

.wcpdl-chat {
	flex: 1 1 auto;
	overflow-y: auto !important;
	overscroll-behavior: contain !important;
	touch-action: pan-y;
	scrollbar-gutter: stable;
	padding: 0.8rem 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.8rem;
}

.wcpdl-msg {
	animation: wcpdl-msg-in 260ms var(--wcpdl-ease) both;
}

@keyframes wcpdl-msg-in {
	from {
		opacity: 0;
		transform: translateY(4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpdl-msg {
		animation: none;
	}
}

.wcpdl-msg__who {
	font-family: var(--wcpdl-mono);
	font-size: 9.5px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--wcpdl-ink-faint);
	margin-block-end: 0.22rem;
}

.wcpdl-msg__body {
	font-size: 14px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	text-wrap: pretty;
}

.wcpdl-msg__body strong,
.wcpdl-briefing__text strong {
	font-weight: 700;
	color: inherit;
}

.wcpdl-msg__body em,
.wcpdl-briefing__text em {
	font-style: italic;
	color: inherit;
}

.wcpdl-msg--user .wcpdl-msg__body {
	background: var(--wcpdl-surface-sunk);
	border-radius: var(--wcpdl-radius-sm);
	padding: 0.55rem 0.7rem;
}

.wcpdl-msg--bot .wcpdl-msg__body {
	background: var(--wcpdl-accent-wash);
	border-radius: var(--wcpdl-radius-sm);
	padding: 0.55rem 0.7rem;
	border-inline-start: 2px solid var(--wcpdl-accent);
}

.wcpdl-msg--error .wcpdl-msg__body {
	background: var(--wcpdl-danger-wash);
	border-inline-start-color: var(--wcpdl-danger);
	color: var(--wcpdl-danger);
}

.wcpdl-typing {
	display: inline-flex;
	align-items: center;
	gap: 0.28em;
}

.wcpdl-typing span {
	inline-size: 0.4em;
	block-size: 0.4em;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.55;
	animation: wcpdl-typing-bounce 1.15s ease-in-out infinite;
}

.wcpdl-typing span:nth-child(2) {
	animation-delay: 0.15s;
}

.wcpdl-typing span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes wcpdl-typing-bounce {
	0%,
	60%,
	100% {
		transform: translateY(0);
		opacity: 0.45;
	}
	30% {
		transform: translateY(-3px);
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpdl-typing span {
		animation: none;
		opacity: 0.8;
	}
}

/* Citation chips: brass instrument tags, tying every claim back to a page. */
.wcpdl-cite {
	display: inline-flex;
	align-items: baseline;
	font-family: var(--wcpdl-mono);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--wcpdl-cite-deep);
	background: var(--wcpdl-cite-wash);
	border: 1px solid color-mix(in oklab, var(--wcpdl-cite), transparent 55%);
	border-radius: 5px;
	padding: 0.02rem 0.3rem;
	margin-inline: 0.12rem;
	cursor: pointer;
	white-space: nowrap;
	transition: background 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease), transform 140ms var(--wcpdl-ease);
}

.wcpdl-cite:hover {
	background: var(--wcpdl-cite);
	color: #fff;
	transform: translateY(-1px);
}

.wcpdl-ask {
	display: flex;
	gap: 0.45rem;
	padding: 0.65rem 1rem;
	border-block-start: 1px solid var(--wcpdl-line);
	align-items: flex-end;
}

.wcpdl-ask textarea {
	flex: 1 1 auto;
	min-inline-size: 0;
	resize: none;
	font: inherit;
	font-size: 14px;
	padding: 0.55rem 0.65rem;
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-sm);
	background: var(--wcpdl-surface);
	color: var(--wcpdl-ink);
	transition: border-color 160ms var(--wcpdl-ease), box-shadow 160ms var(--wcpdl-ease);
}

@supports (field-sizing: content) {
	.wcpdl-ask textarea {
		field-sizing: content;
		min-block-size: 2.4rem;
		max-block-size: 8rem;
	}
}

.wcpdl-ask textarea:focus-visible {
	border-color: var(--wcpdl-accent);
	box-shadow: 0 0 0 4px var(--wcpdl-accent-wash);
	outline: none;
}

.wcpdl-ask textarea:disabled {
	background: var(--wcpdl-surface-sunk);
	color: var(--wcpdl-ink-faint);
}

.wcpdl-assistant__foot {
	margin: 0;
	padding: 0 1rem 0.75rem;
	font-size: 11px;
	color: var(--wcpdl-ink-faint);
	text-wrap: pretty;
}

/* Library-mode answers name which documents they drew from, under the
   answer itself — the citation chips inline already say [N, p. X], this
   is the "N = which document" legend for that same message. */
.wcpdl-msg__sources {
	margin: 0.4rem 0 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	font-size: 11.5px;
}

.wcpdl-msg__sources button {
	font: inherit;
	background: var(--wcpdl-surface-sunk);
	border: 1px solid var(--wcpdl-line);
	border-radius: 999px;
	color: var(--wcpdl-ink-soft);
	padding: 0.15rem 0.55rem;
	cursor: pointer;
	transition: border-color 140ms var(--wcpdl-ease), color 140ms var(--wcpdl-ease);
}

.wcpdl-msg__sources button:hover {
	border-color: var(--wcpdl-accent);
	color: var(--wcpdl-accent-deep);
}

/* ---------------------------------------------------------------- panels */

.wcpdl-briefing {
	flex: 1 1 auto;
	overflow-y: auto !important;
	overscroll-behavior: contain !important;
	scrollbar-gutter: stable;
	padding: 0 1rem 1rem;
	font-size: 13.5px;
}

.wcpdl-briefing__empty {
	color: var(--wcpdl-ink-faint);
	font-size: 12.5px;
	padding-block-start: 0.5rem;
}

.wcpdl-briefing__text {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	text-wrap: pretty;
	margin: 0.6rem 0 1rem;
}

.wcpdl-briefing__sources-heading {
	margin: 0 0 0.4rem;
	font-family: var(--wcpdl-mono);
	font-size: 10.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wcpdl-ink-faint);
	border-block-start: 1px solid var(--wcpdl-line);
	padding-block-start: 0.7rem;
}

.wcpdl-briefing__sources {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0.35rem;
}

.wcpdl-briefing__sources button {
	font: inherit;
	font-size: 12.5px;
	background: transparent;
	border: 0;
	color: var(--wcpdl-accent);
	cursor: pointer;
	text-align: start;
	padding: 0;
}

.wcpdl-briefing__sources button:hover {
	text-decoration: underline;
}

/* --------------------------------------------------------------- buttons */

.wcpdl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	background: linear-gradient(
		to bottom,
		var(--wcpdl-accent-bright),
		var(--wcpdl-accent) 65%
	) !important;
	color: #fff !important;
	border: 1px solid var(--wcpdl-accent-deep) !important;
	border-radius: var(--wcpdl-radius-sm);
	padding: 0.55rem 0.9rem;
	cursor: pointer;
	box-shadow: var(--wcpdl-shadow-sm), inset 0 1px 0 rgb(255 255 255 / 0.2);
	transition: transform 140ms var(--wcpdl-ease), box-shadow 140ms var(--wcpdl-ease), background 140ms var(--wcpdl-ease);
}

.wcpdl-btn:hover {
	background: linear-gradient(to bottom, var(--wcpdl-accent-bright), var(--wcpdl-accent-deep) 75%) !important;
	color: #fff !important;
	transform: translateY(-1px);
	box-shadow: var(--wcpdl-shadow-md), inset 0 1px 0 rgb(255 255 255 / 0.2);
}

.wcpdl-btn:active:not(:disabled) {
	transform: translateY(0);
	box-shadow: var(--wcpdl-shadow-xs);
}

.wcpdl-btn:disabled {
	opacity: 0.5;
	cursor: default;
	transform: none;
}

.wcpdl-btn--ghost {
	background: var(--wcpdl-surface) !important;
	color: var(--wcpdl-accent) !important;
	border-color: var(--wcpdl-line) !important;
	box-shadow: var(--wcpdl-shadow-xs);
}

.wcpdl-btn--ghost:hover {
	background: var(--wcpdl-accent-wash) !important;
	color: var(--wcpdl-accent-deep) !important;
	border-color: var(--wcpdl-accent) !important;
}

.wcpdl-notice {
	border: 1px solid var(--wcpdl-line, #d7dedb);
	border-radius: var(--wcpdl-radius-lg, 16px);
	padding: 1.4rem;
	background: #fff;
	text-align: center;
	box-shadow: var(--wcpdl-shadow-sm, none);
}

/* ------------------------------------------------------------ diagnostics */

.wcpdl-debug {
	border: 1px solid var(--wcpdl-line, #d0d5dc);
	border-inline-start: 4px solid var(--wcpdl-accent, #0b7d6a);
	background: var(--wcpdl-surface, #fff);
	color: var(--wcpdl-ink, #0b1420);
	border-radius: var(--wcpdl-radius, 8px);
	padding: 0.9rem 1rem;
	margin-block-end: 1rem;
	font-family: var(--wcpdl-mono, monospace);
	font-size: 12px;
	overflow-wrap: anywhere;
}

.wcpdl-debug table {
	inline-size: 100%;
	border-collapse: collapse;
	margin-block: 0.5rem;
}

.wcpdl-debug th,
.wcpdl-debug td {
	text-align: start;
	padding: 0.25rem 0.5rem 0.25rem 0;
	border-block-end: 1px solid var(--wcpdl-line, #eceff3);
	vertical-align: top;
}

.wcpdl-debug th {
	inline-size: 12rem;
	font-weight: 600;
	white-space: nowrap;
}

/* ----------------------------------------------------------- narrow view */

@container wcpdl (inline-size < 62rem) {
	.wcpdl-shell,
	.wcpdl-shell--no-chat {
		grid-template-columns: minmax(0, 1fr);
	}

	.wcpdl-tabs {
		display: flex;
	}

	.wcpdl-shell > [data-pane] {
		display: none;
	}

	.wcpdl-shell[data-pane-active="catalog"] > [data-pane="catalog"],
	.wcpdl-shell[data-pane-active="reader"] > [data-pane="reader"],
	.wcpdl-shell[data-pane-active="assistant"] > [data-pane="assistant"] {
		display: flex;
		animation: wcpdl-pane-in 240ms var(--wcpdl-ease) both;
	}
}

@keyframes wcpdl-pane-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wcpdl-shell[data-pane-active] > [data-pane] {
		animation: none;
	}
}

@container wcpdl (inline-size < 34rem) {
	.wcpdl-search__field {
		flex-basis: 100%;
	}

	.wcpdl-select select {
		max-inline-size: none;
		inline-size: 100%;
	}

	.wcpdl-select {
		flex: 1 1 8rem;
	}
}

/* Coarse-pointer touch targets: bump the reader's icon-only buttons up to
   the WCAG 2.5.8 minimum without changing their footprint on a mouse. */
@media (pointer: coarse) {
	.wcpdl-zoomgroup button {
		min-inline-size: 2.5rem;
		padding-block: 0.55rem;
	}

	.wcpdl-search__clear {
		min-inline-size: 2.5rem;
	}
}

/* ------------------------------------------------ approved UI refinements
   These rules only adjust the reader toolbar and the collapsed catalogue
   rail. PDF loading/rendering behaviour is unchanged. */

.wcpdl-catalog__toggle {
	position: relative;
}

.wcpdl-catalog__badge {
	display: none;
	position: absolute;
	inset-block-start: -0.35rem;
	inset-inline-end: -0.35rem;
	min-inline-size: 1.05rem;
	block-size: 1.05rem;
	padding-inline: 0.18rem;
	place-items: center;
	border-radius: 999px;
	background: var(--wcpdl-accent);
	color: #fff;
	font-family: var(--wcpdl-mono);
	font-size: 9px;
	font-weight: 700;
	line-height: 1;
	box-shadow: 0 0 0 2px var(--wcpdl-surface);
}

@container wcpdl (inline-size >= 62rem) {
	.wcpdl-shell[data-catalog="collapsed"] .wcpdl-selection {
		display: none;
	}

	.wcpdl-shell[data-catalog="collapsed"] .wcpdl-catalog__badge:not([hidden]) {
		display: grid;
	}
}

.wcpdl-reader__bar {
	flex-flow: row nowrap;
	justify-content: flex-start;
	gap: 0.55rem;
	padding: 0.65rem 0.75rem !important;
}

.wcpdl-reader__browse {
	margin-inline-end: 0;
}

.wcpdl-reader__title {
	min-inline-size: 8rem;
	flex: 1 1 28rem;
}

.wcpdl-reader__controls {
	flex: 0 0 auto;
	flex-wrap: nowrap;
	gap: 0;
	white-space: nowrap;
}

/* Zoom and Fit width read as one compact control group. */
.wcpdl-zoomgroup {
	border-start-end-radius: 0;
	border-end-end-radius: 0;
}

.wcpdl-zoomgroup button + button {
	border-inline-start: 1px solid var(--wcpdl-line);
}

.wcpdl-fit-icon {
	display: grid;
	place-items: center;
	inline-size: 2.25rem;
	min-inline-size: 2.25rem;
	block-size: 2.05rem;
	padding: 0 !important;
	margin-inline-start: -1px;
	border: 1px solid var(--wcpdl-line) !important;
	border-radius: 0 var(--wcpdl-radius-sm) var(--wcpdl-radius-sm) 0 !important;
	background: var(--wcpdl-surface) !important;
	color: var(--wcpdl-ink-soft) !important;
	position: relative;
}

.wcpdl-fit-icon:hover {
	border-color: var(--wcpdl-accent) !important;
	color: var(--wcpdl-accent) !important;
	z-index: 1;
}

.wcpdl-fit-icon svg,
.wcpdl-reader__iconbtn svg {
	display: block;
}

/* Separate the logical groups without giving every control equal weight. */
.wcpdl-fit-icon {
	margin-inline-end: 1rem;
}

.wcpdl-fit-icon::after {
	content: "";
	position: absolute;
	inset-block: 0.2rem;
	inset-inline-end: -0.55rem;
	inline-size: 1px;
	background: var(--wcpdl-line);
}

.wcpdl-pagejump {
	background: var(--wcpdl-surface);
	border: 1px solid var(--wcpdl-line);
	border-radius: var(--wcpdl-radius-sm);
	padding: 0.25rem 0.6rem;
	margin-inline-end: 1rem;
	box-shadow: none;
	position: relative;
}

.wcpdl-pagejump::before {
	display: none;
}

.wcpdl-pagejump::after {
	content: "";
	position: absolute;
	inset-block: 0.2rem;
	inset-inline-end: -0.55rem;
	inline-size: 1px;
	background: var(--wcpdl-line);
}

.wcpdl-pagejump input {
	inline-size: 2.2rem;
}

.wcpdl-reader__iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	inline-size: 2.25rem;
	min-inline-size: 2.25rem;
	block-size: 2.05rem;
	padding: 0 !important;
	margin-inline-end: 0.4rem;
}

.wcpdl-reader__select {
	margin-inline-end: 0.4rem;
}

/* Keep the title readable; move the controls below only when the reader
   becomes genuinely narrow. */
@container wcpdl (inline-size < 52rem) {
	.wcpdl-reader__bar {
		flex-wrap: wrap;
	}

	.wcpdl-reader__title {
		flex: 1 1 18rem;
	}

	.wcpdl-reader__controls {
		flex: 1 0 100%;
		justify-content: flex-end;
	}
}

@container wcpdl (inline-size < 38rem) {
	.wcpdl-reader__bar {
		gap: 0.45rem;
		padding: 0.55rem !important;
	}

	.wcpdl-reader__controls {
		justify-content: flex-start;
		overflow-x: auto;
		padding-block-end: 0.1rem;
		scrollbar-width: thin;
	}

	.wcpdl-reader__title h2 {
		font-size: 1rem;
	}
}

