/* Easy Folder Gallery — theme-neutral defaults, overridable via CSS custom properties. */

.efg {
	--efg-card-border: rgba(150, 150, 150, 0.4);
	--efg-card-hover-bg: rgba(150, 150, 150, 0.08);
	--efg-frame-bg: #fff;
	--efg-frame-border: #efefef;
	--efg-shadow: 1px 1px 5px rgba(0, 0, 0, 0.4);
	--efg-thumb-size: 150px;
}

.efg-grid {
	display: grid;
	grid-template-columns: repeat(var(--efg-columns, 2), minmax(0, 1fr));
	gap: 10px;
	margin: 20px 0;
}

.efg-card {
	display: block;
	padding: 20px;
	border: 1px solid var(--efg-card-border);
	border-radius: 3px;
	overflow: hidden;
}

/* The whole card is a link — keep its text looking like normal text,
   overriding the theme's link color/underline. */
a.efg-card,
a.efg-card:visited,
a.efg-card:hover,
a.efg-card:focus,
a.efg-card:active {
	color: inherit !important;
	text-decoration: none !important;
}

.efg-card:hover {
	background-color: var(--efg-card-hover-bg);
	box-shadow: var(--efg-shadow);
}

/* Titles and info texts inherit the theme's typography. */
.efg-card h2 {
	margin: 5px 0 15px;
}

.efg-count {
	font-weight: normal;
	opacity: 0.7;
}

.efg-previews {
	display: flex;
	gap: 10px;
}

.efg-previews img,
.efg-preview img {
	box-sizing: border-box;
	flex: 1 1 0;
	min-width: 0;
	max-width: var(--efg-thumb-size);
	height: auto;
	align-self: flex-start;
}

/* White frame with a soft shadow around every thumbnail. */
.efg-previews img,
.efg-preview img,
.efg-photos img {
	background: var(--efg-frame-bg);
	padding: 4px;
	border: 1px solid var(--efg-frame-border);
	box-shadow: var(--efg-shadow);
}

.efg-info {
	margin-top: 10px;
}

/* Gallery cards (single preview image): the teaser text flows to the right
   of the image when there is room, otherwise it wraps below it. */
.efg-card:has(.efg-preview) {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	column-gap: 15px;
	row-gap: 10px;
}

.efg-card:has(.efg-preview) h2 {
	width: 100%;
	margin-bottom: 5px;
}

.efg-card:has(.efg-preview) .efg-preview {
	flex: 0 0 auto;
}

.efg-card:has(.efg-preview) .efg-info {
	flex: 1 1 12em;
	min-width: 0;
	margin-top: 0;
}

.efg-info-long {
	margin: 15px 0;
}

.efg-backlink {
	margin: 10px 0;
}

.efg-photos {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
	margin: 20px 0;
}

.efg-photo img {
	display: block;
	box-sizing: content-box;
	height: auto;
}

/* Lightbox */

.efg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.9);
}

.efg-lightbox.is-open {
	display: flex;
}

.efg-lightbox img {
	max-width: 92vw;
	max-height: 92vh;
	width: auto;
	height: auto;
}

.efg-lightbox button {
	position: absolute;
	background: none;
	border: none;
	color: #fff;
	font-size: 32px;
	line-height: 1;
	padding: 12px;
	cursor: pointer;
	opacity: 0.8;
}

.efg-lightbox button:hover {
	opacity: 1;
}

.efg-lb-close {
	top: 10px;
	right: 10px;
}

.efg-lb-prev {
	left: 10px;
	top: 50%;
	transform: translateY(-50%);
}

.efg-lb-next {
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 600px) {
	.efg-grid {
		grid-template-columns: 1fr;
	}
}
