/**
 * SCB — Forms and Documents (mod_edocman_documents override)
 * Scoped to .scb-docs so nothing else on the site is affected.
 */

.scb-docs {
	--scb-navy: #00548b;
	--scb-navy-deep: #003b63;
	--scb-ink: #2b2b2b;
	--scb-muted: #5b6472;
	--scb-line: #d8e1ea;
	--scb-tint: #eaf2f8;
	--scb-surface: #ffffff;
	--scb-radius: 10px;
	--scb-head-font: "Signika", "Open Sans", Arial, sans-serif;
	--scb-body-font: "Open Sans", Arial, sans-serif;

	font-family: var(--scb-body-font);
	color: var(--scb-ink);
	margin: 0 0 2.5rem;
}

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

.scb-docs [hidden] {
	display: none !important;
}

.scb-docs__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Toolbar: search + count ---------- */

.scb-docs .scb-docs__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem 1.5rem;
	margin: 0 0 1.5rem;
}

.scb-docs .scb-docs__search {
	position: relative;
	flex: 1 1 320px;
	max-width: 460px;
	margin: 0;
}

.scb-docs .scb-docs__search-icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--scb-muted);
	pointer-events: none;
}

.scb-docs .scb-docs__input {
	width: 100%;
	height: 48px;
	margin: 0;
	padding: 0 16px 0 44px;
	font: 400 1rem/1 var(--scb-body-font);
	color: var(--scb-ink);
	background: var(--scb-surface);
	border: 1px solid var(--scb-line);
	border-radius: var(--scb-radius);
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

.scb-docs .scb-docs__input::placeholder {
	color: var(--scb-muted);
	opacity: 1;
}

.scb-docs .scb-docs__input:focus {
	outline: 3px solid var(--scb-navy);
	outline-offset: 1px;
	border-color: var(--scb-navy);
}

.scb-docs .scb-docs__count {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--scb-muted);
}

/* ---------- Grid ---------- */

.scb-docs ul.scb-docs__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 576px) {
	.scb-docs ul.scb-docs__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 992px) {
	.scb-docs ul.scb-docs__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 20px;
	}
}

/* ---------- Card ---------- */

.scb-docs li.scb-doc {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-rows: 1fr auto;
	column-gap: 16px;
	margin: 0;
	padding: 20px 20px 0;
	width: auto;
	min-height: 0;
	background: var(--scb-surface);
	border: 1px solid var(--scb-line);
	border-radius: var(--scb-radius);
	box-shadow: none;
	transition: border-color 0.15s ease;
}

.scb-docs li.scb-doc::before {
	display: none;
}

.scb-docs li.scb-doc:hover {
	border-color: var(--scb-navy);
}

/* File-type badge: a small folded sheet */
.scb-docs .scb-doc__badge {
	position: relative;
	grid-row: 1;
	width: 42px;
	height: 52px;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding-bottom: 8px;
	background: var(--scb-tint);
	color: var(--scb-navy);
	clip-path: polygon(0 0, 68% 0, 100% 26%, 100% 100%, 0 100%);
	border-radius: 4px 0 4px 4px;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.scb-docs .scb-doc__badge::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	width: 32%;
	height: 26%;
	background: rgba(0, 59, 99, 0.18);
	clip-path: polygon(0 0, 0 100%, 100% 100%);
}

.scb-docs .scb-doc__badge span {
	font: 700 0.6875rem/1 var(--scb-body-font);
	letter-spacing: 0.02em;
}

.scb-docs li.scb-doc:hover .scb-doc__badge {
	background: var(--scb-navy);
	color: #ffffff;
}

.scb-docs .scb-doc__thumb {
	grid-row: 1;
	width: 64px;
}

.scb-docs .scb-doc__thumb img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}

.scb-docs .scb-doc__body {
	grid-row: 1;
	min-width: 0;
	padding: 0 0 18px;
}

.scb-docs h2.scb-doc__title {
	margin: 2px 0 6px;
	padding: 0;
	font: 500 1.0625rem/1.35 var(--scb-head-font);
	letter-spacing: 0;
	text-transform: none;
	color: var(--scb-ink);
	overflow-wrap: anywhere;
}

