.lig-gallery {
	--lig-aspect: 16 / 9;
	--lig-main-bg: #000;
	--lig-thumb-min: 120px;
	--lig-thumb-max: 280px;
	--lig-thumb-height: 120px;
	--lig-thumb-gap: 8px;
	--lig-thumb-border-width: 2px;
	--lig-thumb-border-color: #000;
	--lig-arrow-bg: rgba(0,0,0,0.5);
	--lig-arrow-color: #fff;
	--lig-arrow-size: 36px;
	--lig-caption-bg: rgba(0,0,0,0.6);
	--lig-caption-color: #fff;
	display: flex;
	flex-direction: column;
	gap: var(--lig-thumb-gap);
	font-family: inherit;
	border: none !important;
	box-shadow: none !important;
}

.lig-warning {
	padding: 12px 16px;
	background: #fff3cd;
	border-left: 4px solid #ffc107;
	margin: 20px 0;
}

/* ===== Main image ===== */
.lig-main {
	position: relative;
	width: 100%;
	background: var(--lig-main-bg);
	overflow: hidden;
}

.lig-main-inner {
	position: relative;
	width: 100%;
	aspect-ratio: var(--lig-aspect);
}

.lig-main-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: opacity 0.35s ease;
}

.lig-main-img.is-loading { opacity: 0.3; }

/* ===== Arrows ===== */
.lig-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: var(--lig-arrow-size);
	height: calc(var(--lig-arrow-size) * 1.6);
	background: var(--lig-arrow-bg);
	border: 0;
	color: var(--lig-arrow-color);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s ease, opacity 0.2s ease;
	z-index: 2;
}
.lig-arrow:hover { background: rgba(0,0,0,0.75); }
.lig-arrow:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.lig-arrow--prev { left: 0; }
.lig-arrow--next { right: 0; }

.lig-arrow-icon {
	display: inline-block;
	width: 10px; height: 10px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
}
.lig-arrow-icon--left  { transform: rotate(135deg); margin-left: 4px; }
.lig-arrow-icon--right { transform: rotate(-45deg); margin-right: 4px; }

.lig-arrow[disabled] { opacity: 0.35; cursor: not-allowed; }

/* ===== Caption ===== */
.lig-caption {
	position: absolute;
	right: 16px;
	bottom: 16px;
	max-width: calc(100% - 32px);
	padding: 8px 14px;
	background: var(--lig-caption-bg);
	color: var(--lig-caption-color);
	font-size: 14px;
	line-height: 1.3;
	z-index: 2;
	pointer-events: none;
}

.lig-caption:empty { display: none; }

/* ===== Thumbnails ===== */
.lig-thumbs {
	display: flex;
	flex-wrap: nowrap;
	gap: var(--lig-thumb-gap);
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	scrollbar-width: thin;
	scrollbar-color: #888 transparent;
	padding-bottom: 2px;
}

.lig-thumbs::-webkit-scrollbar { height: 8px; }
.lig-thumbs::-webkit-scrollbar-track { background: transparent; }
.lig-thumbs::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }
.lig-thumbs::-webkit-scrollbar-thumb:hover { background: #888; }

/* Hide scrollbar when "Show scrollbar" is off — thumbs still scroll via touch/drag/wheel */
.lig-gallery--no-scrollbar .lig-thumbs {
	scrollbar-width: none;
}
.lig-gallery--no-scrollbar .lig-thumbs::-webkit-scrollbar { display: none; }

.lig-gallery .lig-thumb {
	flex: 1 1 var(--lig-thumb-min);
	min-width: var(--lig-thumb-min);
	max-width: var(--lig-thumb-max);
	height: var(--lig-thumb-height);
	padding: 0;
	border: 0;
	background: #222;
	cursor: pointer;
	overflow: hidden;
	position: relative;
	transition: box-shadow 0.2s ease, opacity 0.2s ease;
	opacity: 0.75;
	box-shadow: none;
}

.lig-gallery .lig-thumb img {
	width: 100%; height: 100%;
	object-fit: cover;
	display: block;
}

.lig-gallery .lig-thumb:hover { opacity: 1; }
.lig-gallery .lig-thumb.is-active {
	opacity: 1;
	box-shadow: inset 0 0 0 var(--lig-thumb-border-width) var(--lig-thumb-border-color);
}

/* ===== Lightbox ===== */
.lig-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.9);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	padding: 40px;
	cursor: zoom-out;
}

.lig-lightbox-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
	cursor: default;
}

.lig-lightbox-close {
	position: absolute;
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	border: 0;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	font-size: 32px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.lig-lightbox-close:hover { background: rgba(0, 0, 0, 0.8); }

.lig-lightbox-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 56px;
	height: 80px;
	border: 0;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 0.2s ease, opacity 0.2s ease;
	z-index: 2;
}

.lig-lightbox-arrow:hover:not([disabled]) { background: rgba(0, 0, 0, 0.8); }
.lig-lightbox-arrow[disabled] { opacity: 0.3; cursor: not-allowed; }

.lig-lightbox-arrow--prev { left: 16px; }
.lig-lightbox-arrow--next { right: 16px; }

.lig-lightbox-arrow-icon {
	display: inline-block;
	width: 14px;
	height: 14px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
}
.lig-lightbox-arrow-icon--left  { transform: rotate(135deg); margin-left: 6px; }
.lig-lightbox-arrow-icon--right { transform: rotate(-45deg); margin-right: 6px; }

@media (max-width: 640px) {
	.lig-lightbox-arrow { width: 44px; height: 64px; }
	.lig-lightbox-arrow--prev { left: 8px; }
	.lig-lightbox-arrow--next { right: 8px; }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
	.lig-gallery {
		--lig-thumb-min: 80px;
		--lig-thumb-height: 80px;
		--lig-arrow-size: 30px;
	}
	.lig-caption { font-size: 12px; padding: 6px 10px; right: 8px; bottom: 8px; }
}
