/* DJ Gallery — frontend styles
   Three layouts share most rules; only .djga-grid differs between them.
   --djga-cols and --djga-gutter are inlined on .djga-wrap from the shortcode. */

/* ---------------------------------------------------------------
   WooCommerce conflict reset.
   WC ships PhotoSwipe 4 CSS that matches our PS5 elements globally:
   1. Applies PS4's icon sprite-sheet as background-image on all .pswp buttons
      → strips it off so our SVG icons render cleanly.
   2. Forces .pswp__bg opacity to 0.7 on any .woocommerce-page body
      → our backdrop was 70% opaque despite bgOpacity:1 in JS.
   Both rules use !important; we match specificity + load order to win.
--------------------------------------------------------------- */
.pswp .pswp__button,
.pswp .pswp__button:hover {
	background-image: none !important;
}
.woocommerce-page .pswp__bg,
.woocommerce .pswp__bg {
	opacity: 1 !important;
}

.djga-wrap {
	--djga-cols: 3;
	--djga-gutter: 12px;
	margin: 2em 0;
}

/* --- Filters --- */
.djga-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5em;
	margin-bottom: 1.25em;
	align-items: center;
}
.djga-filter-group {
	display: flex;
	flex-wrap: wrap;
	gap: .4em;
}
.djga-chip {
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 999px;
	padding: .3em .85em;
	font-size: .85em;
	line-height: 1.2;
	cursor: pointer;
	opacity: .55;
	transition: opacity .15s ease, background-color .15s ease;
	color: inherit;
}
.djga-chip:hover { opacity: .85; }
.djga-chip.is-active {
	opacity: 1;
	background: #111;
	color: #fff;
	border-color: #111;
}
.djga-chip.is-active > * { color: #fff; }

/* --- Grid base --- */
.djga-grid {
	display: grid;
	gap: var(--djga-gutter);
}

/* Grid layout: equal cells, cropped via object-fit */
.djga-layout-grid .djga-grid {
	grid-template-columns: repeat(var(--djga-cols), 1fr);
	align-items: start;
}
.djga-layout-grid .djga-item img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	display: block;
}

/* Masonry: JS-positioned layout (gallery.js) — avoids CSS column cross-browser quirks.
   The grid becomes a relative-positioned container; JS sets absolute left/top/width on items. */
.djga-layout-masonry .djga-grid {
	display: block;
	position: relative;
}
.djga-layout-masonry .djga-item {
	position: absolute;
	margin: 0;
	box-sizing: border-box;
	display: block;
}
.djga-layout-masonry .djga-item img {
	width: 100%;
	height: auto;
	display: block;
}

/* Justified rows: flexbox with growing items. Browser handles wrap;
   the aspect-ratio from the image keeps the natural shape.
   Rows aren't pixel-perfectly aligned but it's very close and needs zero JS. */
.djga-layout-justified .djga-grid {
	display: flex;
	flex-wrap: wrap;
	gap: var(--djga-gutter);
}
.djga-layout-justified .djga-item {
	flex: 1 1 auto;
	height: 260px;
	max-width: 100%;
}
.djga-layout-justified .djga-item img {
	height: 100%;
	width: auto;
	max-width: 100%;
	display: block;
}

/* --- Item common --- */
/* Higher specificity to beat theme rules like .entry-content figure { margin } */
.djga-layout-grid .djga-item,
.djga-layout-justified .djga-item {
	margin: 0;
	-webkit-margin-before: 0 !important;
	margin-block-start: 0 !important;
}
.djga-item {
	margin: 0;
	position: relative;
	overflow: hidden;
}
.djga-item.is-hidden { display: none; }
.djga-link {
	display: block;
	position: relative;
	outline: none;
}
.djga-item img {
	transition: transform .6s ease, opacity .4s ease;
}
@media (hover: hover) {
	.djga-item:hover img { transform: scale(1.03); }
}

/* Fade-in on load */
.djga-item img[loading="lazy"] { opacity: 0; }
.djga-item img.is-loaded { opacity: 1; }

/* Sold dot — corner marker */
.djga-sold-dot {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #d22;
	box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(0,0,0,.3);
	pointer-events: none;
}
@media (max-width: 599px) {
	.djga-sold-dot {
		width: 10px;
		height: 10px;
		box-shadow: 0 1px 3px rgba(0,0,0,.4);
	}
}

/* Keep PhotoSwipe's chrome above the caption panel so it isn't blurred
   by the panel's backdrop-filter. The top-bar holds the close/zoom buttons;
   the arrows sit inside the panel region in beside mode. */
.pswp .pswp__top-bar,
.pswp .pswp__button--arrow--prev,
.pswp .pswp__button--arrow--next {
	z-index: 1100;
}

