/* ==================================================================
   25 - HOME GALLERY  ("Where WaxOrbit Lives")  - reels strip
   Loaded on the front page only (inc/gallery.php). Everything is
   scoped to .wo-gallery / .wo-reels / .wo-lightbox, so it cannot
   affect any other section or page.

   Tall 9:16 cards (like Instagram Reels) in a strip that slides by
   itself, with arrows and swipe. Cards in view at once:
     phones  ~1.6    tablets  3    laptops  4    large screens  5
   Photos fill the tall frame (any upload size works); videos play
   muted on the card, tap to switch sound.
   ================================================================== */

.wo-gallery {
	padding-bottom: clamp(1.5rem, 4vw, 3rem); /* the carousel below has its own top space */
	overflow: hidden;
}

/* ---- Soft nebula glows behind the strip ---- */
.wo-gallery > .wo-gallery__glow {
	position: absolute;
	z-index: 0;
	width: clamp(260px, 42vw, 560px);
	aspect-ratio: 1;
	border-radius: 50%;
	filter: blur(70px);
	opacity: 0.5;
	pointer-events: none;
}

.wo-gallery > .wo-gallery__glow--a {
	top: 8%;
	left: -12%;
	background: radial-gradient(circle, rgba(124, 92, 255, 0.55), transparent 70%);
}

.wo-gallery > .wo-gallery__glow--b {
	bottom: -6%;
	right: -10%;
	background: radial-gradient(circle, rgba(245, 197, 66, 0.22), transparent 70%);
}


/* ---- Strip ---- */
.wo-reels {
	--wo-reels-n: 1.6;
	--wo-reels-gap: clamp(0.6rem, 1.6vw, 1rem);
	position: relative;
}

.wo-reels__track {
	overflow-x: auto;
	overflow-y: hidden;
	padding-block: 10px 14px;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
}

.wo-reels__track::-webkit-scrollbar {
	display: none;
}

.wo-reels__track:focus-visible {
	outline: 2px solid var(--wo-gold);
	outline-offset: 4px;
	border-radius: var(--wo-radius-md);
}

