/**
 * Classic slot: trx shims and WPBakery/Elementor compatibility (owner X). Loaded on every page, last.
 *
 * 1. reCAPTCHA v3 badge hidden on every page (OliveOil's Additional CSS did this; Google's notice is
 *    printed by the contact form, agent P).
 * 2. WPBakery markup inside the article column (.revita-article) and the product description tab
 *    (FC-12): rows and columns without WPBakery's 15px gutters, the article's flow rhythm (block gap)
 *    inside .wpb_wrapper, the first paragraph as the lead, capped empty spaces, links in the design's
 *    colour, no full-width stretching or old-theme row backgrounds inside the article, and the
 *    design's heading font for vc_custom_heading even where WPBakery printed an inline font-family;
 *    lists in full-width text blocks hang as on site-next; 1em rhythm in the description tab; VC
 *    Extensions' timeline and cover slider adapted (fits the screen, brand colours, dot markers, focus
 *    ring). Scoped with :where() so the article and the slot rules of other agents (e.g. the About
 *    page, classic/pages.css) win without a fight.
 * 3. trx shortcode output (inc/shortcodes.php): sections, columns, titles, images, progress bars,
 *    medal/logo figures (boxes reserved before the lazy images load), card grids, map, video, social links.
 * 4. Elementor (post 3881) inside .revita-article: no boxed container or column padding, the design's
 *    text colour, font, rhythm and link underline instead of the kit's (#7A7A7A Roboto, no underline),
 *    the band H1 never hidden by the kit's h1.entry-title rule; empty blocks of old content not shown.
 * 5. WPBakery's per-page CSS on pages 57, 2359 and 2361 (h2{margin-top:0!important;margin-bottom:1em!important})
 *    countered for the theme's own h2s: the footer headings and the cart drawer's title.
 */

/* ------------------------------------------------------------------------
 * 1. reCAPTCHA badge
 * --------------------------------------------------------------------- */

.grecaptcha-badge {
	visibility: hidden;
}

/* ------------------------------------------------------------------------
 * 2. WPBakery in the article column and the product description tab
 * --------------------------------------------------------------------- */

/* Rows: no negative gutters (the top-level row keeps the constrained layout's auto margins). */
:where(.revita-article, .woocommerce-Tabs-panel--description) .vc_row {
	margin-left: 0;
	margin-right: 0;
}

/* Columns: no 15px padding, so the text column is the article column (760px at x 340 on 1440). */
:where(.revita-article, .woocommerce-Tabs-panel--description) .vc_column_container,
:where(.revita-article, .woocommerce-Tabs-panel--description) .vc_column_container > .vc_column-inner {
	padding-left: 0;
	padding-right: 0;
}

/* Rows with more than one column: the design's column gap between them (from 768px, where WPBakery
 * floats its columns side by side). */
@media (min-width: 768px) {
	:where(.revita-article, .woocommerce-Tabs-panel--description) .vc_row > .vc_column_container + .vc_column_container > .vc_column-inner {
		padding-left: var(--wp--preset--spacing--50);
	}

	:where(.revita-article, .woocommerce-Tabs-panel--description) .vc_row > .vc_col-sm-12 + .vc_col-sm-12 > .vc_column-inner {
		padding-left: 0;
	}
}

/* Flow rhythm inside WPBakery wrappers (columns and text blocks): the article's block gap between
 * blocks, no browser or WPBakery margins (17px paragraphs, 35px elements). In the product
 * description tab the blocks are 1em apart, as the plain description flow on site-next. */
:where(.revita-article, .woocommerce-Tabs-panel--description) .wpb_wrapper > * {
	margin-top: 0;
	margin-bottom: 0;
}

:where(.revita-article, .woocommerce-Tabs-panel--description) .wpb_wrapper > * + * {
	margin-top: var(--wp--style--block-gap, var(--wp--preset--spacing--40));
}

:where(.woocommerce-Tabs-panel--description) .wpb_wrapper > * + * {
	margin-top: 1em;
}

/* Lists in a full-width WPBakery text block hang like the design's lists: on site-next the list box
 * is the 760px text column plus its 40px indent, centred, so once the article is wider than 800px the
 * list reaches 20px past the column on both sides and its text starts 20px in (from 0 at ~800px to
 * 20px at ~840px viewport width; 100vw counts a desktop scrollbar, so that ramp is a few pixels early). */
