.tabs {
	position: relative;
	padding-inline: 1rem;
	max-width: 120ch;
	margin: 3rem auto;
	margin-bottom: 6rem;

	@media all and (max-width: 768px) {
		padding-inline: 1rem;
		margin-bottom: 2rem;
	}

	.tab-list {
		padding: 0;
		margin: 0;
		list-style: none;
		display: grid;
		align-items: stretch;

		.tab-panel {
			visibility: hidden;
		}

		.tabs-horizontal & {
			@media all and (min-width: 1300px) {
				grid-template-columns: 21em repeat(var(--num-tabs), 1fr);
				row-gap: 1rem;

				.tab-panel {
					grid-column: 1 / -1;
					grid-row: 2;
					display: grid;
					grid-template-columns: subgrid;
					align-items: start;
				}
			}

			& > button {
				justify-content: center;
				border-right: 1px solid oklch(var(--theme-accent));
				padding: 0 1.5rem;

				&:first-child {
					border-left: 1px solid oklch(var(--theme-accent));
					grid-column: 2;
				}
			}

			.tab-icon-panel {
				display: flex;
				align-items: center;
				justify-content: center;

				@media all and (min-width: 1300px) {
					justify-content: end;
					padding-top: 3.125rem;
					padding-right: 1.5rem;

					&::after {
						content: "";
						height: 1px;
						width: 5rem;
						background-color: oklch(var(--theme-accent));
					}
				}
			}
		}

		.tabs-vertical & {
			@media all and (min-width: 1300px) {
				grid-template-columns: 18em 1fr;
				grid-template-rows: repeat(var(--num-tabs), 1fr);
				column-gap: 3rem;

				.tab-panel {
					grid-column: 2;
					grid-row: 1 / -1;
				}
			}

			& > button {
				border-bottom: 1px solid oklch(var(--theme-accent));
				padding: 0.5rem 0;

				&:first-child {
					border-top: 1px solid oklch(var(--theme-accent));
				}
			}

			.tab-icon-panel {
				margin-bottom: 2rem;
			}

			.tab-icon {
				margin-inline: auto;
			}
		}

		& > button {
			cursor: pointer;
			font-weight: 500;
			font-style: italic;
			line-height: 1.2;
			background: none;
			width: 100%;
			box-sizing: border-box;
			border: 0;
			display: flex;
			align-items: center;

			&:hover, &.active-button {
				color: oklch(var(--theme-accent));
			}

			span {
				align-self: start;
			}

			@media all and (max-width: 1299px) {
				display: none;
			}
		}

		@media all and (max-width: 1299px) {
			grid-auto-flow: column;
			grid-auto-columns: 100%;
			column-gap: 1rem;
			box-sizing: border-box;
			overflow-x: auto;
			scroll-snap-type: x mandatory;
			scroll-behavior: smooth;
			scrollbar-width: none;

			.tab-panel {
				visibility: visible !important;
				scroll-snap-align: center;
				scroll-snap-stop: always;
			}

			.tab-icon-panel {
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;

				&::after {
					content: "";
					width: 1px;
					height: 3rem;
					background-color: oklch(var(--theme-accent));
				}
			}
		}
	}

	.tab-icon {
		width: 8rem;
		height: 8rem;
		border: 6px solid oklch(var(--theme-accent));
		border-radius: 9999px;
		background-color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		overflow: hidden;

		@media screen and (max-width: 767px) {
			width: 6rem;
			height: 6rem;
		}

		img {
			width: 100%;
			height: 100%;
			object-fit: cover;
		}
	}

	.tab-text {
		grid-column: span var(--num-tabs);
	}

	.tab-title {
		padding-bottom: 0.75rem;
		margin-bottom: 0.75rem;
		border-bottom: 6px solid oklch(var(--theme-accent));

		@media screen and (max-width: 767px) {
			padding-bottom: 1.75rem;
		}
		h2 {
			font-size: 1.5rem;
			font-style: italic;
			line-height: 1.2;
			margin: 0;
		}

		button {
			border: 0;
			background: none;
			display: none;
			padding: 0;
			width: 4rem;
			height: 4rem;
			flex-shrink: 0;
			color: oklch(var(--theme-dark));

			&[disabled] {
				opacity: 0.25;
			}

			&:not([disabled]) {
				cursor: pointer;
			}

			&:not([disabled]):hover {
				color: oklch(var(--theme-accent));
			}
		}

		svg {
			width: 100%;
			height: 100%;
			display: block;
		}

		@media all and (max-width: 1299px) {
			display: flex;
			align-items: center;
			justify-content: space-between;
			gap: 0rem;

			button {
				display: block;
			}

			h2 {
				font-size: 1.25rem;
				text-align: center;
			}
		}
	}
}

.acf-block-preview {
	.tabs {
		border: 1px solid #ccc;
		padding: 2rem;

		& > h2 {
			margin-top: 0;
			font-size: 1rem;
		}

		.tab-panel {
			display: flex;
			align-items: center;
			gap: 1rem;
			visibility: visible !important;
		}

		.tab-icon-panel {
			padding: 0 !important;

			&::after {
				display: none;
			}
		}
	}
}
