/**
 * Resource downloads (see inc/resource-downloads.php): the contents of the "Forms & Downloads"
 * card in the Resource template's side column. Colours come from the site's Elementor global
 * variables, with their current values as fallbacks.
 */

/* ---------- Template layout: no files → no side column, content full width ---------- */

.single-resource .left-side:not(:has(.acsa-dl)) {
	display: none;
}

/* (Checked from the parent: CSS doesn't allow :has() nested inside :has().) */
.single-resource :has(> .left-side):not(:has(.acsa-dl)) > .right-side {
	width: 100%;
}

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

.acsa-dl {
	display: flex;
	flex-direction: column;
	gap: 16px;
	font-family: var(--Primary, "Ubuntu"), sans-serif;
}

.acsa-dl__list {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin: 0;
	padding: 0;
	list-style: none;
}

.acsa-dl__item {
	margin: 0;
}

.acsa-dl__subheading {
	margin: 0;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--border, #D7DBE3);
	font-family: var(--Primary, "Ubuntu"), sans-serif;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--Muted, #47536B);
}

/* Each row is one link: icon + name/meta, action underneath. */
.acsa-dl .acsa-dl__link {
	display: grid;
	grid-template-columns: 20px 1fr;
	column-gap: 10px;
	row-gap: 8px;
	align-items: start;
	padding: 12px 0;
	border-bottom: 1px solid var(--border, #D7DBE3);
	color: var(--Dark-blue, #172849);
	text-decoration: none;
}

.acsa-dl__item:last-child .acsa-dl__link {
	border-bottom: 0;
}

.acsa-dl .acsa-dl__link:focus-visible {
	outline: 2px solid var(--Gold, #F4C447);
	outline-offset: 2px;
}

/* Download icon (arrow into a tray), drawn with a mask so it takes the text colour. */
.acsa-dl__icon,
.acsa-dl-row .download-name::before {
	flex: none;
	width: 18px;
	height: 18px;
	margin-top: 1px;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 17v3h16v-3'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12M7 10l5 5 5-5M4 17v3h16v-3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.acsa-dl__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.acsa-dl__name {
	font-size: 15px;
	font-weight: 500;
	line-height: 1.35;
	overflow-wrap: anywhere;
	transition: color .2s;
}

.acsa-dl .acsa-dl__link:hover .acsa-dl__name {
	color: var(--Bright-blue, #6063AD);
}

.acsa-dl__meta,
.acsa-dl-row__meta {
	font-size: 13px;
	font-weight: 400;
	color: var(--Grey-text, #5B6472);
}

/* Secondary rows: the action reads like the site's underlined download-action link. */
.acsa-dl__action {
	grid-column: 2;
	justify-self: start;
	font-size: 14px;
	font-weight: 500;
	color: var(--Dark-blue, #172849);
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: color .2s;
}

.acsa-dl .acsa-dl__link:hover .acsa-dl__action {
	color: var(--Bright-blue, #6063AD);
}

/* The current file: featured white card with the gold call to action (like .btn-main). */
.acsa-dl__list--current .acsa-dl__link {
	padding: 14px;
	border: 1px solid var(--border, #D7DBE3);
	border-left: 4px solid var(--Dark-blue, #172849);
	border-radius: 4px;
	background: var(--white, #FFFFFF);
	transition: border-color .2s, box-shadow .2s;
}

.acsa-dl__list--current .acsa-dl__link:hover {
	border-left-color: var(--Gold, #F4C447);
	box-shadow: 0 6px 16px rgba(23, 40, 73, .1);
}

.acsa-dl__list--current .acsa-dl__action {
	grid-column: 1 / -1;
	justify-self: stretch;
	padding: 10px 14px;
	background: var(--Gold, #F4C447);
	text-align: center;
	text-decoration: none;
}

.acsa-dl__list--current .acsa-dl__link:hover .acsa-dl__action {
	background: #E8B52E;
	color: var(--Dark-blue, #172849);
}

/* Archived versions: native <details>, collapsed by default, lowest priority. */
.acsa-dl__archive {
	border-top: 1px solid var(--border, #D7DBE3);
}

.acsa-dl__summary {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 0 4px;
	font-size: 14px;
	font-weight: 500;
	color: var(--Dark-blue, #172849);
	cursor: pointer;
	list-style: none;
}

.acsa-dl__summary::-webkit-details-marker {
	display: none;
}

.acsa-dl__summary::before {
	content: "";
	flex: none;
	width: 7px;
	height: 7px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(-45deg);
	transition: transform .2s;
}

.acsa-dl__archive[open] > .acsa-dl__summary::before {
	transform: rotate(45deg);
}

.acsa-dl__summary:hover {
	color: var(--Bright-blue, #6063AD);
}

.acsa-dl__summary:focus-visible {
	outline: 2px solid var(--Gold, #F4C447);
	outline-offset: 2px;
}

.acsa-dl__archive .acsa-dl__name {
	font-size: 14px;
}

/* ---------- Forms-Download component rows (enhanced by resource-downloads.js) ---------- */

.acsa-dl-row .download-name {
	display: flex;
	align-items: center;
	gap: 10px;
}

.acsa-dl-row .download-name::before {
	content: "";
	color: var(--Dark-blue, #172849);
}

.acsa-dl-row__meta {
	display: block;
	margin: -4px 0 4px 28px;
}

@media (prefers-reduced-motion: reduce) {
	.acsa-dl__name,
	.acsa-dl__action,
	.acsa-dl__list--current .acsa-dl__link,
	.acsa-dl__summary::before {
		transition: none;
	}
}
