/*
 * KUMITATE Tabs. Colours come from the theme palette (accent, contrast,
 * base, surface); a theme may set the --siteframe-tools-tabs-* and
 * --siteframe-tools-border-* variables to change them.
 */
.siteframe-tools-tabs {
	--siteframe-tools-tabs-main: var(--wp--preset--color--accent, var(--wp--preset--color--contrast, #2e2e2e));
	--siteframe-tools-tabs-on-main: var(--wp--preset--color--on-accent, var(--wp--preset--color--base, #fff));
	--siteframe-tools-tabs-text: var(--wp--preset--color--contrast, #2e2e2e);
	--siteframe-tools-tabs-base: var(--wp--preset--color--base, #fff);
	--siteframe-tools-tabs-surface: var(--wp--preset--color--surface, #f5f5f5);
	--siteframe-tools-tabs-line: color-mix(in srgb, var(--siteframe-tools-tabs-text) 22%, transparent);
	--siteframe-tools-tabs-gap: 0.25rem;
	box-sizing: border-box;
}
.siteframe-tools-tabs *,
.siteframe-tools-tabs *::before,
.siteframe-tools-tabs *::after {
	box-sizing: inherit;
}
.siteframe-tools-tabs.has-background,
.siteframe-tools-tabs.has-border {
	padding: clamp(0.75rem, 2.5vw, 1.25rem);
}
.siteframe-tools-tabs.is-border-1 {
	border: var(--siteframe-tools-border-1, 1px solid var(--siteframe-tools-tabs-line));
}
.siteframe-tools-tabs.is-border-2 {
	border: var(--siteframe-tools-border-2, 1px dashed color-mix(in srgb, var(--siteframe-tools-tabs-text) 45%, transparent));
}
.siteframe-tools-tabs.is-border-3 {
	border: var(--siteframe-tools-border-3, 4px double color-mix(in srgb, var(--siteframe-tools-tabs-text) 35%, transparent));
}
.siteframe-tools-tabs.is-border-4 {
	border: var(--siteframe-tools-border-4, 2px solid var(--siteframe-tools-tabs-main));
}

/* Without JavaScript: no tab buttons, every panel shown with its title. */
.siteframe-tools-tabs:not([data-ready]) > .siteframe-tools-tabs__list {
	display: none;
}
.siteframe-tools-tabs[data-ready] > .siteframe-tools-tabs__panels > .siteframe-tools-tabs__panel > .siteframe-tools-tabs__panel-title {
	display: none;
}
.siteframe-tools-tabs:not([data-ready]) > .siteframe-tools-tabs__panels > .siteframe-tools-tabs__panel + .siteframe-tools-tabs__panel {
	margin-top: 1.5em;
}
.siteframe-tools-tabs__panel-title {
	margin: 0 0 0.5em;
	padding-bottom: 0.25em;
	border-bottom: 2px solid var(--siteframe-tools-tabs-main);
	font-weight: 700;
}
.siteframe-tools-tabs__panel[hidden] {
	display: none !important;
}
.siteframe-tools-tabs__panel-body > :first-child,
.siteframe-tools-tabs__panel > :first-child {
	margin-top: 0;
}
.siteframe-tools-tabs__panel-body > :last-child,
.siteframe-tools-tabs__panel > :last-child {
	margin-bottom: 0;
}

/* Tab list */
.siteframe-tools-tabs__list {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: var(--siteframe-tools-tabs-gap);
	margin: 0;
	padding: 0;
}
.siteframe-tools-tabs__tab {
	position: relative;
	flex: 0 0 auto;
	min-height: 2.75rem;
	margin: 0;
	padding: 0.55em 1.15em;
	border: 1px solid transparent;
	border-radius: 4px 4px 0 0;
	background: var(--siteframe-tools-tabs-surface);
	color: var(--siteframe-tools-tabs-text);
	font: inherit;
	font-size: 0.95em;
	line-height: 1.45;
	text-align: center;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}
.siteframe-tools-tabs__tab:hover {
	background: color-mix(in srgb, var(--siteframe-tools-tabs-surface) 80%, var(--siteframe-tools-tabs-text));
}
.siteframe-tools-tabs__tab:focus-visible {
	z-index: 1;
	outline: 2px solid var(--siteframe-tools-tabs-main);
	outline-offset: 2px;
}
.siteframe-tools-tabs__panel:focus-visible {
	outline: 2px solid var(--siteframe-tools-tabs-main);
	outline-offset: 2px;
}

/* Default: the chosen tab takes the text colour and the panel is framed. */
.siteframe-tools-tabs__tab[aria-selected="true"] {
	background: var(--siteframe-tools-tabs-text);
	color: var(--siteframe-tools-tabs-base);
}
.siteframe-tools-tabs[data-ready]:not(.is-style-balloon):not(.is-style-bb) > .siteframe-tools-tabs__panels > .siteframe-tools-tabs__panel {
	padding: clamp(1rem, 3vw, 1.5rem);
	border: 1px solid var(--siteframe-tools-tabs-text);
	background: var(--siteframe-tools-tabs-base);
	color: var(--siteframe-tools-tabs-text);
}

/* Balloon: rounded tabs, the chosen one in the main colour with a pointer. */
.siteframe-tools-tabs.is-style-balloon {
	--siteframe-tools-tabs-gap: 0.5rem;
}
.siteframe-tools-tabs.is-style-balloon > .siteframe-tools-tabs__list {
	padding-bottom: 0.75rem;
}
.siteframe-tools-tabs.is-style-balloon .siteframe-tools-tabs__tab {
	border-radius: 999px;
}
.siteframe-tools-tabs.is-style-balloon .siteframe-tools-tabs__tab[aria-selected="true"] {
	background: var(--siteframe-tools-tabs-main);
	color: var(--siteframe-tools-tabs-on-main);
}
.siteframe-tools-tabs.is-style-balloon .siteframe-tools-tabs__tab[aria-selected="true"]::after {
	position: absolute;
	top: 100%;
	left: 50%;
	width: 0;
	height: 0;
	border: 0.45rem solid transparent;
	border-top-color: var(--siteframe-tools-tabs-main);
	transform: translateX(-50%);
	content: "";
}
.siteframe-tools-tabs.is-style-balloon[data-ready] > .siteframe-tools-tabs__panels > .siteframe-tools-tabs__panel {
	padding-top: 0.5rem;
}

/* Underline: plain tabs with a line under the chosen one. */
.siteframe-tools-tabs.is-style-bb {
	--siteframe-tools-tabs-gap: 0;
}
.siteframe-tools-tabs.is-style-bb > .siteframe-tools-tabs__list {
	margin-bottom: 1.25rem;
	box-shadow: inset 0 -1px 0 var(--siteframe-tools-tabs-line);
}
.siteframe-tools-tabs.is-style-bb .siteframe-tools-tabs__tab {
	border: 0;
	border-bottom: 3px solid transparent;
	border-radius: 0;
	background: none;
	color: color-mix(in srgb, var(--siteframe-tools-tabs-text) 75%, transparent);
}
.siteframe-tools-tabs.is-style-bb .siteframe-tools-tabs__tab:hover {
	color: var(--siteframe-tools-tabs-text);
	background: none;
}
.siteframe-tools-tabs.is-style-bb .siteframe-tools-tabs__tab[aria-selected="true"] {
	border-bottom-color: var(--siteframe-tools-tabs-main);
	color: var(--siteframe-tools-tabs-text);
	font-weight: 700;
}

/* Tab widths and sideways scrolling (computers from 782px, phones below). */
.siteframe-tools-tabs .siteframe-tools-tabs__tab {
	overflow-wrap: anywhere;
}
@media (min-width: 782px) {
	.siteframe-tools-tabs[data-width-pc="25"] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex: 0 0 calc((100% - 3 * var(--siteframe-tools-tabs-gap)) / 4);
	}
	.siteframe-tools-tabs[data-width-pc="flex-auto"] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex: 1 1 auto;
	}
	.siteframe-tools-tabs[data-width-pc="flex-50"] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex: 1 1 0;
	}
	.siteframe-tools-tabs[data-scroll-pc] > .siteframe-tools-tabs__list {
		flex-wrap: nowrap;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scrollbar-width: thin;
	}
	.siteframe-tools-tabs[data-scroll-pc] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex-shrink: 0;
		white-space: nowrap;
		overflow-wrap: normal;
	}
	.siteframe-tools-tabs[data-scroll-pc][data-width-pc="flex-50"] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex-basis: auto;
	}
}
@media (max-width: 781px) {
	.siteframe-tools-tabs[data-width-sp="50"] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex: 0 0 calc((100% - var(--siteframe-tools-tabs-gap)) / 2);
	}
	.siteframe-tools-tabs[data-width-sp="flex-auto"] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex: 1 1 auto;
	}
	.siteframe-tools-tabs[data-width-sp="flex-50"] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex: 1 1 0;
	}
	.siteframe-tools-tabs[data-scroll-sp] > .siteframe-tools-tabs__list {
		flex-wrap: nowrap;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scrollbar-width: thin;
	}
	.siteframe-tools-tabs[data-scroll-sp] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex-shrink: 0;
		white-space: nowrap;
		overflow-wrap: normal;
	}
	.siteframe-tools-tabs[data-scroll-sp][data-width-sp="flex-50"] > .siteframe-tools-tabs__list > .siteframe-tools-tabs__tab {
		flex-basis: auto;
	}
}
/* Fade the side where more tabs are hidden. */
.siteframe-tools-tabs[data-more-end] > .siteframe-tools-tabs__list {
	-webkit-mask-image: linear-gradient(to right, #000 calc(100% - 3rem), transparent);
	mask-image: linear-gradient(to right, #000 calc(100% - 3rem), transparent);
}
.siteframe-tools-tabs[data-more-start] > .siteframe-tools-tabs__list {
	-webkit-mask-image: linear-gradient(to left, #000 calc(100% - 3rem), transparent);
	mask-image: linear-gradient(to left, #000 calc(100% - 3rem), transparent);
}
.siteframe-tools-tabs[data-more-start][data-more-end] > .siteframe-tools-tabs__list {
	-webkit-mask-image: linear-gradient(to right, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
	mask-image: linear-gradient(to right, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
}

@media (prefers-reduced-motion: no-preference) {
	.siteframe-tools-tabs[data-ready] > .siteframe-tools-tabs__panels > .siteframe-tools-tabs__panel:not([hidden]) {
		animation: siteframe-tools-tab-in 0.25s ease-out;
	}
	.siteframe-tools-tabs__tab {
		transition: background-color 0.2s, color 0.2s, border-color 0.2s;
	}
}
@keyframes siteframe-tools-tab-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}
