/**
 * Villa Portfolio — front-end styles.
 *
 * Modern CSS (Grid, custom properties, aspect-ratio, logical properties).
 * No Bootstrap, Tailwind, or any external dependency.
 * RTL-compatible via CSS logical properties.
 */

/* =========================================================
   Custom Properties (overridable per-widget via Elementor)
   ========================================================= */

.vp-widget {
	--vp-col:            3;
	--vp-gap:            24px;
	--vp-img-radius:     0px;
	--vp-card-radius:    0px;
	--vp-accent:         #1a1a1a;
	--vp-accent-fg:      #ffffff;
	--vp-meta-size:      0.875rem;
	--vp-title-size:     1.15rem;
	--vp-btn-radius:     4px;
	--vp-transition:     0.25s ease;
}

/* =========================================================
   Grid
   ========================================================= */

.vp-grid {
	display: grid;
	grid-template-columns: repeat( var( --vp-col ), 1fr );
	gap: var( --vp-gap );
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Equal-height mode: stretch cards to fill the row */
.vp-grid--equal-height .vp-card {
	height: 100%;
	display: flex;
	flex-direction: column;
}

.vp-grid--equal-height .vp-card__content {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.vp-grid--equal-height .vp-card__button {
	margin-block-start: auto;
}

/* Empty state */
.vp-grid__empty {
	grid-column: 1 / -1;
	text-align: center;
	opacity: 0.65;
	padding-block: 2rem;
}

/* =========================================================
   Card
   ========================================================= */

.vp-card {
	position: relative;
	background: #fff;
	border-radius: var( --vp-card-radius );
	overflow: hidden;
	transition:
		transform var( --vp-transition ),
		box-shadow var( --vp-transition );
}

/* =========================================================
   Figure / Image
   ========================================================= */

.vp-card__figure {
	margin: 0;
	display: block;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background-color: #f0f0f0;
	border-radius: var( --vp-img-radius );
}

.vp-card__figure a {
	display: block;
	width: 100%;
	height: 100%;
}

.vp-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.vp-card:hover .vp-card__image {
	transform: scale( 1.05 );
}

/* =========================================================
   Card Content
   ========================================================= */

.vp-card__content {
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

/* Title */
.vp-card__title {
	margin: 0;
	font-size: var( --vp-title-size );
	line-height: 1.35;
}

.vp-card__title a {
	color: inherit;
	text-decoration: none;
}

.vp-card__title a:hover,
.vp-card__title a:focus-visible {
	text-decoration: underline;
}

/* Meta list */
.vp-card__meta {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	column-gap: 0;
	row-gap: 4px;
	font-size: var( --vp-meta-size );
	opacity: 0.75;
}

.vp-card__meta-item {
	display: inline-flex;
	align-items: center;
}

/* Bullet separator between meta items using ::before on non-first items */
.vp-card__meta-item + .vp-card__meta-item::before {
	content: "";
	display: inline-block;
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: currentColor;
	opacity: 0.45;
	margin-inline: 8px;
	flex-shrink: 0;
}

/* Read More button */
.vp-card__button {
	display: inline-block;
	margin-block-start: 8px;
	padding: 10px 18px;
	border-radius: var( --vp-btn-radius );
	background-color: var( --vp-accent );
	color: var( --vp-accent-fg );
	text-decoration: none;
	font-size: var( --vp-meta-size );
	align-self: flex-start;
	transition: opacity var( --vp-transition );
	line-height: 1.4;
}

.vp-card__button:hover,
.vp-card__button:focus-visible {
	opacity: 0.82;
	color: var( --vp-accent-fg );
}

/* =========================================================
   Filter Tabs
   ========================================================= */

.vp-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-block-end: 24px;
	padding: 0;
	list-style: none;
}

.vp-filter__button {
	cursor: pointer;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	background: transparent;
	padding: 7px 16px;
	border-radius: var( --vp-btn-radius );
	font-size: var( --vp-meta-size );
	line-height: 1.4;
	transition:
		background-color var( --vp-transition ),
		border-color var( --vp-transition ),
		color var( --vp-transition );
}

.vp-filter__button:hover {
	background-color: rgba( 0, 0, 0, 0.05 );
}

.vp-filter__button.is-active,
.vp-filter__button[aria-pressed="true"] {
	background-color: var( --vp-accent );
	border-color: var( --vp-accent );
	color: var( --vp-accent-fg );
}

/* =========================================================
   Meta Filters
   ========================================================= */

.vp-meta-filter {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 150px, 1fr ) );
	gap: 12px;
	align-items: end;
	margin-block-end: 24px;
}

.vp-meta-filter__field {
	display: grid;
	gap: 6px;
	min-width: 0;
}

.vp-meta-filter__label {
	font-size: 0.8rem;
	line-height: 1.4;
	opacity: 0.7;
}

.vp-meta-filter__select {
	width: 100%;
	min-height: 42px;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	border-radius: var( --vp-btn-radius );
	background: #fff;
	color: inherit;
	padding: 8px 12px;
	font: inherit;
	line-height: 1.4;
}