.revita-article > .vc_row > .vc_col-sm-12 > .vc_column-inner > .wpb_wrapper > .wpb_text_column > .wpb_wrapper > :is(ul, ol) {
	margin-inline: calc(-1 * clamp(0px, (100vw - var(--wp--style--root--padding-left, 0px) - var(--wp--style--root--padding-right, 0px) - var(--wp--style--global--content-size, 760px)) / 2, 20px));
}

:where(.revita-article, .woocommerce-Tabs-panel--description) .wpb_content_element {
	margin-bottom: 0;
}

:where(.revita-article, .woocommerce-Tabs-panel--description) .wpb_wrapper > p:empty {
	display: none;
}

/* Headings in WPBakery text: the article's heading rhythm. */
:where(.revita-article) .wpb_wrapper > :is(h2, h3, h4):not(:first-child) {
	margin-top: var(--wp--preset--spacing--60);
	text-wrap: balance;
}

:where(.revita-article) .wpb_wrapper > :is(h2, h3, h4) + * {
	margin-top: var(--wp--preset--spacing--30);
}

/* The first paragraph of the article (first text block of the first row) is the lead, as
 * .revita-article > p:first-child is on site-next. */
.revita-article > .vc_row:first-child > .wpb_column:first-child > .vc_column-inner > .wpb_wrapper > :is(.wpb_text_column:first-child, .vc_empty_space:first-child + .wpb_text_column) > .wpb_wrapper > p:first-child {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.6;
}

/* Empty spaces: at most one block gap; none at the very top or bottom of a column. */
:where(.revita-article, .woocommerce-Tabs-panel--description) .vc_empty_space {
	max-height: var(--wp--style--block-gap, var(--wp--preset--spacing--40));
}

:where(.revita-article, .woocommerce-Tabs-panel--description) .wpb_wrapper > .vc_empty_space:is(:first-child, :last-child) {
	display: none;
}

:where(.revita-article, .woocommerce-Tabs-panel--description) .wpb_wrapper > .vc_empty_space:first-child + * {
	margin-top: 0;
}

/* Links coloured inline by the old theme (#6f2c91) take the design's link colour. */
:where(.revita-article, .woocommerce-Tabs-panel--description) a[style*="color"]:not(.wp-element-button) {
	color: var(--wp--preset--color--primary) !important;
}

:where(.revita-article, .woocommerce-Tabs-panel--description) a[style*="color"]:not(.wp-element-button):hover {
	color: var(--wp--preset--color--primary-deep) !important;
}

/* vc_custom_heading: the design's heading font. vc_templates/vc_custom_heading.php already prints no
 * font; this covers a heading WPBakery rendered with its own template (inline Abril Fatface). */
.vc_custom_heading[style*="font-family"] {
	font-family: var(--wp--preset--font-family--heading) !important;
	font-style: normal !important;
}

:is(h1, h2).vc_custom_heading[style*="font-weight"] {
	font-weight: 700 !important;
}

:is(h3, h4, h5, h6, p, div).vc_custom_heading[style*="font-weight"] {
	font-weight: 600 !important;
}

/* Full-width rows stay in the article column; old-theme row backgrounds (design options) are not
 * shown inside the article, so headings and text always keep the design's contrast. */
.revita-article .vc_row[data-vc-full-width] {
	left: auto !important;
	width: auto !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
}

.revita-article .vc_row-full-width {
	display: none;
}

.revita-article .vc_row[class*="vc_custom_"],
.revita-article .vc_column-inner[class*="vc_custom_"] {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
	background-color: transparent !important;
	background-image: none !important;
}

/* Several rows: section spacing between them. */
:where(.revita-article) > .vc_row ~ .vc_row {
	margin-block-start: var(--wp--preset--spacing--60);
}

:where(.revita-article) .vc_row-has-fill > .vc_column_container > .vc_column-inner,
:where(.revita-article) .vc_row-has-fill + .vc_row > .vc_column_container > .vc_column-inner {
	padding-top: 0;
}

/* VC Extensions' draggable timeline (demo page 239): its 13px text at the design's small size. */
.revita-article .cq-carouselcontent {
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
}

/* The plugin gives the drag handle z-index 999999 (with a transform), so its info box slid over the
 * sticky header (z-index 50) while the page scrolled past the timeline and took the clicks meant for
 * the menu. Its own stacking context keeps that z-index inside the timeline (finding X-re-1). */
