/**
 * «سوابق اجرایی» — project references page + highlights strip.
 * Plain CSS (no build step). Uses the theme tokens (CSS custom properties from style.css) and spec v2:
 * light-dominant, hairlines, 4/6/8px radii, graphite for selection, red only for small accents.
 */

/* ---------- Stats band ---------- */
.pr-stats-band {
	background: var(--color-surface, #fff);
	border-bottom: 1px solid var(--color-line);
}
.pr-stats-band .pr-stats {
	border-top: 0;
}
@media (min-width: 64rem) {
	.pr-stats-band .pr-stats {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
	.pr-stats-band .stat:nth-child(n + 3) {
		border-top: 0;
	}
}
@media (max-width: 63.99rem) {
	.pr-stats-band .stat:nth-child(5) {
		grid-column: 1 / -1;
		border-inline-start: 0;
		padding-inline-start: 0;
	}
}
.pr-stats .stat-value small {
	margin-inline-start: 0.375rem;
}

/* ---------- Highlights ---------- */
.pr-hl-grid {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: min(84%, 22rem);
	gap: 1rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	margin-inline: calc(-1 * var(--spacing-gutter, 1rem));
	padding-inline: var(--spacing-gutter, 1rem);
	scroll-padding-inline: var(--spacing-gutter, 1rem);
	list-style: none;
	padding-block: 0;
}
.pr-hl-grid::-webkit-scrollbar {
	display: none;
}
.pr-hl-item {
	scroll-snap-align: start;
	min-width: 0;
}
@media (min-width: 48rem) {
	.pr-hl-grid {
		grid-auto-flow: row;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		grid-auto-columns: auto;
		overflow: visible;
		margin-inline: 0;
		padding-inline: 0;
		gap: 1.5rem;
	}
}
@media (min-width: 64rem) {
	.pr-hl-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.pr-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	background: var(--color-surface, #fff);
	border: 1px solid var(--color-line);
	border-radius: var(--radius-card, 6px);
	overflow: hidden;
	transition: border-color 0.2s, box-shadow 0.2s;
}
.pr-card:has(.card-link:hover) {
	border-color: var(--color-line-strong);
	box-shadow: 0 12px 32px -16px rgb(17 20 24 / 0.25);
}
.pr-card-media {
	aspect-ratio: 3 / 2;
	background: var(--color-slate-100);
	overflow: hidden;
}
.pr-card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.pr-card-top {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 1.25rem 1.25rem 0;
}
.pr-card-glyph {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid var(--color-line);
	border-radius: 4px;
	background: var(--color-slate-50);
	color: var(--color-slate-700);
}
.pr-ico {
	width: 1.375rem;
	height: 1.375rem;
}
.pr-ico-sm {
	width: 1rem;
	height: 1rem;
	flex: none;
	color: var(--color-slate-600);
}
.pr-card-year {
	margin-inline-start: auto;
	font-size: 0.8125rem;
	font-weight: 700;
	color: var(--color-slate-700);
	font-variant-numeric: tabular-nums;
}
.pr-card-body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.875rem;
	padding: 1rem 1.25rem 1.25rem;
}
@media (min-width: 40rem) {
	.pr-card-top {
		padding: 1.5rem 1.5rem 0;
	}
	.pr-card-body {
		padding: 1rem 1.5rem 1.5rem;
	}
}
.pr-card-title {
	font-size: var(--text-h3, 1.125rem);
	font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
	line-height: 1.65;
	font-weight: 700;
	color: var(--color-foreground);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.pr-card-title a:hover {
	color: var(--color-primary-700);
}
.pr-card-meta {
	display: grid;
	margin: 0;
	border-top: 1px solid var(--color-line);
}
.pr-card-meta > div {
	display: flex;
	gap: 0.75rem;
	justify-content: space-between;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--color-line);
	font-size: 0.875rem;
	line-height: 1.7;
}
.pr-card-meta dt {
	flex: none;
	color: var(--color-slate-600);
}
.pr-card-meta dd {
	margin: 0;
	font-weight: 600;
	color: var(--color-foreground);
	text-align: end;
	min-width: 0;
}
.pr-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	margin-top: auto;
}

/* Latin fallback face renders heavier than Peyda at 600/700. */
.pr-table .lat,
.pr-card-title .lat,
.pr-card-meta .lat {
	font-weight: 500;
}
.pr-tl {
	margin-bottom: 4rem;
}

/* ---------- Tags (square chips, not pills) ---------- */
.pr-tag {
	display: inline-block;
	padding: 0.1875rem 0.4375rem;
	border-radius: 3px;
	background: var(--color-slate-100);
	color: var(--color-slate-700);
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1.6;
	white-space: nowrap;
}
.pr-tag--more {
	background: transparent;
	border: 1px solid var(--color-line);
}

/* ---------- Filter form ---------- */
#pr-list {
	scroll-margin-top: var(--header-h, 3.75rem);
}
.pr-filter {
	margin-bottom: 1rem;
}
.pr-bar {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}
.pr-search {
	position: relative;
	flex: 1;
	min-width: 0;
}
.pr-search-ico {
	position: absolute;
	inset-inline-start: 0.875rem;
	top: 50%;
	width: 1.25rem;
	height: 1.25rem;
	transform: translateY(-50%);
	color: var(--color-slate-600);
	pointer-events: none;
}
.pr-search input {
	display: block;
	width: 100%;
	height: 3rem;
	padding-inline: 2.75rem 0.875rem;
	border: 1px solid var(--color-line-strong);
	border-radius: 4px;
	background: #fff;
	font: inherit;
	font-size: 1rem;
	color: var(--color-foreground);
}
.pr-search input::placeholder {
	color: var(--color-slate-500);
}
.pr-search input:hover,
.pr-select:hover {
	border-color: var(--color-slate-400);
}
.pr-search input:focus-visible,
.pr-select:focus-visible,
.pr-toggle:focus-visible,
.pr-chip:has(input:focus-visible),
.pr-bar-row:focus-visible,
.pr-link:focus-visible {
	outline: 2px solid var(--color-primary-600);
	outline-offset: 2px;
	border-color: var(--color-foreground);
}
.pr-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	height: 3rem;
	padding-inline: 1rem;
	border: 1px solid var(--color-line-strong);
	border-radius: 4px;
	background: #fff;
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--color-foreground);
	cursor: pointer;
	flex: none;
}
.pr-toggle svg {
	width: 1.125rem;
	height: 1.125rem;
}
.pr-toggle-n {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.25rem;
	height: 1.25rem;
	padding-inline: 0.25rem;
	border-radius: 3px;
	background: var(--color-foreground);
	color: #fff;
	font-size: 0.75rem;
}
.pr-toggle-n[hidden] {
	display: none;
}