.wo-reels__list {
	display: flex;
	gap: var(--wo-reels-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Every card is exactly 9:16; the width comes from how many show at once */
.wo-reels__item {
	flex: 0 0 calc((100% - var(--wo-reels-gap) * (var(--wo-reels-n) - 1)) / var(--wo-reels-n));
	aspect-ratio: 9 / 16;
	min-width: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
}

/* Few cards: no sliding, centred */
.wo-reels.is-static .wo-reels__list {
	justify-content: center;
}

.wo-reels.is-static .wo-reels__arrow {
	display: none;
}


/* ---- Card ---- */
.wo-gallery__tile {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	padding: 0;
	margin: 0;
	border: 1px solid var(--wo-line);
	border-radius: var(--wo-radius-lg);
	background: var(--wo-surface);
	overflow: hidden;
	cursor: zoom-in;
	isolation: isolate;
	color: var(--wo-text);
	font: inherit;
	text-align: left;
	box-shadow: var(--wo-shadow-sm);
	transition:
		transform 0.5s var(--wo-ease-out),
		box-shadow 0.5s var(--wo-ease-out),
		border-color 0.3s var(--wo-ease);
	-webkit-tap-highlight-color: transparent;
}

div.wo-gallery__tile {
	cursor: default;
}

.wo-gallery__tile--video {
	cursor: pointer;
}

.wo-gallery .wo-gallery__tile .wo-gallery__img,
.wo-gallery .wo-gallery__tile .wo-reels__video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover; /* fills the tall frame edge to edge */
	display: block;
	transform: scale(1.001);
	transition: transform 0.9s var(--wo-ease-out);
}

/* Dark gradient so the caption is always readable */
.wo-gallery__shade {
	position: absolute;
	inset: 0;
	z-index: 1;
	background:
		linear-gradient(180deg, rgba(15, 10, 32, 0) 50%, rgba(15, 10, 32, 0.8) 100%),
		linear-gradient(135deg, rgba(124, 92, 255, 0) 40%, rgba(124, 92, 255, 0.26) 100%);
	opacity: 0.9;
	transition: opacity 0.4s var(--wo-ease);
	pointer-events: none;
}

/* Glass caption chip */
.wo-gallery__cap {
	position: absolute;
	z-index: 2;
	left: clamp(0.5rem, 1.4vw, 0.8rem);
	bottom: clamp(0.5rem, 1.4vw, 0.8rem);
	max-width: calc(100% - 3.6rem);
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.34rem 0.75rem 0.34rem 0.6rem;
	border-radius: var(--wo-radius-pill);
	background: rgba(20, 14, 42, 0.55);
	border: 1px solid rgba(255, 255, 255, 0.16);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	font-family: var(--wo-font-body);
	font-size: 0.74rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	line-height: 1.2;
	color: var(--wo-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	transition: transform 0.45s var(--wo-ease-out), background 0.3s var(--wo-ease);
}

.wo-gallery__dot {
	flex: 0 0 auto;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--wo-gold);
	box-shadow: 0 0 10px 1px rgba(245, 197, 66, 0.8);
}

/* Sound button on video cards */
.wo-gallery .wo-reels__sound {
	position: absolute;
	z-index: 3;
	right: clamp(0.5rem, 1.4vw, 0.8rem);
	bottom: clamp(0.5rem, 1.4vw, 0.8rem);
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	min-width: 0;
	min-height: 0;
	padding: 0;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(20, 14, 42, 0.6);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--wo-text);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.wo-reels__sound:focus-visible {
	outline: 2px solid var(--wo-gold);
	outline-offset: 2px;
}

.wo-reels__icon {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.wo-reels__icon--on { display: none; }
.wo-reels__sound[aria-pressed="true"] .wo-reels__icon--on { display: block; }
.wo-reels__sound[aria-pressed="true"] .wo-reels__icon--off { display: none; }

/* Hover / focus (only on devices that really hover) */
@media (hover: hover) and (pointer: fine) {

	.wo-reels__item:hover .wo-gallery__tile:not(.wo-gallery__tile--demo) {
		transform: translateY(-5px);
		border-color: var(--wo-primary-line);
		box-shadow: var(--wo-shadow-lg), 0 0 0 1px var(--wo-primary-line), 0 14px 46px rgba(124, 92, 255, 0.28);
	}

	.wo-reels__item:hover .wo-gallery__img {
		transform: scale(1.07);
	}

	.wo-reels__item:hover .wo-gallery__shade {
		opacity: 1;
	}

	.wo-reels__item:hover .wo-gallery__cap {
		transform: translateY(-3px);
		background: rgba(46, 35, 97, 0.7);
	}
}

button.wo-gallery__tile:focus-visible {
	outline: 2px solid var(--wo-gold);
	outline-offset: 3px;
}

@media (hover: none) {
	button.wo-gallery__tile:active {
		transform: scale(0.98);
	}
}


/* ---- Arrows (same look as the hero slider) ---- */
.wo-gallery .wo-reels__arrow {
	position: absolute;
	top: 50%;
	z-index: 4;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	min-width: 0;
	min-height: 0;
	margin-top: -20px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.22);
	background: rgba(20, 14, 42, 0.7);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	color: var(--wo-text);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background 0.25s var(--wo-ease), border-color 0.25s var(--wo-ease);
}

.wo-reels__arrow--prev { left: 0.4rem; }
.wo-reels__arrow--next { right: 0.4rem; }

.wo-reels__arrow:hover,
.wo-reels__arrow:focus-visible {
	background: var(--wo-primary);
	border-color: var(--wo-primary-hover, var(--wo-primary));
}

.wo-reels__arrow:focus-visible {
	outline: 2px solid var(--wo-gold);
	outline-offset: 2px;
}

.wo-reels__arrow svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}


/* ---- Owner-only preview (no cards yet) ---- */
.wo-gallery__notice {
	max-width: 62ch;
	margin: -1rem auto 1.5rem;
	padding: 0.7rem 1rem;
	border-radius: var(--wo-radius-sm);
	border: 1px dashed var(--wo-gold);
	background: var(--wo-gold-soft);
	color: var(--wo-text-muted);
	font-size: 0.85rem;
	text-align: center;
}

.wo-gallery__tile--demo {
	background: var(--wo-grad-card);
}

