/* Горизонтальные отступы даёт общий .container темы —
   секция задаёт только вертикальные */
.sb-gallery-slider {
	padding-block: 100px;
	background: #fff;
}

.sb-gallery-slider__inner {
	width: 100%;
	max-width: 1534px;
	margin: 0 auto;
}

.sb-gallery-slider__heading {
	max-width: 920px;
	margin: 0 auto 36px;
	text-align: center;
}

.sb-gallery-slider__title {
	margin: 0;
	color: #001f4b;
	font-family: "Syne", sans-serif;
	font-size: clamp(32px, 4vw, 56px);
	font-weight: 600;
	line-height: 1.08;
}

@media (min-width: 1280px) {
	.sb-gallery-slider {
		padding-block: 120px;
	}
}

@media (max-width: 767px) {
	.sb-gallery-slider {
		padding-block: 64px;
	}

	.sb-gallery-slider__heading {
		margin-bottom: 24px;
	}

	.sb-gallery-slider__main {
		aspect-ratio: 4 / 3;
	}
}

.sb-gallery-slider__main {
	position: relative;
	width: 100%;
	aspect-ratio: 1534 / 750;
	overflow: hidden;
	background: #f3f2ee;
	touch-action: pan-y;
}

.sb-gallery-slider__slides,
.sb-gallery-slider__slide {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.sb-gallery-slider__slide {
	margin: 0;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.45s ease, visibility 0.45s ease;
}

.sb-gallery-slider__slide.is-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	z-index: 1;
}

.sb-gallery-slider__image,
.sb-gallery-slider__thumb-image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	user-select: none;
}

.sb-gallery-slider__arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 91px;
	height: 91px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: rgba(255, 255, 255, 0.2);
	color: rgba(0, 31, 75, 0.3);
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}

.sb-gallery-slider__arrow--prev {
	left: 13px;
}

.sb-gallery-slider__arrow--next {
	right: 10px;
}

.sb-gallery-slider__arrow svg {
	width: 24px;
	height: 48px;
	overflow: visible;
}

.sb-gallery-slider__arrow path {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: square;
	stroke-linejoin: miter;
}

.sb-gallery-slider__arrow:hover,
.sb-gallery-slider__arrow:focus-visible {
	background: rgba(255, 255, 255, 0.55);
	color: #001f4b;
}

.sb-gallery-slider__arrow:focus-visible,
.sb-gallery-slider__thumb:focus-visible,
.sb-gallery-slider__main:focus-visible {
	outline: 2px solid #001f4b;
	outline-offset: 3px;
}

.sb-gallery-slider__arrow:disabled {
	opacity: 0.35;
	cursor: default;
}

.sb-gallery-slider__thumbs {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 110px) / 6);
	align-items: center;
	gap: 22px;
	width: calc(100% - 14px);
	margin: 23px auto 0;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	scrollbar-width: none;
	overscroll-behavior-inline: contain;
}

.sb-gallery-slider__thumbs::-webkit-scrollbar {
	display: none;
}

.sb-gallery-slider__thumb {
	position: relative;
	width: 100%;
	aspect-ratio: 235 / 126;
	padding: 0;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: 0;
	background: #fff;
	opacity: 0.6;
	cursor: pointer;
	transition: opacity 0.25s ease, border-color 0.25s ease;
}

.sb-gallery-slider__thumb:hover,
.sb-gallery-slider__thumb.is-active {
	opacity: 1;
}

.sb-gallery-slider__thumb.is-active {
	border-color: #001f4b;
}

.sb-gallery-slider__empty {
	max-width: 1534px;
	margin: 0 auto;
	padding: 80px 24px;
	border: 1px dashed #9ca3af;
	background: #f8f7f3;
	text-align: center;
}

.sb-gallery-slider__empty p {
	margin: 8px 0 0;
}

@media (max-width: 1199px) {
	.sb-gallery-slider {
		padding: 72px 0;
	}

	.sb-gallery-slider__thumbs {
		grid-auto-columns: calc((100% - 48px) / 4);
		gap: 16px;
	}

	.sb-gallery-slider__arrow {
		width: 68px;
		height: 68px;
	}

	.sb-gallery-slider__arrow svg {
		width: 18px;
		height: 36px;
	}
}

@media (max-width: 767px) {
	.sb-gallery-slider {
		padding: 50px 0;
	}

	.sb-gallery-slider__main {
		aspect-ratio: 4 / 3;
	}

	.sb-gallery-slider__arrow {
		width: 48px;
		height: 48px;
	}

	.sb-gallery-slider__arrow--prev {
		left: 8px;
	}

	.sb-gallery-slider__arrow--next {
		right: 8px;
	}

	.sb-gallery-slider__arrow svg {
		width: 13px;
		height: 27px;
	}

	.sb-gallery-slider__thumbs {
		grid-auto-columns: 42%;
		gap: 12px;
		width: 100%;
		margin-top: 12px;
	}

	.sb-gallery-slider__thumb {
		aspect-ratio: 235 / 126;
	}
}

/* ============================================================
   Fullscreen: кнопка на главном изображении + lightbox
   ============================================================ */

