.pg-gallery, .pg-gallery *, .pg-lightbox, .pg-lightbox * { box-sizing: border-box; }
.pg-gallery { direction: rtl; font-family: 'Assistant', system-ui, sans-serif; display: flex; gap: 16px; align-items: stretch; width: 100%; max-width: 560px; }

.pg-thumbs { display: flex; flex-direction: column; gap: 12px; width: 78px; flex: 0 0 78px; max-height: 620px; overflow-y: auto; padding: 2px; order: 0; }
.pg-thumbs::-webkit-scrollbar, .pg-lb-thumbs::-webkit-scrollbar { width: 6px; height: 6px; }
.pg-thumbs::-webkit-scrollbar-thumb, .pg-lb-thumbs::-webkit-scrollbar-thumb { background: #d8d2ca; border-radius: 999px; }
.pg-thumb { width: 100%; aspect-ratio: 3 / 4; padding: 0; border-radius: 5px; overflow: hidden; cursor: pointer; background: #fff; border: 2px solid #ece8e2; transition: border-color .15s; }
.pg-thumb:hover { border-color: #b7a488; }
.pg-thumb.is-active { border-color: #1d1d1d; }
.pg-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }

.pg-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.pg-frame { position: relative; max-width: 100%; background: #fff; border: 1px solid #ece8e2; border-radius: 6px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; }
.pg-main { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; touch-action: pan-y; }
.pg-gallery[data-zoom="1"] .pg-main { cursor: zoom-in; }

.pg-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #ece8e2; background: rgba(255,255,255,.9); cursor: pointer; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; color: #1d1d1d; padding: 0; }
.pg-nav:hover { background: #fff; border-color: #b7a488; }
.pg-prev { right: 12px; } .pg-next { left: 12px; }
.pg-hint { position: absolute; bottom: 12px; left: 12px; z-index: 3; display: flex; align-items: center; gap: 6px; background: rgba(255,255,255,.9); border: 1px solid #ece8e2; padding: 6px 11px; border-radius: 999px; font-size: 12px; color: #6b6459; pointer-events: none; }

/* thumbs below (horizontal) */
.pg-gallery[data-pos="bottom"] { flex-direction: column-reverse; }
.pg-gallery[data-pos="bottom"] .pg-thumbs { flex-direction: row; width: auto; flex: 0 0 auto; max-height: none; overflow-x: auto; overflow-y: hidden; }
.pg-gallery[data-pos="bottom"] .pg-thumb { width: 66px; flex: 0 0 66px; }

/* single image */
.pg-gallery.is-single .pg-thumbs,
.pg-gallery.is-single .pg-nav { display: none; }

/* lightbox */
.pg-lightbox { position: fixed; inset: 0; z-index: 99999; background: rgba(20,18,16,.94); display: none; flex-direction: column; direction: rtl; font-family: 'Assistant', system-ui, sans-serif; animation: pgfade .2s ease; }
.pg-lightbox.is-open { display: flex; }
@keyframes pgfade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pgzoom { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }
.pg-lb-top { display: flex; justify-content: flex-end; align-items: center; padding: 18px 24px; color: #fff; }
.pg-lb-close { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: transparent; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; padding: 0; }
.pg-lb-close:hover { background: rgba(255,255,255,.12); }
.pg-lb-body { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; padding: 0 72px; min-height: 0; }
.pg-lb-img { max-width: 100%; max-height: 100%; object-fit: contain; animation: pgzoom .25s ease; }
.pg-lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.2); color: #fff; font-size: 24px; cursor: pointer; padding: 0; }
.pg-lb-nav:hover { background: rgba(255,255,255,.15); }
.pg-lb-prev { right: 20px; } .pg-lb-next { left: 20px; }
.pg-lb-thumbs { display: flex; gap: 10px; justify-content: center; padding: 18px 24px 26px; overflow-x: auto; }
.pg-lb-thumb { width: 56px; height: 74px; flex: 0 0 56px; padding: 0; border-radius: 4px; overflow: hidden; cursor: pointer; background: #fff; border: 2px solid rgba(255,255,255,.3); }
.pg-lb-thumb.is-active { border-color: #fff; }
.pg-lb-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.pg-lightbox.is-single .pg-lb-nav, .pg-lightbox.is-single .pg-lb-thumbs { display: none; }

/* mobile */
@media (max-width: 600px) {
	.pg-gallery { flex-direction: column-reverse; gap: 12px; max-width: 100% !important; }
	.pg-thumbs { flex-direction: row; width: auto; flex: 0 0 auto; max-height: none; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
	.pg-thumb { width: 62px; flex: 0 0 62px; }
	.pg-nav { width: 36px; height: 36px; font-size: 16px; }
	.pg-lb-body { padding: 0 12px; }
	.pg-lb-nav { width: 44px; height: 44px; font-size: 20px; }
	.pg-lb-prev { right: 8px; } .pg-lb-next { left: 8px; }
}
