/* ===================================
   AWYB Tabbed Gallery Widget
   ===================================
   Two-zone layout:
     1. Header zone — static title (optional) + tab bar + per-tab title/description
     2. Gallery zone — per-tab image grid (desktop) / Swiper carousel (mobile)
*/

.awyb-tabbed-gallery {
	--awyb-gallery-cols: 3;
	--awyb-tab-bg: #262626;
	--awyb-tab-active-bg: #3b6348;
	--awyb-pagination-active-color: #d52d2d;
	--awyb-header-image-top: -62px;
	--awyb-header-image-side: 0px;

	width: 100%;
}

/* ----- Header Zone ----- */

.awyb-tabbed-gallery__header {
	background-color: #fffdf9;
	width: 100%;
	padding: 48px var(--spacing-margins-s, 24px);
	box-sizing: border-box;
	position: relative;
	overflow: visible;
}

.awyb-tabbed-gallery__header-inner {
	position: relative;
	max-width: 1280px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 48px;
	width: 100%;
}

/* Static title — left-aligned by default (Pattern A desktop). */
.awyb-tabbed-gallery__static-title {
	font-family: var(--font-family-headings);
	font-size: 48px;
	line-height: 48px;
	font-weight: 700;
	letter-spacing: 0;
	color: #0a0a0a;
	margin: 0;
	width: 100%;
	text-align: left;
	align-self: stretch;
}

.awyb-tabbed-gallery-static-center .awyb-tabbed-gallery__static-title {
	text-align: center;
}

/* ----- Header Image (desktop) ----- */

.awyb-tabbed-gallery__header-image {
	display: block;
	height: auto;
	max-width: 100%;
}

@media (min-width: 769px) {
	/*
	 * Desktop: pulled out of flow and pinned to the chosen edge of the header
	 * zone. Negative top offsets let it overlap the section above.
	 * z-index: 0 keeps it behind the static title and tabs (which sit at the
	 * default static-position layer).
	 */
	.awyb-tabbed-gallery__header-image {
		position: absolute;
		right: 0px;
		bottom: -48px;
		z-index: 0;
		pointer-events: none;
	}

	.awyb-tabbed-gallery-himg-right .awyb-tabbed-gallery__header-image {
		left: auto;
	}

	.awyb-tabbed-gallery-himg-left .awyb-tabbed-gallery__header-image {
		left: var(--awyb-header-image-side, 0px);
		right: auto;
	}

	/* Keep the static title, tabs, and text panels above the image. */
	.awyb-tabbed-gallery__static-title,
	.awyb-tabbed-gallery__tabs,
	.awyb-tabbed-gallery__text-panels {
		position: relative;
		z-index: 1;
	}
}

/* ----- Header Image (mobile-only, separate asset) ----- */

.awyb-tabbed-gallery__header-image-mobile {
	display: none; /* hidden on desktop */
	height: auto;
	max-width: 100%;
	margin: 0 auto;
}

@media (max-width: 1024px) {
	/* Hide the desktop image entirely; show the mobile-only image inline. */
	.awyb-tabbed-gallery__header-image {
		display: none;
	}

	.awyb-tabbed-gallery__header-image-mobile {
		display: block;
		position: relative;
		bottom: -32px;
	}
}

/* ----- Tab Bar ----- */

.awyb-tabbed-gallery__tabs {
	display: flex;
	justify-content: center;
	width: 100%;
	z-index: 2;
}

.awyb-tabbed-gallery__tabs-row {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 8px 0;
	min-height: 56px;
	max-width: 100%;
	/* No background — each button paints its own. */
}

.awyb-tabbed-gallery__tab {
	all: unset;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 56px;
	padding: 6px 16px;
	background-color: var(--awyb-tab-bg);
	color: #f5f5f5;
	font-family: var(--font-family-body);
	font-size: 18px;
	line-height: 20px;
	font-weight: 400;
	cursor: pointer;
	white-space: nowrap;
	box-sizing: border-box;
	transition: background-color 0.18s ease;
}