.pr-group {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}
.pr-legend {
	display: block;
	margin-bottom: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--color-slate-600);
	padding: 0;
}
.pr-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.pr-chip {
	position: relative;
	user-select: none;
}
.pr-chip input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}
.pr-chip:has(input:checked) {
	border-color: var(--color-foreground);
	background: var(--color-foreground);
	color: #fff;
}
.pr-n {
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--color-slate-600);
	font-variant-numeric: tabular-nums;
}
.pr-chip:has(input:checked) .pr-n {
	color: var(--color-slate-300);
}
.pr-chip.is-zero:not(:has(input:checked)) {
	opacity: 0.45;
}
.pr-selects {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	align-items: end;
}
.pr-field {
	display: block;
	min-width: 0;
}
.pr-select {
	display: block;
	width: 100%;
	height: 3rem;
	padding-inline: 0.875rem 2.25rem;
	border: 1px solid var(--color-line-strong);
	border-radius: 4px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23525C6B' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat left 0.75rem center / 1rem;
	font: inherit;
	font-size: 1rem;
	color: var(--color-foreground);
	appearance: none;
	-webkit-appearance: none;
}
.pr-panel-head,
.pr-panel-foot {
	display: none;
}

/* Desktop: panel is inline; toggle hidden. */
@media (min-width: 64rem) {
	.pr-toggle {
		display: none;
	}
	.pr-bar {
		max-width: 34rem;
	}
	.pr-panel-body {
		display: grid;
		gap: 1.25rem;
		margin-top: 1.25rem;
		padding-top: 1.25rem;
		border-top: 1px solid var(--color-line);
	}
	.pr-selects {
		grid-template-columns: repeat(3, minmax(0, 15rem));
	}
}

