/*
 * Lataukset (avalon/downloads + avalon/download-group) and Latausvalikko (avalon/download-nav).
 *
 * A product: name, type line, then the file rows. Each row is a light bar with the file's name on the left and the
 * download buttons in fixed columns on the right (PDF, and DWG when the section has DWG files: ab-dl--dwg); the
 * column heads sit above the rows, "Katso tuote ›" on the same line on the left. Two products side by side from
 * 1025px, one column below that. On a light section the bars are white.
 * The menu: a search field (shown by view.js) and the section jump links as chips.
 */

/* ------------------------------------------------------------ products */

.ab-dl {
	--ab-dl-cell: 44px;
	--ab-dl-row: var(--wp--preset--color--light, #f2f6f8);
}

.ab-dl.ab-bg-light {
	--ab-dl-row: #fff;
}

.ab-dl__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 40px;
	align-items: start;
}

@media (min-width: 769px) {
	.ab-dl {
		--ab-dl-cell: 56px;
	}

	.ab-dl__grid {
		gap: 48px;
	}
}

@media (min-width: 1025px) {
	.ab-dl__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 56px 48px;
	}
}

.ab-dl__group[hidden],
.ab-dl[hidden],
.ab-dln__chips > li[hidden] {
	display: none !important;
}

.ab-dl__head {
	margin-bottom: 10px;
}

