/*
 * GD Section Tab widget
 */

/* Tab shape: left half, fixed-width middle, right half (mirrored) */
.gd-section-tab-bottom {
	--gd-section-tab-fill: var(--gd-white);
	display: flex;
	align-items: flex-end;
	justify-content: center;
	width: 100%;
	height: var(--gd-section-tab-height, 40px);
}

.gd-section-tab-bottom__segment {
	display: flex;
	align-items: flex-end;
	flex: 0 0 auto;
	height: var(--gd-section-tab-height, 40px);
}

.gd-section-tab-bottom__segment--middle {
	width: var(--gd-section-tab-width, 80px);
	height: 100%;
	background-color: var(--gd-white);
}

.gd-section-tab-bottom--color-blue {
	--gd-section-tab-fill: var(--gd-blue);
}

.gd-section-tab-bottom--color-blue .gd-section-tab-bottom__segment--middle {
	background-color: var(--gd-blue);
}

.gd-section-tab-bottom--color-grey {
	--gd-section-tab-fill: var(--gd-light-grey);
}

.gd-section-tab-bottom--color-grey .gd-section-tab-bottom__segment--middle {
	/* --gd-light-grey (#EAECE9) matches tab-half-grey.svg / tab-half-right-grey.svg
	 * exactly — --gd-grey (#e5e7eb) is a different, unrelated token used for
	 * borders/surfaces elsewhere and would not match the curve shapes. */
	background-color: var(--gd-light-grey);
}

.gd-section-tab-bottom--color-dark-blueish-grey {
	--gd-section-tab-fill: var(--gd-dark-blueish-grey);
}

.gd-section-tab-bottom--color-dark-blueish-grey .gd-section-tab-bottom__segment--middle {
	background-color: var(--gd-dark-blueish-grey);
}

/* Fill segments — invisible (zero width) in normal mode. In invert mode they
 * expand to fill all remaining space out to the container edges, painted
 * solid, the same technique GD Breadcrumb Row uses for its pattern segments. */
.gd-section-tab-bottom__segment--fill {
	flex: 0 0 0;
	width: 0;
	overflow: hidden;
}

.gd-section-tab-bottom--invert .gd-section-tab-bottom__segment--fill {
	flex: 1 1 0;
	width: auto;
	height: 100%;
	background-color: var(--gd-white);
}

.gd-section-tab-bottom--invert.gd-section-tab-bottom--color-blue .gd-section-tab-bottom__segment--fill {
	background-color: var(--gd-blue);
}

.gd-section-tab-bottom--invert.gd-section-tab-bottom--color-grey .gd-section-tab-bottom__segment--fill {
	background-color: var(--gd-light-grey);
}

.gd-section-tab-bottom--invert.gd-section-tab-bottom--color-dark-blueish-grey .gd-section-tab-bottom__segment--fill {
	background-color: var(--gd-dark-blueish-grey);
}

/* Invert mode: the middle opens up instead of being painted, revealing
 * whatever sits behind the widget (e.g. an image section). */
.gd-section-tab-bottom--invert .gd-section-tab-bottom__segment--middle {
	background-color: transparent;
}

/* Zero out Elementor's own widget wrappers, so dropping the widget anywhere
 * inside a container doesn't take up layout space or inherit its padding. */
.elementor-widget-immer_gd_section_tab,
.elementor-widget-immer_gd_section_tab .elementor-widget-container {
	height: 0;
	padding: 0;
	margin: 0;
	overflow: visible;
}

/* Zero-height anchor — takes up no space in the layout flow. The tab shape
 * is absolutely positioned within it and paints downward from this point,
 * ignoring the parent container's padding. */
.gd-section-tab-anchor {
	position: relative;
	height: 0;
	width: 100%;
	z-index: 20;
	pointer-events: none;
}

.gd-section-tab-anchor .gd-section-tab-bottom {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
}

/* Direction "up": tab sits above the seam (in the section that precedes it),
 * using the svgs as-is. */
.gd-section-tab-anchor .gd-section-tab-bottom.gd-section-tab-bottom--direction-up {
	top: auto;
	bottom: 0;
}

/* Direction "down": tab sits below the seam (in the section that follows it,
 * the default position). No position override needed here since that's the
 * base .gd-section-tab-bottom position above. */

/* The curve is an inline <svg> (viewBox 30x20, 3:2), so it paints together with
 * the rest of the tab instead of loading afterwards like an <img src> would.
 * Width follows the height so the aspect ratio holds at either height. */
.gd-section-tab-bottom__segment .gd-section-tab-bottom__shape-img {
	display: block;
	width: calc(var(--gd-section-tab-height, 40px) * 1.5);
	height: var(--gd-section-tab-height, 40px);
	fill: var(--gd-section-tab-fill);
}

/* Flip state is tracked via three independent CSS custom properties and
 * combined into one transform, so the invert toggle can flip the horizontal
 * axis on *both* sides without needing a rule for every direction/invert
 * combination:
 * --gd-tab-flip-x   -1 on the right segment's image (mirrors the shared
 *                   asset horizontally so it can serve as the right half)
 * --gd-tab-flip-y   -1 when direction is "down" (mirrors vertically)
 * --gd-tab-invert-x -1 in invert mode: the curve's "tall" edge must sit next
 *                   to the solid fill bar instead of next to the (now
 *                   transparent) middle, on both sides. */
.gd-section-tab-bottom__shape-img {
	--gd-tab-flip-x: 1;
	--gd-tab-flip-y: 1;
	--gd-tab-invert-x: 1;
	transform: scale(calc(var(--gd-tab-flip-x) * var(--gd-tab-invert-x)), var(--gd-tab-flip-y));
}

.gd-section-tab-bottom__shape-img--flipped {
	--gd-tab-flip-x: -1;
}

.gd-section-tab-bottom--direction-down .gd-section-tab-bottom__shape-img {
	--gd-tab-flip-y: -1;
}

.gd-section-tab-bottom--invert .gd-section-tab-bottom__shape-img {
	--gd-tab-invert-x: -1;
}
