/* arrowlinx/collateral-grid. Colours fall back to the Arrowlinx palette if the theme is switched. */
.arx-collateral {
	--arx-c-charcoal: var(--wp--preset--color--charcoal, #1d1f23);
	--arx-c-red: var(--wp--preset--color--red, #e0161c);
	--arx-c-red-dark: var(--wp--preset--color--red-dark, #b51218);
	--arx-c-tint: var(--wp--preset--color--red-tint, #fdeded);
	--arx-c-muted: var(--wp--preset--color--muted, #62666d);
	--arx-c-line: var(--wp--preset--color--line, #e5e6e9);
	--arx-c-surface: var(--wp--preset--color--surface, #f7f7f8);
	margin-top: var(--wp--preset--spacing--40, 1.5rem);
	position: relative;
}

/* Toolbar */
.arx-collateral__toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.75rem;
}
.arx-collateral__filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.arx-chip {
	appearance: none;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.35rem 0.7rem;
	border: 1px solid var(--arx-c-line);
	border-radius: 999px;
	background: #fff;
	color: var(--arx-c-charcoal);
	font: 600 0.75rem/1.1 inherit;
	font-family: inherit;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.arx-chip:hover {
	border-color: var(--arx-c-red);
}
.arx-chip.is-active {
	background: var(--arx-c-charcoal);
	border-color: var(--arx-c-charcoal);
	color: #fff;
}
.arx-chip__count {
	font-size: 0.6875rem;
	font-weight: 600;
	padding: 0.1rem 0.45rem;
	border-radius: 999px;
	background: var(--arx-c-surface);
	color: var(--arx-c-muted);
}
.arx-chip.is-active .arx-chip__count {
	background: rgba(255, 255, 255, 0.16);
	color: #fff;
}
.arx-chip:focus-visible,
.arx-btn:focus-visible,
.arx-icon-btn:focus-visible,
.arx-pager__btn:focus-visible,
.arx-collateral__search input:focus-visible {
	outline: 2px solid var(--arx-c-red);
	outline-offset: 2px;
}

.arx-collateral__search {
	position: relative;
	flex: 0 1 15rem;
	color: var(--arx-c-muted);
}
.arx-collateral__search svg {
	position: absolute;
	left: 0.8rem;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
}
.arx-collateral__search input {
	width: 100%;
	padding: 0.45rem 0.75rem 0.45rem 2.1rem;
	border: 1px solid var(--arx-c-line);
	border-radius: 8px;
	background: #fff;
	font: inherit;
	font-size: 0.8125rem;
	color: var(--arx-c-charcoal);
}
.arx-collateral__status {
	margin: 0 0 0.75rem;
	min-height: 1.2em;
	font-size: 0.75rem;
	color: var(--arx-c-muted);
}

/* Grid */
.arx-collateral__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1rem;
}
@media (max-width: 1023px) {
	.arx-collateral__grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}
.arx-doc-card {
	display: flex;
	flex-direction: column;
	margin: 0;
	background: #fff;
	border: 1px solid var(--arx-c-line);
	border-radius: 12px;
	overflow: hidden;
	transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.arx-doc-card[hidden] {
	display: none;
}
.arx-doc-card:hover {
	border-color: #d3d5d9;
	box-shadow: 0 2px 4px rgba(18, 19, 22, 0.06), 0 16px 32px rgba(18, 19, 22, 0.1);
	transform: translateY(-2px);
}
.arx-doc-card__thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 200px;
	padding: 0.85rem;
	background:
		radial-gradient(120% 80% at 50% 0%, #fff 0%, rgba(255, 255, 255, 0) 70%),
		var(--arx-c-surface);
	border-bottom: 1px solid var(--arx-c-line);
}
.arx-doc-card__thumb img {
	height: 100%;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 1px 2px rgba(18, 19, 22, 0.12), 0 10px 22px rgba(18, 19, 22, 0.16);
	transition: transform 0.25s;
}
.arx-doc-card:hover .arx-doc-card__thumb img {
	transform: scale(1.035);
}
.arx-doc-card__placeholder {
	display: grid;
	place-items: center;
	width: 45%;
	aspect-ratio: 3 / 4;
	border-radius: 6px;
	background: #fff;
	border: 1px dashed var(--arx-c-line);
	font-weight: 700;
	color: var(--arx-c-muted);
}
.arx-doc-card__body {
	flex: 1;
	padding: 0.75rem 0.85rem 0.15rem;
}
.arx-doc-card__top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.4rem;
	margin-bottom: 0.45rem;
}
.arx-badge {
	display: inline-block;
	padding: 0.15rem 0.45rem;
	border-radius: 5px;
	background: var(--arx-c-tint);
	color: var(--arx-c-red-dark);
	font-size: 0.625rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
}
.arx-doc-card__meta {
	font-size: 0.6875rem;
	color: var(--arx-c-muted);
	white-space: nowrap;
}
.arx-doc-card__title {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.35;
	letter-spacing: -0.005em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.7em;
}
.arx-doc-card__title a {
	color: var(--arx-c-charcoal);
	text-decoration: none;
}
.arx-doc-card__title a:hover {
	color: var(--arx-c-red-dark);
}
.arx-doc-card__tags {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin: 0.45rem 0 0;
	padding: 0;
}
.arx-doc-card__tags li {
	margin: 0;
	padding: 0.1rem 0.4rem;
	border: 1px solid var(--arx-c-line);
	border-radius: 5px;
	font-size: 0.6875rem;
	line-height: 1.4;
	color: var(--arx-c-muted);
}
.arx-doc-card__actions {
	display: flex;
	gap: 0.4rem;
	padding: 0.75rem 0.85rem 0.85rem;
}
.arx-btn {
	min-width: 0;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.3rem;
	flex: 1;
	padding: 0.45rem 0.55rem;
	border-radius: 7px;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.1;
	text-decoration: none;
	transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.arx-btn--ghost {
	border: 1px solid var(--arx-c-line);
	color: var(--arx-c-charcoal);
	background: #fff;
}
.arx-btn--ghost:hover {
	border-color: var(--arx-c-charcoal);
	color: var(--arx-c-charcoal);
	text-decoration: none;
}
.arx-btn--solid {
	border: 1px solid var(--arx-c-red-dark);
	background: var(--arx-c-red-dark);
	color: #fff;
}
.arx-btn--solid:hover {
	background: var(--arx-c-charcoal);
	border-color: var(--arx-c-charcoal);
	color: #fff;
	text-decoration: none;
}
.arx-icon-btn {
	appearance: none;
	flex: 0 0 auto;
	display: inline-grid;
	place-items: center;
	width: 2rem;
	border: 1px solid var(--arx-c-line);
	border-radius: 7px;
	background: #fff;
	color: var(--arx-c-muted);
	cursor: pointer;
}
.arx-icon-btn:hover {
	color: var(--arx-c-red-dark);
	border-color: var(--arx-c-red);
}

/* Empty + pager + toast */
.arx-collateral__empty {
	padding: 2.5rem 1rem;
	text-align: center;
	border: 1px dashed var(--arx-c-line);
	border-radius: 16px;
	color: var(--arx-c-muted);
}
.arx-collateral__empty[hidden],
.arx-pager[hidden],
.arx-toast[hidden] {
	display: none;
}
.arx-link-btn {
	appearance: none;
	border: 0;
	background: none;
	padding: 0;
	font: inherit;
	font-weight: 600;
	color: var(--arx-c-red-dark);
	cursor: pointer;
	text-decoration: underline;
}
.arx-pager {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: 2rem;
}
.arx-pager__btn {
	appearance: none;
	min-width: 2.1rem;
	height: 2.1rem;
	padding: 0 0.6rem;
	border: 1px solid var(--arx-c-line);
	border-radius: 8px;
	background: #fff;
	color: var(--arx-c-charcoal);
	font: 600 0.8125rem/1 inherit;
	font-family: inherit;
	cursor: pointer;
}
.arx-pager__btn:hover:not(:disabled) {
	border-color: var(--arx-c-charcoal);
}
.arx-pager__btn.is-current {
	background: var(--arx-c-charcoal);
	border-color: var(--arx-c-charcoal);
	color: #fff;
}
.arx-pager__btn:disabled {
	opacity: 0.4;
	cursor: default;
}
.arx-toast {
	position: fixed;
	left: 50%;
	bottom: 1.5rem;
	transform: translateX(-50%);
	z-index: 100;
	padding: 0.7rem 1.1rem;
	border-radius: 10px;
	background: var(--arx-c-charcoal);
	color: #fff;
	font-size: 0.875rem;
	font-weight: 500;
	box-shadow: 0 10px 30px rgba(18, 19, 22, 0.3);
}

@media (max-width: 600px) {
	.arx-collateral__search {
		flex-basis: 100%;
	}
	.arx-collateral__filters {
		flex-wrap: nowrap;
		overflow-x: auto;
		margin: 0 calc(-1 * var(--wp--style--root--padding-left, 1rem));
		padding: 0 var(--wp--style--root--padding-left, 1rem) 0.25rem;
		scrollbar-width: none;
	}
	.arx-chip {
		flex: 0 0 auto;
	}
	.arx-collateral__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 0.75rem;
	}
	.arx-doc-card__thumb {
		height: 160px;
		padding: 0.65rem;
	}
	.arx-doc-card__body {
		padding: 0.8rem 0.8rem 0.2rem;
	}
	.arx-doc-card__top {
		flex-wrap: wrap;
	}
	.arx-doc-card__actions {
		padding: 0.8rem;
	}
	.arx-btn--ghost {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.arx-doc-card,
	.arx-doc-card__thumb img {
		transition: none;
	}
	.arx-doc-card:hover,
	.arx-doc-card:hover .arx-doc-card__thumb img {
		transform: none;
	}
}