/* (double class: stronger than the theme's heading sizes and margins) */
.ab-dl .ab-dl__title {
	margin: 0;
	color: var(--ab-heading, #012b55);
	font-size: 21px;
	font-weight: 700;
}

:root:root .ab-dl .ab-dl__title {
	line-height: 1.25;
}

@media (min-width: 1025px) {
	.ab-dl .ab-dl__title {
		font-size: 24px;
	}
}

.ab-dl .ab-dl__sub {
	margin: 4px 0 0;
	color: var(--ab-muted, #4a5563);
	font-size: 16px;
	line-height: 1.45;
}

.ab-dl .ab-dl__text {
	margin: 8px 0 0;
	color: var(--ab-body, #282828);
	font-size: 16px;
	line-height: 1.5;
}

/* the line above the rows: "Katso tuote ›" on the left, the column heads over their columns */
.ab-dl__bar,
.ab-dl__row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) var(--ab-dl-cell);
	align-items: center;
}

.ab-dl--dwg :is(.ab-dl__bar, .ab-dl__row) {
	grid-template-columns: minmax(0, 1fr) var(--ab-dl-cell) var(--ab-dl-cell);
}

.ab-dl:not(.ab-dl--dwg) :is(.ab-dl__col--dwg, .ab-dl__cell--dwg) {
	display: none;
}

.ab-dl__bar {
	min-height: 28px;
	margin-bottom: 6px;
	padding-inline-end: 6px;
}

.ab-dl__col {
	color: var(--ab-muted, #4a5563);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-align: center;
}

.ab-dl .ab-dl__product {
	justify-self: start;
	color: var(--ab-navy, #002b56);
	font-size: 15px;
	font-weight: 600;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

.ab-dl .ab-dl__product::after {
	content: " ›";
}

.ab-dl .ab-dl__product:hover {
	text-decoration-thickness: 2px;
}

/* rows */
.ab-dl__rows {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ab-dl__row {
	box-sizing: border-box;
	min-height: 56px;
	margin: 0;
	padding: 6px 6px 6px 16px;
	border-radius: var(--ab-radius-s, 8px);
	background: var(--ab-dl-row);
}

/* the name is text; only the icons are links (no hover on the row or the name: they are not links) */
.ab-dl .ab-dl__name {
	padding-block: 6px;
	padding-inline-end: 12px;
	color: var(--ab-body, #282828);
	font-size: 16px;
	line-height: 1.4;
}

.ab-dl__cell {
	display: grid;
	place-items: center;
}

.ab-dl .ab-dl__file {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	color: var(--ab-navy, #002b56);
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ab-dl .ab-dl__file:hover {
	background: var(--ab-accent, #30cbd3);
	color: var(--ab-navy, #002b56);
}

.ab-dl__icon {
	display: block;
	width: 22px;
	height: 22px;
}

.ab-dl .ab-dl__file:focus-visible,
.ab-dl .ab-dl__product:focus-visible {
	outline: 3px solid var(--ab-navy, #002b56);
	outline-offset: 2px;
	border-radius: 4px;
}

.ab-dl .ab-dl__file:focus-visible {
	border-radius: 50%;
}

@media (max-width: 768px) {
	.ab-dl__row {
		min-height: 52px;
		padding: 4px 0 4px 14px;
	}

	.ab-dl__bar {
		padding-inline-end: 0;
	}

	.ab-dl .ab-dl__name {
		font-size: 15px;
		padding-inline-end: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ab-dl .ab-dl__file {
		transition: none;
	}
}

/* on navy */
.is-dark.ab-dl {
	--ab-dl-row: rgba(255, 255, 255, 0.08);
}

.is-dark.ab-dl :is(.ab-dl__sub, .ab-dl__col) {
	color: rgba(255, 255, 255, 0.8);
}

.is-dark.ab-dl :is(.ab-dl__text, .ab-dl__name, .ab-dl__product) {
	color: #fff;
}

.is-dark.ab-dl .ab-dl__file {
	color: var(--ab-accent, #30cbd3);
}

.is-dark.ab-dl .ab-dl__file:hover {
	color: var(--ab-navy, #002b56);
}

/* ------------------------------------------------------------ menu: search + jump links */

.ab-dln__anchor {
	position: absolute;
	top: 0;
}

.ab-dln__search {
	max-width: 620px;
}

.ab-dln__search[hidden] {
	display: none;
}

.ab-dln .ab-dln__label {
	display: block;
	margin-bottom: 8px;
	color: var(--ab-heading, #012b55);
	font-size: 17px;
	font-weight: 700;
	line-height: 1.35;
}

.ab-dln__field {
	position: relative;
	display: flex;
	align-items: center;
}

.ab-dln__icon {
	position: absolute;
	left: 16px;
	color: var(--ab-muted, #4a5563);
	pointer-events: none;
}

.ab-dln .ab-dln__input {
	box-sizing: border-box;
	width: 100%;
	height: 52px;
	margin: 0;
	padding: 0 104px 0 48px;
	border: 1px solid #b9c4cf;
	border-radius: var(--ab-radius-s, 8px);
	background: #fff;
	color: var(--ab-body, #282828);
	font: inherit;
	font-size: 17px;
	-webkit-appearance: none;
	appearance: none;
}

.ab-dln .ab-dln__input::placeholder {
	color: #6b7682;
	opacity: 1;
}

.ab-dln .ab-dln__input::-webkit-search-cancel-button {
	display: none;
}

.ab-dln .ab-dln__input:focus {
	border-color: var(--ab-navy, #002b56);
	outline: 3px solid var(--ab-accent, #30cbd3);
	outline-offset: 0;
}

.ab-dln .ab-dln__clear {
	position: absolute;
	right: 6px;
	min-height: 40px;
	padding: 0 12px;
	border: 0;
	border-radius: 6px;
	background: var(--ab-tint, #eaf8f9);
	color: var(--ab-navy, #002b56);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.ab-dln.ab-bg-light .ab-dln__clear {
	background: #eaf0f4;
}

.ab-dln .ab-dln__clear[hidden] {
	display: none;
}

.ab-dln .ab-dln__clear:hover {
	background: var(--ab-accent, #30cbd3);
}

.ab-dln .ab-dln__status {
	margin: 8px 0 0;
	color: var(--ab-body, #282828);
	font-size: 15px;
	line-height: 1.45;
}

.ab-dln__status:empty {
	display: none;
}

.ab-dln__search:not([hidden]) + .ab-dln__nav {
	margin-top: 20px;
}

.ab-dln__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ab-dln__chips > li {
	margin: 0;
}

.ab-dln .ab-dln__chips a {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: 40px;
	padding: 6px 14px;
	border: 1px solid #cdd6e0;
	border-radius: 999px;
	background: #fff;
	color: var(--ab-navy, #002b56);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ab-dln .ab-dln__chips a:hover {
	border-color: var(--ab-accent, #30cbd3);
	background: var(--ab-tint, #eaf8f9);
}

.ab-dln.ab-bg-light .ab-dln__chips a:hover {
	background: #e9f7f8;
}

.ab-dln .ab-dln__chips a:focus-visible {
	outline: 3px solid var(--ab-navy, #002b56);
	outline-offset: 2px;
}

@media (max-width: 768px) {
	.ab-dln .ab-dln__label {
		font-size: 16px;
	}

	.ab-dln .ab-dln__chips a {
		min-height: 44px;
		padding: 8px 14px;
		font-size: 15px;
	}
}

/* ------------------------------------------------------------ editor */

.ab-dl__edit-rows {
	display: grid;
	gap: 8px;
}

.ab-dl__edit-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 6px;
	align-items: center;
	padding: 8px;
	border-radius: var(--ab-radius-s, 8px);
	background: var(--ab-dl-row, #f2f6f8);
}

.ab-dl__edit-files {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.ab-dl__edit-row .components-base-control {
	margin: 0;
}

.ab-dl__edit-add {
	margin-top: 8px;
}

.ab-dln__edit-note {
	margin: 12px 0 0;
	font-size: 13px;
	opacity: 0.8;
}