/* Mobile/tablet: sticky search bar + bottom sheet panel. */
@media (max-width: 63.99rem) {
	/* The whole form is the sticky element (its parent spans the list), directly below the site header. */
	.pr-filter {
		position: sticky;
		top: var(--header-h, 3.75rem);
		z-index: 30;
		margin-inline: calc(-1 * var(--spacing-gutter, 1rem));
		margin-bottom: 0;
		padding: 0.625rem var(--spacing-gutter, 1rem);
		background: #fff;
		border-bottom: 1px solid transparent;
	}
	.pr-filter.is-stuck {
		border-bottom-color: var(--color-line);
	}
	html:not(.pr-js) .pr-filter {
		position: static;
	}
	.pr-search input,
	.pr-toggle {
		height: 2.875rem;
	}
	.pr-panel {
		position: fixed;
		inset-inline: 0;
		bottom: var(--tabbar-offset, 0px); /* sits above the mobile tab bar (spec §9) */
		z-index: 60;
		display: flex;
		flex-direction: column;
		max-height: calc(86vh - var(--tabbar-offset, 0px));
		max-height: calc(86dvh - var(--tabbar-offset, 0px));
		background: #fff;
		border-radius: 8px 8px 0 0;
		box-shadow: 0 0 0 100vmax rgb(17 20 24 / 0.5);
		transform: translateY(105%);
		visibility: hidden;
		transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.24s;
	}
	.pr-panel.is-open {
		transform: none;
		visibility: visible;
		transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
	}
	html:not(.pr-js) .pr-panel {
		position: static;
		transform: none;
		visibility: visible;
		box-shadow: none;
		margin-top: 1rem;
	}
	html:not(.pr-js) .pr-toggle,
	html:not(.pr-js) .pr-panel-head,
	html:not(.pr-js) .pr-panel-foot {
		display: none;
	}
	.pr-panel-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0.5rem 1rem 0.5rem 0.5rem;
		padding-inline: 1rem 0.5rem;
		border-bottom: 1px solid var(--color-line);
		font-size: 1.0625rem;
	}
	.pr-panel-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 2.75rem;
		height: 2.75rem;
		border: 0;
		background: none;
		color: var(--color-foreground);
		cursor: pointer;
	}
	.pr-panel-body {
		display: grid;
		gap: 1.25rem;
		padding: 1rem;
		overflow-y: auto;
		overscroll-behavior: contain;
	}
	.pr-panel-foot {
		display: flex;
		gap: 0.5rem;
		padding: 0.75rem 1rem;
		padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
		border-top: 1px solid var(--color-line);
	}
	.pr-panel-apply {
		flex: 1;
	}
	html.pr-sheet-open {
		overflow: hidden;
	}
}

/* ---------- Summary ---------- */
.pr-summary {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.5rem 1rem;
	margin: 1.25rem 0 0.75rem;
	font-size: 0.9375rem;
	color: var(--color-slate-600);
}
.pr-summary strong {
	color: var(--color-foreground);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.pr-reset {
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--color-foreground);
	border-bottom: 1px solid var(--color-line-strong);
}
.pr-reset:hover {
	color: var(--color-primary-700);
	border-color: var(--color-primary-600);
}
.pr-reset[hidden],
[data-pr-filtered][hidden] {
	display: none;
}

