.bbs-slider {
	width: 100%;
	outline: none;
}

/* Main stage: fills the container width; fixed height so landscape and
   portrait images share the same frame. Slides sit side by side on a
   sliding track; the active slide is centered, neighbours peek at
   var(--bbs-peek) opacity. */
.bbs-stage {
	position: relative;
	width: 100%;
	height: var(--bbs-height, 70vh);
	overflow: hidden;
}

.bbs-track {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	height: 100%;
	transition: transform 0.4s ease;
	will-change: transform;
}

.bbs-slide {
	flex: 0 0 auto;
	height: 100%;
	max-width: 100%;
	opacity: var(--bbs-peek, 0.3);
	transition: opacity 0.4s ease;
}

.bbs-slide.is-active {
	opacity: 1;
}

.bbs-slide img {
	height: 100%;
	width: auto;
	max-width: 100%;
	object-fit: contain;
	display: block;
}

/* Caption: overlaid on the bottom of the image, only on the active slide */
.bbs-slide {
	position: relative;
}

.bbs-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 24px 16px 12px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
	color: #fff;
	font-size: 15px;
	line-height: 1.4;
	text-align: center;
	opacity: 0;
	transition: opacity 0.4s ease;
	pointer-events: none;
}

.bbs-slide.is-active .bbs-caption {
	opacity: 1;
}

/* Slide counter (e.g. "3 / 14"), bottom-right of the stage */
.bbs-counter {
	position: absolute;
	right: 12px;
	bottom: 12px;
	z-index: 2;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	font-size: 13px;
	line-height: 1;
	padding: 7px 10px;
	border-radius: 6px;
	pointer-events: none;
}

/* Arrows */
.bbs-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	border: 0;
	cursor: pointer;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
	padding: 0;
}

.bbs-arrow:hover {
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
}

.bbs-prev { left: 12px; }
.bbs-next { right: 12px; }

/* Fullscreen toggle (top-right corner of the stage) */
.bbs-fullscreen {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	border: 0;
	cursor: pointer;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	width: 38px;
	height: 38px;
	border-radius: 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
	padding: 0;
}

.bbs-fullscreen:hover {
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
}

/* Close cross: only shown while in fullscreen */
.bbs-close {
	display: none;
	position: absolute;
	top: 12px;
	right: 60px;
	z-index: 2;
	border: 0;
	cursor: pointer;
	background: rgba(0, 0, 0, 0.35);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	width: 38px;
	height: 38px;
	border-radius: 6px;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
	padding: 0;
}

.bbs-close:hover {
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
}

/* Fullscreen layout */
.bbs-slider:fullscreen {
	display: flex;
	flex-direction: column;
	background: #111;
}

.bbs-slider:fullscreen .bbs-stage {
	flex: 1 1 auto;
	height: auto;
	min-height: 0;
}

.bbs-slider:fullscreen .bbs-thumbs {
	flex: 0 0 auto;
	padding: 6px;
	margin-top: 0;
}

.bbs-slider:fullscreen .bbs-close {
	display: flex;
}

/* Fallback fullscreen overlay: used where the native Fullscreen API is
   unavailable or denied (iframes, iOS Safari). Same layout as native. */
.bbs-slider.bbs-fake-fullscreen {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	background: #111;
	width: auto;
}

.bbs-slider.bbs-fake-fullscreen .bbs-stage {
	flex: 1 1 auto;
	height: auto;
	min-height: 0;
}

.bbs-slider.bbs-fake-fullscreen .bbs-thumbs {
	flex: 0 0 auto;
	padding: 6px;
	margin-top: 0;
}

.bbs-slider.bbs-fake-fullscreen .bbs-close {
	display: flex;
}

/* Safari prefix duplicates (kept separate: unknown selectors would
   invalidate a shared rule). */
.bbs-slider:-webkit-full-screen {
	display: flex;
	flex-direction: column;
	background: #111;
}

.bbs-slider:-webkit-full-screen .bbs-stage {
	flex: 1 1 auto;
	height: auto;
	min-height: 0;
}

.bbs-slider:-webkit-full-screen .bbs-thumbs {
	flex: 0 0 auto;
	padding: 6px;
	margin-top: 0;
}

.bbs-slider:-webkit-full-screen .bbs-close {
	display: flex;
}

/* Thumbnail preview bar */
.bbs-thumbs {
	display: flex;
	gap: 4px;
	margin-top: 4px;
	overflow-x: auto;
	scrollbar-width: thin;
	-webkit-overflow-scrolling: touch;
}

/* Center the strip when the thumbnails don't fill the width. "safe" keeps
   the leftmost thumbnails reachable when they overflow and the strip
   scrolls, instead of clipping them off the start. */
.bbs-thumbs-center {
	justify-content: safe center;
}

.bbs-thumb {
	flex: 0 0 auto;
	border: 0;
	padding: 0;
	cursor: pointer;
	background: none;
	height: 80px;
	opacity: 0.55;
	transition: opacity 0.2s ease;
}

