/* Size the selectable host to its icon, including in existing saved blocks.
 * One class outranks the legacy :where(.local-*) 64px host default, while
 * authored local/global class rules can still override these defaults.
 *
 * Block themes that stretch every constrained-layout child to the content
 * width (e.g. Blocksy) sit at this same 0,1,0 and load after this file, so
 * they win the `width` tie on the front end and balloon the icon. That is
 * re-asserted late in wp_head by behold_blocks_print_svg_host_fix() so a
 * plain 0,1,0 rule wins it back, while still losing to a real authored
 * width printed later in the footer bundle. */
.b-svg-wrapper {
	display: flex;
	width: fit-content;
}

/* Keep standalone icons visible, but let Tabs/Accordion SVG rules win. */
:where(.b-svg-wrapper > svg) {
	display: block;
	width: 64px;
	height: auto;
	flex-grow: 1;
}

.b-accordion__icon svg [id="line-x"] {
	transform-box: view-box;
}

@media (prefers-reduced-motion: reduce) {
	.b-accordion__icon svg [id="line-x"] {
		transition-duration: 0.01ms !important;
		transition-delay: 0ms !important;
	}
}

/* Mobile layout is chosen by Tabs → Details. These rules constrain only
 * structure; colors, typography, spacing and borders stay in Global Styles.
 * The marker is also used by the editor's Mobile preview. */
.b-tabs[data-bhld-tabs-layout] {
	display: flex !important;
	flex-direction: column !important;
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
}
.b-tabs[data-bhld-tabs-layout] > .b-tabs__list {
	display: flex !important;
	flex-direction: row !important;
	flex-wrap: nowrap !important;
	justify-content: flex-start !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	box-sizing: border-box;
	overflow-x: auto !important;
	overflow-y: hidden !important;
	overscroll-behavior-x: contain;
	scrollbar-width: thin;
	align-self: stretch !important;
}
.b-tabs[data-bhld-tabs-layout] > .b-tabs__list > .b-tabs__tab {
	flex: 0 0 auto !important;
	width: auto !important;
	max-width: 100%;
	min-height: 44px;
	box-sizing: border-box;
}
/* The shipped Center / Side / Pills Tab Global Styles keep their centred
 * row on the mobile "scroll" layout instead of being pinned left by the
 * structural rule above. Auto margins on the end tabs centre the row while
 * it fits and collapse to zero once it overflows, so its start stays
 * reachable by horizontal scrolling (a plain justify-content:center would
 * clip it). Their design intent carries over; the Mobile Layout choice
 * (scroll / stacked / accordion) still decides the structure. */
:is(
	[data-bhld-global-class-instance="gci_7twxob2smtbftish"],
	[data-bhld-global-class-instance="gci_tabscenter01"],
	[data-bhld-global-class-instance="gci_tabsside0001"]
).b-tabs[data-bhld-tabs-layout="scroll"] > .b-tabs__list > .b-tabs__tab:first-child {
	margin-inline-start: auto !important;
}
:is(
	[data-bhld-global-class-instance="gci_7twxob2smtbftish"],
	[data-bhld-global-class-instance="gci_tabscenter01"],
	[data-bhld-global-class-instance="gci_tabsside0001"]
).b-tabs[data-bhld-tabs-layout="scroll"] > .b-tabs__list > .b-tabs__tab:last-child {
	margin-inline-end: auto !important;
}
/* Wide keeps its equal-fill tabs on mobile: they span the full width, so
 * there is nothing to scroll and no reason to shrink them to their content
 * the way the structural rule above otherwise forces. */
[data-bhld-global-class-instance="gci_tabswide0001"].b-tabs[data-bhld-tabs-layout="scroll"] > .b-tabs__list > .b-tabs__tab {
	flex: 1 1 0 !important;
	width: auto !important;
	min-width: 0;
	white-space: normal;
}
/* Center tabs intentionally switch content without animating the panel.
 * Keep this structural guarantee outside the editable preset CSS as well,
 * so previously saved blocks stop animating before they are saved again. */
