/** SMALLER THAN DESKTOP **/
@media (max-width: 1220px) {
	/* Sliders, image galleries and posts configured with 4 columns change like 2 columns */
	body .hi-slider:not(.is-vertical).columns-4:not(.hi-not-stacked-on-mobile),
	body figure.wp-block-gallery:not(.is-vertical).columns-4:not(.hi-not-stacked-on-mobile),
	body .wp-block-latest-posts.is-grid:not(.is-vertical).columns-4:not(.hi-not-stacked-on-mobile) {
		--hi-width-slider-slide: var(--hi-width-slider-2columns-slide);
		--hi-width-posts-post: var(--hi-width-posts-2columns-post);
		--hi-width-gallery-img: var(--hi-width-gallery-2columns-img);
		
		/* Remove current slide style in additionally slides that no longer displayed */
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide,
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide {
			opacity: var(--hi-opacity-slider-slide);
		}

		/* Change visible bullets for new number of slides displayed */
		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet) {
			display: block;
		}

		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):not(:nth-child(2n+1)):not(:nth-last-child(2)),
		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):nth-last-child(1) {
			display: none;
		}
	}
	
	/* Sliders, image galleries and posts configured with 5 or 6 columns change like 3 columns */
	body .hi-slider:not(.is-vertical).columns-5:not(.hi-not-stacked-on-mobile),
	body figure.wp-block-gallery:not(.is-vertical).columns-5:not(.hi-not-stacked-on-mobile),
	body .wp-block-latest-posts.is-grid:not(.is-vertical).columns-5:not(.hi-not-stacked-on-mobile),
	body .hi-slider:not(.is-vertical).columns-6:not(.hi-not-stacked-on-mobile),
	body figure.wp-block-gallery:not(.is-vertical).columns-6:not(.hi-not-stacked-on-mobile),
	body .wp-block-latest-posts.is-grid:not(.is-vertical).columns-6:not(.hi-not-stacked-on-mobile) {
		--hi-width-slider-slide: var(--hi-width-slider-3columns-slide);
		--hi-width-posts-post: var(--hi-width-posts-3columns-post);
		--hi-width-gallery-img: var(--hi-width-gallery-3columns-img);
		
		/* Remove current slide style in additionally slides that no longer displayed */
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide,
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide,
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide {
			opacity: var(--hi-opacity-slider-slide);
		}

		/* Change visible bullets for new number of slides displayed */
		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet) {
			display: block;
		}

		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):not(:nth-child(3n+1)):not(:nth-last-child(3)),
		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):nth-last-child(-n + 2) {
			display: none;
		}
	}
}

/** END SMALLER THAN DESKTOP **/

/** ONLY TABLET AND MOBILE **/
@media (max-width: 910px) {
	/* Sliders, image galleries and posts configured with columns change like 2 columns */
	body .hi-slider:not(.is-vertical)[class*="columns-"]:not(.columns-1):not(.hi-not-stacked-on-mobile),
	body figure.wp-block-gallery:not(.is-vertical)[class*="columns-"]:not(.columns-1):not(.hi-not-stacked-on-mobile),
	body .wp-block-latest-posts.is-grid:not(.is-vertical)[class*="columns-"]:not(.columns-1):not(.hi-not-stacked-on-mobile) {
		--hi-width-slider-slide: var(--hi-width-slider-2columns-slide);
		--hi-width-posts-post: var(--hi-width-posts-2columns-post);
		--hi-width-gallery-img: var(--hi-width-gallery-2columns-img);

		/* Remove current slide style in additionally slides that no longer displayed */
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide {
			opacity: var(--hi-opacity-slider-slide);
		}

		/* Change visible bullets for new number of slides displayed */
		&.hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile):not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet),
		&.wp-block-latest-posts[class*="columns-"]:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet) {
			display: block;
		}

		&.hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile):not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):not(:nth-child(2n+1)):not(:nth-last-child(2)),
		&.hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile):not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):nth-last-child(1),
		&.wp-block-latest-posts[class*="columns-"]:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):not(:nth-child(2n+1)):not(:nth-last-child(2)),
		&.wp-block-latest-posts[class*="columns-"]:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):nth-last-child(1) {
			display: none;
		}
	}
}

/** END ONLY TABLET AND MOBILE **/

/** ONLY MOBILE **/
@media (max-width: 600px) {
	/* remove columns in form fieldset on mobile */
	body fieldset,
	body fieldset > p:first-child:last-child:not(.hi-not-stacked-on-mobile) {
		flex-direction: column;
	}

	/* .wp-block-media-text stacked on mobile */
	body .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content:has(> .wp-block-group:first-child:last-child) {
		--hi-size-media-text-content: 1;
		margin-inline: auto;
	}

	/* .wp-block-media-text stacked on mobile */
	body .wp-block-buttons,
	body .wp-block-image,
	body .wp-block-gallery,
	body .wp-block-video,
	body .wp-block-embed,
	body .wp-block-audio,
	body .wp-block-pullquote,
	body .wp-block-code,
	body .wp-block-table,
	body .wp-block-riovizual-tablebuilder,
	body .wp-block-group,
	body .wp-block-cover .wp-block-cover__inner-container,
	body .wp-block-cover-image .wp-block-cover__inner-container,
	body .wp-block-columns,
	body .wp-block-details,
	body .wp-block-media-text,
	body .wp-block-media-text .wp-block-media-text__content,
	body .wp-block-latest-posts {
		&:not(.alignfull) .wp-block-media-text:not(.has-background) {
			&:not(.has-media-on-the-right) > .wp-block-media-text__content {
				padding-left: 0;
				padding-bottom: 0;
			}
			&.has-media-on-the-right > .wp-block-media-text__content {
				padding-right: 0;
				padding-bottom: 0;
			}
		}
	}

	/* Sliders, image galleries and posts no columns in mobile */
	body .hi-slider:not(.is-vertical)[class*="columns-"]:not(.hi-not-stacked-on-mobile),
	body figure.wp-block-gallery:not(.is-vertical)[class*="columns-"]:not(.hi-not-stacked-on-mobile),
	body .wp-block-latest-posts.is-grid:not(.is-vertical)[class*="columns-"]:not(.hi-not-stacked-on-mobile) {
		--hi-width-slider-slide: var(--hi-width-slider-1column-slide);
		--hi-width-posts-post: var(--hi-width-posts-1column-post);
		--hi-width-gallery-img: var(--hi-width-gallery-1column-img);

		/* Remove current slide style in additionally slides that no longer displayed */
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide {
			opacity: var(--hi-opacity-slider-slide);
		}

		/* Show all bullets */
		&.hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile):not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet),
		&.wp-block-latest-posts[class*="columns-"]:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet) {
			display: block !important;
		}
	}
}

