/**
 * Portfolio frontend — 6 gallery layouts + lightbox.
 * Всичко scoped под .mpf-* — не bleed-ва в theme CSS.
 */

.mpf-gallery { margin: 40px 0; --mpf-cols: 3; --mpf-gap: 12px; }
.mpf-gallery img { display: block; max-width: 100%; height: auto; }
.mpf-placeholder { padding: 40px; background: #f8fafc; border: 2px dashed #cbd5e1; border-radius: 12px; text-align: center; color: #64748b; }

/* ═══════════ MASONRY (CSS columns) ═══════════ */
.mpf-masonry {
	column-count: var(--mpf-cols);
	column-gap: var(--mpf-gap);
}
.mpf-mas__item {
	break-inside: avoid;
	margin: 0 0 var(--mpf-gap);
	border-radius: 10px;
	overflow: hidden;
	cursor: zoom-in;
	transition: transform .35s ease, box-shadow .35s ease;
}
.mpf-mas__item:hover { transform: translateY(-3px); box-shadow: 0 20px 40px -10px rgba(0,0,0,.18); }
.mpf-mas__img { width: 100%; }

/* ═══════════ GRID (aspect square) ═══════════ */
.mpf-grid {
	display: grid;
	grid-template-columns: repeat(var(--mpf-cols), 1fr);
	gap: var(--mpf-gap);
}
.mpf-grid__item {
	margin: 0;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 10px;
	cursor: zoom-in;
	position: relative;
	background: #e2e8f0;
}
.mpf-grid__img {
	width: 100%; height: 100%;
	object-fit: cover;
	transition: transform .5s ease;
}
.mpf-grid__item:hover .mpf-grid__img { transform: scale(1.08); }

/* ═══════════ JUSTIFIED (Google-photos-like rows) ═══════════ */
.mpf-justified {
	display: flex;
	flex-wrap: wrap;
	gap: var(--mpf-gap);
}
.mpf-just__item {
	margin: 0;
	height: 240px;
	flex-grow: 1;
	flex-basis: 200px;
	overflow: hidden;
	border-radius: 8px;
	cursor: zoom-in;
	position: relative;
}
.mpf-just__img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease, filter .4s ease; }
.mpf-just__item:hover .mpf-just__img { transform: scale(1.05); filter: brightness(1.05); }

