/* =========================================================
   Галерия Проекти – frontend
   ========================================================= */
.prg-wrap {
	--prg-cols: 3; --prg-cols-t: 2; --prg-cols-m: 1;
	--prg-gcols: 4; --prg-gcols-t: 3; --prg-gcols-m: 2;
	--prg-gap: 20px; --prg-radius: 8px; --prg-accent: #c0965c;
	--prg-ratio: 4/3; --prg-gratio: 1/1; --prg-h: 280px; --prg-gh: 220px;
	--prg-text: inherit; --prg-muted: rgba(0,0,0,.58); --prg-card-bg: #fff;
	--prg-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.06);
	--prg-max: 1200px; --prg-pad: 24px; --prg-text-w: 860px;
	--prg-spv: 3; --prg-spv-t: 2; --prg-spv-m: 1;
	scroll-margin-top: 90px;
	width: 100%;
	max-width: calc(var(--prg-max) + var(--prg-pad) * 2);
	margin: 0 auto 3em;
	padding: 0 var(--prg-pad);
}
@media (max-width: 640px) { .prg-wrap { padding: 0 max(16px, calc(var(--prg-pad) * .66)); } }
.prg-wrap *, .prg-wrap *::before, .prg-wrap *::after { box-sizing: border-box; }
.prg-wrap img { max-width: 100%; height: auto; display: block; }
.prg-empty { padding: 1em 1.2em; background: rgba(0,0,0,.04); border-radius: var(--prg-radius); }

