/*
 * Past papers public styles. Every rule is scoped to .pp-ui, the class on each element the plugin prints.
 * Type, colour, spacing, links, lists, tables and form controls are set here; the theme supplies only the page around them.
 * Element rules are prefixed with "body .pp-ui".
 */

/* ---------- tokens and base ---------- */

.pp-ui {
	--pp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--pp-text: #1e1e1e;
	--pp-muted: #646970;
	--pp-faint: #a7aaad;
	--pp-border: #dcdcde;
	--pp-surface: #f6f7f7;
	--pp-white: #fff;
	--pp-accent: #1f5fa8;
	--pp-accent-dark: #174a84;
	--pp-danger: #b32d2e;
	--pp-radius: 4px;
	--pp-focus: 0 0 0 2px var(--pp-white), 0 0 0 4px var(--pp-accent);
}

body .pp-ui {
	color: var(--pp-text);
	font-family: var(--pp-font);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.55;
	letter-spacing: 0;
	text-align: left;
	text-transform: none;
	-webkit-font-smoothing: antialiased;
}

body .pp-ui *,
body .pp-ui *::before,
body .pp-ui *::after {
	box-sizing: border-box;
}

body .pp-ui h1,
body .pp-ui h2,
body .pp-ui h3 {
	margin: 0;
	padding: 0;
	border: 0;
	color: var(--pp-text);
	font-family: var(--pp-font);
	font-style: normal;
	font-weight: 600;
	letter-spacing: 0;
	line-height: 1.3;
	text-transform: none;
}

body .pp-ui h1 {
	font-size: 30px;
}

body .pp-ui h2 {
	font-size: 20px;
}

body .pp-ui p {
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

body .pp-ui a {
	border: 0;
	box-shadow: none;
	color: var(--pp-accent);
	font-weight: inherit;
	text-decoration: none;
}

body .pp-ui a:hover {
	color: var(--pp-accent-dark);
	text-decoration: underline;
}

body .pp-ui a:focus-visible {
	outline: 2px solid transparent;
	box-shadow: var(--pp-focus);
	border-radius: 2px;
}

body .pp-ui ul,
body .pp-ui ol,
body .pp-ui li {
	margin: 0;
	padding: 0;
	list-style: none;
}

body .pp-ui li::before,
body .pp-ui li::marker {
	content: none;
}

body .pp-ui table,
body .pp-ui thead,
body .pp-ui tbody,
body .pp-ui tr,
body .pp-ui th,
body .pp-ui td {
	margin: 0;
	border: 0;
	background: none;
	font-size: inherit;
	line-height: inherit;
}

body .pp-ui input,
body .pp-ui select,
body .pp-ui button {
	margin: 0;
	box-shadow: none;
	font-family: var(--pp-font);
	font-size: 15px;
	letter-spacing: 0;
	line-height: 1.4;
	text-transform: none;
}

body .pp-ui .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- headings ---------- */

body .pp-ui .pp-title {
	margin: 0 0 20px;
}

body .pp-ui .pp-section-title {
	margin: 32px 0 12px;
}

body .pp-ui .pp-single-content .pp-paper > .pp-section-title:first-child {
	margin-top: 0;
}

.pp-ui .pp-heading {
	margin: 0 0 24px;
}

.pp-ui .pp-eyebrow {
	color: var(--pp-muted);
	font-size: 13px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

body .pp-ui .pp-heading-title {
	margin: 4px 0 8px;
}

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

body .pp-ui .pp-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 38px;
	padding: 8px 16px;
	border: 1px solid var(--pp-accent);
	border-radius: var(--pp-radius);
	background: var(--pp-accent);
	color: var(--pp-white);
	font-family: var(--pp-font);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
}

body .pp-ui .pp-button:hover {
	border-color: var(--pp-accent-dark);
	background: var(--pp-accent-dark);
	color: var(--pp-white);
	text-decoration: none;
}

body .pp-ui .pp-button:focus-visible {
	outline: 2px solid transparent;
	box-shadow: var(--pp-focus);
}

body .pp-ui .pp-icon {
	display: block;
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
}

body .pp-ui .pp-button-secondary {
	background: var(--pp-white);
	color: var(--pp-accent);
}

body .pp-ui .pp-button-secondary:hover {
	background: var(--pp-surface);
	color: var(--pp-accent-dark);
}

/* ---------- filter form ---------- */

.pp-ui .pp-filters {
	display: grid;
	gap: 16px;
	margin: 0 0 24px;
	padding: 20px;
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius);
	background: var(--pp-surface);
}

