.softextheme-pricing {
	margin-top: 3rem;
}

/* Period toggle */

.softextheme-pricing__toggle {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px;
	width: fit-content;
	max-width: 100%;
	margin: 0 auto 3rem;
	padding: 6px;
	background: var(--wp--preset--color--accent-5);
	border-radius: 999px;
}

.softextheme-pricing__toggle-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 22px;
	border: none;
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--contrast);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.softextheme-pricing__toggle-btn:hover {
	background: color-mix( in srgb, var(--softextheme-brand-red) 8%, transparent );
}

.softextheme-pricing__toggle-btn.is-active {
	background: var(--softextheme-brand-red);
	color: var( --sx-white );
	box-shadow: 0 2px 10px color-mix( in srgb, var(--softextheme-brand-red) 35%, transparent );
}

.softextheme-pricing__toggle-btn.is-active:hover {
	background: var(--softextheme-brand-red);
}

.softextheme-pricing__discount-badge {
	font-size: 0.75em;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	background: color-mix( in srgb, var(--softextheme-brand-red) 15%, transparent );
	color: var( --sx-brand-text );
}

.softextheme-pricing__toggle-btn.is-active .softextheme-pricing__discount-badge {
	background: rgba( 255, 255, 255, 0.25 );
	color: var( --sx-white );
}

/*
 * Separate cards, not one slab divided by hairlines.
 *
 * The plans used to share a single rounded surface with a 1px rule between
 * each: five plans read as one object cut into five, and at a glance the eye
 * had to find the rules before it could tell where one offer stopped and the
 * next began. Standing apart, each plan is its own thing to compare.
 *
 * The panel keeps only the layout now — every surface property moved onto the
 * cards, which is also what lets each one round its own corners.
 */
.softextheme-pricing__panel {
	display: grid;
	grid-template-columns: repeat( var( --softextheme-plan-count, 3 ), minmax( 0, 1fr ) );
	gap: 1.25rem;
}

@media ( max-width: 781px ) {
	.softextheme-pricing__panel {
		grid-template-columns: minmax( 0, 1fr );
		gap: 1rem;
	}
}

.softextheme-pricing__panel-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 4.5rem 1.75rem 2.5rem;
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--accent-6);
	border-radius: 20px;
	/* Clips the ribbon to the rounded top — it is pinned to the card's edges
	   and would otherwise square off the two corners it covers. */
	overflow: hidden;
	box-shadow: 0 2px 4px color-mix( in srgb, var(--wp--preset--color--contrast) 3%, transparent );
	transition:
		box-shadow var( --sx-transition-base ) var( --sx-ease ),
		transform var( --sx-transition-base ) var( --sx-ease );
}

@media ( hover: hover ) {
	.softextheme-pricing__panel-card:hover {
		transform: translateY( -3px );
		box-shadow: 0 12px 28px color-mix( in srgb, var(--wp--preset--color--contrast) 10%, transparent );
	}
}

/*
 * The recommended plan is the one card that should still be picked out at a
 * glance now that they all sit apart. It keeps its tint and its ribbon, and
 * takes the brand outline so the ribbon does not look stuck on top of a card
 * with nothing to do with it.
 */
.softextheme-pricing__panel-card.is-popular {
	background: color-mix( in srgb, var(--wp--preset--color--contrast) 4%, var(--wp--preset--color--base) );
	border-color: var( --softextheme-brand-red );
	box-shadow: 0 6px 18px color-mix( in srgb, var(--softextheme-brand-red) 14%, transparent );
}

.softextheme-pricing__ribbon {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	padding: 0.6rem 1rem;
	background: var(--softextheme-brand-red);
	color: var( --sx-white );
	text-align: center;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.8px;
}

.softextheme-pricing__title {
	margin: 0 0 1rem;
	font-size: 1.6rem;
	font-weight: 700;
}

/*
 * A qualifier that belongs to the name — "тільки для Базових версій". Two
 * lines are reserved whether or not a card has one, so a single qualifier
 * cannot knock that card's price and button out of line with the others.
 */
.softextheme-pricing__note {
	margin: -0.75rem 0 1rem;
	min-height: 2.4em;
	color: var( --sx-text-secondary );
	font-size: 0.8125rem;
	line-height: 1.2;
}

.softextheme-pricing__price {
	margin: 0;
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
}

.softextheme-pricing__price-amount {
	font-size: 2.8rem;
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: -0.02em;
	/* "1 600 грн" is one figure, not a number and a word on the next line. */
	white-space: nowrap;
}