/** END ONLY MOBILE **/

/** HEIGHT LIMITS **/
@media (max-height: 830px) {
	/* Vertical sliders, image galleries and posts configured with 4 columns change like 2 columns */
	body .hi-slider.is-vertical.columns-4:not(.hi-not-stacked-on-mobile),
	body figure.wp-block-gallery.is-vertical.columns-4:not(.hi-not-stacked-on-mobile),
	body .wp-block-latest-posts.is-grid.is-vertical.columns-4:not(.hi-not-stacked-on-mobile) {
		--hi-height-slider-slide: var(--hi-height-slider-2columns-slide);
		
		/* Remove current slide style in additionally slides that no longer displayed */
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide,
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide {
			opacity: var(--hi-opacity-slider-slide);
		}

		/* Change visible bullets for new number of slides displayed */
		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet) {
			display: block;
		}

		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):not(:nth-child(2n+1)):not(:nth-last-child(2)),
		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):nth-last-child(1) {
			display: none;
		}
	}
	
	/* Vertical sliders, image galleries and posts configured with 5 and 6 columns change like 3 columns */
	body .hi-slider.is-vertical.columns-5:not(.hi-not-stacked-on-mobile),
	body figure.wp-block-gallery.is-vertical.columns-5:not(.hi-not-stacked-on-mobile),
	body .wp-block-latest-posts.is-grid.is-vertical.columns-5:not(.hi-not-stacked-on-mobile),
	body .hi-slider.is-vertical.columns-6:not(.hi-not-stacked-on-mobile),
	body figure.wp-block-gallery.is-vertical.columns-6:not(.hi-not-stacked-on-mobile),
	body .wp-block-latest-posts.is-grid.is-vertical.columns-6:not(.hi-not-stacked-on-mobile) {
		--hi-height-slider-slide: var(--hi-height-slider-3columns-slide);
		
		/* Remove current slide style in additionally slides that no longer displayed */
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide,
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide,
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide + .hi-slider-slide {
			opacity: var(--hi-opacity-slider-slide);
		}

		/* Change visible bullets for new number of slides displayed */
		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet) {
			display: block;
		}

		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):not(:nth-child(3n+1)):not(:nth-last-child(3)),
		&:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):nth-last-child(-n + 2) {
			display: none;
		}
	}
}
@media (max-height: 560px) {
	/* Vertical sliders, image galleries and posts configured with columns change like 2 columns */
	body .hi-slider[class*="columns-"]:not(.columns-1):not(.hi-not-stacked-on-mobile).is-vertical,
	body figure.wp-block-gallery[class*="columns-"]:not(.columns-1):not(.hi-not-stacked-on-mobile).is-vertical,
	body .wp-block-latest-posts.is-grid[class*="columns-"]:not(.columns-1):not(.hi-not-stacked-on-mobile).is-vertical {
		--hi-height-slider-slide: var(--hi-height-slider-2columns-slide);

		/* Remove current slide style in additionally slides that no longer displayed */
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide + .hi-slider-slide {
			opacity: var(--hi-opacity-slider-slide);
		}

		/* Change visible bullets for new number of slides displayed */
		&.hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile):not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet),
		&.wp-block-latest-posts[class*="columns-"]:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet) {
			display: block;
		}

		&.hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile):not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):not(:nth-child(2n+1)):not(:nth-last-child(2)),
		&.hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile):not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):nth-last-child(1),
		&.wp-block-latest-posts[class*="columns-"]:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):not(:nth-child(2n+1)):not(:nth-last-child(2)),
		&.wp-block-latest-posts[class*="columns-"]:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet):nth-last-child(1) {
			display: none;
		}
	}
}
@media (max-height: 440px) {

	/* Vertical sliders, image galleries and posts configured with columns only show one */
	body .hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile).is-vertical,
	body figure.wp-block-gallery[class*="columns-"]:not(.hi-not-stacked-on-mobile).is-vertical,
	body .wp-block-latest-posts.is-grid[class*="columns-"]:not(.hi-not-stacked-on-mobile).is-vertical {
		--hi-height-slider-slide: var(--hi-height-slider-1column-slide);

		/* Remove current slide style in additionally slides that no longer displayed */
		& .hi-slider-slide.hi-slider-current + .hi-slider-slide {
			opacity: var(--hi-opacity-slider-slide);
		}

		/* Show all bullets */
		&.hi-slider[class*="columns-"]:not(.hi-not-stacked-on-mobile):not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet),
		&.wp-block-latest-posts[class*="columns-"]:not(.hi-is-rotative) .hi-slider-bullets > *:has(.hi-slider-bullet) {
			display: block !important;
		}
	}
}

/** END HEIGHT LIMITS **/