.wo-gallery__tile--demo-1 { background: linear-gradient(150deg, #3A2D78 0%, #7C5CFF 140%); }
.wo-gallery__tile--demo-2 { background: linear-gradient(150deg, #2E2361 0%, #F5C542 190%); }
.wo-gallery__tile--demo-3 { background: linear-gradient(150deg, #241A4D 0%, #6E5CC4 130%); }


/* ==================================================================
   MORE CARDS IN VIEW ON BIGGER SCREENS
   ================================================================== */

@media (min-width: 600px) {
	.wo-reels { --wo-reels-n: 3; }
	.wo-gallery__cap { font-size: 0.78rem; }
	.wo-reels__arrow--prev { left: 0.6rem; }
	.wo-reels__arrow--next { right: 0.6rem; }
}

@media (min-width: 992px) {
	.wo-reels { --wo-reels-n: 4; }
	.wo-gallery .wo-reels__arrow { width: 46px; height: 46px; margin-top: -23px; }
}

@media (min-width: 1200px) {
	.wo-reels { --wo-reels-n: 5; }
}

@media (prefers-reduced-motion: reduce) {

	.wo-reels__track {
		scroll-behavior: auto;
	}

	.wo-gallery__tile,
	.wo-gallery__img,
	.wo-gallery__cap {
		transition: none !important;
	}
}


/* ==================================================================
   LIGHTBOX (built by assets/js/gallery.js)
   ================================================================== */

.wo-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: clamp(0.75rem, 3vw, 2rem);
	padding-top: max(clamp(0.75rem, 3vw, 2rem), env(safe-area-inset-top));
	padding-bottom: max(clamp(0.75rem, 3vw, 2rem), env(safe-area-inset-bottom));
	background: rgba(10, 6, 24, 0.92);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s var(--wo-ease), visibility 0s linear 0.3s;
	touch-action: pan-y pinch-zoom;
}

.wo-lightbox.is-open {
	opacity: 1;
	visibility: visible;
	transition: opacity 0.3s var(--wo-ease), visibility 0s;
}

.wo-lightbox__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.9rem;
	max-width: min(100%, 1100px);
	max-height: 100%;
	min-height: 0;
}

.wo-lightbox__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 9rem);
	max-height: calc(100dvh - 9rem);
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: var(--wo-radius-md);
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
	transform: scale(0.96);
	opacity: 0;
	transition: transform 0.45s var(--wo-ease-out), opacity 0.35s var(--wo-ease);
}

.wo-lightbox.is-open .wo-lightbox__img.is-ready {
	transform: scale(1);
	opacity: 1;
}

.wo-lightbox__caption {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.45rem 1rem;
	border-radius: var(--wo-radius-pill);
	background: rgba(46, 35, 97, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.14);
	font-family: var(--wo-font-body);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--wo-text);
	text-align: center;
}

.wo-lightbox__caption:empty {
	display: none;
}

.wo-lightbox__count {
	font-family: var(--wo-font-body);
	font-size: 0.78rem;
	letter-spacing: 0.12em;
	color: var(--wo-gold);
}

.wo-lightbox__btn {
	position: absolute;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(46, 35, 97, 0.75);
	color: var(--wo-text);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background 0.25s var(--wo-ease), transform 0.25s var(--wo-ease), border-color 0.25s var(--wo-ease);
}

.wo-lightbox__btn:hover,
.wo-lightbox__btn:focus-visible {
	background: var(--wo-primary);
	border-color: var(--wo-primary-hover);
}

.wo-lightbox__btn:focus-visible {
	outline: 2px solid var(--wo-gold);
	outline-offset: 2px;
}

.wo-lightbox__btn svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.wo-lightbox__close {
	top: max(0.75rem, env(safe-area-inset-top));
	right: max(0.75rem, env(safe-area-inset-right));
}

.wo-lightbox__prev,
.wo-lightbox__next {
	top: 50%;
	margin-top: -23px;
}

.wo-lightbox__prev { left: max(0.75rem, env(safe-area-inset-left)); }
.wo-lightbox__next { right: max(0.75rem, env(safe-area-inset-right)); }

.wo-lightbox__prev:hover { transform: translateX(-2px); }
.wo-lightbox__next:hover { transform: translateX(2px); }

/* Phones: arrows move to the bottom so they never cover the photo */
@media (max-width: 767.98px) {

	.wo-lightbox__prev,
	.wo-lightbox__next {
		top: auto;
		margin-top: 0;
		bottom: max(0.9rem, env(safe-area-inset-bottom));
		width: 42px;
		height: 42px;
	}

	.wo-lightbox__prev { left: calc(50% - 4.2rem); }
	.wo-lightbox__next { right: calc(50% - 4.2rem); }

	.wo-lightbox__img {
		max-height: calc(100vh - 12rem);
		max-height: calc(100dvh - 12rem);
	}

	.wo-lightbox__figure {
		padding-bottom: 3.2rem;
	}
}

body.wo-lightbox-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {

	.wo-gallery__tile,
	.wo-gallery__img,
	.wo-gallery__cap,
	.wo-lightbox,
	.wo-lightbox__img {
		transition: none !important;
	}
}
