/**
 * Rezeta Blog Grid — front styles
 * Grid aligned: fixed image ratio + clamped title/excerpt heights.
 */

.rbg {
	--rbg-columns: 3;
	--rbg-image-ratio: 4 / 3;
	--rbg-cat-color: #2a9d8f;
	--rbg-title-lines: 3;
	--rbg-excerpt-lines: 3;
	--rbg-gap: 2.5rem;
	--rbg-text: #1a1a1a;
	--rbg-muted: #666666;
	--rbg-filter-bg: #ececec;
	--rbg-filter-active: #3a3a3a;
	--rbg-max: 1100px;

	box-sizing: border-box;
	width: 100%;
	max-width: var(--rbg-max);
	margin: 0 auto;
	padding: 2.5rem 1.25rem 3rem;
	color: var(--rbg-text);
	font-family: Georgia, "Times New Roman", Times, serif;
}

.rbg[data-columns="1"] { --rbg-columns: 1; }
.rbg[data-columns="2"] { --rbg-columns: 2; }
.rbg[data-columns="3"] { --rbg-columns: 3; }
.rbg[data-columns="4"] { --rbg-columns: 4; }

.rbg *,
.rbg *::before,
.rbg *::after {
	box-sizing: border-box;
}

.rbg__header {
	text-align: center;
	margin-bottom: 1.75rem;
}

.rbg__heading {
	margin: 0;
	font-size: clamp(2rem, 4vw, 2.75rem);
	font-weight: 700;
	letter-spacing: 0.01em;
	line-height: 1.15;
	color: var(--rbg-text);
}

.rbg__heading::after {
	content: "";
	display: block;
	width: 2.25rem;
	height: 2px;
	margin: 0.65rem auto 0;
	background: currentColor;
	opacity: 0.85;
}

.rbg__filters {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.65rem;
	margin: 0 0 2.25rem;
}

.rbg__filter {
	appearance: none;
	border: none;
	cursor: pointer;
	margin: 0;
	padding: 0.55rem 1.15rem;
	border-radius: 4px;
	background: var(--rbg-filter-bg);
	color: #333;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.2;
	transition: background 0.2s ease, color 0.2s ease;
}

.rbg__filter:hover {
	background: #dedede;
}

.rbg__filter.is-active,
.rbg__filter[aria-pressed="true"] {
	background: var(--rbg-filter-active);
	color: #fff;
}

.rbg__filter:focus-visible {
	outline: 2px solid var(--rbg-cat-color);
	outline-offset: 2px;
}

.rbg__grid {
	display: grid;
	grid-template-columns: repeat(var(--rbg-columns), minmax(0, 1fr));
	gap: var(--rbg-gap) 1.75rem;
	align-items: stretch;
}

.rbg.is-loading .rbg__grid {
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.rbg-card {
	display: flex;
	flex-direction: column;
	margin: 0;
	min-width: 0;
	background: transparent;
	text-align: center;
}

.rbg-card__media {
	display: block;
	width: 100%;
	aspect-ratio: var(--rbg-image-ratio, 4 / 3);
	overflow: hidden;
	background: #f0f0f0;
	text-decoration: none;
	border-radius: 6px;
	position: relative;
}

/* Override theme/Elementor `img { height: auto }` so cover fills the box */
.rbg .rbg-card__media img.rbg-card__img,
.rbg .rbg-card__media .rbg-card__placeholder {
	display: block !important;
	position: absolute !important;
	top: 0 !important;
	left: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	object-fit: cover !important;
	object-position: center center !important;
}

.rbg-card__placeholder {
	background: linear-gradient(135deg, #ececec 0%, #dcdcdc 100%);
}

.rbg-card__body {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 1 1 auto;
	padding-top: 1.1rem;
	min-height: 0;
}

.rbg-card__title {
	margin: 0 0 0.75rem;
	width: 100%;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.35;
	/* Fixed height = perfect horizontal alignment across the row */
	min-height: calc(1.35em * var(--rbg-title-lines));
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--rbg-title-lines);
	line-clamp: var(--rbg-title-lines);
	overflow: hidden;
}

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

.rbg-card__title a:hover {
	color: var(--rbg-cat-color);
}

.rbg-card__cat {
	display: inline-block;
	margin: 0 0 0.85rem;
	padding: 0.28rem 0.7rem;
	border-radius: 2px;
	background: var(--rbg-cat-color);
	color: #fff !important;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.2;
	text-transform: uppercase;
	text-decoration: none;
}

.rbg-card__cat:hover {
	filter: brightness(0.95);
	color: #fff !important;
}

.rbg-card__cat--empty {
	visibility: hidden;
}

.rbg-card__meta {
	list-style: none;
	margin: 0 0 0.85rem;
	padding: 0;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.35rem;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
	font-size: 0.8rem;
	color: var(--rbg-muted);
}

.rbg-card__meta-item {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin: 0;
	line-height: 1.3;
}

.rbg-card__icon {
	display: inline-flex;
	color: #888;
	flex-shrink: 0;
}

.rbg-card__excerpt {
	margin: 0 0 1rem;
	width: 100%;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--rbg-muted);
	min-height: calc(1.55em * var(--rbg-excerpt-lines));
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--rbg-excerpt-lines);
	line-clamp: var(--rbg-excerpt-lines);
	overflow: hidden;
}

