/* ── My Tabs Block — styles frontend ──────────────────────────────────── */

.mtb-tabs {
	--mtb-color-active:   var(--wp--preset--color--primary, #0073aa);
	--mtb-color-border:   var(--wp--preset--color--contrast-2, #ddd);
	--mtb-color-bg:       var(--wp--preset--color--base, #fff);
	--mtb-color-tab-idle: #f0f0f0;
	--mtb-radius:         6px 6px 0 0;
	--mtb-pad-tab:        .65em 1.3em;
	--mtb-gap:            .3rem;

	display: flex;
	flex-direction: column;
}

/* ── Tablist ─────────────────────────────────────────────────────────── */
.mtb-tabs__tablist {
	display: flex;
	flex-wrap: wrap;
	gap: var(--mtb-gap);
	border-bottom: 1px solid var(--mtb-color-border);
}

/* ── Layout vertical ─────────────────────────────────────────────────── */
.mtb-tabs--vertical {
	flex-direction: row;
	align-items: flex-start;
}
.mtb-tabs--vertical .mtb-tabs__tablist {
	flex-direction: column;
	flex-wrap: nowrap;
	border-bottom: none;
	border-right: 1px solid var(--mtb-color-border);
	min-width: 150px;
	flex-shrink: 0;
}
.mtb-tabs--vertical .mtb-tabs__panels { flex: 1; }

/* ── Boutons ─────────────────────────────────────────────────────────── */
.mtb-tabs__tab {
	appearance: none;
	background: var(--mtb-color-tab-idle);
	border: 1px solid var(--mtb-color-border);
	border-bottom: none;
	border-radius: var(--mtb-radius);
	color: inherit;
	cursor: pointer;
	font: inherit;
	margin-bottom: -1px;
	padding: var(--mtb-pad-tab);
	transition: color .18s, background .18s;
}
.mtb-tabs--vertical .mtb-tabs__tab {
	border-bottom: 1px solid var(--mtb-color-border);
	border-right: none;
	border-radius: 6px 0 0 6px;
	margin-bottom: 0;
	margin-right: -1px;
	text-align: left;
}
.mtb-tabs__tab:hover {
	color: var(--mtb-color-active);
	background: color-mix(in srgb, var(--mtb-color-tab-idle) 60%, var(--mtb-color-bg));
}
.mtb-tabs__tab:focus-visible {
	outline: 2px solid var(--mtb-color-active);
	outline-offset: 2px;
}
.mtb-tabs__tab.is-active,
.mtb-tabs__tab[aria-selected="true"] {
	background: var(--mtb-color-bg);
	border-color: var(--mtb-color-border);
	border-bottom-color: var(--mtb-color-bg);
	color: var(--mtb-color-active);
	font-weight: 600;
	position: relative;
	z-index: 1;
}
.mtb-tabs--vertical .mtb-tabs__tab.is-active,
.mtb-tabs--vertical .mtb-tabs__tab[aria-selected="true"] {
	border-right-color: var(--mtb-color-bg);
	border-bottom-color: var(--mtb-color-border);
}

/* ── Panneaux ────────────────────────────────────────────────────────── */
.mtb-tabs__panels {
	border: 1px solid var(--mtb-color-border);
	border-top: none;
	overflow: hidden;
}
.mtb-tabs--vertical .mtb-tabs__panels {
	border: 1px solid var(--mtb-color-border);
	border-left: none;
}
.mtb-tab-panel { padding: 1.5em; }
.mtb-tab-panel[hidden] { display: none; }

/* ── Animation contenu ───────────────────────────────────────────────── */
@keyframes mtb-slide-in {
	from { opacity: 0; transform: translateX(32px); }
	to   { opacity: 1; transform: translateY(0); }
}
.mtb-tab-panel.is-entering {
	animation: mtb-slide-in .32s cubic-bezier(.25,.46,.45,.94) both;
}

/* ── Navigation précédent / suivant ─────────────────────────────────── */
.mtb-tabs__nav {
	display: flex;
	gap: 1em;
	justify-content: space-between;
	margin-top: 1.25em;
	padding-top: 1em;
	border-top: 1px solid var(--mtb-color-border);
}
.mtb-tabs__nav-btn {
	appearance: none;
	background: none;
	border: none;
	color: var(--mtb-color-active);
	cursor: pointer;
	font: inherit;
	font-size: .9em;
	font-weight: 600;
	padding: 0;
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: opacity .15s;
}
.mtb-tabs__nav-btn:hover { opacity: .7; }
.mtb-tabs__nav-btn--prev::before { content: '\2190  '; }
.mtb-tabs__nav-btn--next::after  { content: '  \2192'; }
.mtb-tabs__nav-btn--spacer { visibility: hidden; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════════════
   STYLE "PILLS" — boutons ovales façon Ollie WP
   ════════════════════════════════════════════════════════════════════════ */
.mtb-tabs.is-style-pills {
	--mtb-pill-active-color: #fff;
	--mtb-pill-idle-bg:      #e8e8e8;
	--mtb-pill-idle-color:   #555;
}
.mtb-tabs.is-style-pills .mtb-tabs__tablist {
	border-bottom: none;
	gap: .5rem;
	margin-bottom: 1.25em;
	align-items: center;
}
.mtb-tabs.is-style-pills .mtb-tabs__panels {
	border: none;
}
.mtb-tabs.is-style-pills .mtb-tab-panel {
	padding: 0;
}
.mtb-tabs.is-style-pills .mtb-tabs__tab {
	background: var(--mtb-pill-idle-bg);
	border: none;
	border-radius: 999px;
	color: var(--mtb-pill-idle-color);
	font-size: .9em;
	font-weight: 500;
	margin-bottom: 0;
	padding: .5em 1.4em;
	transition: background .2s, color .2s, transform .15s;
}
.mtb-tabs.is-style-pills .mtb-tabs__tab:hover {
	background: color-mix(in srgb, var(--mtb-color-active) 15%, var(--mtb-pill-idle-bg));
	color: var(--mtb-color-active);
	transform: none;
}
.mtb-tabs.is-style-pills .mtb-tabs__tab:active {
	transform: scale(.96);
}
.mtb-tabs.is-style-pills .mtb-tabs__tab.is-active,
.mtb-tabs.is-style-pills .mtb-tabs__tab[aria-selected="true"] {
	background: var(--mtb-color-active);
	border: none;
	border-bottom-color: transparent;
	color: var(--mtb-pill-active-color);
	font-weight: 600;
	position: static;
	z-index: auto;
}
.mtb-tabs.is-style-pills .mtb-tabs__nav {
	border-top: 1px solid var(--mtb-color-border);
}

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE — menu déroulant moderne
   ════════════════════════════════════════════════════════════════════════ */
.mtb-tabs__select-wrapper { display: none; }

@media (max-width: 600px) {
	.mtb-tabs__tablist { display: none; }

	.mtb-tabs__select-wrapper {
		display: block;
		position: relative;
		margin-bottom: .75em;
	}
	.mtb-tabs__select-wrapper::after {
		content: '';
		pointer-events: none;
		position: absolute;
		right: 1em;
		top: 50%;
		transform: translateY(-50%);
		width: 0; height: 0;
		border-left: 5px solid transparent;
		border-right: 5px solid transparent;
		border-top: 6px solid var(--mtb-color-active);
	}
	.mtb-tabs__select {
		appearance: none;
		background: var(--mtb-color-bg);
		border: 2px solid var(--mtb-color-active);
		border-radius: 8px;
		color: var(--mtb-color-active);
		cursor: pointer;
		display: block;
		font: inherit;
		font-weight: 600;
		padding: .75em 3em .75em 1em;
		width: 100%;
		box-shadow: 0 2px 8px rgba(0,0,0,.08);
		transition: box-shadow .2s;
	}
	.mtb-tabs__select:focus {
		outline: none;
		box-shadow: 0 0 0 3px color-mix(in srgb, var(--mtb-color-active) 25%, transparent);
	}

	.mtb-tabs--vertical { flex-direction: column; }
	.mtb-tabs__panels {
		border: 1px solid var(--mtb-color-border);
		border-top: none;
	}
	.mtb-tabs.is-style-pills .mtb-tabs__panels {
		border: none;
	}
}

/* ═══════════════════════════════════════════════════════════════════════
   STYLE "UNDERLINE" — trait horizontal sous l'onglet actif
   ════════════════════════════════════════════════════════════════════════ */
.mtb-tabs.is-style-underline {
	--mtb-ul-height:  3px;
	--mtb-ul-color:   var(--wp--preset--color--primary, #0073aa);
	--mtb-ul-radius:  2px;
}

.mtb-tabs.is-style-underline .mtb-tabs__tablist {
	border-bottom: 1px solid var(--mtb-color-border);
	gap: 0;
}

.mtb-tabs.is-style-underline .mtb-tabs__panels {
	border: none;
}
.mtb-tabs.is-style-underline .mtb-tab-panel {
	padding: 1.5em 0;
}

/*
 * Le ::after est positionné sous le texte uniquement.
 * Le bouton garde un padding vertical pour l'espace de clic,
 * mais le trait ne déborde pas au-delà du texte.
 * On utilise un span interne généré par JS (voir view.js),
 * mais en CSS pur on travaille avec padding: 0 horizontal.
 */
.mtb-tabs.is-style-underline .mtb-tabs__tab {
	background: transparent;
	border: none;
	border-radius: 0;
	color: inherit;
	margin-bottom: 0;
	/* Pas de padding horizontal — le trait collera au texte */
	padding: .7em 0;
	/* Espacement entre les onglets via gap sur le parent */
	position: relative;
	opacity: .65;
	transition: opacity .2s, color .2s;
}

/* Trait : part de la gauche et glisse vers la droite */
.mtb-tabs.is-style-underline .mtb-tabs__tab::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: var(--mtb-ul-height);
	background: var(--mtb-ul-color);
	border-radius: var(--mtb-ul-radius);
	/* Masqué par clip-path, révélé de gauche à droite */
	clip-path: inset(0 100% 0 0);
	transition: clip-path .22s cubic-bezier(.4,0,.2,1);
}

/* Tablist : gap pour aérer les onglets sans padding */
.mtb-tabs.is-style-underline .mtb-tabs__tablist {
	gap: 1.5em;
}

.mtb-tabs.is-style-underline .mtb-tabs__tab:hover {
	background: transparent;
	color: var(--mtb-ul-color);
	opacity: 1;
}
/* Hover : trait pleine largeur */
.mtb-tabs.is-style-underline .mtb-tabs__tab:hover::after {
	clip-path: inset(0 0% 0 0);
}

/* Onglet actif : trait pleine largeur, de gauche à droite */
.mtb-tabs.is-style-underline .mtb-tabs__tab.is-active,
.mtb-tabs.is-style-underline .mtb-tabs__tab[aria-selected="true"] {
	background: transparent;
	border: none;
	border-bottom-color: transparent;
	color: var(--mtb-ul-color);
	font-weight: 700;
	opacity: 1;
	position: relative;
	z-index: auto;
}
.mtb-tabs.is-style-underline .mtb-tabs__tab.is-active::after,
.mtb-tabs.is-style-underline .mtb-tabs__tab[aria-selected="true"]::after {
	clip-path: inset(0 0% 0 0);
	transition: clip-path .3s cubic-bezier(.4,0,.2,1);
}

/* Nav prev/next sans bordure en underline */
.mtb-tabs.is-style-underline .mtb-tabs__nav {
	border-top: 1px solid var(--mtb-color-border);
}
