/* [wg_category_tabs]: Rent / Buy tabs with a carousel of category cards. */

.wg-cat-tabs {
	--wgct-accent: #49976d;
	--wgct-accent-dark: #3d8460;
	--wgct-tab-active: #efc533;
	--wgct-tab-active-text: #2b5c42;
	--wgct-card: #fff;
	--wgct-text: #1a1a1a;
	--wgct-gap: 16px;
	--wgct-visible: 5;
	text-align: center;
}

/* Tab switch */
.wg-cat-tabs__switch {
	display: inline-flex;
	gap: 4px;
	margin: 0 auto 38px;
	padding: 6px;
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 2px 12px rgba( 0, 0, 0, .05 );
}

.wg-cat-tabs .wg-cat-tabs__tab {
	min-width: 142px;
	margin: 0;
	padding: 12px 28px;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var( --wgct-accent );
	font: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: .02em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color .2s ease;
}

.wg-cat-tabs .wg-cat-tabs__tab:hover {
	background: rgba( 239, 197, 51, .22 );
}

.wg-cat-tabs .wg-cat-tabs__tab.is-active {
	background: var( --wgct-tab-active );
	/* Darker green: the brand green on yellow is too faint to read. */
	color: var( --wgct-tab-active-text );
}

.wg-cat-tabs .wg-cat-tabs__tab:focus-visible {
	outline: 2px solid var( --wgct-accent );
	outline-offset: 2px;
}

.wg-cat-tabs__panel[hidden] {
	display: none;
}

/* Carousel */
.wg-cat-tabs__carousel {
	position: relative;
}

/* Fade the last visible card while there is more to scroll to, as a hint. */
.wg-cat-tabs__carousel.has-more {
	-webkit-mask-image: linear-gradient( to right, #000 82%, transparent 100% );
	mask-image: linear-gradient( to right, #000 82%, transparent 100% );
}

.wg-cat-tabs .wg-cat-tabs__track {
	display: flex;
	gap: var( --wgct-gap );
	margin: 0;
	padding: 0;
	overflow-x: auto;
	list-style: none;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.wg-cat-tabs .wg-cat-tabs__track.is-static {
	justify-content: center;
}

.wg-cat-tabs__track::-webkit-scrollbar {
	display: none;
}

.wg-cat-tabs .wg-cat-tabs__item {
	flex: 0 0 calc( ( 100% - ( var( --wgct-visible ) - 1 ) * var( --wgct-gap ) ) / var( --wgct-visible ) );
	margin: 0;
	padding: 0;
	list-style: none;
	scroll-snap-align: start;
}

.wg-cat-tabs__card {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding: 24px 18px 18px;
	border-radius: 18px;
	background: var( --wgct-card );
	color: var( --wgct-text );
	text-decoration: none;
	transition: box-shadow .2s ease, transform .2s ease;
}

.wg-cat-tabs__card:hover,
.wg-cat-tabs__card:focus-visible {
	color: var( --wgct-text );
	box-shadow: 0 8px 24px rgba( 0, 0, 0, .08 );
	transform: translateY( -2px );
}

.wg-cat-tabs__title {
	display: block;
	margin-bottom: 36px;
	font-size: 22px;
	font-weight: 500;
	line-height: 1.3;
}

.wg-cat-tabs__media {
	display: block;
	overflow: hidden;
	margin-top: auto;
	border-radius: 16px;
	background: #f3efed;
	aspect-ratio: 308 / 338;
}

.wg-cat-tabs .wg-cat-tabs__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform .35s ease;
}

.wg-cat-tabs__card:hover .wg-cat-tabs__img {
	transform: scale( 1.04 );
}

/* Arrows */
.wg-cat-tabs__nav {
	display: flex;
	justify-content: center;
	gap: 48px;
	margin: 24px 0 26px;
}

.wg-cat-tabs__nav[hidden] {
	display: none;
}

.wg-cat-tabs .wg-cat-tabs__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var( --wgct-accent );
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease;
}

.wg-cat-tabs .wg-cat-tabs__arrow:hover:not(:disabled) {
	background: rgba( 73, 151, 109, .1 );
}

.wg-cat-tabs .wg-cat-tabs__arrow:disabled {
	color: rgba( 73, 151, 109, .3 );
	cursor: default;
}

/* View all */
.wg-cat-tabs__more {
	margin-top: 8px;
}

.wg-cat-tabs__nav[hidden] + .wg-cat-tabs__more {
	margin-top: 32px;
}

.wg-cat-tabs .wg-cat-tabs__button {
	display: inline-block;
	padding: 10px 22px;
	border-radius: 999px;
	background: var( --wgct-accent );
	color: #fff;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	transition: background-color .2s ease;
}

.wg-cat-tabs .wg-cat-tabs__button:hover,
.wg-cat-tabs .wg-cat-tabs__button:focus-visible {
	background: var( --wgct-accent-dark );
	color: #fff;
}

@media ( max-width: 1199px ) {
	.wg-cat-tabs {
		--wgct-visible: 3.6;
	}
}

@media ( max-width: 767px ) {
	.wg-cat-tabs {
		--wgct-visible: 1.6;
		--wgct-gap: 12px;
	}

	.wg-cat-tabs__switch {
		margin-bottom: 26px;
	}

	.wg-cat-tabs .wg-cat-tabs__tab {
		min-width: 110px;
		padding: 10px 22px;
		font-size: 17px;
	}

	.wg-cat-tabs__card {
		padding: 16px 12px 12px;
		border-radius: 14px;
	}

	.wg-cat-tabs__title {
		margin-bottom: 18px;
		font-size: 17px;
	}

	.wg-cat-tabs__media {
		border-radius: 12px;
	}

	.wg-cat-tabs__nav {
		margin: 16px 0 20px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.wg-cat-tabs .wg-cat-tabs__track {
		scroll-behavior: auto;
	}

	.wg-cat-tabs__card,
	.wg-cat-tabs .wg-cat-tabs__img {
		transition: none;
	}
}
