/*
 * #reels-2400 — their Facebook reels on the homepage (FacebookReels.astro, src/data/reels.ts), ported from
 * the Vibera Solar demo (viberasolar InstagramReels.astro). Heading centred, the cards below, the follow
 * button centred under them. The clips are mixed (two 16:9, two 9:16), so every card is 4:5: the cover frame
 * is cropped to fill it, and the playing clip is shown whole (contain) on black. Cards a view: 1 on phones,
 * 2 from 36rem, 3 from 56rem, all 4 from 75rem (no sliding, no arrows). Before Keen Slider loads (and without
 * JS) the row scrolls with scroll-snap at the same card widths Keen will give it (--pv cards a view, --gap apart).
 */
#reels-2400 {
	padding: 0 1rem clamp(3.75rem, 7.82vw, 6.25rem);
	--pad: clamp(1rem, 4.5vw, 6.25rem);
	--pv: 1;
	--gap: 16px;
}
#reels-2400 .cs-container {
	width: 100%;
	max-width: 112.5rem;
	margin: auto;
	padding: clamp(3rem, 6vw, 6.25rem) var(--pad);
	box-sizing: border-box;
	background-color: var(--primaryLight);
	display: grid;
	grid-template-columns: minmax(0, 80rem);
	justify-content: center;
	gap: clamp(2rem, 4vw, 3rem);
}
#reels-2400 .cs-content {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}
#reels-2400 .cs-title {
	margin: 0 0 1rem;
}
#reels-2400 .cs-text {
	max-width: 36rem;
	margin: 0;
}
#reels-2400 .tb-ig-follow {
	justify-self: center;
	margin: 0;
}

/* Arrows on the slider's sides, half outside it (the AutoVerus reviews slider) */
#reels-2400 .tb-ig-viewport {
	min-width: 0;
	position: relative;
}
#reels-2400 .tb-ig-arrow {
	width: 3rem;
	height: 3rem;
	padding: 0;
	border: 0;
	display: grid;
	place-items: center;
	position: absolute;
	top: calc(50% - 1.5rem);
	z-index: 5;
	color: var(--tbInk);
	background-color: #fff;
	box-shadow: 3px 3px 0 0 var(--tbInk);
	cursor: pointer;
	transition: background-color 0.3s, color 0.3s, transform 0.2s;
}
#reels-2400 .tb-ig-prev {
	left: -1.5rem;
}
#reels-2400 .tb-ig-next {
	right: -1.5rem;
}
#reels-2400 .tb-ig-arrow:hover {
	color: #fff;
	background-color: var(--tbGold);
}
#reels-2400 .tb-ig-arrow:active {
	transform: translate(2px, 2px);
	box-shadow: 1px 1px 0 0 var(--tbInk);
}
#reels-2400 .tb-ig-arrow:focus-visible,
#reels-2400 .tb-ig-play:focus-visible,
#reels-2400 .tb-ig-meta a:focus-visible {
	outline: 3px solid var(--tbGold);
	outline-offset: 3px;
}

#reels-2400 .tb-ig-slider {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	gap: var(--gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}
#reels-2400 .tb-ig-slider::-webkit-scrollbar {
	display: none;
}
#reels-2400 .tb-ig-slide {
	flex: 0 0 calc((100% - var(--gap) * (var(--pv) - 1)) / var(--pv));
	scroll-snap-align: start;
	min-width: 0;
}
/* Keen Slider in charge (its own CSS, scoped): it sizes and moves every slide itself */
#reels-2400 .tb-ig-slider.tb-ig-keen {
	gap: 0;
	overflow: hidden;
	scroll-snap-type: none;
	position: relative;
	touch-action: pan-y;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}
#reels-2400 .tb-ig-keen .tb-ig-slide {
	flex: none;
	width: 100%;
	position: relative;
	overflow: hidden;
}