.sb-gallery-slider__fullscreen {
	position: absolute;
	top: 20px;
	right: 20px;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(0, 31, 75, 0.15);
	border-radius: 0;
	background: rgba(248, 247, 243, 0.85);
	color: rgba(0, 31, 75, 0.75);
	cursor: pointer;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.sb-gallery-slider__fullscreen:hover {
	background: #F8F7F3;
	color: #001F4B;
}

.sb-gallery-slider__fullscreen:focus-visible {
	outline: 2px solid #001f4b;
	outline-offset: 3px;
}

.sb-gallery-slider__fullscreen svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: square;
}

/* ---------- Lightbox ---------- */

.sb-gallery-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100020;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sb-gallery-lightbox.is-open {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

.sb-gallery-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 13, 30, 0.92);
}

.sb-gallery-lightbox__dialog {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding:
		max(64px, env(safe-area-inset-top))
		max(72px, env(safe-area-inset-right))
		max(56px, env(safe-area-inset-bottom))
		max(72px, env(safe-area-inset-left));
	box-sizing: border-box;
	pointer-events: none;
}

/* Клики проходят на backdrop всюду, кроме реальных элементов диалога */
.sb-gallery-lightbox__close,
.sb-gallery-lightbox__arrow,
.sb-gallery-lightbox__figure,
.sb-gallery-lightbox__counter {
	pointer-events: auto;
}

.sb-gallery-lightbox__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: 100%;
	max-height: 100%;
	min-width: 0;
}

.sb-gallery-lightbox__image {
	display: block;
	max-width: 100%;
	max-height: calc(100dvh - 140px);
	width: auto;
	height: auto;
	object-fit: contain;
	user-select: none;
}

.sb-gallery-lightbox__caption {
	max-width: min(90vw, 720px);
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	line-height: 1.5;
	text-align: center;
	color: rgba(248, 247, 243, 0.85);
	overflow-wrap: anywhere;
}

.sb-gallery-lightbox__close {
	position: absolute;
	top: max(16px, env(safe-area-inset-top));
	right: max(16px, env(safe-area-inset-right));
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(248, 247, 243, 0.25);
	border-radius: 0;
	background: rgba(248, 247, 243, 0.1);
	color: #F8F7F3;
	cursor: pointer;
	transition: background-color 0.25s ease, border-color 0.25s ease;
}

.sb-gallery-lightbox__close:hover {
	background: rgba(248, 247, 243, 0.25);
}

.sb-gallery-lightbox__close svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: square;
}

.sb-gallery-lightbox__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 72px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: rgba(248, 247, 243, 0.65);
	cursor: pointer;
	transition: color 0.25s ease;
}

.sb-gallery-lightbox__arrow:hover {
	color: #F8F7F3;
}

.sb-gallery-lightbox__arrow--prev {
	left: max(8px, env(safe-area-inset-left));
}

.sb-gallery-lightbox__arrow--next {
	right: max(8px, env(safe-area-inset-right));
}

.sb-gallery-lightbox__arrow svg {
	width: 20px;
	height: 40px;
	overflow: visible;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: square;
	stroke-linejoin: miter;
}

.sb-gallery-lightbox__arrow:disabled {
	opacity: 0.35;
	cursor: default;
}

.sb-gallery-lightbox__close:focus-visible,
.sb-gallery-lightbox__arrow:focus-visible {
	outline: 2px solid #F8F7F3;
	outline-offset: 3px;
}

.sb-gallery-lightbox__counter {
	position: absolute;
	bottom: max(16px, env(safe-area-inset-bottom));
	left: 50%;
	transform: translateX(-50%);
	font-family: 'Montserrat', sans-serif;
	font-size: 13px;
	line-height: 1;
	letter-spacing: 0.08em;
	color: rgba(248, 247, 243, 0.8);
}

@media (max-width: 767px) {
	.sb-gallery-slider__fullscreen {
		top: 12px;
		right: 12px;
		width: 42px;
		height: 42px;
	}

	.sb-gallery-slider__fullscreen svg {
		width: 17px;
		height: 17px;
	}

	.sb-gallery-lightbox__dialog {
		padding:
			max(56px, env(safe-area-inset-top))
			max(12px, env(safe-area-inset-right))
			max(48px, env(safe-area-inset-bottom))
			max(12px, env(safe-area-inset-left));
	}

	.sb-gallery-lightbox__image {
		max-height: calc(100dvh - 112px);
	}

	.sb-gallery-lightbox__close {
		top: max(10px, env(safe-area-inset-top));
		right: max(10px, env(safe-area-inset-right));
		width: 42px;
		height: 42px;
	}

	.sb-gallery-lightbox__arrow {
		width: 44px;
		height: 56px;
	}

	.sb-gallery-lightbox__arrow svg {
		width: 14px;
		height: 28px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sb-gallery-slider__slide,
	.sb-gallery-slider__arrow,
	.sb-gallery-slider__thumb,
	.sb-gallery-slider__thumbs,
	.sb-gallery-slider__fullscreen,
	.sb-gallery-lightbox,
	.sb-gallery-lightbox__close,
	.sb-gallery-lightbox__arrow {
		transition: none;
		scroll-behavior: auto;
	}
}