.pp-ui .pp-selects {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 16px;
}

.pp-ui .pp-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

body .pp-ui .pp-field label {
	color: var(--pp-text);
	font-size: 14px;
	font-weight: 600;
}

body .pp-ui .pp-filters input[type="search"],
body .pp-ui .pp-filters select {
	width: 100%;
	max-width: 100%;
	height: 40px;
	padding: 0 12px;
	border: 1px solid #8c8f94;
	border-radius: var(--pp-radius);
	background-color: var(--pp-white);
	color: var(--pp-text);
}

body .pp-ui .pp-filters input[type="search"]:focus,
body .pp-ui .pp-filters select:focus {
	border-color: var(--pp-accent);
	outline: 2px solid transparent;
	box-shadow: 0 0 0 1px var(--pp-accent);
}

.pp-ui .pp-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
}

/* ---------- results ---------- */

body .pp-ui .pp-count {
	margin: 0 0 12px;
	color: var(--pp-muted);
	font-size: 14px;
}

.pp-ui .pp-table-wrap {
	overflow-x: auto;
}

body .pp-ui .pp-table {
	width: 100%;
	border-collapse: collapse;
}

body .pp-ui .pp-table th,
body .pp-ui .pp-table td {
	padding: 12px;
	border-bottom: 1px solid var(--pp-border);
	color: var(--pp-text);
	text-align: left;
	vertical-align: top;
}

body .pp-ui .pp-table thead th {
	border-bottom: 2px solid var(--pp-border);
	color: var(--pp-muted);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
}

body .pp-ui .pp-col-title > a {
	font-weight: 600;
}

.pp-ui .pp-row-meta {
	display: block;
	margin-top: 4px;
	color: var(--pp-muted);
	font-size: 14px;
}

body .pp-ui .pp-row-meta a {
	color: inherit;
}

.pp-ui .pp-none {
	color: var(--pp-faint);
}

.pp-ui .pp-file-links {
	white-space: nowrap;
}

body .pp-ui .pp-empty,
body .pp-ui .pp-note {
	padding: 16px 20px;
	border: 1px dashed var(--pp-border);
	border-radius: var(--pp-radius);
	color: var(--pp-muted);
}

/* ---------- pagination ---------- */

.pp-ui .pp-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 20px 0 0;
}

body .pp-ui .pp-pagination .page-numbers {
	display: inline-block;
	min-width: 36px;
	padding: 6px 10px;
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius);
	color: var(--pp-text);
	text-align: center;
	text-decoration: none;
}

body .pp-ui .pp-pagination .page-numbers.current {
	border-color: var(--pp-accent);
	background: var(--pp-accent);
	color: var(--pp-white);
}

body .pp-ui .pp-pagination .page-numbers.dots {
	border-color: transparent;
}

/* ---------- single paper ---------- */

.pp-ui.pp-single {
	max-width: 1240px;
	margin: 0 auto;
	padding: 40px 20px 56px;
}

.pp-ui .pp-single-content > p {
	margin: 0 0 16px;
}

.pp-ui.pp-paper-head {
	margin: 0 0 8px;
}

.pp-ui.pp-hero {
	width: 100%;
	margin: 0;
	padding: 32px 20px;
	background: var(--pp-surface);
	border-bottom: 1px solid var(--pp-border);
}