/*
 * A plan priced by agreement carries a word where the others carry a figure,
 * and a word does not behave like one. "Індивідуально" at the figure's size is
 * wider than the card, and nowrap — which is there to keep "1 600" and "грн"
 * together — pushed it straight out through the side.
 *
 * So the word gets its own treatment: smaller, allowed to wrap, and allowed to
 * break as a last resort, since a single long word has nowhere else to go.
 */
.softextheme-pricing__panel-card[ data-price-text ] .softextheme-pricing__price-amount {
	font-size: 1.75rem;
	white-space: normal;
	overflow-wrap: break-word;
}

/* ---- Four or five plans in the row ---- */

@media ( min-width: 782px ) {
	/*
	 * Five fixed columns fit 1320px only in arithmetic. Let the row wrap
	 * instead: five across on a wide monitor, three then two on a laptop.
	 */
	.softextheme-pricing__panel.is-dense {
		grid-template-columns: repeat( auto-fit, minmax( 240px, 1fr ) );
	}

	.softextheme-pricing__panel.is-dense .softextheme-pricing__panel-card {
		padding: 4rem 1.75rem 2.25rem;
	}

	.softextheme-pricing__panel.is-dense .softextheme-pricing__title {
		font-size: 1.35rem;
	}

	.softextheme-pricing__panel.is-dense .softextheme-pricing__price-amount {
		font-size: 2.1rem;
	}

	/* Five across is the narrowest a card ever gets — 240px, so about 180px of
	   room once the padding is off. */
	.softextheme-pricing__panel.is-dense .softextheme-pricing__panel-card[ data-price-text ] .softextheme-pricing__price-amount {
		font-size: 1.5rem;
	}

	.softextheme-pricing__panel.is-dense .softextheme-pricing__cta {
		gap: 0.75rem;
		padding-left: 1.25rem;
		font-size: 0.85rem;
	}

	.softextheme-pricing__panel.is-dense .softextheme-pricing__features {
		font-size: 0.875rem;
	}
}

.softextheme-pricing__period-label {
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.6;
	margin: 6px 0 1.75rem;
}

.softextheme-pricing__cta {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	width: 100%;
	box-sizing: border-box;
	padding: 0.4rem 0.4rem 0.4rem 1.75rem;
	border-radius: 999px;
	background: color-mix( in srgb, var(--wp--preset--color--contrast) 6%, transparent );
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	font-weight: 600;
	font-size: 0.9rem;
	transition: background-color 0.15s ease, transform 0.15s ease;
}

/*
 * A plan with no URL renders as a <button> rather than a link, because it acts
 * instead of navigating. A button brings the browser's own styling with it — a
 * 2px outset border that reads as a bevel, and no inherited typeface — so the
 * defaults are cleared here and the rule above is left to draw it.
 *
 * This belongs to the component, not to any one page that uses it. It lived in
 * budget-config.css, which meant the buttons were only ever styled on the
 * budget configurator: anywhere else the block appeared, they came out
 * bevelled. Moving it here fixes every such page at once and stops the block
 * depending on a stylesheet it has nothing to do with.
 */
button.softextheme-pricing__cta {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
}

.softextheme-pricing__cta:hover {
	transform: translateY( -2px );
}

.softextheme-pricing__cta.is-filled {
	background: var(--softextheme-brand-red);
	color: var( --sx-white );
}

.softextheme-pricing__cta-arrow {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.4rem;
	height: 2.4rem;
	border-radius: 999px;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font-size: 1.1rem;
}

.softextheme-pricing__cta.is-filled .softextheme-pricing__cta-arrow {
	color: var( --sx-brand-text );
}

.softextheme-pricing__divider {
	height: 1px;
	margin: 2rem 0;
	background: color-mix( in srgb, currentColor 12%, transparent );
}

.softextheme-pricing__features {
	flex-grow: 1;
}

.softextheme-pricing__features :where(ul) {
	margin: 0;
}

.softextheme-pricing__features :where(li) {
	margin-top: 0.6rem;
}

.softextheme-pricing__features .is-style-checkmark-list li::marker {
	color: var( --sx-brand-text );
}

/* Comparison table */

.softextheme-pricing__compare {
	margin-top: 4.5rem;
	overflow-x: auto;
	background: var(--wp--preset--color--base);
	border-radius: 20px;
	box-shadow: 0 25px 50px color-mix( in srgb, var(--wp--preset--color--contrast) 6%, transparent );
	position: relative;
}

