/* ==========================================================================
   AM Devices - Category Tabs  [am_tabs]
   ========================================================================== */

.am-tabs {
	padding-block: 80px;
	background: linear-gradient(180deg, rgb(245 245 245), rgba(16, 79, 169, 0) 65%);
}

/* ---------- Heading ---------- */

.am-tabs__head {
	max-width: 720px;
	margin: 0 auto 36px;
	text-align: center;
}

.am-tabs__title {
	margin: 0 0 10px;
	font-size: clamp(26px, 3vw, 38px);
	font-weight: 700;
}

.am-tabs__subtitle {
	margin: 0;
	color: var(--am-text-soft);
	font-size: 17px;
}

/* ---------- Tab buttons ---------- */

.am-tabs__nav {
	position: relative; /* offsetLeft of tabs = position inside the bar (am-tab.js) */
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin-bottom: 32px;
}

.am-tabs__tab {
	flex: 0 0 auto;
	min-height: 46px;
	padding: 0 24px;
	border: 1px solid var(--am-border-strong);
	border-radius: 999px;
	background: #fff;
	color: var(--am-text);
	font-family: var(--am-font-heading);
	font-size: 15px;
	font-weight: 500;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.am-tabs__tab:hover {
	border-color: var(--am-primary);
	color: var(--am-primary);
}

.am-tabs__tab.is-active {
	border-color: var(--am-primary);
	background: var(--am-primary);
	color: #fff;
	box-shadow: 0 8px 20px rgba(16, 79, 169, 0.25);
}

/* ---------- Panel ---------- */

.am-tabs__panel {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	overflow: hidden;
	border: 1px solid var(--am-border);
	border-radius: 16px;
	background: #fff;
	box-shadow: var(--am-shadow);
}

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

.am-tabs__panel.is-active {
	animation: am-tabs-in 0.45s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.am-tabs__panel:focus-visible {
	outline: 2px solid var(--am-primary);
	outline-offset: 3px;
}

.am-tabs__content {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	padding: 56px;
}

.am-tabs__name {
	margin: 0 0 16px;
	font-size: clamp(24px, 2.6vw, 34px);
	font-weight: 700;
}

.am-tabs__text {
	margin-bottom: 28px;
	color: var(--am-text-soft);
	font-size: 16px;
	line-height: 1.7;
}

.am-tabs__text > *:last-child {
	margin-bottom: 0;
}

.am-tabs__btn .am-tabs__arrow {
	transition: transform 0.2s;
}

.am-tabs__btn:hover .am-tabs__arrow {
	transform: translateX(4px);
}

.am-tabs__media {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 380px;
	padding: 40px;
	background: #ffffff;
}

/*
 * Box = the picture itself (no object-fit letterboxing), so the rounded corners land on
 * the image. ".am-tabs" prefix outranks Elementor's ".elementor img { border-radius: 0 }".
 */
.am-tabs .am-tabs__img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 340px;
	border-radius: 20px;
	transition: transform 0.4s ease;
}

.am-tabs__panel:hover .am-tabs__img {
	transform: scale(1.03);
}

@keyframes am-tabs-in {
	from {
		opacity: 0;
		transform: translateY(14px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.am-tabs__content {
		padding: 40px;
	}

	.am-tabs__media {
		min-height: 320px;
		padding: 32px;
	}
}

@media (max-width: 767px) {
	.am-tabs {
		padding-block: 56px;
	}

	/* Tabs scroll sideways instead of wrapping into many rows */
	.am-tabs__nav {
		flex-wrap: nowrap;
		justify-content: flex-start;
		margin-inline: calc(var(--am-gutter) * -1);
		padding: 4px var(--am-gutter) 10px;
		overflow-x: auto;
		scroll-snap-type: x proximity;
		scroll-padding-inline: var(--am-gutter); /* snap keeps the side gutter */
		scrollbar-width: none;
	}

	.am-tabs__nav::-webkit-scrollbar {
		display: none;
	}

	.am-tabs__tab {
		min-height: 42px;
		padding: 0 18px;
		font-size: 14px;
		scroll-snap-align: start;
	}

	/* Image on top, text below */
	.am-tabs__panel {
		grid-template-columns: minmax(0, 1fr);
	}

	.am-tabs__media {
		order: -1;
		min-height: 220px;
		padding: 24px;
	}

	.am-tabs .am-tabs__img {
		max-height: 200px;
	}

	.am-tabs__content {
		padding: 28px 22px;
	}

	.am-tabs__btn {
		width: 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.am-tabs__panel.is-active {
		animation: none;
	}

	.am-tabs__img,
	.am-tabs__btn .am-tabs__arrow {
		transition: none;
	}
}
