/* =====================================================
   Swiper Block — Frontend Styles v1.3
   ===================================================== */

/* Outer: relative for button positioning, overflow visible so peek shows */
.swiper-block-outer {
	position: relative;
	width: 100%;
	overflow: visible;
	--swiper-arrow-color: #ffffff;
	--swiper-arrow-bg: rgba(0,0,0,0.6);
}

/* Viewport: clips the track. JS sets its width to (100% - peek). */
.swiper-block-viewport {
	overflow: hidden;
	width: 100%; /* JS overrides this once it measures peek */
}

/* Track: horizontal flex row. JS sets translateX to navigate. */
.swiper-block-track {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	/* No gap here — JS adds margin-right per slide instead, simpler */
	transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
	user-select: none;
	-webkit-user-select: none;
}

/* Slides: JS sets explicit px width on each slide via inline style */
.swiper-block-slide {
	flex: 0 0 auto;
	min-width: 0;
	box-sizing: border-box;
	/* Default: full width so content is visible even if JS hasn't run */
	width: 100%;
}

/* ---- Navigation Buttons ---- */
.swiper-block-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 20;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: none;
	cursor: pointer;
	padding: 0;
	color: var(--swiper-arrow-color);
	background: var(--swiper-arrow-bg);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}
.swiper-block-btn svg {
	width: 22px;
	height: 22px;
	display: block;
	pointer-events: none;
	flex-shrink: 0;
}
.swiper-block-btn--prev { left: 12px; }
.swiper-block-btn--next { right: 12px; }
.swiper-block-btn:hover  { opacity: 0.9; transform: translateY(-50%) scale(1.08); }
.swiper-block-btn:active { transform: translateY(-50%) scale(0.96); }

/* JS adds .is-hidden to toggle visibility */
.swiper-block-btn.is-hidden {
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Before JS runs: hide prev (we start at slide 0) */
.swiper-block-btn--prev { opacity: 0; pointer-events: none; }

/* Once JS marks it ready, normal opacity rules apply */
.swiper-block-btn--prev.js-ready { opacity: 1; pointer-events: auto; }
.swiper-block-btn--next.js-ready { opacity: 1; pointer-events: auto; }

@media (max-width: 600px) {
	.swiper-block-btn { width: 36px; height: 36px; }
	.swiper-block-btn svg { width: 18px; height: 18px; }
}

/* =====================================================
   Accessibility additions v1.8
   ===================================================== */

/**
 * Visually hidden but readable by screen readers.
 * The announcer div uses aria-live="polite" so changes
 * are read after the current utterance finishes.
 */
.swiper-block-announcer {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/**
 * On mobile (< 768px) the JS forces single-slide layout,
 * but we also ensure buttons are easily tappable (min 44px target).
 */
@media (max-width: 767px) {
	.swiper-block-btn {
		width: 40px;
		height: 40px;
		/* Expand tap target beyond visual size */
		-webkit-tap-highlight-color: transparent;
	}
	.swiper-block-btn::before {
		content: '';
		position: absolute;
		top: -8px;
		right: -8px;
		bottom: -8px;
		left: -8px;
	}
}

/**
 * Reduced motion — disable slide transition for users who prefer it.
 */
@media (prefers-reduced-motion: reduce) {
	.swiper-block-track {
		transition: none !important;
	}
}

/* =====================================================
   Dot Navigation v1.9
   ===================================================== */

.swiper-block-dots {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	padding: 10px 0;
	gap: 0; /* gaps handled by margin on each dot button */
	line-height: 1;
}

/* Individual dot — a <button> built by JS */
.swiper-block-dot {
	flex-shrink: 0;
	/* Visual styles set via inline style by JS (size, colour, shape) */
	/* Expand tap target on touch screens */
	position: relative;
}
.swiper-block-dot::before {
	content: '';
	position: absolute;
	top: -6px;
	right: -4px;
	bottom: -6px;
	left: -4px;
}
.swiper-block-dot:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* When dots are above, add a little bottom margin to separate from slides */
[data-dots-position="above"] .swiper-block-dots {
	margin-bottom: 4px;
}
/* When dots are below */
[data-dots-position="below"] .swiper-block-dots {
	margin-top: 4px;
}

/* =====================================================
   Media Max-Height v1.10
   ===================================================== */

/*
 * --swiper-media-max-height is set on .swiper-block-outer (global)
 * and can be overridden on individual .swiper-block-slide elements.
 *
 * We target all common media elements inside slides:
 *   - img (core/image, core/cover, any theme image)
 *   - video (core/video, core/cover with video bg)
 *   - iframe (embeds: YouTube, Vimeo, etc.)
 *   - figure (WordPress wraps img in figure for core/image)
 *   - .wp-block-cover (cover block)
 *   - .wp-block-video video
 *
 * object-fit: contain shrinks media to fit without cropping.
 * width: 100% ensures it fills the slide horizontally first.
 */

.swiper-block-outer {
	/* Default: no cap — overridden when attribute is set */
	--swiper-media-max-height: none;
}

/* Apply to all direct and nested media within slides */
.swiper-block-slide img,
.swiper-block-slide video,
.swiper-block-slide iframe,
.swiper-block-slide figure,
.swiper-block-slide .wp-block-image img,
.swiper-block-slide .wp-block-video video,
.swiper-block-slide .wp-block-embed__wrapper iframe {
	max-height: var( --swiper-media-max-height );
	width: 100%;
	object-fit: contain;
	display: block;
}

/*
 * Cover blocks use a different structure — the image/video is a
 * background, not an <img>. We cap the block height instead.
 */
.swiper-block-slide .wp-block-cover {
	max-height: var( --swiper-media-max-height );
	overflow: hidden;
}

/*
 * WordPress core/image wraps in <figure> which is block-level.
 * Ensure the figure itself doesn't add extra space.
 */
.swiper-block-slide figure {
	margin: 0;
}