/* --- PhotoSwipe caption pane ---
   Rendered as an absolutely-positioned panel over the pswp root.
   PhotoSwipe's paddingFn carves out space so the image never sits under it. */
.djga-caption-wrap {
	position: absolute;
	z-index: 1050;
	box-sizing: border-box;
	color: #eee;
	background: rgba(0, 0, 0, .55);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	overflow-y: auto;
	pointer-events: auto;
	scroll-behavior: smooth;
}
/* Thin scrollbar so overflow text looks deliberate, not broken */
.djga-caption-wrap::-webkit-scrollbar { width: 4px; }
.djga-caption-wrap::-webkit-scrollbar-track { background: transparent; }
.djga-caption-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,.3); border-radius: 2px; }
.djga-caption {
	color: #eee;
	font-size: 14px;
	line-height: 1.5;
	max-width: 100%;
	box-sizing: border-box;
}
.djga-caption .djga-caption-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: .35em;
	margin-bottom: .25em;
}
.djga-caption h3 {
	margin-top: .25em;
	font-size: 1.1em;
	font-weight: 600;
	color: #fff;
}
.djga-caption .djga-badge-wrap {
	display: flex;
	align-items: center;
	gap: .9em;
	margin: .5em 0 .75em;
	padding-bottom: .75em;
	border-bottom: 1px solid rgb(99, 99, 99);
}
.djga-caption .djga-badge {
	display: block;
	max-width: 100px;
	max-height: 100px;
	width: auto;
	height: auto;
	flex-shrink: 0;
	border-radius: 3px;
}
.djga-caption .djga-badge-caption {
	opacity: .75;
	margin: 0;
	font-size: .9em;
	white-space: pre-wrap;
}
.djga-caption .djga-meta {
	opacity: .75;
	margin: 0 0 .75em;
	font-size: .9em;
}
.djga-caption .djga-desc {
	margin: 0 0 1em;
	white-space: pre-wrap;
}
.djga-caption .djga-actions {
	display: flex;
	gap: .75em;
	align-items: center;
	flex-wrap: wrap;
}
.djga-caption .djga-buy {
	display: inline-block;
	padding: .55em 1.1em;
	background: #fff;
	color: #111;
	border-radius: 3px;
	text-decoration: none;
	font-weight: 500;
	font-size: .9em;
	transition: background-color .15s ease;
}
.djga-caption .djga-buy:hover { background: #e9e9e9; }
.djga-caption .djga-sold-badge {
	display: inline-block;
	padding: .4em .8em;
	background: rgba(210, 34, 34, .15);
	color: #ff6b6b;
	border: 1px solid #d22;
	border-radius: 3px;
	font-size: .85em;
	text-transform: uppercase;
	letter-spacing: .05em;
}

/* Slide-change fade overlay — dips to dark on arrow navigation, then fades out.
   Sits below the caption panel (1050) and buttons (1100) so only the image dims. */
.pswp__djga-fade-overlay {
	position: absolute;
	inset: 0;
	background: #000;
	opacity: 0;
	pointer-events: none;
	z-index: 1040;
}
@keyframes djga-slide-fade {
	0%   { opacity: 0; }
	35%  { opacity: .82; }
	100% { opacity: 0; }
}
.pswp__djga-fade-overlay.is-active {
	animation: djga-slide-fade 380ms ease forwards;
}

/* Hide the wrap until we've picked an orientation (prevents top-left flash). */
.djga-caption-wrap { display: none; }
.pswp--djga-below .djga-caption-wrap,
.pswp--djga-beside .djga-caption-wrap { display: block; }

/* Mode A: caption below (landscape images, or any image on mobile). */
.pswp--djga-below .djga-caption-wrap {
	left: 0;
	right: 0;
	bottom: 0;
	height: 25%;
	padding: 1.25em clamp(1em, 4vw, 2.5em) 1.5em;
}
.pswp--djga-below .djga-caption {
	max-width: 900px;
}

/* Mode B: caption beside (portrait images on ≥900px viewports). */
@media (min-width: 900px) {
	.pswp--djga-beside .djga-caption-wrap {
		top: 0;
		right: 0;
		bottom: 0;
		width: 340px;
		padding: 3.75em 1.75em 2em;
	}
}
/* Below 900px, "beside" collapses to "below" visually. */
@media (max-width: 899px) {
	.pswp--djga-beside .djga-caption-wrap {
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		width: auto;
		height: 25%;
		padding: 1.25em 1.25em 1.5em;
	}
}
/* Mobile caption panel height is set dynamically by gallery.js (refresh)
   so the image always renders at full width / natural aspect ratio. */