.revita-article .cq-draggable-container {
	isolation: isolate;
}

/* The timeline (shown from 768px) centres its 324px info box on the drag handle, which travels from
 * the first dot to the very end of the bar, so up to ~920px the box ran past the screen edges
 * ("а децата" at the first position, the last one cut on the right): narrower there, the box fits at
 * both ends (from 768px on). */
@media (max-width: 940px) {
	.revita-article .cq-draggable-container {
		max-inline-size: calc(100% - 20rem);
		margin-inline: auto;
	}
}

/* Info box and title bar in the brand purple (the plugin's grey #aab2bd gave white text 2.14:1). */
.revita-article .cq-draggable-container .cq-infobox {
	border-color: var(--wp--preset--color--primary);
}

.revita-article .cq-draggable-container .cq-infobox::before {
	border-color: var(--wp--preset--color--primary) transparent;
}

.revita-article .cq-draggable-container .cq-infobox :is(.cq-titlecontainer, .cq-titlebar) {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
}

/* Timeline dots whose icon font is gone (OliveOil's fontello "icon-*" classes): a small deep-purple
 * hexagon in the honey circle instead of an empty circle. */
.revita-article .cq-highlight .fa[class*="icon-"]:empty::before {
	content: "";
	display: inline-block;
	inline-size: 0.9rem;
	block-size: 0.78rem;
	vertical-align: middle;
	background-color: var(--wp--preset--color--primary-deep);
	clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

/* The plugins' focusable slick lists (timeline, cover slider) and scrollbars: the design's focus ring
 * (slick's own CSS removes the outline, which left only the white band on a white page). */
.revita-article :is(.slick-list, .ps__scrollbar-x, .ps__scrollbar-y):focus-visible {
	outline: 2px solid var(--revita-focus, var(--wp--preset--color--primary-deep));
	outline-offset: 3px;
	box-shadow: 0 0 0 3px var(--revita-focus-ring, var(--wp--preset--color--base));
}

/* The cover slider's caption slider when the plugin emptied it (no captions): not shown, so its
 * zero-height slick list is no longer an invisible Tab stop. */
.revita-article .cq-coverslider-content:not(:has(.cq-coverslider-contentitem)) {
	display: none;
}

/* vc_btn printed by vc_templates/vc_btn.php: a design button in the rhythm. */
.revita-vc-btn .wp-block-button__width-100 .wp-block-button__link {
	inline-size: 100%;
}

/* ------------------------------------------------------------------------
 * 3. trx shortcodes (inc/shortcodes.php)
 * --------------------------------------------------------------------- */

/* Sections: optional narrower width (columns="2_3"), centred buttons in centred sections. */
@media (min-width: 782px) {
	.revita-trx-section[style*="--revita-trx-span"] {
		max-inline-size: var(--revita-trx-span);
		margin-inline: auto;
	}
}

.revita-trx-section__media {
	margin: 0 0 var(--wp--preset--spacing--20);
	line-height: 0;
}

.revita-trx-section.has-text-align-center > .revita-trx-section__media {
	text-align: center;
}

.revita-trx-section__icon,
.revita-trx-title__icon {
	inline-size: auto;
	max-block-size: 3.5rem;
}

.revita-trx-title__icon {
	display: block;
	margin-block-end: var(--wp--preset--spacing--20);
}

.revita-trx-title.has-text-align-center .revita-trx-title__icon {
	margin-inline: auto;
}

:is(.revita-trx-section, .revita-trx-column).has-text-align-center > .wp-block-buttons {
	justify-content: center;
}

/* Columns: margins="no" removes the gap; columns with a background get the design's card padding. */
.wp-block-columns.revita-trx-columns--no-gap {
	gap: 0;
}

.wp-block-column.revita-trx-column.has-background {
	padding: var(--wp--preset--spacing--40);
	border-radius: var(--wp--custom--radius--lg);
}

/* Images: a medal or icon alone in its column sits in the column's centre. */
.revita-trx-image {
	margin: 0;
}

.revita-trx-column > .revita-trx-image:only-child,
.revita-trx-column > .revita-trx-image:first-child:last-child {
	text-align: center;
}

.revita-trx-image img {
	block-size: auto;
	max-inline-size: 100%;
}

/* Progress bars ([trx_skills]): label and value above a honey bar on a lavender track. */
.revita-skills {
	max-inline-size: 32rem;
}

.revita-skills__title {
	margin-block: 0 var(--wp--preset--spacing--30);
	font-size: var(--wp--preset--font-size--large);
}

.revita-skills__list {
	display: grid;
	gap: var(--wp--preset--spacing--30);
}

.revita-skills__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1em;
	margin-block-end: 0.45em;
	color: var(--wp--preset--color--primary-deep);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.3;
}