[data-bhld-global-class-instance="gci_tabscenter01"].b-tabs[data-bhld-tabs-animation] > .b-tabs__panels > .b-tabs__panel[aria-hidden="false"] {
	animation: none !important;
}
.b-tabs[data-bhld-tabs-layout] > .b-tabs__panels {
	width: 100% !important;
	max-width: 100%;
	min-width: 0;
	flex-basis: auto !important;
}
.b-tabs[data-bhld-tabs-layout] > .b-tabs__panels > .b-tabs__panel {
	min-height: 0 !important;
	min-width: 0;
	max-width: 100%;
}
.b-tabs[data-bhld-tabs-layout="stacked"] > .b-tabs__list {
	flex-direction: column !important;
	overflow: visible !important;
}
.b-tabs[data-bhld-tabs-layout="stacked"] > .b-tabs__list > .b-tabs__tab,
.b-tabs[data-bhld-tabs-layout="accordion"] .b-tabs__heading > .b-tabs__tab {
	width: 100% !important;
	min-height: 44px;
	flex: 0 0 auto !important;
	white-space: normal;
	text-align: start;
}
.b-tabs[data-bhld-tabs-layout="accordion"] > .b-tabs__list[hidden] {
	display: none !important;
}
.b-tabs[data-bhld-tabs-layout="accordion"] > .b-tabs__panels {
	display: block !important;
}
.b-tabs[data-bhld-tabs-layout="accordion"] > .b-tabs__panels > .b-tabs__heading {
	margin: 0;
	padding: 0;
	font: inherit;
}
/* Dedicated disclosure icon; independent from SVGs inside tab labels. */
.b-tabs__accordion-icon {
	display: inline-flex;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	margin-inline-start: auto;
	align-self: center;
}
.b-tabs .b-tabs__tab .b-tabs__accordion-icon > svg {
	width: 100% !important;
	height: 100% !important;
	display: block;
	color: inherit;
}
.b-tabs .b-tabs__tab .b-tabs__accordion-icon svg {
	fill: currentColor !important;
}
.b-tabs .b-tabs__tab .b-tabs__accordion-icon svg [fill="none"] { fill: none !important; }
.b-tabs .b-tabs__tab .b-tabs__accordion-icon svg [fill="currentColor"] { fill: currentColor !important; }
.b-tabs__accordion-icon [id="line-x"] {
	transform: rotate(0deg);
	transform-origin: center;
	transform-box: view-box;
	transition: transform 0.3s ease-out;
}
.b-tabs__tab:is([aria-expanded="true"],[data-bhld-tabs-expanded="true"]) .b-tabs__accordion-icon [id="line-x"] {
	transform: rotate(90deg);
}
@media (prefers-reduced-motion: reduce) {
	.b-tabs__accordion-icon, .b-tabs__accordion-icon * {
		transition-duration: 0.01ms !important;
		transition-delay: 0ms !important;
		animation-duration: 0.01ms !important;
	}
}
/* Hidden must win against authored flex/grid display on panel classes. */
.b-tabs[data-bhld-tabs-ready] > .b-tabs__panels > .b-tabs__panel[hidden] {
	display: none !important;
}
/* Interleave the actual editable blocks visually. Do not move React-owned
 * nodes: their list order, selection, undo and editable contents stay intact. */
.b-tabs[data-bhld-tabs-editor][data-bhld-tabs-layout="accordion"] {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) !important;
	gap: 0 !important;
}
.b-tabs[data-bhld-tabs-editor][data-bhld-tabs-layout="accordion"] > .b-tabs__list,
.b-tabs[data-bhld-tabs-editor][data-bhld-tabs-layout="accordion"] > .b-tabs__panels {
	display: contents !important;
}
.b-tabs[data-bhld-tabs-editor][data-bhld-tabs-layout="accordion"] > .b-tabs__list > .b-tabs__tab,
.b-tabs[data-bhld-tabs-editor][data-bhld-tabs-layout="accordion"] > .b-tabs__panels > .b-tabs__panel {
	order: var(--bhld-tabs-order) !important;
	width: 100% !important;
}
