/* BA Gallery – front end. Colours and spacing are CSS variables so themes and the
   Elementor style controls can change them without overriding selectors. */

.bag-gallery,
.bag-case,
.bag-details,
.bag-lightbox {
	--bag-gap: 24px;
	--bag-radius: 10px;
	--bag-accent: #1f2937;
	--bag-accent-text: #fff;
	--bag-text: inherit;
	--bag-muted: #6b7280;
	--bag-border: #e5e7eb;
	--bag-card-bg: #fff;
	--bag-label-bg: rgba(17, 24, 39, 0.78);
	--bag-label-text: #fff;
	box-sizing: border-box;
}
.bag-gallery *,
.bag-case *,
.bag-lightbox * { box-sizing: border-box; }

/* ---------------------------------------------------------------- Filter bar */
.bag-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 var(--bag-gap);
}
.bag-filter__btn {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 8px 16px;
	border: 1px solid var(--bag-border);
	border-radius: 999px;
	background: transparent;
	color: var(--bag-text);
	font-size: 0.9375rem;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.bag-filter__btn:hover { border-color: var(--bag-accent); }
.bag-filter__btn.is-active {
	background: var(--bag-accent);
	border-color: var(--bag-accent);
	color: var(--bag-accent-text);
}

/* ---------------------------------------------------------------- Grid & cards */
.bag-grid {
	display: grid;
	grid-template-columns: repeat(var(--bag-cols, 3), minmax(0, 1fr));
	gap: var(--bag-gap);
	transition: opacity 0.2s;
}
@media (max-width: 1024px) {
	.bag-grid { grid-template-columns: repeat(var(--bag-cols-t, 2), minmax(0, 1fr)); }
}
@media (max-width: 767px) {
	.bag-grid { grid-template-columns: repeat(var(--bag-cols-m, 1), minmax(0, 1fr)); }
}
.bag-gallery.is-loading .bag-grid { opacity: 0.45; pointer-events: none; }

.bag-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--bag-card-bg);
	border: 1px solid var(--bag-border);
	border-radius: var(--bag-radius);
}
.bag-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 10px;
	padding: 16px 18px 18px;
}
.bag-card__title {
	margin: 0;
	font-size: 1.125rem;
	line-height: 1.3;
}
.bag-card__title a { color: inherit; text-decoration: none; }
.bag-card__title a:hover { text-decoration: underline; }
.bag-card__details {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 16px;
	margin: 0;
	font-size: 0.875rem;
}
.bag-card__details div { display: flex; gap: 4px; }
.bag-card__details dt { margin: 0; color: var(--bag-muted); font-weight: 400; }
.bag-card__details dt::after { content: ":"; }
.bag-card__details dd { margin: 0; font-weight: 600; }
.bag-card__link {
	margin-top: auto;
	align-self: flex-start;
	color: var(--bag-accent);
	font-weight: 600;
	text-decoration: none;
}
.bag-card__link:hover { text-decoration: underline; }
.bag-empty { grid-column: 1 / -1; margin: 0; padding: 32px 0; text-align: center; color: var(--bag-muted); }

/* ---------------------------------------------------------------- Photos */
.bag-media {
	position: relative;
	display: grid;
	grid-template-columns: 1fr;
	gap: 2px;
	background: var(--bag-border);
}
.bag-media--pair { grid-template-columns: 1fr 1fr; }
.bag-photo {
	position: relative;
	display: block;
	overflow: hidden;
	background: #f3f4f6;
	cursor: zoom-in;
}
.bag-photo[hidden] { display: none; }
.bag-photo__img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.35s ease, filter 0.35s ease;
}
.bag-card .bag-photo__img {
	aspect-ratio: var(--bag-aspect, auto);
	object-fit: cover;
	height: 100%;
}
.bag-grid--natural .bag-card .bag-photo__img { aspect-ratio: auto; }
.bag-photo:hover .bag-photo__img,
.bag-photo:focus-visible .bag-photo__img { transform: scale(1.03); }
.bag-photo:focus-visible { outline: 3px solid var(--bag-accent); outline-offset: -3px; }
.bag-photo__label {
	position: absolute;
	left: 8px;
	bottom: 8px;
	padding: 3px 9px;
	border-radius: 4px;
	background: var(--bag-label-bg);
	color: var(--bag-label-text);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1.4;
	text-transform: uppercase;
	pointer-events: none;
}