.pp-ui .pp-hero-inner {
	max-width: 1200px;
	margin: 0 auto;
}

body .pp-ui .pp-hero .pp-title {
	margin: 0;
}

body .pp-ui .pp-hero .pp-eyebrow {
	margin: 0 0 6px;
}




.pp-ui .pp-trail {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 0 0 20px;
	font-size: 14px;
}

.pp-ui .pp-hero .pp-trail {
	margin: 0 0 12px;
}

.pp-ui .pp-trail-sep {
	color: var(--pp-faint);
}

.pp-ui .pp-file-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 0;
}

.pp-ui .pp-file-row + .pp-file-row {
	border-top: 1px solid var(--pp-border);
}

body .pp-ui .pp-file-row-icon {
	display: block;
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	box-shadow: none;
}

.pp-ui .pp-file-row-text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
}

.pp-ui .pp-file-row-name {
	font-weight: 600;
}

.pp-ui .pp-file-row-meta {
	color: var(--pp-muted);
	font-size: 14px;
}

.pp-ui .pp-file-row-actions {
	display: flex;
	flex: 0 0 auto;
	gap: 8px;
}

.pp-ui .pp-file-row.is-missing .pp-file-row-icon {
	filter: grayscale(1);
	opacity: 0.4;
}

.pp-ui .pp-file-row.is-missing .pp-file-row-name {
	color: var(--pp-muted);
}

.pp-ui .pp-related li {
	padding: 10px 0;
	border-bottom: 1px solid var(--pp-border);
}

@media (max-width: 640px) {
	body .pp-ui .pp-file-row-actions .pp-button {
		width: 40px;
		min-height: 40px;
		padding: 0;
	}

	body .pp-ui .pp-file-row-actions .pp-button-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	body .pp-ui .pp-file-row-actions .pp-icon {
		width: 20px;
		height: 20px;
	}

	body .pp-ui h1 {
		font-size: 26px;
	}
}

/* ---------- term grid ---------- */

.pp-ui.pp-browse {
	margin: 0 0 72px;
}

.pp-ui .pp-term-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 12px;
}

body .pp-ui .pp-term-grid a {
	display: flex;
	flex-direction: column;
	gap: 4px;
	height: 100%;
	padding: 14px 16px;
	border: 1px solid var(--pp-border);
	border-radius: var(--pp-radius);
	color: var(--pp-text);
	text-decoration: none;
}

body .pp-ui .pp-term-grid a:hover {
	border-color: var(--pp-accent);
	text-decoration: none;
}

.pp-ui .pp-term-name {
	font-weight: 600;
}

.pp-ui .pp-term-count {
	color: var(--pp-muted);
	font-size: 14px;
}

/* ---------- narrow screens: each result row becomes a card with labelled cells ---------- */

@media (max-width: 640px) {
	body .pp-ui .pp-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	body .pp-ui .pp-table,
	body .pp-ui .pp-table tbody,
	body .pp-ui .pp-table tr,
	body .pp-ui .pp-table td {
		display: block;
		width: 100%;
	}

	body .pp-ui .pp-table tr {
		margin: 0 0 12px;
		border: 1px solid var(--pp-border);
		border-radius: var(--pp-radius);
	}

	body .pp-ui .pp-table td {
		display: grid;
		grid-template-columns: 110px 1fr;
		gap: 8px;
	}

	body .pp-ui .pp-table td:last-child {
		border-bottom: 0;
	}

	body .pp-ui .pp-table td::before {
		content: attr(data-label);
		color: var(--pp-muted);
		font-size: 13px;
		font-weight: 600;
	}

	.pp-ui .pp-file-links {
		white-space: normal;
	}
}

/* ---------- details section ---------- */

.pp-ui .pp-details-box {
	margin: 0 0 8px;
	border-bottom: 1px solid var(--pp-border);
}

