/**
 * Album Lightbox CSS.
 *
 * @package Orca
 */

/* ================================================================
 * Unlayered: @keyframes (must stay outside @layer per CSS spec)
 * ================================================================ */

@keyframes zb-lb-fade {
	from { opacity: 0.3; }
	to   { opacity: 1; }
}

@keyframes zb-lb-slide {
	from { opacity: 0.5; transform: translateX(40px); }
	to   { opacity: 1;   transform: translateX(0); }
}

@keyframes zb-lb-zoom {
	from { opacity: 0.5; transform: scale(0.92); }
	to   { opacity: 1;   transform: scale(1); }
}

@keyframes zb-lb-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(0, 86, 179, 0.7); }
	50%      { box-shadow: 0 0 0 8px rgba(0, 86, 179, 0); }
}


@layer components {

	.orca-lightbox {
		position: fixed;
		inset: 0;
		z-index: 100000;
		display: flex;
		align-items: center;
		justify-content: center;
		background: rgba(0, 0, 0, 0.95);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.3s ease, visibility 0.3s ease;
	}

	.orca-lightbox.is-open {
		opacity: 1;
		visibility: visible;
	}

	/* Image stage */
	.orca-lightbox__stage {
		position: relative;
		max-width: 92vw;
		max-height: 82vh;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.orca-lightbox__img {
		max-width: 100%;
		max-height: 82vh;
		width: auto;
		height: auto;
		object-fit: contain;
		display: block;
		user-select: none;
		-webkit-user-drag: none;
		cursor: zoom-in;
		touch-action: none;
		transform-origin: center center;
		will-change: transform;
	}

	.orca-lightbox__img.is-zoomed {
		cursor: zoom-out;
	}

	.orca-lightbox__img.is-dragging {
		cursor: grabbing;
	}

	.orca-lightbox__img.is-loading {
		opacity: 0.5;
	}

	/* Close button */
	.orca-lightbox__close {
		position: absolute;
		top: 16px;
		right: 16px;
		width: 48px;
		height: 48px;
		background: rgba(255, 255, 255, 0.1);
		border: none;
		color: #fff;
		font-size: 28px;
		line-height: 1;
		cursor: pointer;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		transition: background 0.2s;
		padding: 0;
		font-family: inherit;
		z-index: 10;
	}

	.orca-lightbox__close:hover {
		background: rgba(255, 255, 255, 0.25);
	}

	/* Prev/next navigation */
	.orca-lightbox__nav {
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		width: 56px;
		height: 56px;
		background: rgba(255, 255, 255, 0.15);
		border: none;
		color: #fff;
		font-size: 32px;
		line-height: 1;
		cursor: pointer;
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		transition: background 0.2s;
		padding: 0;
		font-family: inherit;
		z-index: 10;
	}

	.orca-lightbox__nav:hover {
		background: rgba(255, 255, 255, 0.35);
	}

	.orca-lightbox__nav--prev {
		left: 20px;
	}

	.orca-lightbox__nav--next {
		right: 20px;
	}

	/* Counter */
	.orca-lightbox__counter {
		position: absolute;
		top: 20px;
		left: 50%;
		transform: translateX(-50%);
		color: #fff;
		font-size: 0.9375rem;
		padding: 6px 14px;
		background: rgba(0, 0, 0, 0.5);
		border-radius: 20px;
		z-index: 10;
		letter-spacing: 0.5px;
	}

	/* Thumbnail strip */
	.orca-lightbox__thumbs {
		position: absolute;
		bottom: 16px;
		left: 50%;
		transform: translateX(-50%);
		display: flex;
		gap: 8px;
		max-width: 80vw;
		overflow-x: auto;
		padding: 8px;
		background: rgba(0, 0, 0, 0.5);
		border-radius: var(--orca-radius, 8px);
		z-index: 10;
		scrollbar-width: thin;
	}

	.orca-lightbox__thumb {
		flex-shrink: 0;
		width: 60px;
		height: 60px;
		border: 2px solid transparent;
		border-radius: var(--orca-radius-sm, 4px);
		overflow: hidden;
		cursor: pointer;
		padding: 0;
		background: #222;
		transition: border-color 0.2s, opacity 0.2s;
		opacity: 0.5;
	}

	.orca-lightbox__thumb:hover {
		opacity: 0.8;
	}

	.orca-lightbox__thumb.is-active {
		border-color: #fff;
		opacity: 1;
	}

	.orca-lightbox__thumb img {
		width: 100%;
		height: 100%;
		object-fit: cover;
		display: block;
		pointer-events: none;
	}

	/* Mobile */
	@media (max-width: 768px) {
		.orca-lightbox__nav {
			width: 44px;
			height: 44px;
			font-size: 24px;
		}

		.orca-lightbox__nav--prev {
			left: 8px;
		}

		.orca-lightbox__nav--next {
			right: 8px;
		}

		.orca-lightbox__close {
			width: 40px;
			height: 40px;
			font-size: 24px;
		}

		.orca-lightbox__thumb {
			width: 48px;
			height: 48px;
		}

		.orca-lightbox__counter {
			font-size: 0.8125rem;
		}
	}

	/* Lock body scroll while open */
	body.orca-lightbox-open {
		overflow: hidden;
	}

	/* ================================================================
	 * Album Lightbox: caption block (title / caption / description)
	 * ================================================================ */
	.orca-lightbox__caption {
		position: absolute;
		bottom: 20px;
		max-height: 30vh;
		overflow-y: auto;
		padding: 12px 16px;
		border-radius: 8px;
		display: none;
		pointer-events: auto;
		z-index: 2;
	}
	.orca-lightbox__caption.is-visible { display: block; }

	/* Position: bottom-left */
	.orca-lightbox__caption[data-position="bottom-left"] {
		left: 20px;
		text-align: left;
	}
	/* Position: bottom-center */
	.orca-lightbox__caption[data-position="bottom-center"] {
		left: 50%;
		transform: translateX(-50%);
		text-align: center;
	}
	/* Position: bottom-right */
	.orca-lightbox__caption[data-position="bottom-right"] {
		right: 20px;
		text-align: right;
	}

	/* Background: auto — always dark block (independent of theme), text-shadow for safety */
	.orca-lightbox__caption[data-bg="auto"] {
		background: rgba(0, 0, 0, 0.75);
		color: #fff;
		text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
		box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
	}

	/* Background: dark — stronger black */
	.orca-lightbox__caption[data-bg="dark"] {
		background: rgba(0, 0, 0, 0.88);
		color: #fff;
		text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
		box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
	}

	/* Background: light — white block with border/shadow to separate from white images */
	.orca-lightbox__caption[data-bg="light"] {
		background: rgba(255, 255, 255, 0.95);
		color: #1a1a1a;
		border: 1px solid rgba(0, 0, 0, 0.1);
		box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
	}

	/* Field styles */
	.orca-lightbox__cap-title {
		font-size: 1.125rem;
		font-weight: 700;
		margin: 0 0 4px;
	}
	.orca-lightbox__cap-caption {
		font-size: 0.9375rem;
		opacity: 0.9;
		margin: 0 0 6px;
	}
	.orca-lightbox__cap-desc {
		font-size: 0.875rem;
		opacity: 0.85;
		line-height: 1.5;
	}
	.orca-lightbox__cap-exif {
		font-size: 0.75rem;
		line-height: 1.4;
		opacity: 0.7;
		letter-spacing: 0.01em;
		margin: 4px 0 0;
		font-feature-settings: "tnum" 1;
	}
	.orca-lightbox__gps {
		display: inline-block;
		margin-top: 4px;
		font-size: 0.75rem;
		line-height: 1.4;
		color: inherit;
		text-decoration: underline;
		text-decoration-thickness: 1px;
		text-underline-offset: 2px;
		white-space: nowrap;
	}
	.orca-lightbox__gps:hover,
	.orca-lightbox__gps:focus-visible {
		opacity: 1;
		text-decoration-thickness: 2px;
	}

	/* ================================================================
	 * Album Lightbox: fullscreen button + fullscreen mode
	 * ================================================================ */
	.orca-lightbox__fullscreen {
		position: absolute;
		top: 16px;
		right: 60px;  /* left of close button */
		width: 40px;
		height: 40px;
		border: none;
		border-radius: 50%;
		background: rgba(0, 0, 0, 0.5);
		color: #fff;
		font-size: 20px;
		line-height: 1;
		cursor: pointer;
		z-index: 3;
		transition: background 0.2s;
	}
	.orca-lightbox__fullscreen:hover,
	.orca-lightbox__fullscreen:focus-visible {
		background: rgba(0, 0, 0, 0.75);
		outline: 2px solid #fff;
		outline-offset: 2px;
	}

	/* Fullscreen mode: image fills viewport */
	.orca-lightbox.is-fullscreen {
		background: #000;
	}
	.orca-lightbox.is-fullscreen .orca-lightbox__stage {
		padding: 0;
	}
	.orca-lightbox.is-fullscreen .orca-lightbox__img {
		max-height: 100vh;
		max-width: 100vw;
		width: auto;
		height: auto;
		object-fit: contain;
	}
	/* In fullscreen, hide thumbnails to maximize image area */
	.orca-lightbox.is-fullscreen .orca-lightbox__thumbs {
		display: none;
	}
	/* In fullscreen, caption still visible (per user requirement) */
	.orca-lightbox.is-fullscreen .orca-lightbox__caption {
		z-index: 4;
	}

	/* ================================================================
	 * Album Lightbox: autoplay button
	 * ================================================================ */
	.orca-lightbox__autoplay {
		position: absolute;
		bottom: 120px;  /* above thumbnails */
		left: 50%;
		transform: translateX(-50%);
		z-index: 3;
	}
	.orca-lightbox__play {
		width: 44px;
		height: 44px;
		border: none;
		border-radius: 50%;
		background: rgba(0, 0, 0, 0.6);
		color: #fff;
		font-size: 18px;
		line-height: 1;
		cursor: pointer;
		transition: background 0.2s, transform 0.2s;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.orca-lightbox__play:hover,
	.orca-lightbox__play:focus-visible {
		background: rgba(0, 0, 0, 0.85);
		transform: scale(1.08);
		outline: 2px solid #fff;
		outline-offset: 2px;
	}
	.orca-lightbox.is-autoplay .orca-lightbox__play {
		background: rgba(0, 86, 179, 0.85);
	}

	/* Autoplay button hidden if autoplay disabled in Customizer? — always visible so user can start manually */
	/* In fullscreen mode, keep autoplay button visible */
	.orca-lightbox.is-fullscreen .orca-lightbox__autoplay {
		bottom: 80px;
		z-index: 5;
	}

	/* ================================================================
	 * Album Lightbox: like button
	 * ================================================================ */
	.orca-lightbox__like {
		display: inline-flex;
		align-items: center;
		gap: 4px;
		padding: 8px 14px;
		border: 1px solid rgba(255, 255, 255, 0.5);
		border-radius: 999px;
		background: rgba(0, 0, 0, 0.65);
		color: #fff;
		text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
		font-size: 0.9375rem;
		cursor: pointer;
		transition: background 0.2s, border-color 0.2s, transform 0.1s;
	}
	.orca-lightbox__like:hover:not(:disabled) {
		background: rgba(0, 0, 0, 0.85);
		border-color: rgba(255, 255, 255, 0.7);
	}
	.orca-lightbox__like:active:not(:disabled) {
		transform: scale(0.96);
	}
	.orca-lightbox__like:disabled {
		opacity: 0.6;
		cursor: default;
	}
	.orca-lightbox__like.is-liked {
		background: rgba(231, 76, 60, 0.25);
		border-color: rgba(231, 76, 60, 0.7);
		color: #ff6b5b;
	}
	.orca-lightbox__like-icon {
		font-size: 1.0625rem;
		line-height: 1;
	}
	.orca-lightbox__like-count {
		font-variant-numeric: tabular-nums;
	}

	/* Light background variant */
	.orca-lightbox__like-wrap[data-bg="light"] .orca-lightbox__like {
		border-color: rgba(0, 0, 0, 0.2);
		background: rgba(0, 0, 0, 0.05);
		color: #1a1a1a;
	}
	.orca-lightbox__like-wrap[data-bg="light"] .orca-lightbox__like:hover:not(:disabled) {
		background: rgba(0, 0, 0, 0.1);
		border-color: rgba(0, 0, 0, 0.4);
	}
	.orca-lightbox__like-wrap[data-bg="light"] .orca-lightbox__like.is-liked {
		background: rgba(231, 76, 60, 0.15);
		border-color: rgba(231, 76, 60, 0.6);
		color: #c0392b;
	}
	/* Download button: same pill style as like, no count */
	.orca-lightbox__download {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 8px 12px;
		border: 1px solid rgba(255, 255, 255, 0.5);
		border-radius: 999px;
		background: rgba(0, 0, 0, 0.65);
		color: #fff;
		font-size: 16px;
		line-height: 1;
		text-decoration: none;
		margin-right: 8px;
		cursor: pointer;
		transition: background 0.2s ease, border-color 0.2s ease;
	}
	.orca-lightbox__download:hover {
		background: rgba(0, 0, 0, 0.85);
		border-color: rgba(255, 255, 255, 0.8);
	}

	/* Comments link (inside like-wrap, leftmost) */
	.orca-lightbox__comments-link {
		display: inline-flex;
		align-items: center;
		gap: 4px;
		padding: 8px 12px;
		border: 1px solid rgba(255, 255, 255, 0.5);
		border-radius: 999px;
		background: rgba(0, 0, 0, 0.65);
		color: #fff;
		font-size: 14px;
		line-height: 1;
		text-decoration: none;
		margin-right: 8px;
		transition: background 0.2s ease, border-color 0.2s ease;
	}
	.orca-lightbox__comments-link:hover {
		background: rgba(0, 0, 0, 0.85);
		border-color: rgba(255, 255, 255, 0.8);
		color: #fff;
	}
	.orca-lightbox__like-wrap[data-bg="light"] .orca-lightbox__comments-link {
		border-color: rgba(0, 0, 0, 0.2);
		background: rgba(0, 0, 0, 0.05);
		color: #1a1a1a;
	}
	.orca-lightbox__like-wrap[data-bg="light"] .orca-lightbox__comments-link:hover {
		background: rgba(0, 0, 0, 0.1);
		border-color: rgba(0, 0, 0, 0.4);
	}
	.orca-lightbox__like-wrap[data-bg="light"] .orca-lightbox__download {
		border-color: rgba(0, 0, 0, 0.2);
		background: rgba(0, 0, 0, 0.05);
		color: #1a1a1a;
	}
	.orca-lightbox__like-wrap[data-bg="light"] .orca-lightbox__download:hover {
		background: rgba(0, 0, 0, 0.1);
		border-color: rgba(0, 0, 0, 0.4);
	}

	/* ================================================================
	 * Album Lightbox: like button wrapper (opposite side of caption)
	 * ================================================================ */
	.orca-lightbox__like-wrap {
		position: absolute;
		bottom: 20px;
		z-index: 3;
		display: none;
	}
	.orca-lightbox__like-wrap.is-visible {
		display: block;
	}

	/* Caption left/center -> like on right */
	.orca-lightbox[data-position="bottom-left"] .orca-lightbox__like-wrap,
	.orca-lightbox[data-position="bottom-center"] .orca-lightbox__like-wrap {
		right: 20px;
		left: auto;
		text-align: right;
	}
	/* Caption right -> like on left */
	.orca-lightbox[data-position="bottom-right"] .orca-lightbox__like-wrap {
		left: 20px;
		right: auto;
		text-align: left;
	}

	/* In fullscreen, keep same positions */
	.orca-lightbox.is-fullscreen .orca-lightbox__like-wrap {
		bottom: 20px;
	}

	/* Caption should not overflow into like area: max-width adjusted */
	.orca-lightbox__caption {
		max-width: 55%;
	}

	/* ================================================================
	 * Slide transitions (fade / slide / zoom)
	 * ================================================================ */
	.orca-lightbox__stage[data-transition="fade"] .orca-lightbox__img.is-transitioning {
		animation: zb-lb-fade 0.3s ease;
	}
	.orca-lightbox__stage[data-transition="slide"] .orca-lightbox__img.is-transitioning {
		animation: zb-lb-slide 0.3s ease;
	}
	.orca-lightbox__stage[data-transition="zoom"] .orca-lightbox__img.is-transitioning {
		animation: zb-lb-zoom 0.3s ease;
	}


	/* During transition, disable transform will-change to avoid conflict */
	.orca-lightbox__img.is-transitioning {
		will-change: opacity;
	}

	/* Accessibility: reduced-motion preference must win over the
	   .is-transitioning animation. */
	@media (prefers-reduced-motion: reduce) {
		.orca-lightbox__img.is-transitioning {
			animation: none !important;
		}
	}

	/* ================================================================
	 * Background music button (bottom center, above thumbs)
	 * ================================================================ */
	.orca-lightbox__music {
		position: absolute;
		bottom: 20px;
		left: 20px;
		width: 44px;
		height: 44px;
		border: none;
		border-radius: 50%;
		background: rgba(0, 0, 0, 0.6);
		color: #fff;
		font-size: 18px;
		line-height: 1;
		cursor: pointer;
		z-index: 3;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		transition: background 0.2s, transform 0.2s;
	}
	.orca-lightbox__music:hover,
	.orca-lightbox__music:focus-visible {
		background: rgba(0, 0, 0, 0.85);
		transform: scale(1.08);
		outline: 2px solid #fff;
		outline-offset: 2px;
	}
	.orca-lightbox__music.is-playing {
		background: rgba(0, 86, 179, 0.85);
		animation: zb-lb-pulse 1.5s ease-in-out infinite;
	}

	/* Fullscreen: keep music button visible, higher z-index */
	.orca-lightbox.is-fullscreen .orca-lightbox__music {
		z-index: 5;
		bottom: 20px;
	}

	/* Mobile */
	@media (max-width: 768px) {
		.orca-lightbox__music {
			bottom: 16px;
			left: 16px;
			width: 40px;
			height: 40px;
			font-size: 16px;
		}
	}



	/* Album photos sentinel (infinite scroll trigger) */
	.orca-album-photos__sentinel {
		height: 40px;
		margin: 1rem 0;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.orca-album-photos__sentinel.is-loading::before {
		content: "";
		width: 24px;
		height: 24px;
		border: 3px solid var(--orca-color-border, #e4e4e7);
		border-top-color: var(--orca-color-accent, #0056b3);
		border-radius: 50%;
		animation: orca-sentinel-spin 0.8s linear infinite;
	}
	@keyframes orca-sentinel-spin {
		to { transform: rotate(360deg); }
	}

}


	/* ================================================================
	 * Toolbar
	 * ================================================================ */
	.orca-lightbox__toolbar {
		position: absolute;
		top: 16px;
		right: 16px;
		z-index: 5;
		display: flex;
		gap: 6px;
		flex-wrap: wrap;
		justify-content: flex-end;
		max-width: calc(100vw - 32px);
	}

	.orca-lightbox__tool {
		width: 40px;
		height: 40px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		border: none;
		border-radius: 50%;
		background: rgba(255, 255, 255, 0.1);
		color: #fff;
		cursor: pointer;
		transition: background 0.2s, transform 0.15s;
		padding: 0;
		font-family: inherit;
	}

	.orca-lightbox__tool:hover,
	.orca-lightbox__tool:focus-visible {
		background: rgba(255, 255, 255, 0.25);
		outline: none;
	}

	.orca-lightbox__tool:focus-visible {
		outline: 2px solid #fff;
		outline-offset: 2px;
	}

	.orca-lightbox__tool:active {
		transform: scale(0.94);
	}

	.orca-lightbox__tool.is-active {
		background: rgba(0, 86, 179, 0.75);
	}

	.orca-lightbox__tool svg {
		display: block;
		pointer-events: none;
	}

	.orca-lightbox__toolbar .orca-lightbox__close,
	.orca-lightbox__toolbar .orca-lightbox__fullscreen {
		position: static;
		top: auto;
		right: auto;
	}

	@media (max-width: 600px) {
		.orca-lightbox__toolbar {
			top: 8px;
			right: 8px;
			gap: 4px;
		}
		.orca-lightbox__tool {
			width: 32px;
			height: 32px;
		}
		.orca-lightbox__tool svg {
			width: 16px;
			height: 16px;
		}
	}


	/* Force music button into toolbar (override legacy position: absolute) */
	.orca-lightbox__toolbar .orca-lightbox__music {
		position: static;
		top: auto;
		left: auto;
		right: auto;
		bottom: auto;
		transform: none;
	}

	/* Force nav arrows to be vertically centered via absolute positioning */
	.orca-lightbox__nav {
		position: absolute;
		top: 50%;
		bottom: auto;
		transform: translateY(-50%);
	}
	
	.orca-lightbox__nav--prev {
		left: 24px;
		right: auto;
	}
	
	.orca-lightbox__nav--next {
		right: 24px;
		left: auto;
	}

	@media (max-width: 600px) {
		.orca-lightbox__nav--prev { left: 8px; }
		.orca-lightbox__nav--next { right: 8px; }
	}
