/**
 * Document blocks: list, filters and single document.
 * 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;
}

/* ---------- Filters ---------- */

.ivo-document-filters {
	box-sizing: border-box;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
	gap: 1rem;
	align-items: end;
	margin-block: 1.5rem 2rem;
	padding: 1.25rem;
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-radius: 8px;
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-document-filters__field--search {
	grid-column: 1 / -1;
}

/* Inside a page: search box, year and button on one line where there is room. */
.ivo-document-filters--compact {
	grid-template-columns: minmax(12rem, 3fr) minmax(8rem, 1fr) auto;
	margin-block: 0 1.5rem;
}

.ivo-document-filters--compact .ivo-document-filters__field--search {
	grid-column: auto;
}

@media (max-width: 600px) {
	.ivo-document-filters--compact {
		grid-template-columns: 1fr;
	}
}

.ivo-document-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-document-filters input,
.ivo-document-filters select {
	box-sizing: border-box;
	width: 100%;
	min-height: 44px;
	font: inherit;
}

.ivo-document-filters__actions {
	display: flex;
	align-items: center;
	gap: 1rem;
}

.ivo-document-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-documents {
	scroll-margin-top: 5rem;
}

.ivo-documents__summary,
.ivo-documents__empty,
.ivo-documents__description {
	color: var(--wp--preset--color--muted, #475569);
}

.ivo-documents__summary {
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-documents__list {
	margin: 0 0 1.5rem;
	padding: 0;
	list-style: none;
}

.ivo-documents__section {
	margin-block: 2rem;
}

.ivo-documents__section .ivo-documents__section {
	margin-block: 1.5rem;
}

.ivo-documents__heading {
	margin-block: 0 0.5rem;
	font-size: var(--wp--preset--font-size--x-large, 1.5rem);
}

.ivo-documents__section .ivo-documents__section .ivo-documents__heading {
	font-size: var(--wp--preset--font-size--large, 1.25rem);
}

.ivo-documents__year {
	margin-block: 1.5rem 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-document {
	display: grid;
	gap: 0.25rem;
	padding-block: 1rem;
	border-bottom: 1px solid var(--wp--preset--color--border, #cbd5e1);
}

.ivo-document > * {
	margin: 0;
}

.ivo-document__title {
	font-weight: 700;
	line-height: 1.35;
}

.ivo-document__title a {
	color: var(--wp--preset--color--primary-dark, #1e3a8a);
	text-decoration: none;
}

.ivo-document__title a:hover {
	text-decoration: underline;
}

.ivo-document__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	align-items: center;
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-document__meta > * + *::before {
	content: "·";
	margin-right: 0.75rem;
}

.ivo-document__meta > .ivo-document__status::before {
	content: none;
}

.ivo-document__status {
	padding: 0.1rem 0.55rem;
	border-radius: 999px;
	background: #e2e8f0;
	color: #334155;
	font-size: var(--wp--preset--font-size--x-small, 0.75rem);
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.ivo-document__description {
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-document__downloads {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
}

.ivo-document__download {
	display: inline-flex;
	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-document__download:hover {
	background: var(--wp--preset--color--primary, #1d4ed8);
	color: #fff;
}

.ivo-document__size {
	font-weight: 400;
	opacity: 0.85;
}

/* ---------- Accordion ---------- */

.ivo-documents__panel {
	border: 1px solid var(--wp--preset--color--border, #cbd5e1);
	border-radius: 8px;
	background: var(--wp--preset--color--base, #fff);
}

.ivo-documents__panel + .ivo-documents__panel {
	margin-top: 0.75rem;
}

.ivo-documents__panel > summary {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	align-items: center;
	box-sizing: border-box;
	min-height: 52px;
	padding: 0.75rem 3rem 0.75rem 1.25rem;
	position: relative;
	color: var(--wp--preset--color--primary-dark, #1e3a8a);
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}

.ivo-documents__panel > summary::-webkit-details-marker {
	display: none;
}

/* Chevron: points down when closed, up when open. */
.ivo-documents__panel > summary::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 1.25rem;
	width: 0.55rem;
	height: 0.55rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-70%) rotate(45deg);
}

.ivo-documents__panel[open] > summary::after {
	transform: translateY(-30%) rotate(-135deg);
}

.ivo-documents__panel > summary:hover {
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-documents__panel > summary:focus-visible {
	outline: 3px solid var(--wp--preset--color--highlight, #f59e0b);
	outline-offset: 2px;
}

.ivo-documents__count {
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	font-weight: 400;
}

.ivo-documents__panel-body {
	padding: 0 1.25rem 0.5rem;
	border-top: 1px solid var(--wp--preset--color--border, #cbd5e1);
}

.ivo-documents__panel-body > .ivo-documents__description {
	margin-block: 1rem 0;
}

.ivo-documents__panel-body .ivo-documents__list:last-child {
	margin-bottom: 0;
}

.ivo-documents__panel-body .ivo-document:last-child {
	border-bottom: 0;
}

/* ---------- Pagination (WordPress puts "page-numbers" on the list too) ---------- */

.ivo-documents__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-documents__pagination li {
	margin: 0;
}

.ivo-documents__pagination a.page-numbers,
.ivo-documents__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-documents__pagination a.page-numbers:hover {
	border-color: var(--wp--preset--color--primary, #1d4ed8);
	background: var(--wp--preset--color--surface, #f1f5f9);
}

.ivo-documents__pagination span.page-numbers.current {
	border-color: var(--wp--preset--color--primary, #1d4ed8);
	background: var(--wp--preset--color--primary, #1d4ed8);
	color: #fff;
}

.ivo-documents__pagination span.page-numbers.dots {
	min-width: auto;
	padding-inline: 0.25rem;
	border-color: transparent;
}

/* ---------- Single document ---------- */

.ivo-document-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-document-single__title {
	margin: 0;
}

.ivo-document-single__notice {
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	border-radius: 8px;
	background: #fef3c7;
	color: #92400e;
}

.ivo-document-single__description {
	margin-top: 1.5rem;
}

.ivo-document-single__downloads {
	margin-block: 1.5rem;
}

.ivo-document-single__downloads .ivo-document__downloads {
	gap: 0.75rem;
	margin: 0;
}

.ivo-document-single__downloads .wp-element-button {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	text-decoration: none;
}

.ivo-document-single__downloads > .ivo-document__size {
	margin: 0.75rem 0 0;
	color: var(--wp--preset--color--muted, #475569);
	font-size: var(--wp--preset--font-size--small, 0.875rem);
}

.ivo-document-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-document-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-document-single__facts dd {
	margin: 0.15rem 0 0;
}

.ivo-document-single__back {
	margin-top: 2rem;
	font-weight: 700;
}