.softextheme-pricing__compare-table {
	width: 100%;
	min-width: 480px;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small);
}

.softextheme-pricing__compare-table th,
.softextheme-pricing__compare-table td {
	padding: 18px 24px;
	text-align: center;
	border-bottom: 1px solid var(--wp--preset--color--accent-6);
}

.softextheme-pricing__compare-table th[scope='row'] {
	text-align: left;
	font-weight: 400;
}

/*
 * The heading row stays in view while the table is read — twenty-one rows in,
 * a tick means nothing if the plan it belongs to has scrolled off the top.
 *
 * Which scrollport it pins to depends on the width, hence the two rules under
 * this one: a sticky cell sticks inside the nearest scrolling ancestor, and
 * this wrapper scrolls sideways on a phone.
 */
.softextheme-pricing__compare-table thead th {
	position: sticky;
	top: var( --sx-sticky-top );
	z-index: 2;
	font-weight: 700;
	/* Opaque: the rows travel underneath it. */
	background: color-mix( in srgb, var(--wp--preset--color--contrast) 4%, var(--wp--preset--color--base) );
	box-shadow: inset 0 -1px 0 var(--wp--preset--color--accent-6);
}

@media ( min-width: 1000px ) {
	/*
	 * Wide enough for the whole table, so nothing has to scroll sideways here.
	 * "clip" keeps the rounded corners without making this a scrollport, which
	 * leaves the page itself to pin the heading against.
	 */
	.softextheme-pricing__compare {
		overflow-x: clip;
	}

	/*
	 * Clear the admin bar. It is fixed over the top of the page for a logged-in
	 * editor, so a heading pinned at 0 arrives half under it — which reads as
	 * the heading sticking a moment too late. Below 783px WordPress stops
	 * fixing that bar, and below 1000px this table pins inside its own window
	 * anyway, so the offset belongs here and nowhere else.
	 */
	.softextheme-pricing__compare-table thead th {
		top: var( --sx-sticky-top );
	}
}

@media ( max-width: 999px ) {
	/*
	 * Here the table does scroll sideways, so the page can never pin anything
	 * inside it. It gets its own window instead — the heading pins to the top
	 * of that.
	 */
	.softextheme-pricing__compare {
		max-height: 70vh;
		overflow: auto;
		overscroll-behavior: contain;
	}
}

.softextheme-pricing__compare-table thead th:first-child {
	text-align: left;
}

.softextheme-pricing__compare-table tbody tr:last-child th,
.softextheme-pricing__compare-table tbody tr:last-child td {
	border-bottom: none;
}

.softextheme-pricing__compare-table tbody tr:nth-child(even):not(.softextheme-pricing__compare-group) {
	background: color-mix( in srgb, var(--wp--preset--color--contrast) 2%, transparent );
}

/* Section group headers within the comparison table */

.softextheme-pricing__compare-table .softextheme-pricing__compare-group th:first-child {
	position: static;
	text-align: left;
	background: transparent;
	padding: 28px 24px 8px;
	font-size: 1rem;
	font-weight: 700;
	box-shadow: none;
}

.softextheme-pricing__compare-group:first-child th {
	padding-top: 8px;
}

/* Included / not-included cell indicators */

.softextheme-pricing__compare-check {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border-radius: 999px;
	background: color-mix( in srgb, var(--wp--preset--color--contrast) 8%, transparent );
	color: var(--wp--preset--color--contrast);
	font-size: 0.85rem;
	line-height: 1;
}

.softextheme-pricing__compare-check.is-accent {
	background: var(--softextheme-brand-red);
	color: var( --sx-white );
}

.softextheme-pricing__compare-dash {
	color: color-mix( in srgb, currentColor 35%, transparent );
}

/* Sticky first column ("Можливості") so it stays visible while the plan columns scroll horizontally on narrow screens. */

.softextheme-pricing__compare-table th:first-child {
	position: sticky;
	left: 0;
	z-index: 2;
	background: var(--wp--preset--color--base);
	box-shadow: 2px 0 6px color-mix( in srgb, var(--wp--preset--color--contrast) 10%, transparent );
}

.softextheme-pricing__compare-table thead th:first-child {
	z-index: 3;
	background: color-mix( in srgb, var(--wp--preset--color--contrast) 4%, var(--wp--preset--color--base) );
}

.softextheme-pricing__compare-table tbody tr:nth-child(even) th:first-child {
	background: color-mix( in srgb, var(--wp--preset--color--contrast) 2%, var(--wp--preset--color--base) );
}
