/* Free Download Library, front end.
   Every value below that a site owner can change comes in as a CSS variable
   set on .fdl-library, so the theme keeps control of fonts and colors. */

.fdl-library {
	--fdl-grid-width: 1200px;
	--fdl-gap: 16px;
	--fdl-pad: 10px;
	--fdl-radius: 6px;
	--fdl-border-width: 1px;
	--fdl-border-style: solid;
	--fdl-border-color: rgba(216, 216, 216, 1);
	--fdl-tile-bg: #ffffff;
	--fdl-fit: contain;
	--fdl-ratio: 1 / 1;
	--fdl-col: 220px;
	--fdl-cols: 4;
	max-width: var(--fdl-grid-width);
	margin-inline: auto;
	width: 100%;
}

/* Filter bar */
.fdl-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: calc(var(--fdl-gap) + 4px);
}

.fdl-field-search {
	flex: 1 1 220px;
	min-width: 180px;
}

.fdl-filters input[type="search"],
.fdl-filters select {
	width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--fdl-border-color);
	border-radius: var(--fdl-radius);
	background: #fff;
	font: inherit;
	color: inherit;
}

.fdl-filters select {
	min-width: 170px;
}

.fdl-btn {
	padding: 8px 16px;
	border: 1px solid var(--fdl-border-color);
	border-radius: var(--fdl-radius);
	background: #f2f2f2;
	font: inherit;
	cursor: pointer;
}

.fdl-btn:hover {
	background: #e7e7e7;
}

/* Grid */
.fdl-grid {
	display: grid;
	gap: var(--fdl-gap);
	list-style: none;
	margin: 0;
	padding: 0;
}

.fdl-mode-px .fdl-grid {
	grid-template-columns: repeat(auto-fill, minmax(min(var(--fdl-col), 100%), 1fr));
}

.fdl-mode-percent .fdl-grid {
	grid-template-columns: repeat(var(--fdl-cols), minmax(0, 1fr));
}

.fdl-item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.fdl-item .fdl-tile {
	display: flex;
	flex-direction: column;
	gap: 6px;
	width: 100%;
	padding: var(--fdl-pad);
	background: var(--fdl-tile-bg);
	border: var(--fdl-border-width) var(--fdl-border-style) var(--fdl-border-color);
	border-radius: var(--fdl-radius);
	cursor: pointer;
	font: inherit;
	color: inherit;
	text-align: center;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fdl-item .fdl-tile:hover,
.fdl-item .fdl-tile:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.fdl-item .fdl-tile:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.fdl-thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: var(--fdl-ratio);
	overflow: hidden;
	width: 100%;
}

.fdl-thumb img {
	width: 100%;
	height: 100%;
	object-fit: var(--fdl-fit);
	display: block;
}

.fdl-thumb-fallback {
	font-weight: 700;
	letter-spacing: 0.08em;
	opacity: 0.55;
	font-size: 1.1rem;
}

.fdl-item-title {
	font-size: 0.9rem;
	line-height: 1.3;
	word-break: break-word;
}

.fdl-empty {
	padding: 2rem 0;
	text-align: center;
	opacity: 0.8;
}

/* Pagination */
.fdl-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
	margin-top: calc(var(--fdl-gap) + 8px);
}

.fdl-pagination .page-numbers {
	display: inline-block;
	padding: 6px 12px;
	border: 1px solid var(--fdl-border-color);
	border-radius: var(--fdl-radius);
	text-decoration: none;
	line-height: 1.4;
}

.fdl-pagination .page-numbers.current {
	background: #333;
	color: #fff;
	border-color: #333;
}

.fdl-pagination .dots {
	border: 0;
}

/* Lightbox */
.fdl-lightbox[hidden] {
	display: none;
}

.fdl-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.fdl-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.72);
}

.fdl-lightbox-box {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 14px;
	max-width: 760px;
	width: 100%;
	max-height: 90vh;
	overflow: auto;
	padding: 20px;
	background: #fff;
	border-radius: calc(var(--fdl-radius) + 4px);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.fdl-lightbox-x {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #444;
}

.fdl-lightbox-media {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--fdl-tile-bg);
	border-radius: var(--fdl-radius);
	min-height: 120px;
	padding: 10px;
}

.fdl-lightbox-img {
	max-width: 100%;
	max-height: 55vh;
	height: auto;
	display: block;
}

.fdl-lightbox-img[src=""] {
	display: none;
}

.fdl-lightbox-title {
	margin: 0;
	font-size: 1.25rem;
	line-height: 1.3;
}

.fdl-lightbox-desc,
.fdl-lightbox-terms {
	margin: 6px 0 0;
	font-size: 0.9rem;
}

.fdl-lightbox-terms {
	opacity: 0.7;
}

.fdl-download-btn {
	display: inline-block;
	margin-top: 14px;
	padding: 12px 26px;
	background: #1c7c54;
	color: #fff;
	border-radius: var(--fdl-radius);
	text-decoration: none;
	font-weight: 600;
}

.fdl-download-btn:hover,
.fdl-download-btn:focus {
	background: #166647;
	color: #fff;
}

.fdl-is-loading {
	opacity: 0.45;
	pointer-events: none;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

@media (max-width: 700px) {
	.fdl-mode-percent .fdl-grid,
	.fdl-mode-px .fdl-grid {
		grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.fdl-item .fdl-tile {
		transition: none;
	}

	.fdl-item .fdl-tile:hover,
	.fdl-item .fdl-tile:focus-visible {
		transform: none;
	}
}

/* Tiles are links now, so strip the link chrome the theme adds */
.fdl-item .fdl-tile,
.fdl-item .fdl-tile:hover,
.fdl-item .fdl-tile:focus {
	text-decoration: none;
	color: inherit;
}

/* Themes love to frame block wrappers. This wrapper is ours and stays bare. */
.fdl-library,
.fdl-related {
	border: 0;
	box-shadow: none;
	background: none;
}

.fdl-details-link {
	display: inline-block;
	margin: 14px 0 0 14px;
	font-size: 0.9rem;
}

/* Single item page */
.fdl-single {
	margin-top: 1.5em;
}

.fdl-single-media {
	display: flex;
	justify-content: center;
	padding: 16px;
	background: var(--fdl-tile-bg, #fff);
	border-radius: 8px;
}

.fdl-single-media img {
	max-width: 100%;
	height: auto;
}

.fdl-single-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 20px;
	margin: 20px 0;
}

.fdl-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 20px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9rem;
}

.fdl-facts li {
	margin: 0;
}

.fdl-fact-label {
	opacity: 0.65;
}

.fdl-fact-value {
	font-weight: 600;
}

.fdl-term-links {
	margin: 8px 0;
	font-size: 0.95rem;
}

.fdl-term-label {
	opacity: 0.65;
	margin-right: 4px;
}

.fdl-related {
	margin-top: 2.5em;
}

.fdl-related-title {
	font-size: 1.15rem;
	margin: 0 0 0.8em;
}
