/* EcoParts – felugró képek és galéria (front end) */

:root {
	--ep-accent: var(--wp--preset--color--accent-2, #ff9524);
}

/* The popup's own gallery never shows on the page, only inside the viewer. */
.is-style-ep-popup {
	display: none !important;
}

/* ---------- Clickable trigger image ---------- */

.is-style-ep-popup-trigger.ep-ready img {
	cursor: zoom-in;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.is-style-ep-popup-trigger.ep-ready:hover img,
.is-style-ep-popup-trigger.ep-ready img:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 24px 50px -14px rgba(0, 0, 0, 0.65);
}

.is-style-ep-popup-trigger img:focus-visible,
.ep-gallery img:focus-visible {
	outline: 3px solid var(--ep-accent);
	outline-offset: 4px;
}

.is-style-ep-popup-trigger.ep-ready figcaption {
	cursor: pointer;
	color: var(--ep-accent);
	font-weight: 600;
	text-align: center;
}

.is-style-ep-popup-trigger.ep-ready figcaption::before {
	content: "";
	display: inline-block;
	width: 1.15em;
	height: 1.15em;
	margin-right: 0.45em;
	vertical-align: -0.2em;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m20 20-4.8-4.8M10.5 7.5v6M7.5 10.5h6'/%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='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m20 20-4.8-4.8M10.5 7.5v6M7.5 10.5h6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.is-style-ep-popup-trigger.ep-ready:hover figcaption {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* ---------- Galleries ---------- */

.ep-gallery .ep-zoomable {
	overflow: hidden;
}

.ep-gallery .ep-zoomable img {
	cursor: zoom-in;
	transition: transform 0.45s ease;
}

.ep-gallery .ep-zoomable:hover img {
	transform: scale(1.04);
}

.ep-gallery .ep-zoomable img:focus-visible {
	outline-offset: -3px;
}

/* ---------- Viewer ---------- */

html.ep-lock {
	overflow: hidden;
}

html.ep-lock body {
	padding-right: var(--ep-scrollbar, 0px);
}

.ep-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	color: #fff;
	opacity: 0;
	transition: opacity 0.22s ease;
}

.ep-modal.is-open {
	opacity: 1;
}

.ep-modal::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(8, 8, 8, 0.93);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.ep-modal[hidden],
.ep-modal [hidden] {
	display: none !important;
}

.ep-stage {
	position: absolute;
	inset: 0;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 76px 24px 28px;
	overflow: auto;
	overscroll-behavior: contain;
}

.ep-bar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 2;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	pointer-events: none;
}

.ep-back {
	grid-column: 1;
	justify-self: start;
}

.ep-bar > * {
	pointer-events: auto;
}

.ep-counter {
	grid-column: 2;
	padding: 6px 12px;
	border-radius: 999px;
	background: rgba(24, 24, 24, 0.75);
	font-size: 15px;
	font-variant-numeric: tabular-nums;
	pointer-events: none;
}

.ep-counter:empty {
	visibility: hidden;
}

.ep-btn {
	appearance: none;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-width: 44px;
	height: 44px;
	margin: 0;
	padding: 0 14px;
	border: 0;
	border-radius: 999px;
	background: rgba(24, 24, 24, 0.75);
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
	color: #fff;
	font: inherit;
	font-size: 15px;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: background 0.2s ease;
}

.ep-btn:hover {
	background: rgba(64, 64, 64, 0.9);
}

.ep-btn:focus-visible,
.ep-card__open:focus-visible {
	outline: 3px solid var(--ep-accent);
	outline-offset: 3px;
}

.ep-btn svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	flex: none;
}

.ep-close {
	grid-column: 3;
	justify-self: end;
	padding: 0;
}

.ep-nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	width: 52px;
	height: 52px;
	padding: 0;
	transform: translateY(-50%);
}

.ep-nav svg {
	width: 28px;
	height: 28px;
}

.ep-prev {
	left: 16px;
}

.ep-next {
	right: 16px;
}

/* Several images floating side by side */
.ep-stage.is-group {
	--ep-gap: clamp(16px, 3vw, 44px);
	gap: var(--ep-gap);
}

.ep-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	min-width: 0;
	margin: 0;
	animation: ep-rise 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
	animation-delay: calc(var(--ep-i, 0) * 110ms + 60ms);
}

.ep-card__open {
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: none;
	cursor: zoom-in;
	transition: transform 0.3s ease;
}

.ep-card__open:hover {
	transform: translateY(-6px);
}

.ep-card img {
	display: block;
	width: auto;
	height: auto;
	max-height: calc(100vh - 170px);
	max-height: calc(100dvh - 170px);
	max-width: calc((100vw - 48px - (var(--ep-n, 1) - 1) * var(--ep-gap)) / var(--ep-n, 1));
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 40px 90px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.ep-card figcaption,
.ep-single figcaption {
	max-width: 60ch;
	font-size: 15px;
	line-height: 1.4;
	text-align: center;
	opacity: 0.85;
}

/* One image large */
.ep-stage.is-single {
	padding-left: 84px;
	padding-right: 84px;
}

.ep-single {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	min-width: 0;
	max-width: 100%;
	margin: 0;
	animation: ep-fade 0.25s ease both;
}

.ep-single img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: calc(100vh - 150px);
	max-height: calc(100dvh - 150px);
	border-radius: 4px;
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
	cursor: zoom-in;
}

.ep-card img,
.ep-single img {
	opacity: 0;
	transition: opacity 0.3s ease;
}

.ep-card img.is-loaded,
.ep-single img.is-loaded {
	opacity: 1;
}

/* Real size, scroll to read */
.ep-stage.is-zoomed {
	display: block;
	padding: 0;
}

.ep-stage.is-zoomed .ep-single {
	display: block;
	width: max-content;
	max-width: none;
	margin: 0 auto;
	padding: 76px 24px 28px;
	animation: none;
}

.ep-stage.is-zoomed .ep-single img {
	max-width: none;
	max-height: none;
	cursor: zoom-out;
}

.ep-stage.is-zoomed .ep-single figcaption {
	display: none;
}

@keyframes ep-rise {
	from {
		opacity: 0;
		transform: translateY(28px) scale(0.96);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes ep-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Phones: stack the floating images and scroll; arrows move to the bottom. */
@media (max-width: 700px) {
	.ep-stage {
		padding: 68px 12px 20px;
	}

	.ep-stage.is-group {
		flex-direction: column;
		justify-content: flex-start;
	}

	.ep-card {
		max-width: 100%;
	}

	.ep-card img {
		max-width: 100%;
		max-height: none;
	}

	.ep-stage.is-single {
		padding: 68px 12px 84px;
	}

	.ep-single img {
		max-height: calc(100vh - 170px);
		max-height: calc(100dvh - 170px);
	}

	.ep-nav {
		top: auto;
		bottom: 16px;
		transform: none;
	}

	.ep-prev {
		left: calc(50% - 64px);
	}

	.ep-next {
		right: calc(50% - 64px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ep-modal,
	.ep-card,
	.ep-single,
	.ep-card__open,
	.ep-card img,
	.ep-single img,
	.is-style-ep-popup-trigger.ep-ready img,
	.ep-gallery .ep-zoomable img {
		animation: none !important;
		transition: none !important;
	}
}