.vp-meta-filter__reset {
	min-height: 42px;
	cursor: pointer;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	border-radius: var( --vp-btn-radius );
	background: transparent;
	color: inherit;
	padding: 8px 16px;
	font: inherit;
	line-height: 1.4;
	transition: background-color var( --vp-transition );
}

.vp-meta-filter__reset:hover {
	background-color: rgba( 0, 0, 0, 0.05 );
}

/* =========================================================
   Numbered Pagination
   ========================================================= */

.vp-pagination {
	margin-block-start: 32px;
	display: flex;
	justify-content: center;
}

.vp-pagination__list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.vp-pagination__list a,
.vp-pagination__list span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 36px;
	height: 36px;
	padding-inline: 8px;
	border-radius: 4px;
	text-decoration: none;
	color: inherit;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	transition:
		background-color var( --vp-transition ),
		color var( --vp-transition );
}

.vp-pagination__list a:hover {
	background-color: rgba( 0, 0, 0, 0.05 );
}

.vp-pagination__list .current {
	background-color: var( --vp-accent );
	color: var( --vp-accent-fg );
	border-color: var( --vp-accent );
}

/* =========================================================
   Load More
   ========================================================= */

.vp-load-more {
	margin-block-start: 32px;
	display: flex;
	justify-content: center;
}

.vp-load-more__button {
	cursor: pointer;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	background: transparent;
	padding: 12px 32px;
	border-radius: 4px;
	font-size: 0.95rem;
	line-height: 1.4;
	transition: background-color var( --vp-transition );
}

.vp-load-more__button:hover {
	background-color: rgba( 0, 0, 0, 0.05 );
}

.vp-load-more__button[disabled] {
	opacity: 0.45;
	cursor: not-allowed;
}

.vp-load-more__button.is-loading {
	opacity: 0.7;
	cursor: wait;
}

/* =========================================================
   Breadcrumb
   ========================================================= */

.vp-breadcrumb {
	margin-block: 0 24px;
	font-size: 0.9rem;
	line-height: 1.5;
}

.vp-breadcrumb__list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.vp-breadcrumb__item {
	display: inline-flex;
	align-items: center;
	color: inherit;
	opacity: 0.75;
}

.vp-breadcrumb__item + .vp-breadcrumb__item::before {
	content: "/";
	margin-inline-end: 6px;
	opacity: 0.45;
}

.vp-breadcrumb__item[aria-current="page"] {
	opacity: 1;
}

.vp-breadcrumb a {
	color: inherit;
	text-decoration: none;
}

.vp-breadcrumb a:hover,
.vp-breadcrumb a:focus-visible {
	text-decoration: underline;
}

/* =========================================================
   Single Portfolio Shortcodes
   ========================================================= */

.vp-single-details {
	display: grid;
	grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	gap: 12px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.vp-single-auto-content {
	display: grid;
	gap: 28px;
	margin-block-start: 28px;
}

.vp-single-render > :first-child {
	margin-block-start: 0;
}

.vp-single-render > :last-child {
	margin-block-end: 0;
}

.vp-single-details__item {
	display: grid;
	gap: 4px;
	padding: 12px 0;
	border-bottom: 1px solid rgba( 0, 0, 0, 0.12 );
}

.vp-single-details__label {
	font-size: 0.82rem;
	line-height: 1.4;
	opacity: 0.65;
}

.vp-single-details__value {
	font-size: 1rem;
	line-height: 1.5;
	color: inherit;
}

.vp-single-gallery {
	display: grid;
	grid-template-columns: repeat( var( --vp-single-gallery-columns, 3 ), minmax( 0, 1fr ) );
	gap: 16px;
	margin: 0;
}

.vp-single-gallery__item {
	margin: 0;
	overflow: hidden;
	aspect-ratio: 4 / 3;
	background: #f0f0f0;
}

.vp-single-gallery__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* =========================================================
   Skeleton / Loading state
   ========================================================= */

.vp-card--skeleton .vp-card__figure {
	animation: vp-pulse 1.4s ease-in-out infinite;
	background: linear-gradient( 90deg, #e8e8e8 25%, #f4f4f4 50%, #e8e8e8 75% );
	background-size: 200% 100%;
}

@keyframes vp-pulse {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* =========================================================
   Responsive fallback
   (Elementor responsive controls override these via selectors,
    but these ensure sensible defaults when Elementor hasn't
    set a value yet or the widget is used outside Elementor.)
   ========================================================= */

@media ( max-width: 1024px ) {
	.vp-grid {
		grid-template-columns: repeat( 2, 1fr );
	}
}

@media ( max-width: 600px ) {
	.vp-grid {
		grid-template-columns: 1fr;
	}

	.vp-meta-filter {
		grid-template-columns: 1fr;
	}

	.vp-meta-filter__reset {
		width: 100%;
	}

	.vp-single-details,
	.vp-single-gallery {
		grid-template-columns: 1fr;
	}
}

/* =========================================================
   RTL
   (CSS logical properties handle most of it above.
    These rules cover cases that still need physical overrides.)
   ========================================================= */

[dir="rtl"] .vp-card__button {
	align-self: flex-end;
}