.scb-docs a.scb-doc__link,
.scb-docs a.scb-doc__link:visited {
	color: var(--scb-ink);
	text-decoration: none;
	background: none;
	font-weight: inherit;
}

.scb-docs a.scb-doc__link:hover,
.scb-docs a.scb-doc__link:focus {
	color: var(--scb-navy-deep);
	text-decoration: none;
}

/* Whole card clicks through to the title link */
.scb-docs a.scb-doc__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: var(--scb-radius);
}

.scb-docs a.scb-doc__link:focus {
	outline: none;
}

.scb-docs a.scb-doc__link:focus-visible::after {
	outline: 3px solid var(--scb-navy);
	outline-offset: 2px;
}

.scb-docs .scb-doc__meta,
.scb-docs .scb-doc__category {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.5;
	color: var(--scb-muted);
}

.scb-docs .scb-doc__category {
	margin-top: 4px;
}

.scb-docs .scb-doc__category a {
	position: relative;
	z-index: 2;
	color: var(--scb-navy);
}

.scb-docs .scb-doc__sep::before {
	content: "/";
	margin: 0 0.4em;
	opacity: 0.6;
}

.scb-docs .scb-doc__labels {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 6px;
}

.scb-docs .scb-doc__labels .label {
	display: inline-block;
	padding: 2px 8px;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.5;
	color: var(--scb-navy-deep);
	background: var(--scb-tint);
	border-radius: 999px;
}

/* ---------- Card footer ---------- */

.scb-docs .scb-doc__actions {
	grid-column: 1 / -1;
	grid-row: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 56px;
	padding: 10px 0;
	border-top: 1px solid var(--scb-line);
}

.scb-docs .scb-doc__cue {
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--scb-navy);
}

.scb-docs li.scb-doc:hover .scb-doc__cue {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.scb-docs a.scb-doc__download,
.scb-docs a.scb-doc__download:visited {
	position: relative;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 36px;
	padding: 6px 14px;
	font: 600 0.875rem/1 var(--scb-body-font);
	color: var(--scb-navy);
	text-decoration: none;
	background: var(--scb-surface);
	border: 1px solid var(--scb-navy);
	border-radius: 6px;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.scb-docs a.scb-doc__download:hover {
	color: #ffffff;
	background: var(--scb-navy);
	text-decoration: none;
}

.scb-docs a.scb-doc__download:focus-visible {
	outline: 3px solid var(--scb-navy);
	outline-offset: 2px;
}

/* ---------- Empty states ---------- */

.scb-docs .scb-docs__empty,
.scb-docs .scb-docs__none {
	margin: 0;
	padding: 28px 24px;
	text-align: center;
	color: var(--scb-muted);
	background: var(--scb-tint);
	border-radius: var(--scb-radius);
}

.scb-docs .scb-docs__empty p {
	margin: 0 0 12px;
	color: var(--scb-ink);
}

.scb-docs .scb-docs__clear {
	padding: 8px 16px;
	font: 600 0.875rem/1 var(--scb-body-font);
	color: #ffffff;
	background: var(--scb-navy);
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.scb-docs .scb-docs__clear:hover {
	background: var(--scb-navy-deep);
}

.scb-docs .scb-docs__clear:focus-visible {
	outline: 3px solid var(--scb-navy);
	outline-offset: 2px;
}

/* ---------- Small screens ---------- */

@media (max-width: 575.98px) {
	.scb-docs li.scb-doc {
		padding: 16px 16px 0;
		column-gap: 14px;
	}

	.scb-docs .scb-docs__search {
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.scb-docs li.scb-doc,
	.scb-docs .scb-doc__badge,
	.scb-docs a.scb-doc__download {
		transition: none;
	}
}

@media print {
	.scb-docs .scb-docs__toolbar,
	.scb-docs .scb-doc__actions {
		display: none !important;
	}

	.scb-docs li.scb-doc {
		break-inside: avoid;
	}
}