.rbg-card__more {
	margin-top: auto;
	display: inline-block;
	padding-bottom: 1px;
	border-bottom: 1px solid currentColor;
	color: var(--rbg-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
	font-size: 0.9rem;
	font-weight: 500;
	text-decoration: none;
	line-height: 1.3;
}

.rbg-card__more:hover {
	color: var(--rbg-cat-color);
}

.rbg__empty {
	text-align: center;
	padding: 3rem 1rem;
	color: var(--rbg-muted);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.rbg__pagination-wrap {
	margin-top: 2.5rem;
}

.rbg__pagination {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.45rem;
}

.rbg__page {
	appearance: none;
	border: none;
	cursor: pointer;
	margin: 0;
	min-width: 2.35rem;
	height: 2.35rem;
	padding: 0 0.7rem;
	border-radius: 4px;
	background: var(--rbg-filter-bg);
	color: #333;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	transition: background 0.2s ease, color 0.2s ease;
}

.rbg__page:hover:not(:disabled):not(.is-active) {
	background: #dedede;
}

.rbg__page.is-active,
.rbg__page[aria-current="page"] {
	background: var(--rbg-filter-active);
	color: #fff;
	cursor: default;
}

.rbg__page:disabled {
	opacity: 0.4;
	cursor: not-allowed;
}

.rbg__page:focus-visible {
	outline: 2px solid var(--rbg-cat-color);
	outline-offset: 2px;
}

.rbg__page--prev,
.rbg__page--next {
	min-width: auto;
	padding: 0 0.9rem;
}

.rbg__page--ellipsis {
	background: transparent;
	cursor: default;
	min-width: 1.5rem;
	padding: 0;
	color: var(--rbg-muted);
	pointer-events: none;
}

.rbg.is-loading .rbg__pagination {
	opacity: 0.45;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.rbg__loading {
	text-align: center;
	padding: 1rem;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 0.875rem;
	color: var(--rbg-muted);
}

@media (max-width: 900px) {
	.rbg[data-columns="3"],
	.rbg[data-columns="4"] {
		--rbg-columns: 2;
	}

	.rbg {
		--rbg-gap: 2rem;
	}
}

@media (max-width: 560px) {
	.rbg[data-columns="2"],
	.rbg[data-columns="3"],
	.rbg[data-columns="4"] {
		--rbg-columns: 1;
	}

	.rbg {
		padding-left: 1rem;
		padding-right: 1rem;
	}

	.rbg__filters {
		gap: 0.5rem;
	}

	.rbg__filter {
		padding: 0.5rem 0.9rem;
		font-size: 0.8125rem;
	}

	.rbg__page-label {
		display: none;
	}

	.rbg__page--prev,
	.rbg__page--next {
		min-width: 2.35rem;
		padding: 0 0.7rem;
	}

	.rbg__pagination {
		gap: 0.35rem;
	}
}
