@import "./variables-main";

/*
 * Visual Portfolio main style.
 */
.vp-portfolio {
	position: relative;
	box-sizing: border-box;
	min-height: var(--vp-wrap__min-height);
	overflow-wrap: break-word;

	*,
	*::before,
	*::after {
		box-sizing: inherit;
	}

	// Fixes Swiper box-sizing conflict.
	// https://github.com/nk-crew/visual-portfolio/issues/147
	.swiper-wrapper {
		box-sizing: inherit;
	}
}

.vp-portfolio__items {
	transition: var(--vp-transition-duration) height var(--vp-transition-easing), var(--vp-transition-duration) transform var(--vp-transition-easing);
}

.vp-portfolio::after,
.vp-portfolio__items::after {
	display: block;
	clear: both;
	content: "";
}

.vp-portfolio__items-wrap,
.vp-portfolio__thumbnails-wrap,
.vp-portfolio__filter-wrap,
.vp-portfolio__sort-wrap,
.vp-portfolio__pagination-wrap,
.vp-portfolio__item {
	position: relative;
	overflow: hidden;
}

.vp-portfolio__items-wrap,
.vp-portfolio__thumbnails-wrap,
.vp-portfolio__layout-elements {
	margin-bottom: var(--vp-elements__gap);
	visibility: hidden;
	opacity: 0;
	transition: var(--vp-transition-duration) opacity, var(--vp-transition-duration) visibility;
}

.vp-portfolio > :last-child {
	margin-bottom: 0;
}

.vp-portfolio__item-wrap {
	position: relative;
	float: left;
	width: 33.333%;
}

// icons.
.vp-svg-icon {
	display: inline-block;
	width: 1em;
	height: 1em;
	overflow: visible;
	font-size: inherit;
	vertical-align: -0.125em;
}

// screen readers only.
.vp-screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	word-break: normal;
	word-wrap: normal !important;
	border: 0;

	&:focus {
		top: 5px;
		right: 5px;
		z-index: 100000;
		display: block;
		width: auto;
		height: auto;
		padding: 15px 23px 14px;
		clip: auto !important;
		clip-path: none;
		font-size: 14px;
		font-size: 0.875rem;
		font-weight: 700;
		line-height: normal;
		color: var(--vp-color-brand);
		text-decoration: none;
		background-color: #f1f1f1;
		border-radius: 3px;
		box-shadow: 0 0 2px 2px rgba(0, 0, 0, 60%);
	}
}

// fix for default themes styles.
[data-vp-layout]:not([data-vp-layout="slider"]) .vp-portfolio__item-wrap {
	padding: 0 !important;
	margin: 0 !important;
}

[data-vp-layout="slider"] .vp-portfolio__item-wrap {
	// In some plugins there is a style with `display: flex`, which breaks our items.
	display: block;
	float: none;
	padding: 0 !important;
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

// Keep horizontal margin reset only before Swiper initialization.
// Swiper controls slide gap via inline `margin-left`/`margin-right` depending on direction.
[data-vp-layout="slider"] .vp-portfolio__item-wrap:not(.swiper-slide) {
	margin-left: 0 !important;
}

.vp-portfolio__item .vp-portfolio__item-img img,
.vp-portfolio__item .vp-portfolio__item-img a,
.vp-portfolio__item .vp-portfolio__thumbnail-img img {
	display: block;
	width: 100%;
	height: auto;
}

.vp-portfolio__item-img,
.vp-portfolio__thumbnail-img {
	position: relative;
}

// Fix conflict with such theme styles:
// a { position: relative; }
// https://wordpress.org/support/topic/gallery-images-grey/
.vp-portfolio__item .vp-portfolio__item-img a {
	position: unset;
}

// layout elements
.vp-portfolio__layout-elements {
	display: flex;
	flex-wrap: wrap;
	gap: var(--vp-elements__gap);

	&-align-left {
		justify-content: flex-start;
	}

	&-align-center {
		justify-content: center;
	}

	&-align-right {
		justify-content: flex-end;
	}

	&-align-between {
		justify-content: space-between;
	}
}

// Fix custom theme styles for figures
.vp-portfolio figure.vp-portfolio__item {
	display: block;
	margin: 0;
}

[class^="wp-block-"]:not(.wp-block-gallery) figcaption.vp-portfolio__item-meta,
.vp-portfolio figcaption.vp-portfolio__item-meta {
	margin-bottom: 0;
	font-style: inherit;
}

// Preloader
.vp-portfolio__preloader-wrap {
	visibility: visible;
	opacity: 1;
	transition: var(--vp-transition-duration) opacity, var(--vp-transition-duration) visibility;
}

.vp-portfolio__preloader {
	position: absolute;
	left: 50%;
	width: 20px;
	height: 20px;
	margin-top: 45px;
	margin-left: -10px;

	svg,
	img {
		display: block;
		width: 100%;
		height: 100%;
		border-radius: 20px;
	}

	&::after {
		position: absolute;
		top: -2px;
		left: -2px;
		display: block;
		width: 24px;
		height: 24px;
		text-indent: -9999em;
		content: "";
		border: 1px solid rgba(#000, 0.2);
		border-left: 1px solid #000;
		border-radius: 50%;
		animation: vp-preloader-spinner 0.3s infinite linear;
	}
}

@keyframes vp-preloader-spinner {
	100% {
		transform: rotate(360deg);
	}
}

// On loaded portfolio
.vp-portfolio.vp-portfolio__ready {
	min-height: initial;

	.vp-portfolio__items-wrap,
	.vp-portfolio__thumbnails-wrap,
	.vp-portfolio__layout-elements {
		visibility: visible;
		opacity: 1;
	}

	.vp-portfolio__preloader-wrap {
		visibility: hidden;
		opacity: 0;

		.vp-portfolio__preloader {
			animation: none;
		}
	}
}

.vp-portfolio__layout-elements__ready {
	visibility: visible;
	opacity: 1;
}

.vp-single-filter.vp-single-filter__ready {
	.vp-portfolio__filter-wrap {
		visibility: visible;
		opacity: 1;
	}
}

.vp-single-sort.vp-single-sort__ready {
	.vp-portfolio__sort-wrap {
		visibility: visible;
		opacity: 1;
	}
}

// Loading
.vp-portfolio.vp-portfolio__loading .vp-portfolio__layout-elements {
	opacity: 0.5;
}

// Popup Galleries
.vp-portfolio__item-popup {
	display: none;
}

// loading spinner.
.vp-spinner {
	position: relative;
	display: block;
	width: var(--vp-spinner__size);
	height: var(--vp-spinner__size);
	text-indent: -9999em;
	border: var(--vp-spinner__border-size) solid transparent;
	border-left: var(--vp-spinner__border-size) solid var(--vp-spinner__color);
	border-radius: 50%;
	animation: vp-spinner var(--vp-spinner__speed) infinite linear;

	&::after {
		position: absolute;
		top: calc(-1 * var(--vp-spinner__border-size));
		right: calc(-1 * var(--vp-spinner__border-size));
		bottom: calc(-1 * var(--vp-spinner__border-size));
		left: calc(-1 * var(--vp-spinner__border-size));
		display: block;
		content: "";
		border: var(--vp-spinner__border-size) solid var(--vp-spinner--background__color);
		border-radius: 50%;
		opacity: var(--vp-spinner--background__opacity);
	}
}
@keyframes vp-spinner {
	100% {
		transform: rotate(360deg);
	}
}