/* Sensitive cover */
.bag-cover { display: none; }
.bag-media.is-sensitive .bag-photo__img { filter: blur(22px) saturate(0.6); transform: scale(1.1); }
.bag-media.is-sensitive .bag-photo__label { visibility: hidden; }
.bag-media.is-sensitive .bag-cover {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 16px;
	border: 0;
	border-radius: 0;
	background: rgba(17, 24, 39, 0.35);
	color: #fff;
	font: inherit;
	font-size: 0.875rem;
	text-align: center;
	cursor: pointer;
}
.bag-cover__btn {
	padding: 7px 16px;
	border: 1px solid rgba(255, 255, 255, 0.85);
	border-radius: 999px;
	font-weight: 600;
}
.bag-cover:hover .bag-cover__btn,
.bag-cover:focus-visible .bag-cover__btn { background: #fff; color: #111827; }
.bag-cover:focus-visible { outline: 3px solid #fff; outline-offset: -6px; }

/* ---------------------------------------------------------------- Load more & disclaimer */
.bag-more { margin-top: var(--bag-gap); text-align: center; }
.bag-more[hidden] { display: none; }
.bag-more__btn {
	display: inline-block;
	padding: 12px 28px;
	border-radius: 999px;
	background: var(--bag-accent);
	color: var(--bag-accent-text);
	font-weight: 600;
	text-decoration: none;
}
.bag-more__btn:hover { opacity: 0.9; color: var(--bag-accent-text); }
.bag-disclaimer {
	margin: var(--bag-gap) 0 0;
	color: var(--bag-muted);
	font-size: 0.8125rem;
	text-align: center;
}

/* ---------------------------------------------------------------- Single case */
.bag-case { display: grid; gap: var(--bag-gap); }
.bag-pair { margin: 0; }
.bag-pair .bag-media { border-radius: var(--bag-radius); overflow: hidden; }
.bag-case--stacked .bag-media--pair { grid-template-columns: 1fr; }
.bag-pair__caption { margin-top: 8px; color: var(--bag-muted); font-size: 0.875rem; text-align: center; }
@media (max-width: 480px) {
	.bag-case .bag-media--pair { grid-template-columns: 1fr; }
}
.bag-case .bag-disclaimer { margin-top: 0; }

.bag-details { display: grid; gap: 16px; }
.bag-details__procedure {
	margin: 0;
	color: var(--bag-muted);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.bag-details__description > :last-child { margin-bottom: 0; }
.bag-details__list { margin: 0; border-top: 1px solid var(--bag-border); }
.bag-details__row {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 10px 0;
	border-bottom: 1px solid var(--bag-border);
}
.bag-details__row dt { margin: 0; color: var(--bag-muted); }
.bag-details__row dd { margin: 0; font-weight: 600; text-align: right; }
.bag-case-nav {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: 12px;
	align-items: center;
	font-size: 0.9375rem;
}
.bag-case-nav a { color: var(--bag-accent); font-weight: 600; text-decoration: none; }
.bag-case-nav a:hover { text-decoration: underline; }
.bag-case-nav__back { text-align: center; }
.bag-case-nav__next { text-align: right; }
.bag-case-full { display: grid; gap: calc(var(--bag-gap, 24px) * 1.5); margin-bottom: 32px; }

/* ---------------------------------------------------------------- Lightbox */
.bag-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	background: var(--bag-lb-bg, rgba(12, 12, 14, 0.94));
	color: #fff;
	opacity: 0;
	transition: opacity 0.2s ease;
}
.bag-lightbox[hidden] { display: none; }
.bag-lightbox.is-open { opacity: 1; }
.bag-lightbox__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 56px;
	padding: 8px 8px 8px 20px;
	font-size: 0.875rem;
}
.bag-lightbox__counter { opacity: 0.75; font-variant-numeric: tabular-nums; }
.bag-lightbox__stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 64px;
	touch-action: pan-y;
}
.bag-lightbox__slide {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	height: 100%;
	margin: 0;
}
.bag-lightbox__figure {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-width: 0;
	max-height: 100%;
	margin: 0;
}
.bag-lightbox__slide--pair .bag-lightbox__figure { flex: 0 1 50%; }
.bag-lightbox__figure img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 160px);
	max-height: calc(100dvh - 160px);
	width: auto;
	height: auto;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
	user-select: none;
	-webkit-user-drag: none;
}
.bag-lightbox.is-upscale .bag-lightbox__figure img { width: 100%; object-fit: contain; }
.bag-lightbox__tag {
	position: absolute;
	top: 10px;
	left: 10px;
	padding: 3px 10px;
	border-radius: 4px;
	background: rgba(0, 0, 0, 0.6);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}
.bag-lightbox__caption {
	min-height: 52px;
	padding: 12px 20px 18px;
	text-align: center;
	font-size: 0.9375rem;
	opacity: 0.9;
}
.bag-lightbox button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	cursor: pointer;
	transition: background-color 0.15s;
}
.bag-lightbox button:hover { background: rgba(255, 255, 255, 0.2); }
.bag-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.bag-lightbox button[disabled] { opacity: 0.3; cursor: default; }
.bag-lightbox__prev,
.bag-lightbox__next { position: absolute; top: 50%; transform: translateY(-50%); }
.bag-lightbox__prev { left: 8px; }
.bag-lightbox__next { right: 8px; }
.bag-lightbox svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html.bag-lightbox-open { overflow: hidden; }

@media (max-width: 767px) {
	.bag-lightbox__stage { padding: 0 8px; }
	.bag-lightbox__slide--pair { flex-direction: column; gap: 8px; }
	.bag-lightbox__slide--pair .bag-lightbox__figure { flex: 0 1 auto; max-height: 50%; }
	.bag-lightbox__slide--pair .bag-lightbox__figure img { max-height: calc(50vh - 90px); max-height: calc(50dvh - 90px); }
	.bag-lightbox__prev,
	.bag-lightbox__next { top: auto; bottom: -56px; transform: none; }
	.bag-lightbox__prev { left: 12px; }
	.bag-lightbox__next { right: 12px; }
	.bag-lightbox__caption { padding: 12px 72px 18px; }
}

@media (prefers-reduced-motion: reduce) {
	.bag-photo__img,
	.bag-lightbox,
	.bag-grid { transition: none; }
	.bag-photo:hover .bag-photo__img { transform: none; }
}
