/* Shuffle Gallery — override any of these variables in Elementor/Astra custom CSS. */
.shg,
.shg-lightbox {
	--shg-gap: 4px;
	--shg-tile-bg: #1d1a16;
	--shg-accent: #c9a54b;
	--shg-ink: #f1ebdf;
	--shg-ink-dim: #b3aa99;
	--shg-backdrop: rgba(12, 10, 8, 0.96);
	--shg-radius: 2px;
	font-family: inherit; /* uses the site's own fonts */
}

/* ---------- grid ---------- */

.shg {
	width: 100%;
}

.shg .shg-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(var(--shg-cols, 4), minmax(0, 1fr));
	grid-auto-flow: dense;
	gap: var(--shg-gap);
	/* Hidden until the script has shuffled; shown anyway after 2.5s if scripts are blocked or delayed. */
	opacity: 0;
	animation: shg-fallback 0s linear 2.5s forwards;
}

.shg.shg--ready .shg-grid {
	opacity: 1;
	animation: none;
}

@keyframes shg-fallback {
	to { opacity: 1; }
}

.shg .shg-item {
	margin: 0;
	padding: 0;
	aspect-ratio: 1 / 1;
	min-width: 0;
}

.shg .shg-item[hidden] {
	display: none;
}

.shg .shg-item--feature {
	grid-column: span 2;
	grid-row: span 2;
}

/* Theme button styles (Astra/Elementor) are reset for the tile. */
.shg .shg-tile,
.shg .shg-tile:hover,
.shg .shg-tile:focus {
	appearance: none;
	display: block;
	position: relative;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: var(--shg-radius);
	background: var(--shg-tile-bg);
	box-shadow: none;
	overflow: hidden;
	cursor: zoom-in;
	color: inherit;
}

.shg .shg-tile img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	margin: 0;
	border-radius: 0;
	transition: filter 0.25s ease;
}

.shg .shg-tile::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit; /* outline follows the tile's rounded corners */
	box-shadow: inset 0 0 0 0 var(--shg-accent);
	transition: box-shadow 0.2s ease;
	pointer-events: none;
}

.shg .shg-tile:hover img {
	filter: brightness(1.08) contrast(1.04);
}

.shg .shg-tile:hover::after,
.shg .shg-tile:focus-visible::after {
	box-shadow: inset 0 0 0 3px var(--shg-accent);
}

.shg .shg-tile:focus-visible {
	outline: none;
}

/* The one moment of motion: photos are dealt back onto the grid after Shuffle. */
.shg .shg-item.shg-deal {
	animation: shg-deal 0.5s cubic-bezier(0.2, 0.75, 0.25, 1) both;
	animation-delay: var(--shg-delay, 0ms);
}

@keyframes shg-deal {
	from {
		opacity: 0;
		transform: translateY(14px) rotate(var(--shg-tilt, -2deg)) scale(0.94);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* ---------- controls ---------- */

.shg .shg-controls {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 12px;
	margin-top: 24px;
}

.shg .shg-controls:empty {
	display: none;
}

.shg .shg-btn,
.shg .shg-btn:hover,
.shg .shg-btn:focus {
	appearance: none;
	font: inherit;
	font-size: 1rem;
	letter-spacing: 0.03em;
	line-height: 1.2;
	padding: 0.8em 1.6em;
	margin: 0;
	border: 1px solid var(--shg-accent);
	border-radius: var(--shg-btn-radius, var(--shg-radius));
	background: var(--shg-accent);
	color: #17140f;
	cursor: pointer;
	box-shadow: none;
	text-decoration: none;
}

.shg .shg-btn:hover {
	background: transparent;
	color: var(--shg-accent);
}

.shg .shg-btn--ghost,
.shg .shg-btn--ghost:focus {
	background: transparent;
	color: var(--shg-accent);
}

.shg .shg-btn--ghost:hover {
	background: var(--shg-accent);
	color: #17140f;
}

.shg .shg-btn:focus-visible {
	outline: 2px solid var(--shg-accent);
	outline-offset: 3px;
}

.shg .shg-more[hidden] {
	display: none !important;
}

.shg-empty {
	padding: 1em;
	border: 1px dashed currentColor;
	opacity: 0.7;
}

/* ---------- responsive ---------- */

@media (max-width: 1024px) {
	.shg .shg-grid {
		grid-template-columns: repeat(var(--shg-cols-md, 3), minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.shg .shg-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ---------- lightbox ---------- */

.shg-lightbox {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: var(--shg-backdrop);
	color: var(--shg-ink);
	overflow: hidden;
}

.shg-lightbox::backdrop {
	background: transparent;
}

.shg-lightbox[open] {
	display: grid;
	grid-template-rows: auto minmax(0, 1fr) auto;
	animation: shg-open 0.2s ease-out;
}

@keyframes shg-open {
	from { opacity: 0; }
}

.shg-lightbox .shg-lb-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: max(12px, env(safe-area-inset-top)) 16px 8px;
	font-size: 0.9rem;
	color: var(--shg-ink-dim);
}

.shg-lightbox .shg-lb-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 64px;
	touch-action: pan-y;
}

.shg-lightbox .shg-lb-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	transition: opacity 0.15s ease;
}

.shg-lightbox .shg-lb-img.is-loading {
	opacity: 0.25;
}

.shg-lightbox .shg-lb-meta {
	padding: 12px 16px max(16px, env(safe-area-inset-bottom));
	max-width: 68ch;
	margin: 0 auto;
	width: 100%;
	text-align: center;
	line-height: 1.5;
}

.shg-lightbox .shg-lb-caption {
	margin: 0;
	font-size: 0.95rem;
}

.shg-lightbox .shg-lb-caption:empty {
	display: none;
}

.shg-lightbox .shg-lb-link {
	display: inline-block;
	margin-top: 6px;
	color: var(--shg-accent);
	font-size: 0.9rem;
	text-underline-offset: 3px;
}

.shg-lightbox .shg-lb-link[hidden] {
	display: none;
}

.shg-lightbox .shg-lb-btn,
.shg-lightbox .shg-lb-btn:hover,
.shg-lightbox .shg-lb-btn:focus {
	appearance: none;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 50%;
	background: transparent;
	color: var(--shg-ink);
	cursor: pointer;
	box-shadow: none;
}

.shg-lightbox .shg-lb-btn[hidden] {
	display: none;
}

.shg-lightbox .shg-lb-btn:hover {
	border-color: var(--shg-accent);
	color: var(--shg-accent);
}

.shg-lightbox .shg-lb-btn:focus-visible {
	outline: 2px solid var(--shg-accent);
	outline-offset: 2px;
}

.shg-lightbox .shg-lb-btn svg {
	width: 22px;
	height: 22px;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.shg-lightbox .shg-lb-prev,
.shg-lightbox .shg-lb-next {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
}

.shg-lightbox .shg-lb-prev { left: 10px; }
.shg-lightbox .shg-lb-next { right: 10px; }

@media (max-width: 600px) {
	.shg-lightbox .shg-lb-stage { padding: 0; }
	.shg-lightbox .shg-lb-prev,
	.shg-lightbox .shg-lb-next { display: none; } /* swipe instead */
}

html.shg-locked {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.shg .shg-item.shg-deal,
	.shg-lightbox[open] { animation: none; }
	.shg .shg-tile img,
	.shg .shg-tile::after,
	.shg-lightbox .shg-lb-img { transition: none; }
}
