/**
 * Inoforest Tabs
 *
 * Contents
 * 1. Defaults (variables), Underline look
 * 2. Tab row and buttons
 * 3. Panels, intro line, text, check-mark lists
 * 4. Editor hint, reduced motion, responsive
 *
 * Colours read the Design System (--inoforest-color-*) with fallbacks. The defaults sit in :where() blocks (no
 * specificity), so the Style tab controls, which set the same variables or properties on the widget, always win.
 */

/* 1. Defaults ------------------------------------------------------------------ */
:where(.inoforest-tabs) {
	--ino-tabs-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--ino-tabs-primary: var(--inoforest-color-primary, #0b7a75);
	--ino-tabs-heading: var(--inoforest-color-heading, #0d1b2a);
	--ino-tabs-text: var(--inoforest-color-text, #5a6a79);
	--ino-tabs-border: var(--inoforest-color-border, #e5ebef);
	--ino-tabs-justify: flex-start;
	--ino-tabs-grow: 0;
	--ino-tabs-gap: 10px;
	--ino-tabs-nav-space: 40px;
	--ino-tabs-line: transparent;
	--ino-tabs-tab-border: var(--ino-tabs-border);
	--ino-tabs-check-size: 22px;
	--ino-tabs-check-color: #fff;
	--ino-tabs-check-bg: var(--ino-tabs-primary);
	--ino-tabs-list-gap: 12px;
}

:where(.inoforest-tabs[data-look="underline"]) {
	--ino-tabs-gap: 28px;
	--ino-tabs-line: var(--ino-tabs-border);
	--ino-tabs-tab-border: transparent;
}

/* 2. Tab row and buttons ------------------------------------------------------------ */
.inoforest-tabs__nav {
	display: flex;
	flex-wrap: wrap;
	justify-content: var(--ino-tabs-justify);
	gap: var(--ino-tabs-gap);
	margin-bottom: var(--ino-tabs-nav-space);
	border-bottom: 1px solid var(--ino-tabs-line);
}

/* Two classes: out-rank the theme's and Elementor's button resets. */
.inoforest-tabs .inoforest-tabs__tab {
	display: inline-flex;
	flex-grow: var(--ino-tabs-grow);
	align-items: center;
	justify-content: center;
	gap: 3px;
	margin: 0;
	padding: 11px 24px;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.75;
	text-transform: none;
	letter-spacing: normal;
	color: var(--ino-tabs-heading);
	background-color: #fff;
	border: 1px solid var(--ino-tabs-tab-border);
	border-radius: 999px;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.3s var(--ino-tabs-ease), color 0.3s var(--ino-tabs-ease), border-color 0.3s var(--ino-tabs-ease), box-shadow 0.3s var(--ino-tabs-ease);
}

/* button + two classes: above the kit's button hover styles, below the Hover controls. */
.inoforest-tabs button.inoforest-tabs__tab:hover,
.inoforest-tabs button.inoforest-tabs__tab:focus {
	--ino-tabs-tab-border: var(--ino-tabs-primary);
	color: var(--ino-tabs-primary);
	background-color: #fff;
	box-shadow: none;
}

.inoforest-tabs .inoforest-tabs__tab:focus-visible {
	outline: 2px solid var(--ino-tabs-primary);
	outline-offset: 2px;
}

.inoforest-tabs button.inoforest-tabs__tab.is-active {
	--ino-tabs-tab-border: var(--ino-tabs-primary);
	color: #fff;
	background-color: var(--ino-tabs-primary);
}

/* Underline: no box, a 2 px line under the active tab (drawn with a shadow so the text does not move). */
.inoforest-tabs[data-look="underline"] .inoforest-tabs__tab {
	margin-bottom: -1px;
	padding: 12px 0;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: inset 0 -2px 0 transparent;
}

.inoforest-tabs[data-look="underline"] button.inoforest-tabs__tab:hover,
.inoforest-tabs[data-look="underline"] button.inoforest-tabs__tab:focus {
	background: none;
}

.inoforest-tabs[data-look="underline"] button.inoforest-tabs__tab.is-active {
	--ino-tabs-tab-border: var(--ino-tabs-primary);
	color: var(--ino-tabs-primary);
	background: none;
	box-shadow: inset 0 -2px 0 var(--ino-tabs-tab-border);
}

.inoforest-tabs__icon {
	display: inline-flex;
	line-height: 1;
}

.inoforest-tabs__icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* 3. Panels ------------------------------------------------------------------ */
.inoforest-tabs__panel {
	animation: ino-tabs-in 0.5s var(--ino-tabs-ease);
}

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

.inoforest-tabs__panel:focus {
	outline: 0;
}

.inoforest-tabs__panel:focus-visible {
	outline: 2px solid var(--ino-tabs-primary);
	outline-offset: 4px;
}

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

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

.inoforest-tabs .inoforest-tabs__intro {
	margin: 0 0 1rem;
	font-size: 1.125rem;
	line-height: 1.8;
	color: var(--ino-tabs-text);
}

.inoforest-tabs .inoforest-tabs__content {
	color: var(--ino-tabs-text);
}

.inoforest-tabs__content > :first-child {
	margin-top: 0;
}

.inoforest-tabs__content > :last-child {
	margin-bottom: 0;
}

.inoforest-tabs__content a {
	color: var(--ino-tabs-primary);
}

/* Check-mark lists: a round tick before each item instead of a bullet. */
.inoforest-tabs[data-check-lists] .inoforest-tabs__content ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.inoforest-tabs[data-check-lists] .inoforest-tabs__content li {
	position: relative;
	margin: 0 0 var(--ino-tabs-list-gap);
	padding-left: calc(var(--ino-tabs-check-size) + 10px);
	font-weight: 600;
	color: var(--ino-tabs-heading);
}

.inoforest-tabs[data-check-lists] .inoforest-tabs__content li::before {
	position: absolute;
	top: calc(0.875em - var(--ino-tabs-check-size) / 2);
	left: 0;
	width: var(--ino-tabs-check-size);
	height: var(--ino-tabs-check-size);
	content: "";
	background-color: var(--ino-tabs-check-bg);
	border-radius: 50%;
}

/* The tick, drawn by a mask so its colour is a variable; 64 % of the circle, as the design's icon. */
.inoforest-tabs[data-check-lists] .inoforest-tabs__content li::after {
	position: absolute;
	top: calc(0.875em - var(--ino-tabs-check-size) * 0.32);
	left: calc(var(--ino-tabs-check-size) * 0.18);
	width: calc(var(--ino-tabs-check-size) * 0.64);
	height: calc(var(--ino-tabs-check-size) * 0.64);
	content: "";
	background-color: var(--ino-tabs-check-color);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 15.172l9.192-9.193 1.415 1.414L10 18l-6.364-6.364 1.414-1.414z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 4. Editor hint, reduced motion, responsive ------------------------------------------- */
.inoforest-tabs__hint {
	margin: 0;
	padding: 16px;
	font-size: 0.85rem;
	text-align: center;
	border: 1px dashed currentColor;
	opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
	.inoforest-tabs .inoforest-tabs__tab {
		transition: none;
	}

	.inoforest-tabs__panel {
		animation: none;
	}
}

@media (max-width: 767px) {
	:where(.inoforest-tabs) {
		--ino-tabs-gap: 8px;
	}

	:where(.inoforest-tabs[data-look="underline"]) {
		--ino-tabs-gap: 22px;
	}

	.inoforest-tabs .inoforest-tabs__tab {
		padding: 9px 16px;
		font-size: 0.9rem;
	}

	.inoforest-tabs[data-look="underline"] .inoforest-tabs__tab {
		padding: 10px 0;
	}

	.inoforest-tabs .inoforest-tabs__content {
		font-size: 0.9375rem;
	}
}