.awyb-tabbed-gallery__tab-text {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 14px;
	border-radius: 8px;
}

/* Hover and active share the same highlighted background. */
.awyb-tabbed-gallery__tab:hover,
.awyb-tabbed-gallery__tab.is-active {
	background-color: var(--awyb-tab-active-bg);
}

.awyb-tabbed-gallery__tab:focus-visible .awyb-tabbed-gallery__tab-text {
	outline: 2px solid #ffffff;
	outline-offset: -2px;
}

.awyb-tabbed-gallery__separator {
	display: block;
	width: 1px;
	align-self: stretch;
	background-color: #ffffff;
	flex-shrink: 0;
}

/* ----- Per-Tab Text Panels (title + description) ----- */
/*
 * Stacked in the same DOM slot — only the active one is shown. The panel's
 * horizontal position and max-width are driven by the "Tab Bar & Description
 * Alignment" and "Tab Bar & Description Max Width" responsive controls (which
 * also drive the tab row), so the title/description and tabs share a column.
 */

.awyb-tabbed-gallery__text-panels {
	width: 100%;
	display: flex;
}

.awyb-tabbed-gallery__text-panel {
	display: none;
	flex-direction: column;
	gap: 20px;
	text-align: center;
	width: 100%;
	transition: opacity 0.15s ease;
	opacity: 1;
}

.awyb-tabbed-gallery__text-panel.is-active {
	display: flex;
}

.awyb-tabbed-gallery__text-panel.is-leaving {
	opacity: 0;
}

.awyb-tabbed-gallery__panel-title {
	font-family: var(--font-family-headings);
	font-size: 48px;
	line-height: 48px;
	font-weight: 700;
	letter-spacing: 0;
	color: #0a0a0a;
	margin: 0;
}

.awyb-tabbed-gallery__panel-description {
	font-family: var(--font-family-body);
	font-size: 28px;
	line-height: 38px;
	font-weight: 400;
	color: #262626;
	margin: 0;
}

/* ----- Gallery Zone ----- */

.awyb-tabbed-gallery__gallery {
	background-color: #fffdf9;
	width: 100%;
	padding: 48px var(--spacing-margins-s, 24px);
	box-sizing: border-box;
}

/* Atlanta-pattern background variant — heavier vertical breathing room. */
.awyb-tabbed-gallery__gallery.atlanta-bg {
	padding-top: 100px;
	padding-bottom: 100px;
}

@media (max-width: 1024px) {
	.awyb-tabbed-gallery__gallery.atlanta-bg {
		padding-top: 44px;
		padding-bottom: 44px;
	}
}

.awyb-tabbed-gallery__panels {
	max-width: 1280px;
	margin: 0 auto;
	width: 100%;
	position: relative;
}

.awyb-tabbed-gallery__panel {
	display: none;
	transition: opacity 0.15s ease;
	opacity: 1;
}

.awyb-tabbed-gallery__panel.is-active {
	display: block;
}

.awyb-tabbed-gallery__panel.is-leaving {
	opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
	.awyb-tabbed-gallery__panel,
	.awyb-tabbed-gallery__text-panel {
		transition: none;
	}
}

/* ----- Gallery Grid (desktop) -----
 *
 * The grid container is `<div class="awyb-tabbed-gallery__grid swiper">`. On
 * desktop CSS overrides Swiper's flex into a grid. On mobile it reverts to
 * Swiper's native flex layout.
 */

.awyb-tabbed-gallery__grid {
	width: 100%;
	box-sizing: border-box;
	position: relative;
	padding-right: 24px;
}

.awyb-tabbed-gallery__text-panel { 
	padding: 0 24px;
}

@media screen and (max-width: 1024px) {
	.awyb-tabbed-gallery__grid {
			padding: 0 24px !important;
	}
}