.bbs-thumb img {
	height: 100%;
	width: auto;
	display: block;
	object-fit: cover;
}

.bbs-thumb:hover {
	opacity: 0.85;
}

.bbs-thumb.is-active {
	opacity: 1;
	box-shadow: inset 0 -3px 0 0 currentColor;
}

@media (max-width: 767px) {
	.bbs-thumb { height: 56px; }
	.bbs-arrow { width: 36px; height: 36px; font-size: 18px; }
}

/* ==========================================================================
   Idle-hiding controls (opt-in via .bbs-idle-hide)
   ==========================================================================

   On a full-height slider the controls sit on top of the work. They fade out
   after a couple of seconds of no interaction and return on any input. Pointer
   events go with them, so an invisible arrow can never swallow a click. */

.bbs-idle-hide .bbs-arrow,
.bbs-idle-hide .bbs-counter,
.bbs-idle-hide .bbs-fullscreen,
.bbs-idle-hide .bbs-thumbs {
	transition: opacity .45s ease;
}

/* Faded out and click-through, but NOT visibility:hidden.
   visibility:hidden takes an element out of the tab order and makes it
   impossible to focus even programmatically — which meant the rule below could
   never fire, and a keyboard user could not reach the controls at all once the
   slider had gone idle. pointer-events alone is enough to stop an invisible
   arrow swallowing a click. */
.bbs-idle-hide.is-idle .bbs-arrow,
.bbs-idle-hide.is-idle .bbs-counter,
.bbs-idle-hide.is-idle .bbs-fullscreen,
.bbs-idle-hide.is-idle .bbs-thumbs {
	opacity: 0;
	pointer-events: none;
}

/* Keyboard users must never lose the controls they are tabbing through. */
.bbs-idle-hide.is-idle :focus-visible {
	opacity: 1 !important;
	pointer-events: auto !important;
}

@media (prefers-reduced-motion: reduce) {
	.bbs-idle-hide.is-idle .bbs-arrow,
	.bbs-idle-hide.is-idle .bbs-counter,
	.bbs-idle-hide.is-idle .bbs-fullscreen,
	.bbs-idle-hide.is-idle .bbs-thumbs {
		opacity: 1;
		pointer-events: auto;
	}
}

/* ==========================================================================
   Hidden arrows (still focusable) and the reactive cursor
   ========================================================================== */

/* `arrows => false` hides the buttons without removing them, so keyboard and
   screen-reader users keep a real labelled control. They come back the moment
   they take keyboard focus — a control you can tab to but never see is worse
   than no control at all. */
.bbs-arrows-hidden .bbs-arrow {
	opacity: 0;
	pointer-events: none;
}

.bbs-arrows-hidden .bbs-arrow:focus-visible {
	opacity: 1;
	pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Reactive cursor
   -------------------------------------------------------------------------- */

.bbs-cursor-nav {
	position: relative;
}

/* The disc replaces the pointer, so the system one goes. Only over the image
   itself — the thumbnails, arrows and any chrome keep a normal cursor. */
.bbs-cursor-nav .bbs-stage,
.bbs-cursor-nav .bbs-slide,
.bbs-cursor-nav .bbs-slide img {
	cursor: none;
}

.bbs-cursor {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 72px;
	height: 72px;
	color: #fff;
	opacity: 0;
	/* Never take a pointer event: the click handling belongs to the stage, and
	   a disc under the cursor would otherwise swallow every click. */
	pointer-events: none;
	transition: opacity .22s ease;
	will-change: transform;
}

.bbs-cursor svg {
	width: 44px;
	height: 44px;
	filter: drop-shadow(0 1px 10px rgba(0, 0, 0, .85)) drop-shadow(0 0 3px rgba(0, 0, 0, .6));
}

.bbs-cursor-nav.is-cursor-in .bbs-cursor {
	opacity: 1;
}

.bbs-cursor svg {
	position: absolute;
	transition: opacity .16s ease, transform .16s ease;
}

.bbs-cursor .bbs-cursor-prev { transform: translateX(-1px); }
.bbs-cursor .bbs-cursor-next { transform: translateX(1px); }

.bbs-cursor.is-next .bbs-cursor-prev,
.bbs-cursor.is-prev .bbs-cursor-next {
	opacity: 0;
}

/* A little push on press, so a click feels like it did something even on the
   frame before the slide moves. */
.bbs-cursor-nav .bbs-stage:active ~ .bbs-cursor svg {
	transform: scale(.86);
}

/* No custom cursor where there is no pointer to follow. The stage keeps its
   normal cursor and swipe does the work. */
@media (hover: none), (pointer: coarse) {
	.bbs-cursor {
		display: none;
	}

	.bbs-cursor-nav .bbs-stage,
	.bbs-cursor-nav .bbs-slide,
	.bbs-cursor-nav .bbs-slide img {
		cursor: auto;
	}

	/* With no cursor affordance, the arrows have to come back. */
	.bbs-arrows-hidden .bbs-arrow {
		opacity: 1;
		pointer-events: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.bbs-cursor {
		transition: opacity .01ms;
	}
}