body .pp-ui .pp-details-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 0;
	color: var(--pp-text);
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	list-style: none;
	cursor: pointer;
}

body .pp-ui .pp-details-summary::-webkit-details-marker {
	display: none;
}

body .pp-ui .pp-details-summary::marker {
	content: "";
}

body .pp-ui .pp-details-summary:focus-visible {
	outline: 2px solid transparent;
	box-shadow: var(--pp-focus);
}

.pp-ui .pp-toggle-icon {
	display: flex;
	flex: 0 0 auto;
	color: var(--pp-text);
}

body .pp-ui .pp-toggle-icon .pp-icon {
	width: 24px;
	height: 24px;
}

.pp-ui .pp-toggle-icon .pp-icon:last-child,
.pp-ui .pp-details-box[open] .pp-toggle-icon .pp-icon:first-child {
	display: none;
}

.pp-ui .pp-details-box[open] .pp-toggle-icon .pp-icon:last-child {
	display: block;
}

.pp-ui .pp-details-body {
	padding: 0 0 16px;
}

body .pp-ui .pp-details-body > p {
	margin: 0 0 12px;
}

body .pp-ui .pp-details-empty {
	color: var(--pp-muted);
}

/* ---------- column heading filters ---------- */

body .pp-ui .pp-table thead th.pp-th-filter {
	padding: 8px 8px 10px;
	text-transform: none;
	letter-spacing: 0;
}

body .pp-ui .pp-th-filter select {
	width: 100%;
	min-width: 120px;
	height: 34px;
	padding: 0 8px;
	border: 1px solid #8c8f94;
	border-radius: var(--pp-radius);
	background-color: var(--pp-white);
	color: var(--pp-text);
	font-size: 14px;
	font-weight: 600;
}

body .pp-ui .pp-th-filter select:focus {
	border-color: var(--pp-accent);
	outline: 2px solid transparent;
	box-shadow: 0 0 0 1px var(--pp-accent);
}

body .pp-ui .pp-table .pp-no-rows td {
	padding: 24px 12px;
	color: var(--pp-muted);
	text-align: center;
}

@media (max-width: 640px) {
	body .pp-ui .pp-table thead {
		position: static;
		display: block;
		width: auto;
		height: auto;
		overflow: visible;
		clip: auto;
	}

	body .pp-ui .pp-table thead tr {
		display: grid;
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 8px;
		margin: 0 0 12px;
		border: 0;
	}

	body .pp-ui .pp-table thead th {
		display: none;
	}

	body .pp-ui .pp-table thead th.pp-th-filter {
		display: block;
		padding: 0;
		border: 0;
	}

	body .pp-ui .pp-th-filter select {
		min-width: 0;
	}

	body .pp-ui .pp-table .pp-no-rows td {
		display: block;
	}

	body .pp-ui .pp-table .pp-no-rows td::before {
		content: none;
	}
}

/* ---------- paper page sidebar ---------- */

.pp-ui .pp-columns.pp-has-sidebar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 40px;
	align-items: start;
}

.pp-ui .pp-main {
	min-width: 0;
}

.pp-ui .pp-sidebar {
	min-width: 0;
}

.pp-ui .pp-widget + .pp-widget {
	margin-top: 24px;
}

body .pp-ui .pp-widget-title {
	margin: 0 0 12px;
	font-size: 16px;
}

body .pp-ui .pp-area-placeholder {
	padding: 20px;
	border: 1px dashed var(--pp-faint);
	color: var(--pp-muted);
	font-size: 14px;
}

@media (max-width: 900px) {
	.pp-ui .pp-columns.pp-has-sidebar {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ---------- ad and custom code areas ---------- */

.pp-ui .pp-ad-area {
	width: 100%;
}

.pp-ui .pp-ad-top {
	margin: 0 0 48px;
}

.pp-ui .pp-ad-before-related {
	margin: 28px 0 0;
}

.pp-ui .pp-ad-bottom {
	margin: 48px 0 0;
}