.revita-skills__value {
	color: var(--wp--preset--color--primary);
	font-variant-numeric: tabular-nums;
}

.revita-skills__track {
	position: relative;
	block-size: 0.625rem;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--pill);
	background-color: var(--wp--preset--color--lavender);
}

.revita-skills__bar {
	display: block;
	block-size: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, var(--wp--preset--color--accent), var(--wp--preset--color--accent-deep));
}

@media (forced-colors: active) {
	.revita-skills__track {
		border: 1px solid CanvasText;
	}

	.revita-skills__bar {
		background: Highlight;
	}
}

/* Card grids and figure grids inside the article: no list-item spacing of the article's lists. */
.revita-article .revita-trx-grid > li + li {
	margin-block-start: 0;
}

/* Medals ([trx_team]) and logos ([trx_clients]): simple figures in a grid. */
.revita-trx-figures__list {
	--revita-trx-gap: var(--wp--preset--spacing--40);
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(max(min(8.5rem, 100%), calc((100% - (var(--revita-trx-gap) * (var(--revita-trx-columns, 4) - 1))) / var(--revita-trx-columns, 4))), 1fr));
	gap: var(--revita-trx-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.revita-trx-figure {
	margin: 0;
}

.revita-trx-figure__media {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	text-align: center;
}

/* The width/height attributes keep their box (aspect ratio) before the lazy image loads, so the grid
 * does not grow under the visitor; a medal taller than the cap is fitted inside that box. */
.revita-trx-figure__img {
	max-inline-size: 100%;
	max-block-size: 11rem;
	block-size: auto;
	object-fit: contain;
}

.revita-trx-figures--clients .revita-trx-figure__img {
	max-block-size: 8rem;
}

/* Certificate logos: centred rows of up to "columns" logos (6 in one row from 768px, 3 + 3 on
 * phones), so a short last row is centred instead of left-aligned. */
.revita-trx-figures--clients .revita-trx-figures__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

.revita-trx-figures--clients .revita-trx-figure {
	flex: 0 1 calc((100% - var(--revita-trx-gap) * (var(--revita-trx-columns, 4) - 1)) / var(--revita-trx-columns, 4));
	min-inline-size: min(6rem, 100%);
}

.revita-trx-figure__caption {
	margin: 0;
	color: var(--wp--preset--color--primary-deep);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.35;
}

.revita-trx-figure__caption a {
	color: inherit;
	text-decoration: none;
}

.revita-trx-figure__caption a:hover,
.revita-trx-figure__caption a:focus-visible {
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
}

/* Card grids ([trx_services], [trx_blogger]) inside an article: the grid's own top margin only. */
.revita-trx-services__image {
	margin: 0;
	text-align: center;
}

/* Map and video. */
.revita-trx-map {
	margin: 0;
}

.revita-trx-map iframe {
	display: block;
	inline-size: 100%;
	max-block-size: 80vh;
	border: 0;
	border-radius: var(--wp--custom--radius--md);
}

.revita-trx-video {
	margin: 0;
	overflow-wrap: break-word;
}

/* Responsive video frame (WordPress 7.1 core/embed CSS for the aspect ratios, scoped: the foundation's
 * core-blocks.css has no embed block CSS and WordPress 5.6's block library is not loaded). */
.revita-trx-video .wp-block-embed__wrapper {
	position: relative;
}

.revita-trx-video.wp-has-aspect-ratio .wp-block-embed__wrapper::before {
	content: "";
	display: block;
	padding-top: 56.25%;
}

.revita-trx-video.wp-embed-aspect-4-3 .wp-block-embed__wrapper::before {
	padding-top: 75%;
}

.revita-trx-video.wp-has-aspect-ratio iframe {
	position: absolute;
	inset: 0;
	inline-size: 100%;
	block-size: 100%;
	border: 0;
}

.revita-trx-video video {
	display: block;
	inline-size: 100%;
	border-radius: var(--wp--custom--radius--md);
}

/* Social links ([trx_socials]): the brand purple. */
.wp-block-social-links.revita-trx-socials .wp-social-link {
	color: var(--wp--preset--color--primary);
}

/* ------------------------------------------------------------------------
 * 4. Elementor inside the article (post 3881)
 * --------------------------------------------------------------------- */

:where(.revita-article) .elementor-section.elementor-section-boxed > .elementor-container {
	max-width: none;
}

:where(.revita-article) .elementor-column-gap-default > .elementor-column > .elementor-element-populated,
:where(.revita-article) .elementor-column > .elementor-widget-wrap {
	padding: 0;
}

:where(.revita-article) .elementor-widget:not(:last-child) {
	margin-bottom: var(--wp--style--block-gap, var(--wp--preset--spacing--40));
}

:where(.revita-article) :is(.elementor-widget-text-editor, .elementor-widget-heading .elementor-heading-title) {
	color: inherit;
	font-family: inherit;
	font-weight: inherit;
}

:where(.revita-article) .elementor-widget-heading .elementor-heading-title {
	color: var(--wp--preset--color--primary-deep);
	font-family: var(--wp--preset--font-family--heading);
}

:where(.revita-article) .elementor-widget-text-editor .elementor-widget-container > * {
	margin-top: 0;
	margin-bottom: 0;
}

:where(.revita-article) .elementor-widget-text-editor .elementor-widget-container > * + * {
	margin-top: var(--wp--style--block-gap, var(--wp--preset--spacing--40));
}

:where(.revita-article) .elementor-widget-text-editor .elementor-widget-container > style + * {
	margin-top: 0;
}

:where(.revita-article) .elementor-widget-text-editor .elementor-widget-container > :is(h2, h3, h4):not(:first-child) {
	margin-top: var(--wp--preset--spacing--60);
}

:where(.revita-article) .elementor-widget-text-editor .elementor-widget-container > :is(h2, h3, h4) + * {
	margin-top: var(--wp--preset--spacing--30);
}

/* The first paragraph of the first text widget is the article's lead. */
.revita-article > .elementor > :first-child .elementor-widget-text-editor:first-child .elementor-widget-container > p:first-of-type {
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.6;
}

:where(.revita-article) .elementor-widget-container > figure {
	margin-inline: 0;
}

:where(.revita-article) .elementor-widget-container figure img,
:where(.revita-article) .elementor-widget-container p > img {
	border-radius: var(--wp--custom--radius--md);
}

/* Content links keep the design's underline (1px, 2px on hover; the article's 45% underline colour
 * and offset apply): Elementor's ".elementor a{text-decoration:none}" left them told apart from the
 * text by colour only (#8f4899 on #2b2230, 2.59:1). */
.revita-article .elementor a:where(:not(.wp-element-button):not(.wp-block-button__link):not(.elementor-button)) {
	text-decoration-line: underline;
	text-decoration-thickness: 1px;
}

.revita-article .elementor a:where(:not(.wp-element-button):not(.wp-block-button__link):not(.elementor-button)):hover {
	text-decoration-thickness: 2px;
}

/* Empty blocks at the end of post 3881 (an empty paragraph in Elementor's text widget, an empty
 * preformatted block, a button without text, a gallery without images): hidden by classic/content.css
 * section 6, the single place for those rules. */

/* The kit's h1.entry-title{display:var(--page-title-display)} never hides the band's H1. */
.revita-page-header .revita-page-header__title.entry-title {
	display: block;
}

/* ------------------------------------------------------------------------
 * 5. Pages 57, 2359, 2361: WPBakery's per-page h2{margin-top:0!important;margin-bottom:1em!important}
 *    (body.revita-has-wpb-page-css, inc/compat.php): the theme's own h2s keep the design's margins.
 *    The About sections' h2s are restored by classic/pages.css (agent P); the content's h2s keep the
 *    page's rule.
 * --------------------------------------------------------------------- */

body.revita-has-wpb-page-css h2.wp-block-heading.revita-footer__heading {
	margin-top: 0 !important;
	margin-bottom: var(--wp--preset--spacing--30) !important;
}

/* The drawer title keeps the design's margin: 0 (blocks/woocommerce-mini-cart.css), not WPBakery's
 * h2 margins, so the item list starts right under the purple title bar. */
body.revita-has-wpb-page-css .wc-block-mini-cart__drawer h2.wc-block-mini-cart__title {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}