/* A reel: the cover frame, dark shades top and bottom for the labels, the play button in the middle */
#reels-2400 .tb-ig-card {
	aspect-ratio: 4 / 5;
	position: relative;
	overflow: hidden;
	isolation: isolate;
	color: #fff;
	background-color: var(--tbInk);
	cursor: pointer;
}
#reels-2400 .tb-ig-poster,
#reels-2400 .tb-ig-video {
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
	object-fit: cover;
}
#reels-2400 .tb-ig-video {
	z-index: 0;
	background-color: #000;
}
#reels-2400 .tb-ig-poster {
	z-index: 1;
	transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s;
}
#reels-2400 .tb-ig-card:hover .tb-ig-poster {
	transform: scale(1.05);
}
#reels-2400 .tb-ig-card:after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background:
		linear-gradient(to bottom, rgba(11, 18, 32, 0.55) 0%, rgba(11, 18, 32, 0) 18%),
		linear-gradient(to top, rgba(11, 18, 32, 0.95) 0%, rgba(11, 18, 32, 0.7) 22%, rgba(11, 18, 32, 0) 50%);
	transition: opacity 0.3s;
}
#reels-2400 .tb-ig-badge,
#reels-2400 .tb-ig-time {
	position: absolute;
	top: 0.75rem;
	z-index: 3;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 0.4375rem 0.625rem 0.375rem;
	background-color: rgba(11, 18, 32, 0.6);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	transition: opacity 0.3s;
}
#reels-2400 .tb-ig-badge {
	left: 0.75rem;
	display: inline-flex;
	align-items: center;
	gap: 0.4375rem;
}
#reels-2400 .tb-ig-glyph {
	width: 0.875rem;
	height: 0.875rem;
	margin-top: -0.125rem;
}
#reels-2400 .tb-ig-time {
	right: 0.75rem;
	letter-spacing: 0.04em;
	font-variant-numeric: tabular-nums;
}
#reels-2400 .tb-ig-play {
	width: 4.5rem;
	height: 3.5rem;
	padding: 0;
	border: 0;
	display: grid;
	place-items: center;
	position: absolute;
	top: 46%;
	left: 50%;
	z-index: 3;
	color: #fff;
	background-color: var(--tbGold);
	box-shadow: 4px 4px 0 0 var(--tbInk);
	transform: translate(-50%, -50%) skew(-10deg);
	cursor: pointer;
	transition: background-color 0.3s, box-shadow 0.3s, transform 0.3s, opacity 0.3s;
}
#reels-2400 .tb-ig-play svg {
	transform: skew(10deg) translateX(2px);
}
#reels-2400 .tb-ig-card:hover .tb-ig-play,
#reels-2400 .tb-ig-play:focus-visible {
	background-color: var(--tbInk);
	box-shadow: 4px 4px 0 0 var(--tbGold);
	transform: translate(-50%, -50%) skew(-10deg) scale(1.08);
}
/* A slow pulse on the play button so the cards read as video at a glance (not for reduced motion) */
@media (prefers-reduced-motion: no-preference) {
	#reels-2400 .tb-ig-play:before {
		content: "";
		position: absolute;
		inset: 0;
		border: 2px solid #fff;
		opacity: 0;
		animation: tb-ig-pulse 2.4s ease-out infinite;
		pointer-events: none;
	}
	#reels-2400 .tb-ig-card:hover .tb-ig-play:before {
		animation: none;
	}
}
@keyframes tb-ig-pulse {
	0% {
		opacity: 0.7;
		transform: scale(1);
	}
	70%,
	100% {
		opacity: 0;
		transform: scale(1.45);
	}
}
#reels-2400 .tb-ig-info {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 3;
	padding: 0 1.125rem 1.125rem;
	transition: opacity 0.3s;
}
#reels-2400 .tb-ig-title {
	font-family: "Overpass", Arial, sans-serif;
	font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
	font-weight: 800;
	line-height: 1.3em;
	text-transform: none;
	color: #fff;
	margin: 0 0 0.625rem;
	padding-left: 0.75rem;
	border-left: 3px solid var(--tbGold);
}
#reels-2400 .tb-ig-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem 0.75rem;
	white-space: nowrap;
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.2em;
	color: var(--tbPhone);
}
#reels-2400 .tb-ig-meta a {
	font-weight: 700;
	color: #fff;
	text-decoration: none;
	border-bottom: 1px solid rgba(255, 255, 255, 0.5);
	transition: border-color 0.3s, color 0.3s;
	position: relative;
	z-index: 1;
}
#reels-2400 .tb-ig-meta a:hover {
	color: var(--tbPhone);
	border-color: var(--tbPhone);
}

/* Playing: the cover, shades and labels step aside for the clip and the browser's own controls */
#reels-2400 .is-playing {
	cursor: auto;
}
#reels-2400 .is-playing .tb-ig-poster,
#reels-2400 .is-playing .tb-ig-badge,
#reels-2400 .is-playing .tb-ig-time,
#reels-2400 .is-playing .tb-ig-play,
#reels-2400 .is-playing .tb-ig-info,
#reels-2400 .is-playing:after {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.3s, visibility 0s 0.3s;
}
#reels-2400 .is-playing .tb-ig-video {
	z-index: 4;
	object-fit: contain;
}

/* Cards a view per width, the same as the Keen breakpoints in InstagramReels.astro */
@media only screen and (min-width: 36rem) {
	#reels-2400 {
		--pv: 2;
	}
}
@media only screen and (min-width: 56rem) {
	#reels-2400 {
		--pv: 3;
		--gap: 20px;
	}
}
/* Desktop: all four in one row, nothing to slide */
@media only screen and (min-width: 75rem) {
	#reels-2400 {
		--pv: 4;
	}
	#reels-2400 .tb-ig-arrow {
		display: none;
	}
}
