/*
 * TABS-2: tabs as buttons, centred.
 * The tabs take the shape of the theme's buttons: pills where its buttons are
 * pills, square where they are square. The open one is filled like the main
 * button. Each panel is a few centred lines and a button.
 */

.wprk-tabs-2 .wprk-tabs-2__tabs {
	margin-block: 0;
}

.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list {
	border-block-end: 0;
	box-shadow: none;
	flex-grow: 0;
	--wprk-tabs-gap: var(--wp--preset--spacing--20);
	gap: var(--wprk-tabs-gap);
	justify-content: center;
}

.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list button {
	border: 1px solid var(--wprk-border);
	border-radius: var(--wp--custom--button--radius);
	box-shadow: none;
	color: var(--wprk-fg);
	margin-block-end: 0;
	padding: 0.6em 1.25em;
}

.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list button:hover {
	border-color: color-mix(in srgb, var(--wprk-heading) 45%, transparent);
	color: var(--wprk-heading);
}

.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list button[aria-selected="true"] {
	background-color: var(--wprk-btn-bg);
	border-color: var(--wprk-btn-bg);
	color: var(--wprk-btn-fg);
}

.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list button[aria-selected="true"]::before {
	content: none;
}

.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list button:focus-visible {
	outline-offset: 3px;
}

.wprk-tabs-2 .wp-block-tab-panel {
	text-align: center;
}

.wprk-tabs-2 .wprk-tabs .wp-block-tab-panel > * {
	margin-inline: auto;
	max-width: 40rem;
}

.wprk-tabs-2 .wprk-tabs .wp-block-tab-panel > .wp-block-buttons {
	justify-content: center;
	margin-block-start: var(--wp--preset--spacing--40);
}

/*
 * On a phone the buttons keep to one line that is moved sideways (tabs.css).
 * They stay centred while they fit. A centred row that holds more than fits
 * could not be moved back to its first button, so the centring is done with
 * margins that give way. The row keeps room for the ring of the keyboard,
 * which a row that scrolls would cut off.
 */
@media (max-width: 599px) {
	.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list {
		justify-content: flex-start;
		--wprk-tabs-room: 0.375rem;
		margin: calc(0px - var(--wprk-tabs-room));
		padding: var(--wprk-tabs-room);
	}

	.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list button:first-child {
		margin-inline-start: auto;
	}

	.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list button:last-child {
		margin-inline-end: auto;
	}
}

@media (prefers-reduced-motion: no-preference) {
	.wprk-tabs-2 .wprk-tabs > .wp-block-tab-list button {
		transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
	}
}
