/*------------------------------------------------------------------
[ AB Posts — последните 2 или 4 поста в решетка 2×2 ]

Променливите (--ab-ps-*) идват inline от шорткода. Структурата е тук,
project-specific override-и отиват в css/ab_custom.css.

Картата е снимка (Featured image) в заоблена рамка вляво и текстова
част вдясно. Сиянието е външен box-shadow върху отделен слой под
рамката — не blur върху плътен блок и не радиален градиент (те не
проследяват контура на заобления правоъгълник).

Паралаксът е на .ab-ps__img, която е по-висока от рамката само когато
на корена стои .ab-ps--parallax — иначе кадрирането не се пипа.
------------------------------------------------------------------*/

.ab-ps {
	position: relative;
	width: 100%;
}

.ab-ps .ab-ps__grid {
	/* изрично, за да не зависи от глобалния reset на темата */
	box-sizing: border-box;
	width: 100%;
	max-width: var(--ab-ps-container, 1400px);
	margin: 0 auto;
	padding-left: 15px;
	padding-right: 15px;

	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: var(--ab-ps-gap-x, 56px);
	row-gap: var(--ab-ps-gap-y, 64px);
	align-items: start;
}

/* ── Карта ─────────────────────────────────────────────────────── */

.ab-ps__card {
	display: flex;
	align-items: flex-start;
	gap: var(--ab-ps-card-gap, 34px);
	min-width: 0;
	background: var(--ab-ps-card-bg, transparent);
	padding: var(--ab-ps-card-pad, 0px);
	border-radius: calc(var(--ab-ps-radius, 18px) + var(--ab-ps-card-pad, 0px));
}

/* ── Снимка ────────────────────────────────────────────────────── */

.ab-ps__figure {
	display: block;
	position: relative;
	flex: 0 0 var(--ab-ps-img-w, 45%);
	width: var(--ab-ps-img-w, 45%);
	max-width: var(--ab-ps-img-w, 45%);
	text-decoration: none;
}

/* Сиянието: външен box-shadow върху слой с формата на рамката */
.ab-ps__glow {
	position: absolute;
	inset: 0;
	border-radius: var(--ab-ps-radius, 18px);
	box-shadow: 0 0 var(--ab-ps-glow-size, 60px) calc(var(--ab-ps-glow-size, 60px) / 3) var(--ab-ps-glow, transparent);
	pointer-events: none;
	z-index: 0;
	transition: box-shadow 0.45s ease;
}

.ab-ps__frame {
	display: block;
	position: relative;
	z-index: 1;
	width: 100%;
	aspect-ratio: var(--ab-ps-ratio, 310 / 470);
	border-radius: var(--ab-ps-radius, 18px);
	overflow: hidden;
}

/* Safari: изолиран стекинг контекст + маска, за да не „изтича“
   съдържанието извън заоблянето при transform на детето */
.ab-ps__media {
	display: block;
	position: absolute;
	inset: 0;
	border-radius: inherit;
	overflow: hidden;
	isolation: isolate;
	-webkit-mask-image: -webkit-radial-gradient(white, black);
	transform: translateZ(0);
}

.ab-ps__img {
	display: block;
	position: absolute;
	inset: 0;
}

/* Паралакс: снимката е по-висока от рамката, за да има накъде да мърда */
.ab-ps--parallax .ab-ps__img {
	inset: -10% 0;
	will-change: transform;
}

.ab-ps__img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.25, 1);
}

.ab-ps--hover .ab-ps__card:hover .ab-ps__img img,
.ab-ps--hover .ab-ps__card:focus-within .ab-ps__img img {
	transform: scale(var(--ab-ps-zoom, 1.06));
}

/* Карта без главно изображение — рамката пази ритъма на решетката */
.ab-ps__card--noimg .ab-ps__frame {
	background: rgba(255, 255, 255, 0.03);
}

/* ── Текстова част ─────────────────────────────────────────────── */

.ab-ps__body {
	flex: 1 1 auto;
	min-width: 0;
	padding-top: 4px;
}