@media (min-width: 769px) {
	.awyb-tabbed-gallery__grid {
		padding-right: 0;	
	}

	.awyb-tabbed-gallery__grid .swiper-wrapper {
		display: grid;
		grid-template-columns: repeat(var(--awyb-gallery-cols), 1fr);
		gap: 24px !important;
		transform: none !important;
	}

	.awyb-tabbed-gallery__pagination {
		display: none;
	}

	.awyb-tabbed-gallery__text-panel { 
		padding: 0;
	}
}

.awyb-tabbed-gallery__item {
	position: relative;
	margin: 0;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	width: 100%;
	box-sizing: border-box;
}

.awyb-tabbed-gallery__item-image {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 100%;
	object-fit: cover;
	aspect-ratio: 1 / 1;
}

/* Caption — hidden by default; revealed on hover (desktop) or .is-active tap (mobile/touch). */

.awyb-tabbed-gallery__item-caption {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	padding: 16px 24px;
	background-color: rgba(0, 0, 0, 0.7);
	color: #ffffff;
	display: flex;
	flex-direction: column;
	gap: 6px;
	transform: translateY(100%);
	transition: transform 0.25s ease;
	pointer-events: none;
	will-change: transform;
}

.awyb-tabbed-gallery__item-name {
	font-family: var(--font-family-body);
	font-size: 20px;
	font-weight: 700;
	line-height: 1;
}

.awyb-tabbed-gallery__item-community {
	font-family: var(--font-family-body);
	font-size: 18px;
	font-weight: 400;
	line-height: 1;
}

@media (hover: hover) {
	.awyb-tabbed-gallery__item:hover .awyb-tabbed-gallery__item-caption {
		transform: translateY(0);
	}
}

.awyb-tabbed-gallery__item.is-active .awyb-tabbed-gallery__item-caption {
	transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
	.awyb-tabbed-gallery__item-caption {
		transition: none;
	}
}

/* ----- Mobile (≤768px) ----- */

@media (max-width: 768px) {
	.awyb-tabbed-gallery__header {
		padding: 32px 0;
	}

	.awyb-tabbed-gallery__header-inner {
		gap: 32px;
		/* padding: 0 var(--spacing-margins-s, 24px); */
	}

	/* Static title centers on mobile regardless of desktop alignment. */
	.awyb-tabbed-gallery__static-title {
		font-size: 36px;
		line-height: 40px;
		text-align: center;
	}

	/* Tab bar scrolls horizontally; bleeds to viewport edges. */
	.awyb-tabbed-gallery__tabs {
		justify-content: flex-start;
		overflow-x: auto;
		scrollbar-width: none;
		-ms-overflow-style: none;
		-webkit-overflow-scrolling: touch;
		margin: 0 calc(var(--spacing-margins-s, 24px) * -1);
		padding: 0 var(--spacing-margins-s, 24px);
	}

	.awyb-tabbed-gallery__tabs::-webkit-scrollbar {
		display: none;
	}

	.awyb-tabbed-gallery__tabs-row {
		flex-wrap: nowrap;
		justify-content: flex-start;
		min-width: max-content;
	}

	.awyb-tabbed-gallery__panel-title {
		font-size: 36px;
		line-height: 40px;
	}

	.awyb-tabbed-gallery__panel-description {
		font-size: 20px;
		line-height: 24px;
	}

	.awyb-tabbed-gallery__gallery {
		padding: 32px 0 32px 0;
	}

	.awyb-tabbed-gallery__pagination {
		position: static;
		margin-top: 8px;
		display: flex;
		justify-content: center;
		gap: 8px;
	}

	.awyb-tabbed-gallery__pagination .swiper-pagination-bullet {
		width: 8px;
		height: 8px;
		border-radius: 9999px;
		background-color: #d4d4d4;
		opacity: 1;
		margin: 0 !important;
	}

	.awyb-tabbed-gallery__pagination .swiper-pagination-bullet-active {
		background-color: var(--awyb-pagination-active-color, #d52d2d);
	}
}