/* ═══════════ SLIDER (one at a time + arrows + dots) ═══════════ */
.mpf-slider {
	position: relative;
	overflow: hidden;
	border-radius: 12px;
	background: linear-gradient(160deg,#1f2129,#16181e);
}
.mpf-slider__track {
	display: flex;
	transition: transform .5s cubic-bezier(.4,0,.2,1);
	will-change: transform;
}
.mpf-slide {
	flex: 0 0 100%;
	aspect-ratio: 16 / 10;
	display: flex; align-items: center; justify-content: center;
	background: linear-gradient(160deg,#1f2129,#16181e);
}
.mpf-slide__img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mpf-slider__nav {
	position: absolute; top: 50%; transform: translateY(-50%);
	width: 48px; height: 48px; border-radius: 50%;
	background: rgba(255,255,255,.9); border: 0; cursor: pointer;
	font-size: 24px; line-height: 1;
	display: flex; align-items: center; justify-content: center;
	z-index: 2; color: #0a0a0a; font-weight: 700;
	transition: background .2s;
}
.mpf-slider__nav:hover { background: #fff; }
.mpf-slider__prev { left: 16px; }
.mpf-slider__next { right: 16px; }
.mpf-slider__dots {
	position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
	display: flex; gap: 8px; z-index: 2;
}
.mpf-slider__dot {
	width: 10px; height: 10px; border-radius: 50%;
	background: rgba(255,255,255,.4); border: 0; cursor: pointer;
	transition: background .2s, transform .2s;
}
.mpf-slider__dot.is-active { background: #fff; transform: scale(1.3); }

/* ═══════════ CAROUSEL (horizontal scroll snap) ═══════════ */
.mpf-carousel { overflow: hidden; }
.mpf-carousel__track {
	display: flex;
	gap: var(--mpf-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	padding-bottom: 16px;
	scrollbar-width: thin;
}
.mpf-carousel__item {
	flex: 0 0 60%;
	max-width: 500px;
	aspect-ratio: 3 / 4;
	scroll-snap-align: center;
	border-radius: 12px;
	overflow: hidden;
	cursor: zoom-in;
}
@media (max-width: 700px) { .mpf-carousel__item { flex: 0 0 85%; } }
.mpf-carousel__img { width: 100%; height: 100%; object-fit: cover; }

/* ═══════════ FULLSCREEN (stacked full-width) ═══════════ */
.mpf-fullscreen { display: flex; flex-direction: column; gap: 2px; background: linear-gradient(160deg,#1f2129,#16181e); }
.mpf-fs-item { margin: 0; }
.mpf-fs-img { width: 100%; height: auto; display: block; cursor: zoom-in; }

/* ═══════════ LIGHTBOX ═══════════ */
.mpf-lightbox[hidden] { display: none !important; }
.mpf-lightbox {
	position: fixed; inset: 0;
	background: rgba(20,22,29,.95);
	display: flex; align-items: center; justify-content: center;
	z-index: 999999;
	padding: 40px;
	animation: mpfFade .25s ease;
}
@keyframes mpfFade { from { opacity: 0 } to { opacity: 1 } }
.mpf-lb__img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 40px 100px rgba(0,0,0,.5); }
.mpf-lb__close, .mpf-lb__nav {
	position: absolute;
	background: rgba(255,255,255,.1);
	color: #fff; border: 0; cursor: pointer;
	backdrop-filter: blur(20px);
	transition: background .2s, transform .2s;
}
.mpf-lb__close {
	top: 20px; right: 20px;
	width: 44px; height: 44px; border-radius: 50%;
	font-size: 24px; line-height: 1;
	display: flex; align-items: center; justify-content: center;
}
.mpf-lb__nav {
	top: 50%; transform: translateY(-50%);
	width: 56px; height: 56px; border-radius: 50%;
	font-size: 32px; font-weight: 700;
}
.mpf-lb__prev { left: 24px; }
.mpf-lb__next { right: 24px; }
.mpf-lb__close:hover, .mpf-lb__nav:hover { background: rgba(255,255,255,.25); }
.mpf-lb__counter {
	position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
	color: #fff; font-size: 14px; opacity: .7;
	background: rgba(0,0,0,.4); padding: 6px 14px; border-radius: 100px;
	backdrop-filter: blur(10px);
}

/* Responsive */
@media (max-width: 900px) {
	.mpf-gallery { --mpf-cols: 2; }
}
@media (max-width: 500px) {
	.mpf-gallery { --mpf-cols: 1; }
	.mpf-grid { --mpf-cols: 2; }
	.mpf-just__item { height: 180px; }
}

/* Accessibility + touch improvements */
.mpf-gallery figure { margin: 0; }
.mpf-gallery img { content-visibility: auto; }
.mpf-lightbox button:focus-visible, .mpf-gallery img:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.mpf-gallery img { -webkit-user-drag: none; }
@media (prefers-reduced-motion: reduce) {
	.mpf-gallery *, .mpf-gallery *::before, .mpf-gallery *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* v2.73.0 — бутоните на lightbox-а: тънък кръг, без цветни фонове от skin-а; при hover — акцентът на темата. */
.mpf-lightbox .mpf-lb__close,
.mpf-lightbox .mpf-lb__nav {
	background: rgba(0, 0, 0, .35) !important;
	border: 1px solid rgba(255, 255, 255, .45) !important;
	color: #fff !important;
	box-shadow: none !important;
	padding: 0 !important;
	border-radius: 50% !important;
	font-weight: 300;
}
.mpf-lightbox .mpf-lb__close:hover,
.mpf-lightbox .mpf-lb__nav:hover {
	background: var(--mega-primary, #fff) !important;
	border-color: var(--mega-primary, #fff) !important;
	color: #08090b !important;
}
