/**
 * Procurement blocks: open bids, lists, awarded contracts and a record's page.
 * Uses the theme's colors and fonts when available, with fallbacks.
 */

.ivo-sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.ivo-procurement__amount {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* ---------- Status: always written out; the color only helps ---------- */

.ivo-procurement-status {
	display: inline-block;
	padding: 0.1rem 0.6rem;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: #e2e8f0;
	color: #334155;
	font-size: var(--wp--preset--font-size--x-small, 0.75rem);
	font-weight: 700;
	line-height: 1.6;
	letter-spacing: 0.02em;
	white-space: nowrap;
}

.ivo-procurement-status.is-open {
	background: #dcfce7;
	color: #14532d;
}

.ivo-procurement-status.is-closed {
	background: #fef3c7;
	color: #78350f;
}

.ivo-procurement-status.is-awarded {
	background: #dbeafe;
	color: #1e3a8a;
}

.ivo-procurement-status.is-failed {
	background: #fee2e2;
	color: #7f1d1d;
}

/* ---------- Filters ---------- */

.ivo-procurement-filters {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
	gap: 1rem;
	align-items: end;
	margin-block: 0 1.5rem;
	padding: 1.25rem;
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-radius: 8px;
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-procurement-filters__field--search {
	grid-column: 1 / -1;
}

.ivo-procurement-filters__field label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
}

/* Border, corners, padding and the search icon come from the theme's form fields. */
.ivo-procurement-filters input,
.ivo-procurement-filters select {
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	font: inherit;
}

.ivo-procurement-filters__actions {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.ivo-procurement-filters__actions .wp-element-button {
	min-height: 44px;
	border: 0;
	cursor: pointer;
}

/* ---------- Lists ---------- */

/* After a search the page jumps to the list; keep it clear of the sticky menu bar. */
.ivo-procurement-list,
.ivo-procurement-awards,
.ivo-procurement-awards__year {
	scroll-margin-top: 5rem;
}

.ivo-procurement-list__summary,
.ivo-procurement-list__empty,
.ivo-procurement-open__empty,
.ivo-procurement-awards__empty {
	color: var(--wp--preset--color--muted, #475569);
}

.ivo-procurement-list__summary {
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-procurement-list__year {
	margin-block: 2rem 0;
	padding-bottom: 0.35rem;
	border-bottom: 2px solid var(--wp--preset--color--primary, #1d4ed8);
	color: var(--wp--preset--color--primary-dark, #1e3a8a);
	font-size: var(--wp--preset--font-size--large, 1.25rem);
}

.ivo-procurement-list__items {
	margin: 0 0 1.5rem;
	padding: 0;
	list-style: none;
}

.ivo-procurement {
	display: grid;
	gap: 0.3rem;
	padding-block: 1rem;
	border-bottom: 1px solid var(--wp--preset--color--border, #cbd5e1);
}

.ivo-procurement > * {
	margin: 0;
}

.ivo-procurement__top {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	align-items: center;
}

.ivo-procurement__reference {
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 600;
}

.ivo-procurement__title {
	font-weight: 700;
	line-height: 1.35;
}

.ivo-procurement__title a {
	color: var(--wp--preset--color--primary-dark, #1e3a8a);
	text-decoration: none;
}

.ivo-procurement__title a:hover {
	text-decoration: underline;
}

.ivo-procurement__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-procurement__meta > * + *::before {
	content: "·";
	margin-right: 0.75rem;
}

.ivo-procurement__award {
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-procurement__downloads {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
}

.ivo-procurement__download {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem;
	box-sizing: border-box;
	min-height: 44px;
	padding: 0.4rem 0.9rem;
	border: 2px solid var(--wp--preset--color--primary, #1d4ed8);
	border-radius: 4px;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
	text-decoration: none;
}

.ivo-procurement__download:hover {
	background: var(--wp--preset--color--primary, #1d4ed8);
	color: #fff;
}

.ivo-procurement__size {
	font-weight: 400;
	opacity: 0.85;
}

/* ---------- Pagination (WordPress puts "page-numbers" on the list too) ---------- */

.ivo-procurement-pagination ul.page-numbers {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin: 2rem 0 0;
	padding: 0;
	border: 0;
	list-style: none;
}

.ivo-procurement-pagination li {
	margin: 0;
}

.ivo-procurement-pagination a.page-numbers,
.ivo-procurement-pagination span.page-numbers {
	display: inline-grid;
	place-items: center;
	box-sizing: border-box;
	min-width: 44px;
	min-height: 44px;
	padding-inline: 0.75rem;
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-radius: 4px;
	font-weight: 600;
	text-decoration: none;
}

.ivo-procurement-pagination a.page-numbers:hover {
	border-color: var(--wp--preset--color--primary, #1d4ed8);
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-procurement-pagination span.page-numbers.current {
	border-color: var(--wp--preset--color--primary, #1d4ed8);
	background: var(--wp--preset--color--primary, #1d4ed8);
	color: #fff;
}

.ivo-procurement-pagination span.page-numbers.dots {
	min-width: auto;
	padding-inline: 0.25rem;
	border-color: transparent;
}

/* ---------- Open bids ---------- */

.ivo-procurement-open__list {
	display: grid;
	gap: 1rem;
	margin: 0 0 1rem;
	padding: 0;
	list-style: none;
}

.ivo-procurement-bid {
	display: grid;
	gap: 0.5rem;
	padding: 1.25rem;
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-left: 4px solid var(--wp--preset--color--primary, #1d4ed8);
	border-radius: 8px;
	background: var(--wp--preset--color--base, #fff);
	box-shadow: var(--wp--preset--shadow--card, 0 1px 3px rgba(15, 23, 42, 0.08));
}

.ivo-procurement-bid > * {
	margin: 0;
}

.ivo-procurement-bid__eyebrow {
	color: var(--wp--preset--color--primary, #1d4ed8);
	font-size: var(--wp--preset--font-size--x-small, 0.75rem);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ivo-procurement-bid__title {
	font-size: var(--wp--preset--font-size--large, 1.25rem);
	line-height: 1.3;
}

.ivo-procurement-bid__title a {
	color: var(--wp--preset--color--primary-dark, #1e3a8a);
	text-decoration: none;
}

.ivo-procurement-bid__title a:hover {
	text-decoration: underline;
}

.ivo-procurement-bid__deadline {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	align-items: center;
	font-weight: 600;
}

.ivo-procurement__time-left {
	color: #14532d;
}

.ivo-procurement-bid__facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: 0.75rem 1.5rem;
	margin: 0.25rem 0 0;
}

.ivo-procurement-bid__facts dt,
.ivo-procurement-single__facts dt {
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--x-small, 0.75rem);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ivo-procurement-bid__facts dd,
.ivo-procurement-single__facts dd {
	margin: 0.15rem 0 0;
}

.ivo-procurement-open__feed {
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

/* ---------- Awarded contracts ---------- */

.ivo-procurement-awards__download {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	align-items: center;
}

.ivo-procurement-awards__download .wp-element-button {
	text-decoration: none;
}

.ivo-procurement-awards__hint {
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-procurement-awards__years ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 1rem 0 0;
	padding: 0;
	list-style: none;
}

.ivo-procurement-awards__years a {
	display: inline-grid;
	place-items: center;
	box-sizing: border-box;
	min-width: 44px;
	min-height: 44px;
	padding-inline: 0.75rem;
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-radius: 4px;
	font-weight: 600;
	text-decoration: none;
}

.ivo-procurement-awards__years a:hover {
	border-color: var(--wp--preset--color--primary, #1d4ed8);
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-procurement-awards__year > h2,
.ivo-procurement-awards__year > h3,
.ivo-procurement-awards__year > h4 {
	margin-block: 2rem 0.75rem;
	padding-bottom: 0.35rem;
	border-bottom: 2px solid var(--wp--preset--color--primary, #1d4ed8);
	color: var(--wp--preset--color--primary-dark, #1e3a8a);
	font-size: var(--wp--preset--font-size--large, 1.25rem);
}

.ivo-procurement-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-procurement-awards {
	container-type: inline-size;
}

/* The same column widths in every year's table, where amounts fit in them. */
@container (min-width: 1000px) {
	.ivo-procurement-table {
		table-layout: fixed;
	}

	.ivo-procurement-table th,
	.ivo-procurement-table td {
		box-sizing: border-box;
	}

	.ivo-procurement-table thead th:nth-child(1) {
		width: 24%;
	}

	.ivo-procurement-table thead th:nth-child(2),
	.ivo-procurement-table thead th:nth-child(3),
	.ivo-procurement-table thead th:nth-child(5) {
		width: 11%;
	}

	.ivo-procurement-table thead th:nth-child(4) {
		width: 15%;
	}

	.ivo-procurement-table thead th:nth-child(6) {
		width: 10%;
	}

	.ivo-procurement-table thead th:nth-child(7) {
		width: 18%;
	}
}

.ivo-procurement-table th,
.ivo-procurement-table td {
	padding: 0.6rem 0.75rem;
	border-bottom: 1px solid var(--wp--preset--color--border, #cbd5e1);
	text-align: left;
	vertical-align: top;
}

.ivo-procurement-table thead th {
	background: var(--wp--preset--color--surface, #f1f5f9);
	font-weight: 700;
}

.ivo-procurement-table tbody th {
	font-weight: 600;
}

.ivo-procurement-table .is-amount {
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ivo-procurement-table__reference {
	display: block;
	margin-top: 0.2rem;
	color: var(--wp--preset--color--muted, #475569);
	font-weight: 400;
}

.ivo-procurement-table__documents {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ivo-procurement-table__documents li + li {
	margin-top: 0.35rem;
}

/* Phones: each contract becomes a card with its column names. */
@media (max-width: 760px) {
	.ivo-procurement-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}

	.ivo-procurement-table,
	.ivo-procurement-table tbody,
	.ivo-procurement-table tr,
	.ivo-procurement-table th,
	.ivo-procurement-table td {
		display: block;
	}

	.ivo-procurement-table tr {
		padding-block: 0.75rem;
		border-bottom: 1px solid var(--wp--preset--color--border, #cbd5e1);
	}

	.ivo-procurement-table th,
	.ivo-procurement-table td {
		padding: 0.2rem 0;
		border: 0;
	}

	.ivo-procurement-table td {
		display: grid;
		grid-template-columns: 9rem 1fr;
		gap: 0.75rem;
	}

	.ivo-procurement-table td::before {
		content: attr(data-label);
		color: var(--wp--preset--color--muted, #475569);
		font-weight: 700;
	}

	.ivo-procurement-table .is-amount {
		text-align: left;
	}
}

/* ---------- A record's page ---------- */

.ivo-procurement-single__category {
	margin: 0 0 0.5rem;
	color: var(--wp--preset--color--primary, #1d4ed8);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.ivo-procurement-single__title {
	margin: 0;
}

.ivo-procurement-single__status {
	margin-top: 1.25rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-radius: 8px;
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-procurement-single__status.is-open {
	border-color: #86efac;
	background: #f0fdf4;
}

.ivo-procurement-single__status > p {
	margin: 0;
}

.ivo-procurement-single__status > p + p {
	margin-top: 0.4rem;
}

.ivo-procurement-single__status-label {
	margin-right: 0.35rem;
	font-weight: 700;
}

.ivo-procurement-single__deadline {
	font-weight: 600;
}

.ivo-procurement-single__facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
	gap: 1rem 2rem;
	margin: 1.5rem 0;
	padding: 1.25rem;
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-radius: 8px;
}

.ivo-procurement-single__facts--award {
	margin-top: 0;
}

.ivo-procurement-single__description {
	margin-block: 1.5rem;
}

.ivo-procurement-single__section {
	margin-block: 2rem;
}

.ivo-procurement-single__section > h2 {
	margin-block: 0 0.75rem;
	font-size: var(--wp--preset--font-size--x-large, 1.5rem);
}

.ivo-procurement-single__group + .ivo-procurement-single__group {
	margin-top: 1.25rem;
}

.ivo-procurement-single__group > h3 {
	margin-block: 0 0.5rem;
	font-size: var(--wp--preset--font-size--large, 1.25rem);
}

.ivo-procurement-single__files {
	margin: 0;
	padding-left: 1.25rem;
}

.ivo-procurement-single__files li + li {
	margin-top: 0.4rem;
}

.ivo-procurement-single__files a {
	font-weight: 600;
}

.ivo-procurement-single__downloads .ivo-procurement__downloads {
	gap: 0.75rem;
	margin: 0;
}

.ivo-procurement-single__downloads .wp-element-button {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem;
	text-decoration: none;
}

.ivo-procurement-single__back {
	margin-top: 2rem;
	font-weight: 700;
}

/* ---------- Rebid history ---------- */

.ivo-procurement-timeline {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ivo-procurement-timeline__step {
	position: relative;
	padding: 0 0 1.25rem 1.75rem;
	border-left: 2px solid var(--wp--preset--color--border, #cbd5e1);
	margin-left: 0.5rem;
}

.ivo-procurement-timeline__step:last-child {
	padding-bottom: 0;
	border-left-color: transparent;
}

.ivo-procurement-timeline__step::before {
	content: "";
	position: absolute;
	top: 0.3rem;
	left: -0.5rem;
	box-sizing: border-box;
	width: 1rem;
	height: 1rem;
	border: 2px solid var(--wp--preset--color--primary, #1d4ed8);
	border-radius: 50%;
	background: var(--wp--preset--color--base, #fff);
}

.ivo-procurement-timeline__step.is-current::before {
	background: var(--wp--preset--color--primary, #1d4ed8);
}

.ivo-procurement-timeline__step > p {
	margin: 0;
}

.ivo-procurement-timeline__step > p + p {
	margin-top: 0.25rem;
}

.ivo-procurement-timeline__label {
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 700;
}

.ivo-procurement-timeline__title {
	font-weight: 600;
}

.ivo-procurement-timeline__here {
	color: var(--wp--preset--color--muted, #475569);
	font-weight: 400;
}