.ab-ps__label {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 14px;
	color: var(--ab-ps-label, #C39B63);
	font-size: var(--ab-ps-label-size, 14px);
	line-height: 1.2;
	letter-spacing: 0.04em;
}

.ab-ps__line {
	display: block;
	flex: 0 0 auto;
	width: var(--ab-ps-line-w, 46px);
	height: 1px;
	background: currentColor;
	opacity: 0.85;
}

.ab-ps__cat {
	display: block;
}

.ab-ps .ab-ps__title {
	margin: 0 0 18px;
	color: var(--ab-ps-title, #fff);
	font-size: var(--ab-ps-title-size, 30px);
	line-height: 1.22;
	/* темата прави h2/h3 главни букви — тук заглавията са както са в поста */
	text-transform: none;
	letter-spacing: 0;
}

.ab-ps .ab-ps__title a {
	color: inherit;
	text-decoration: none;
	background-image: linear-gradient(currentColor, currentColor);
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0 1px;
	transition: background-size 0.4s ease;
}

.ab-ps .ab-ps__title a:hover,
.ab-ps .ab-ps__title a:focus-visible {
	color: inherit;
	background-size: 100% 1px;
}

.ab-ps__excerpt {
	margin: 0;
	color: var(--ab-ps-text, rgba(255, 255, 255, 0.72));
	font-size: var(--ab-ps-text-size, 16px);
	line-height: 1.85;
}

/* ── Бутон ─────────────────────────────────────────────────────── */

.ab-ps .ab-ps__btn {
	display: inline-block;
	margin-top: 32px;
	padding: 14px 34px;
	border: 1px solid var(--ab-ps-btn, #C39B63);
	border-radius: 999px;
	color: var(--ab-ps-btn, #C39B63);
	background: transparent;
	font-size: 16px;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: uppercase;
	text-decoration: none;
	transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

.ab-ps .ab-ps__btn:hover,
.ab-ps .ab-ps__btn:focus-visible {
	background: var(--ab-ps-btn-bg, #C39B63);
	border-color: var(--ab-ps-btn-bg, #C39B63);
	color: var(--ab-ps-btn-hover, #241D1D);
	/* box-shadow: 0px 7px 20px 0px #b58753b3 !important;
        -webkit-box-shadow: 0px 7px 20px 0px #b58753b3 !important; */
	box-shadow: 0 0 24px rgba(195, 155, 99, 0.45);

}

/* ── Респонсив ─────────────────────────────────────────────────── */

@media (max-width: 1199px) {
	.ab-ps .ab-ps__grid {
		column-gap: calc(var(--ab-ps-gap-x, 56px) * 0.6);
	}
	.ab-ps__card {
		gap: calc(var(--ab-ps-card-gap, 34px) * 0.7);
	}
	.ab-ps .ab-ps__title {
		font-size: calc(var(--ab-ps-title-size, 30px) * 0.82);
	}
}

/* Под 992px картата се изправя: снимка отгоре, текст отдолу */
@media (max-width: 991px) {
	.ab-ps__card {
		flex-direction: column;
		gap: 24px;
	}
	.ab-ps__figure {
		flex: 0 0 auto;
		width: 100%;
		max-width: 100%;
	}
	.ab-ps__frame {
		aspect-ratio: 16 / 10;
	}
	.ab-ps .ab-ps__btn {
		margin-top: 24px;
	}
}

/* Под 767px — една колона */
@media (max-width: 767px) {
	.ab-ps .ab-ps__grid {
		grid-template-columns: minmax(0, 1fr);
		row-gap: calc(var(--ab-ps-gap-y, 64px) * 0.75);
	}
	.ab-ps .ab-ps__title {
		font-size: calc(var(--ab-ps-title-size, 30px) * 0.75);
	}
}

/* ── Достъпност / предпочитания ────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
	.ab-ps__img img,
	.ab-ps .ab-ps__btn,
	.ab-ps .ab-ps__title a,
	.ab-ps__glow {
		transition: none !important;
	}
	.ab-ps--parallax .ab-ps__img {
		inset: 0;
		transform: none !important;
	}
}