/* ---------- Филтри ---------- */
.prg-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 calc(var(--prg-gap) + 4px); }
.prg-filter__btn {
	appearance: none; cursor: pointer; font: inherit; font-size: .9em; line-height: 1.2;
	padding: .55em 1.1em; border-radius: 999px; border: 1px solid rgba(0,0,0,.15);
	background: transparent; color: inherit; transition: all .2s ease;
}
.prg-filter__btn:hover { border-color: var(--prg-accent); color: var(--prg-accent); }
.prg-filter__btn.is-active { background: var(--prg-accent); border-color: var(--prg-accent); color: #fff; }

/* ---------- Мрежа с категории ---------- */
.prg-grid { display: grid; gap: var(--prg-gap); grid-template-columns: repeat(var(--prg-cols), minmax(0, 1fr)); }
@media (max-width: 1024px) { .prg-grid { grid-template-columns: repeat(var(--prg-cols-t), minmax(0, 1fr)); } }
@media (max-width: 640px)  { .prg-grid { grid-template-columns: repeat(var(--prg-cols-m), minmax(0, 1fr)); } }

.prg-card { min-width: 0; }
.prg-card.is-hidden { display: none; }
.prg-card__link {
	display: flex; flex-direction: column; height: 100%; position: relative;
	color: inherit !important; text-decoration: none !important;
	border-radius: var(--prg-radius); overflow: hidden;
	transition: transform .35s ease, box-shadow .35s ease;
}
.prg-card__link:focus-visible { outline: 3px solid var(--prg-accent); outline-offset: 3px; }
.prg-card__media { position: relative; overflow: hidden; aspect-ratio: var(--prg-ratio); background: #eee; }
.prg-cat-fixed .prg-card__media { aspect-ratio: auto; height: var(--prg-h); }
.prg-wrap .prg-card__img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .5s ease; }
.prg-card__placeholder { position: absolute; inset: 0; background: linear-gradient(135deg, #e9e6e1, #d6d0c7); }

.prg-card__count {
	position: absolute; top: 12px; right: 12px; z-index: 2;
	display: inline-flex; align-items: center; gap: 5px;
	padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4;
	background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(4px);
}
.prg-card__count svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.prg-card__body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
.prg-wrap .prg-card__title { margin: 0 0 4px; font-size: 1.15em; line-height: 1.3; font-weight: 600; color: inherit; }
.prg-wrap .prg-card__subtitle { margin: 0; font-size: .92em; line-height: 1.45; color: var(--prg-muted); }
.prg-card__more {
	margin-top: auto; padding-top: 10px; font-size: .85em; font-weight: 600; letter-spacing: .02em;
	color: var(--prg-accent); opacity: 0; transform: translateX(-6px); transition: all .3s ease;
}
.prg-card__link:hover .prg-card__more, .prg-card__link:focus-visible .prg-card__more { opacity: 1; transform: none; }

/* Стил: карта */
.prg-style-card .prg-card__link { background: var(--prg-card-bg); box-shadow: var(--prg-shadow); }

/* Стил: минимален */
.prg-style-minimal .prg-card__media { border-radius: var(--prg-radius); }
.prg-style-minimal .prg-card__link { overflow: visible; }
.prg-style-minimal .prg-card__body { padding: 12px 2px 0; }

/* Стил: текст върху снимката */
.prg-style-overlay .prg-card__body {
	position: absolute; inset: auto 0 0 0; z-index: 2; color: #fff; padding: 60px 20px 18px;
	background: linear-gradient(to top, rgba(0,0,0,.78) 0%, rgba(0,0,0,.35) 55%, transparent 100%);
}
.prg-style-overlay .prg-card__subtitle { color: rgba(255,255,255,.85); }
.prg-style-overlay .prg-card__more { color: #fff; }

/* Ефекти при посочване */
.prg-hover-zoom .prg-card__link:hover .prg-card__img { transform: scale(1.07); }
.prg-hover-lift .prg-card__link:hover { transform: translateY(-6px); box-shadow: 0 14px 34px rgba(0,0,0,.16); }
.prg-hover-grayscale .prg-card__img { filter: grayscale(1); }
.prg-hover-grayscale .prg-card__link:hover .prg-card__img { filter: none; }

/* ---------- Страниране ---------- */
.prg-pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: calc(var(--prg-gap) * 1.5); }
.prg-pagination .page-numbers {
	min-width: 40px; height: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
	border-radius: 999px; border: 1px solid rgba(0,0,0,.12); text-decoration: none; color: inherit;
}
.prg-pagination .page-numbers.current, .prg-pagination a.page-numbers:hover { background: var(--prg-accent); border-color: var(--prg-accent); color: #fff; }

/* ---------- Отворен проект ---------- */
.prg-back {
	display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px;
	font-weight: 600; font-size: .95em; text-decoration: none !important; color: var(--prg-accent) !important;
}
.prg-back span { transition: transform .2s ease; }
.prg-back:hover span { transform: translateX(-4px); }

.prg-project { padding: 24px 0 8px; }
.prg-project__header { margin-bottom: 32px; }
.prg-wrap .prg-project__title { margin: 0 0 10px; font-size: clamp(1.6em, 2.6vw, 2.25em); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.prg-wrap .prg-project__subtitle { margin: 0; font-size: 1.12em; line-height: 1.5; color: var(--prg-muted); }

.prg-meta { list-style: none; margin: 24px 0 0; padding: 18px 0; display: flex; flex-wrap: wrap; gap: 14px 48px; border-top: 1px solid rgba(0,0,0,.09); border-bottom: 1px solid rgba(0,0,0,.09); }
.prg-meta li { margin: 0; padding: 0 0 0 14px; display: flex; flex-direction: column; gap: 3px; border-left: 3px solid var(--prg-accent); }
.prg-meta__label { font-size: .72em; text-transform: uppercase; letter-spacing: .1em; color: var(--prg-muted); }
.prg-meta__value { font-weight: 600; font-size: 1.02em; }

/* Текст над галерията */
.prg-project__content { max-width: var(--prg-text-w); margin: 0 0 44px; font-size: 1.04em; line-height: 1.8; }
.prg-project__content > :first-child { margin-top: 0; }
.prg-project__content > :last-child { margin-bottom: 0; }
.prg-wrap .prg-project__content p { margin: 0 0 1.15em; }
.prg-wrap .prg-project__content h2,
.prg-wrap .prg-project__content h3,
.prg-wrap .prg-project__content h4 { margin: 1.8em 0 .7em; line-height: 1.3; }
.prg-wrap .prg-project__content p > strong:only-child { display: block; margin-top: 1.6em; font-size: 1.08em; }
.prg-wrap .prg-project__content ul,
.prg-wrap .prg-project__content ol { margin: 0 0 1.4em; padding-left: 1.6em; }
.prg-wrap .prg-project__content li { margin: 0 0 .85em; padding-left: .35em; }
.prg-wrap .prg-project__content li:last-child { margin-bottom: 0; }
.prg-wrap .prg-project__content li::marker { color: var(--prg-accent); font-weight: 700; }
.prg-wrap .prg-project__content li strong { color: inherit; }
.prg-wrap .prg-project__content a { color: var(--prg-accent); }
.prg-wrap .prg-project__content blockquote { margin: 1.6em 0; padding: .4em 0 .4em 1.2em; border-left: 3px solid var(--prg-accent); font-style: italic; }
.prg-wrap .prg-project__content img { border-radius: var(--prg-radius); }

/* Галерия – мрежа */
.prg-gallery--grid { display: grid; gap: var(--prg-gap); grid-template-columns: repeat(var(--prg-gcols), minmax(0, 1fr)); }
@media (max-width: 1024px) { .prg-gallery--grid { grid-template-columns: repeat(var(--prg-gcols-t), minmax(0, 1fr)); } }
@media (max-width: 640px)  { .prg-gallery--grid { grid-template-columns: repeat(var(--prg-gcols-m), minmax(0, 1fr)); } }
.prg-gallery--grid .prg-item { aspect-ratio: var(--prg-gratio); }
.prg-gal-fixed .prg-gallery--grid .prg-item { aspect-ratio: auto; height: var(--prg-gh); }
.prg-gal-natural .prg-gallery--grid { align-items: start; }
.prg-gal-natural .prg-gallery--grid .prg-item { aspect-ratio: auto; }
.prg-gal-natural .prg-gallery--grid .prg-item__img { height: auto !important; }

/* Галерия – мазайка */
.prg-gallery--masonry { column-count: var(--prg-gcols); column-gap: var(--prg-gap); }
@media (max-width: 1024px) { .prg-gallery--masonry { column-count: var(--prg-gcols-t); } }
@media (max-width: 640px)  { .prg-gallery--masonry { column-count: var(--prg-gcols-m); } }
.prg-gallery--masonry .prg-item { display: block; break-inside: avoid; margin-bottom: var(--prg-gap); }
.prg-gallery--masonry .prg-item__img { height: auto !important; }

.prg-item {
	position: relative; display: block; overflow: hidden; border-radius: var(--prg-radius);
	background: #eee; cursor: zoom-in; text-decoration: none !important;
}
.prg-item:focus-visible { outline: 3px solid var(--prg-accent); outline-offset: 3px; }
.prg-wrap .prg-item__img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.prg-item::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,0); transition: background .3s ease; pointer-events: none; }
.prg-item:hover::after { background: rgba(0,0,0,.25); }
.prg-item:hover .prg-item__img { transform: scale(1.05); }
.prg-item__zoom {
	position: absolute; top: 50%; left: 50%; z-index: 2; width: 46px; height: 46px; margin: -23px 0 0 -23px;
	display: flex; align-items: center; justify-content: center; border-radius: 50%;
	background: rgba(255,255,255,.92); color: #222; opacity: 0; transform: scale(.7); transition: all .3s ease;
}
.prg-item__zoom svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.prg-item:hover .prg-item__zoom, .prg-item:focus-visible .prg-item__zoom { opacity: 1; transform: none; }
.prg-item__caption { display: none; }
.prg-gallery--hovercap .prg-item__caption {
	display: block; position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 26px 12px 10px;
	font-size: .85em; line-height: 1.35; color: #fff;
	background: linear-gradient(to top, rgba(0,0,0,.7), transparent);
	opacity: 0; transform: translateY(8px); transition: all .3s ease;
}
.prg-gallery--hovercap .prg-item:hover .prg-item__caption { opacity: 1; transform: none; }

/* Цялата снимка се вижда (без изрязване) */
.prg-fit-contain .prg-item { background: #f3f3f3; }
.prg-fit-contain .prg-item__img { object-fit: contain !important; }
.prg-fit-contain .prg-item:hover .prg-item__img { transform: scale(1.02); }

/* Галерия – слайдер */
.prg-slider { position: relative; }
.prg-gallery--slider {
	display: flex; gap: var(--prg-gap); overflow-x: auto; overflow-y: hidden;
	scroll-snap-type: x mandatory; scroll-behavior: smooth; overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 2px 0;
}
.prg-gallery--slider::-webkit-scrollbar { display: none; }
.prg-gallery--slider:focus-visible { outline: 2px solid var(--prg-accent); outline-offset: 4px; }
.prg-gallery--slider .prg-item {
	flex: 0 0 calc((100% - (var(--prg-spv) - 1) * var(--prg-gap)) / var(--prg-spv));
	scroll-snap-align: start; aspect-ratio: var(--prg-gratio);
}
@media (max-width: 1024px) { .prg-gallery--slider .prg-item { flex-basis: calc((100% - (var(--prg-spv-t) - 1) * var(--prg-gap)) / var(--prg-spv-t)); } }
@media (max-width: 640px)  { .prg-gallery--slider .prg-item { flex-basis: calc((100% - (var(--prg-spv-m) - 1) * var(--prg-gap)) / var(--prg-spv-m)); } }
.prg-gal-fixed .prg-gallery--slider .prg-item { aspect-ratio: auto; height: var(--prg-gh); }
.prg-gal-natural .prg-gallery--slider { align-items: flex-start; }
.prg-gal-natural .prg-gallery--slider .prg-item { aspect-ratio: auto; }
.prg-gal-natural .prg-gallery--slider .prg-item__img { height: auto !important; }

.prg-slider__arrow {
	position: absolute; top: 50%; z-index: 3; width: 48px; height: 48px; margin-top: -24px; padding: 0;
	display: flex; align-items: center; justify-content: center; cursor: pointer;
	border: 0; border-radius: 50%; background: #fff; color: #222;
	box-shadow: 0 4px 16px rgba(0,0,0,.18); transition: opacity .25s, transform .25s, background .2s, color .2s;
}
.prg-slider.has-dots .prg-slider__arrow { margin-top: -42px; }
.prg-slider__arrow svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.prg-slider__arrow:hover { background: var(--prg-accent); color: #fff; }
.prg-slider__prev { left: -20px; }
.prg-slider__next { right: -20px; }
.prg-slider__arrow:disabled { opacity: 0; pointer-events: none; transform: scale(.8); }
.prg-slider.is-static .prg-slider__arrow, .prg-slider.is-static .prg-slider__dots { display: none; }
@media (max-width: 1300px) { .prg-slider__prev { left: 10px; } .prg-slider__next { right: 10px; } }
@media (max-width: 640px) { .prg-slider__arrow { width: 40px; height: 40px; margin-top: -20px; } .prg-slider.has-dots .prg-slider__arrow { margin-top: -38px; } }

.prg-slider__dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.prg-slider__dots:empty { display: none; }
.prg-slider__dot {
	width: 10px; height: 10px; padding: 0; border: 0; border-radius: 999px; cursor: pointer;
	background: rgba(0,0,0,.18); transition: width .3s ease, background .3s ease;
}
.prg-slider__dot:hover { background: rgba(0,0,0,.35); }
.prg-slider__dot.is-active { width: 28px; background: var(--prg-accent); }

/* Предишен / следващ проект */
.prg-project-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--prg-gap); margin-top: calc(var(--prg-gap) * 2); padding-top: var(--prg-gap); border-top: 1px solid rgba(0,0,0,.09); }
.prg-project-nav a { display: flex; flex-direction: column; gap: 2px; text-decoration: none !important; color: inherit !important; }
.prg-project-nav a:hover span { color: var(--prg-accent); }
.prg-project-nav small { font-size: .78em; text-transform: uppercase; letter-spacing: .06em; color: var(--prg-muted); }
.prg-project-nav span { font-weight: 600; transition: color .2s; }
.prg-project-nav__next { text-align: right; align-items: flex-end; }

/* ---------- Анимации ---------- */
@keyframes prgFadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.prg-anim .prg-card, .prg-anim .prg-gallery--grid .prg-item { animation: prgFadeUp .55s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 60ms); }
.prg-anim .prg-project__header, .prg-anim .prg-project__content { animation: prgFadeUp .5s ease both; }
@media (prefers-reduced-motion: reduce) {
	.prg-wrap *, .prg-lb * { animation: none !important; transition: none !important; }
}

/* =========================================================
   Лайтбокс
   ========================================================= */
html.prg-lb-open, html.prg-lb-open body { overflow: hidden !important; }
.prg-lb {
	position: fixed; inset: 0; z-index: 999999; display: flex; flex-direction: column;
	height: 100vh; height: 100dvh; background: rgba(12,12,14,.96); color: #fff;
	opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
	font-family: inherit; -webkit-tap-highlight-color: transparent; user-select: none;
}
.prg-lb.is-open { opacity: 1; visibility: visible; }
.prg-lb:focus { outline: none; }
.prg-lb svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.prg-lb__play svg path, .prg-lb__pause svg path { fill: currentColor; stroke: none; }

.prg-lb__top { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; flex: 0 0 auto; }
.prg-lb__counter { font-size: 14px; opacity: .8; letter-spacing: .04em; padding-left: 6px; }
.prg-lb__tools { display: flex; gap: 4px; }
.prg-lb__btn {
	appearance: none; border: 0; margin: 0; padding: 0; cursor: pointer; color: #fff; text-decoration: none;
	width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
	background: transparent; border-radius: 50%; transition: background .2s ease, opacity .2s ease;
}
.prg-lb__btn:hover, .prg-lb__btn:focus-visible { background: rgba(255,255,255,.12); outline: none; }
.prg-lb__btn:disabled { opacity: .25; cursor: default; background: transparent; }
.prg-lb__play.is-playing { background: rgba(255,255,255,.18); }

.prg-lb__main { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 64px; }
.prg-lb__stage { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: pan-y; }
.prg-lb__img {
	max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block;
	box-shadow: 0 10px 40px rgba(0,0,0,.5); transition: transform .35s ease; transform-origin: center;
}
.prg-lb.can-zoom .prg-lb__img { cursor: zoom-in; }
.prg-lb__img.is-zoomed { transform: scale(2.2); cursor: zoom-out !important; transition: transform .35s ease, transform-origin .08s linear; }
.prg-lb__img.is-in { animation: prgLbIn .35s ease both; }
@keyframes prgLbIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

.prg-lb__nav { position: absolute; top: 50%; margin-top: -26px; width: 52px; height: 52px; background: rgba(255,255,255,.08); z-index: 3; }
.prg-lb__nav svg { width: 28px; height: 28px; }
.prg-lb__prev { left: 8px; }
.prg-lb__next { right: 8px; }
.prg-lb.is-single .prg-lb__nav, .prg-lb.is-single .prg-lb__thumbs, .prg-lb.is-single .prg-lb__play { display: none; }

.prg-lb__spinner {
	position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px;
	border: 3px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%;
	animation: prgSpin .8s linear infinite; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.prg-lb.is-loading .prg-lb__spinner { opacity: 1; }
@keyframes prgSpin { to { transform: rotate(360deg); } }

.prg-lb__caption { flex: 0 0 auto; text-align: center; padding: 12px 20px 4px; font-size: 15px; line-height: 1.45; max-width: 900px; margin: 0 auto; opacity: .92; min-height: 1em; }
.prg-lb__caption[hidden] { display: block; visibility: hidden; padding-top: 6px; }

.prg-lb__thumbs { position: relative; flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 14px 14px; overflow-x: auto; scrollbar-width: thin; justify-content: safe center; }
.prg-lb__thumb {
	appearance: none; flex: 0 0 auto; width: 72px; height: 52px; padding: 0; border: 2px solid transparent; border-radius: 6px;
	overflow: hidden; cursor: pointer; background: #222; opacity: .5; transition: opacity .2s, border-color .2s;
}
.prg-lb__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prg-lb__thumb:hover { opacity: .85; }
.prg-lb__thumb.is-active { opacity: 1; border-color: var(--prg-lb-accent, #fff); }

.prg-lb__progress { position: absolute; left: 0; top: 0; height: 2px; width: 0; background: var(--prg-lb-accent, #fff); z-index: 4; }
.prg-lb__progress.is-running { animation: prgProgress linear forwards; }
@keyframes prgProgress { from { width: 0; } to { width: 100%; } }

@media (max-width: 640px) {
	.prg-lb__main { padding: 0; }
	.prg-lb__nav { width: 42px; height: 42px; margin-top: -21px; background: rgba(0,0,0,.35); }
	.prg-lb__prev { left: 6px; } .prg-lb__next { right: 6px; }
	.prg-lb__thumb { width: 56px; height: 42px; }
	.prg-lb__btn { width: 40px; height: 40px; }
}