/* ---------- Results table ---------- */
.pr-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
	line-height: 1.75;
}
.pr-table thead th {
	position: sticky;
	top: var(--header-h, 3.75rem);
	z-index: 2;
	padding: 0.75rem;
	background: var(--color-slate-100);
	border-top: 2px solid var(--color-foreground);
	border-bottom: 1px solid var(--color-line-strong);
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--color-slate-700);
	text-align: start;
	white-space: nowrap;
}
.pr-table tbody th,
.pr-table tbody td {
	padding: 0.875rem 0.75rem;
	border-bottom: 1px solid var(--color-line);
	text-align: start;
	vertical-align: top;
}
.pr-table tbody tr:hover {
	background: var(--color-slate-50);
}
.pr-table .pr-c-title {
	width: 36%;
}
.pr-table tbody .pr-c-title {
	font-weight: 600;
	color: var(--color-foreground);
}
.pr-table .pr-c-client {
	width: 20%;
}
.pr-table .pr-c-loc {
	width: 12%;
}
.pr-table .pr-c-year {
	width: 4.5rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.pr-table .pr-c-sector {
	width: 13%;
	color: var(--color-slate-700);
}
.pr-table .pr-c-types {
	width: 17%;
}
.pr-table tbody .pr-c-types {
	font-size: 0;
}
.pr-table tbody .pr-c-types .pr-tag {
	margin: 0 0 0.25rem;
	margin-inline-end: 0.25rem;
}
.pr-table--noyear .pr-c-year {
	display: none;
}
.pr-na {
	color: var(--color-slate-400);
}
.pr-anon {
	color: var(--color-slate-600);
	font-style: normal;
}
.pr-row.is-anon .pr-c-title {
	font-weight: 500;
	color: var(--color-slate-700);
}
.pr-link {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--color-line-strong);
	text-underline-offset: 4px;
}
.pr-link:hover {
	color: var(--color-primary-700);
	text-decoration-color: var(--color-primary-600);
}
.pr-row.is-new {
	animation: pr-in 0.28s ease-out both;
}
@keyframes pr-in {
	from {
		opacity: 0;
	}
}
@media (prefers-reduced-motion: reduce) {
	.pr-row.is-new {
		animation: none;
	}
	.pr-panel,
	.pr-panel.is-open {
		transition: none;
	}
}

/* Mobile: each row becomes a compact card (no horizontal scroll). */
@media (max-width: 47.99rem) {
	.pr-table,
	.pr-table tbody {
		display: block;
	}
	.pr-table thead {
		display: none;
	}
	.pr-table {
		border-top: 2px solid var(--color-foreground);
	}
	.pr-table tbody tr {
		display: flex;
		flex-wrap: wrap;
		align-items: baseline;
		column-gap: 0;
		row-gap: 0.25rem;
		padding: 0.875rem 0;
		border-bottom: 1px solid var(--color-line);
	}
	.pr-table tbody tr:hover {
		background: none;
	}
	.pr-table tbody th,
	.pr-table tbody td {
		display: block;
		width: auto;
		padding: 0;
		border: 0;
	}
	.pr-table tbody .pr-c-title {
		width: 100%;
		font-size: 0.9375rem;
		line-height: 1.8;
	}
	.pr-table tbody .pr-c-client {
		width: 100%;
		font-size: 0.875rem;
		color: var(--color-slate-700);
	}
	.pr-table tbody .pr-c-client:has(.pr-na) {
		display: none;
	}
	.pr-table tbody .pr-c-loc,
	.pr-table tbody .pr-c-year,
	.pr-table tbody .pr-c-sector {
		width: auto;
		flex: 0 1 auto;
		font-size: 0.8125rem;
		color: var(--color-slate-600);
	}
	.pr-table tbody .pr-c-loc:has(.pr-na),
	.pr-table tbody .pr-c-year:has(.pr-na) {
		display: none;
	}
	.pr-table tbody .pr-c-loc::after,
	.pr-table:not(.pr-table--noyear) tbody .pr-c-year::after {
		content: "·";
		margin-inline: 0.4rem;
		color: var(--color-slate-400);
	}
	.pr-table tbody .pr-c-types {
		width: 100%;
		margin-top: 0.25rem;
	}
	.pr-table tbody .pr-c-types:empty {
		display: none;
	}
}

