/* Flow With Joy — poster rows as swipeable carousels
   Only applies below the Kadence desktop breakpoint, where the rows would
   otherwise stack into one very tall column. Above it they stay a plain grid. */

@media (max-width: 1023.98px) {
	.fwj-carousel {
		position: relative;
	}

	.fwj-carousel .kt-row-column-wrap {
		display: flex !important;
		flex-wrap: nowrap !important;
		grid-template-columns: none !important;
		gap: 16px;
		margin: 0;
		padding: 2px 2px 12px;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
		scroll-behavior: smooth;
		overscroll-behavior-x: contain;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}

	.fwj-carousel .kt-row-column-wrap::-webkit-scrollbar {
		display: none;
	}

	.fwj-carousel .kt-row-column-wrap > .wp-block-kadence-column {
		flex: 0 0 auto !important;
		width: min(78%, 340px) !important;
		max-width: none !important;
		margin: 0 !important;
		scroll-snap-align: start;
	}

	.fwj-carousel .kt-row-column-wrap > .wp-block-kadence-column img,
	.fwj-carousel .kt-row-column-wrap > .wp-block-kadence-column video {
		max-width: 100%;
	}
}

@media (min-width: 600px) and (max-width: 1023.98px) {
	.fwj-carousel .kt-row-column-wrap > .wp-block-kadence-column {
		width: min(46%, 320px) !important;
	}
}

/* Controls are only useful (and only shown) in carousel mode. */
.fwj-carousel__ui {
	display: none;
}

@media (max-width: 1023.98px) {
	.fwj-carousel__ui {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 12px;
		margin: 4px 0 0;
	}

	/* A row that already fits on screen needs no controls. */
	.fwj-carousel--static .fwj-carousel__ui {
		display: none;
	}

	.fwj-carousel__btn {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 42px;
		height: 42px;
		padding: 0;
		border: 0;
		border-radius: 999px;
		background: #0d5c46;
		color: #fff;
		cursor: pointer;
		box-shadow: 0 6px 14px rgba(2, 8, 24, 0.18);
		transition: opacity 0.15s ease, transform 0.15s ease;
	}

	.fwj-carousel__btn:hover:not(:disabled) {
		transform: translateY(-1px);
	}

	.fwj-carousel__btn:disabled {
		opacity: 0.35;
		box-shadow: none;
		cursor: default;
	}

	.fwj-carousel__btn:focus-visible {
		outline: 3px solid #0d5c46;
		outline-offset: 3px;
	}

	.fwj-carousel__dots {
		display: flex;
		align-items: center;
		gap: 8px;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.fwj-carousel__dot {
		display: block;
		width: 9px;
		height: 9px;
		padding: 0;
		border: 0;
		border-radius: 999px;
		background: #c9d2cd;
		cursor: pointer;
		transition: width 0.18s ease, background-color 0.18s ease;
	}

	.fwj-carousel__dot[aria-current="true"] {
		width: 22px;
		background: #0d5c46;
	}

	.fwj-carousel__dot:focus-visible {
		outline: 2px solid #0d5c46;
		outline-offset: 3px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fwj-carousel .kt-row-column-wrap {
		scroll-behavior: auto;
	}

	.fwj-carousel__btn,
	.fwj-carousel__dot {
		transition: none;
	}
}