.pr-empty {
	padding: 3rem 1rem;
	text-align: center;
	color: var(--color-slate-600);
	border-bottom: 1px solid var(--color-line);
}
.pr-empty[hidden],
.pr-progress[hidden],
.pr-more-btn[hidden] {
	display: none;
}
.pr-empty p {
	margin-bottom: 0.75rem;
}
.pr-more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	margin-top: 1.5rem;
}
.pr-progress {
	font-size: 0.875rem;
	color: var(--color-slate-600);
	font-variant-numeric: tabular-nums;
}
.pr-more-btn {
	min-width: 12rem;
}
.pr-note {
	margin-top: 1.5rem;
	font-size: 0.8125rem;
	line-height: 1.8;
	color: var(--color-slate-600);
	max-width: 46rem;
}

/* ---------- Breakdown ---------- */
.pr-bd-grid {
	display: grid;
	gap: 2.5rem;
}
@media (min-width: 64rem) {
	.pr-bd-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 4rem;
	}
}
.pr-bd {
	margin: 0;
	min-width: 0;
}
.pr-bd-cap {
	margin-bottom: 0.5rem;
	padding-bottom: 0.625rem;
	border-bottom: 2px solid var(--color-foreground);
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--color-foreground);
}
.pr-bd-cap span {
	font-weight: 400;
	font-size: 0.8125rem;
	color: var(--color-slate-600);
}
.pr-bars {
	list-style: none;
	margin: 0;
	padding: 0;
}
.pr-bar-row {
	display: grid;
	grid-template-columns: minmax(7.5rem, 11rem) 1fr 3rem;
	align-items: center;
	gap: 0.75rem;
	min-height: 2.75rem;
	border-bottom: 1px solid var(--color-line);
	color: var(--color-foreground);
	font-size: 0.875rem;
}
.pr-bar-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.pr-bar-track {
	position: relative;
	height: 0.5rem;
	background: var(--color-slate-200, #d9dee5);
	border-radius: 1px;
	overflow: hidden;
}
.pr-bar-fill {
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	width: calc(var(--v, 0) * 100%);
	min-width: 2px;
	background: var(--color-slate-700);
	transition: background-color 0.15s;
}
.pr-bar-n {
	text-align: end;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}
.pr-bar-row:hover .pr-bar-fill {
	background: var(--color-primary-600);
}
.pr-bar-row:hover .pr-bar-label {
	color: var(--color-primary-700);
}
.pr-bd-rest {
	margin-top: 0.875rem;
	font-size: 0.875rem;
	line-height: 2;
	color: var(--color-slate-600);
}
.pr-bd-rest a {
	color: var(--color-foreground);
	white-space: nowrap;
}
.pr-bd-rest a span {
	color: var(--color-slate-600);
	font-variant-numeric: tabular-nums;
}
.pr-bd-rest a:hover {
	color: var(--color-primary-700);
}
@media (max-width: 30rem) {
	.pr-bar-row {
		grid-template-columns: 8.5rem 1fr 2.5rem;
		gap: 0.5rem;
	}
}

/* Decade timeline (only when enough rows are dated) */
.pr-tl {
	margin: 0 0 3rem;
}
.pr-tl-list {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	gap: 0.5rem;
	align-items: end;
	height: 10rem;
	list-style: none;
	margin: 1rem 0 0;
	padding: 0;
	border-bottom: 1px solid var(--color-line-strong);
}
.pr-tl-item {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	height: 100%;
	position: relative;
}
.pr-tl-bar {
	position: relative;
	display: block;
	height: calc(var(--v, 0) * 85%);
	min-height: 2px;
	background: var(--color-slate-700);
	border-radius: 2px 2px 0 0;
}
.pr-tl-item:last-child .pr-tl-bar {
	background: var(--color-primary-600);
}
.pr-tl-n {
	position: absolute;
	bottom: 100%;
	inset-inline: 0;
	text-align: center;
	font-size: 0.8125rem;
	font-weight: 700;
	padding-bottom: 0.25rem;
	font-variant-numeric: tabular-nums;
}
.pr-tl-dec {
	position: absolute;
	top: calc(100% + 0.5rem);
	inset-inline: 0;
	text-align: center;
	font-size: 0.8125rem;
	font-weight: 700;
	color: var(--color-slate-700);
	font-variant-numeric: tabular-nums;
}

.pr-search input::-webkit-search-cancel-button {
	filter: grayscale(1) brightness(0.6);
	cursor: pointer;
}
