/* ==========================================================================
   Rero Portfolio — scoped to .rero-pf so Astra/theme styles stay isolated.
   ========================================================================== */

.wp-block-rero-portfolio-showcase,
.wp-block-rero-portfolio-showcase.alignwide,
.wp-block-rero-portfolio-showcase.alignfull {
	max-width: none;
	width: 100%;
}

.wp-block-rero-portfolio-showcase.alignfull {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

.rero-pf {
	--rero-pf-ink: #1d283a;
	--rero-pf-white: #ffffff;
	--rero-pf-border: 2px solid #ffffff;
	--rero-pf-stack-max-w: 34rem;
	--rero-pf-stack-max-h: 42rem;
	--rero-pf-font-body: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
	--rero-pf-font-display: "Special Elite", Inter, serif;
	box-sizing: border-box;
	color: #ffffff;
	font-family: var(--rero-pf-font-body);
	isolation: isolate;
	width: 100%;
}

/* KA: Lortkipanidze for Georgian; Inter / Special Elite for Latin (see unicode-range). */
.rero-pf--ka {
	--rero-pf-font-body: Inter, Lortkipanidze, system-ui, sans-serif;
	--rero-pf-font-display: "Special Elite", Lortkipanidze, serif;
}

.rero-pf--ka,
.rero-pf--ka .rero-pf-desc,
.rero-pf--ka .rero-pf-desc p,
.rero-pf--ka .rero-pf-link,
.rero-pf--ka .rero-pf-empty,
.entry-content .rero-pf--ka,
.entry-content .rero-pf--ka .rero-pf-desc,
.entry-content .rero-pf--ka .rero-pf-desc p,
.entry-content .rero-pf--ka .rero-pf-link {
	font-family: Inter, Lortkipanidze, system-ui, sans-serif !important;
}

.rero-pf--ka .rero-pf-heading,
.rero-pf--ka .rero-pf-title,
.entry-content .rero-pf--ka .rero-pf-title {
	font-family: "Special Elite", Lortkipanidze, serif !important;
}

.rero-pf *,
.rero-pf *::before,
.rero-pf *::after {
	box-sizing: border-box;
}

.rero-pf,
.rero-pf h1,
.rero-pf h2,
.rero-pf h3,
.rero-pf h4,
.rero-pf h5,
.rero-pf h6,
.rero-pf p,
.rero-pf a,
.rero-pf span,
.rero-pf button,
.rero-pf li,
.rero-pf strong,
.rero-pf em,
.entry-content .rero-pf,
.entry-content .rero-pf h1,
.entry-content .rero-pf h2,
.entry-content .rero-pf h3,
.entry-content .rero-pf h4,
.entry-content .rero-pf p,
.entry-content .rero-pf a,
.ast-plain-container .rero-pf h1,
.ast-plain-container .rero-pf h2,
.ast-plain-container .rero-pf h3,
.ast-plain-container .rero-pf p,
.ast-plain-container .rero-pf a {
	color: #ffffff !important;
}

.rero-pf .rero-pf-title,
.entry-content .rero-pf .rero-pf-title,
.ast-plain-container .entry-content .rero-pf h3.rero-pf-title {
	color: #ffffff !important;
}

.rero-pf-hero {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 85vh;
	overflow: hidden;
	background: var(--rero-pf-ink);
}

.rero-pf-hero--image {
	isolation: isolate;
	box-sizing: border-box;
	min-height: 0;
	height: auto;
	padding-top: clamp(5rem, 12vw, 10rem);
	padding-bottom: clamp(2.5rem, 6vw, 5rem);
	padding-left: clamp(1.25rem, 4vw, 4rem);
	padding-right: clamp(1.25rem, 4vw, 4rem);
	background-color: var(--rero-pf-ink);
	background-image: var(--rero-pf-bg, url("https://rerodev.com/wp-content/uploads/2024/11/background.webp"));
	background-repeat: repeat;
	background-position: top center;
	background-size: auto;
	background-attachment: fixed;
}

.rero-pf-hero--image + .rero-pf-grid {
	padding-top: 0;
}

.rero-pf-hero-image {
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	max-width: 86rem;
	height: auto;
	margin: 0 auto;
	object-fit: contain;
}

.rero-pf-hero-video {
	display: block;
	width: 100%;
	height: 85vh;
	object-fit: contain;
	background: var(--rero-pf-ink);
}

.rero-pf-grid {
	position: relative;
	isolation: isolate;
	padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 4vw, 4rem) 6rem;
	overflow: hidden;
	background-color: var(--rero-pf-ink);
}

/* Viewport-locked so Chrome does not rasterize new tiles while you scroll. */
.rero-pf-grid::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	background-color: var(--rero-pf-ink);
	background-image: var(--rero-pf-bg, url("https://rerodev.com/wp-content/uploads/2024/11/background.webp"));
	background-repeat: repeat;
	background-position: top center;
	background-size: auto;
	background-attachment: fixed;
}

.rero-pf-heading,
.rero-pf-empty,
.rero-pf-project {
	position: relative;
	z-index: 1;
}

.rero-pf-heading {
	margin: 0 auto 2.5rem;
	max-width: 72rem;
	color: #ffffff !important;
	font-family: var(--rero-pf-font-display);
	font-size: clamp(1.8rem, 4vw, 3rem);
	font-weight: 400;
	letter-spacing: 0.02em;
	text-align: center;
}

.rero-pf-empty {
	margin: 0;
	color: #ffffff !important;
	text-align: center;
}

.rero-pf-project {
	display: grid;
	grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.2fr);
	gap: clamp(1.25rem, 3vw, 2.75rem);
	align-items: center;
	max-width: 86rem;
	margin: 0 auto 1.75rem;
	padding: clamp(0.6rem, 1.4vw, 1.05rem) clamp(1.25rem, 3vw, 2.25rem);
	border: var(--rero-pf-border);
	content-visibility: auto;
	contain-intrinsic-size: auto 32rem;
}

.rero-pf-copy {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
}

.rero-pf-title {
	margin: 0 0 1rem;
	color: #ffffff !important;
	font-family: var(--rero-pf-font-display);
	font-size: clamp(1.35rem, 2.4vw, 2rem);
	font-weight: 400;
	line-height: 1.25;
}

.rero-pf-desc,
.rero-pf-desc p {
	margin: 0;
	color: #ffffff !important;
	font-size: clamp(0.98rem, 1.35vw, 1.125rem);
	line-height: 1.65;
}

.rero-pf-desc p + p {
	margin-top: 0.85rem;
}

.rero-pf-link-wrap {
	margin: 1.25rem 0 0;
}

.rero-pf .rero-pf-link,
.entry-content .rero-pf a.rero-pf-link {
	display: inline-block;
	padding: 0.55rem 1.2rem;
	border: 2px solid #ffffff;
	border-radius: 999px;
	background: transparent;
	color: #ffffff !important;
	font-weight: 600;
	text-decoration: none;
}

.rero-pf .rero-pf-link:hover,
.rero-pf .rero-pf-link:focus-visible,
.entry-content .rero-pf a.rero-pf-link:hover {
	background: rgba(255, 255, 255, 0.12);
	color: #ffffff !important;
	box-shadow: 0 0 16px rgba(255, 255, 255, 0.45);
}

.rero-pf-media {
	position: relative;
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	align-content: center;
	gap: 0.4rem 0.65rem;
	padding: 0.85rem 1.1rem 1.15rem;
	box-sizing: border-box;
	overflow: visible;
}

.rero-pf-stack {
	position: relative;
	display: grid;
	place-items: center;
	width: fit-content;
	max-width: min(100%, var(--rero-pf-stack-max-w));
	margin: 0 auto;
	overflow: visible;
	perspective: 1400px;
	outline: none;
}

.rero-pf-stack.has-stack-frame {
	width: min(
		100%,
		var(--rero-pf-stack-max-w),
		calc((var(--rero-pf-stack-max-h) - 3.5rem) * var(--rero-cover-ratio))
	);
	aspect-ratio: var(--rero-cover-ratio);
}

.rero-pf-stack.has-stack-frame:not(.is-hydrated) .rero-pf-card:nth-child(1) {
	width: 100%;
	max-width: 100%;
	height: 100%;
}

.rero-pf-stack:focus-visible {
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45);
	border-radius: 4px;
}

.rero-pf-card {
	grid-area: 1 / 1;
	overflow: hidden;
	border: var(--rero-pf-border);
	background: #0b1220;
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
	transform-origin: center center;
	transition: transform 0.34s ease;
	box-sizing: border-box;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

.rero-pf-stack.is-no-motion .rero-pf-card {
	transition: none !important;
}

.rero-pf-stack.is-deck-next .rero-pf-card,
.rero-pf-stack.is-deck-prev .rero-pf-card {
	will-change: transform;
}

.rero-pf-card:nth-child(1),
.rero-pf-card:nth-child(2),
.rero-pf-card:nth-child(3) {
	width: fit-content;
	max-width: 100%;
	height: fit-content;
}

.rero-pf-card:nth-child(1) {
	z-index: 3;
	transform: rotate(-5deg);
}

.rero-pf-card:nth-child(2) {
	z-index: 2;
	transform: rotate(4deg) translate(10px, 8px) scale(0.96);
}

.rero-pf-card:nth-child(3) {
	z-index: 1;
	transform: rotate(-2deg) translate(-8px, 14px) scale(0.92);
}

.rero-pf-stack.is-deck-next .rero-pf-card:nth-child(1) {
	z-index: 1;
	transform: rotate(-2deg) translate(-8px, 14px) scale(0.92);
}

.rero-pf-stack.is-deck-next .rero-pf-card:nth-child(2) {
	z-index: 3;
	transform: rotate(-5deg);
}

.rero-pf-stack.is-deck-next .rero-pf-card:nth-child(3) {
	z-index: 2;
	transform: rotate(4deg) translate(10px, 8px) scale(0.96);
}

.rero-pf-stack.is-deck-prev .rero-pf-card:nth-child(1) {
	z-index: 2;
	transform: rotate(4deg) translate(10px, 8px) scale(0.96);
}

.rero-pf-stack.is-deck-prev .rero-pf-card:nth-child(2) {
	z-index: 1;
	transform: rotate(-2deg) translate(-8px, 14px) scale(0.92);
}

.rero-pf-stack.is-deck-prev .rero-pf-card:nth-child(3) {
	z-index: 3;
	transform: rotate(-5deg);
}

.rero-pf-card.is-empty {
	display: none;
}

.rero-pf-card-media {
	position: relative;
	display: block;
	width: fit-content;
	max-width: 100%;
	line-height: 0;
	background: transparent;
}

.rero-pf-video-controls {
	position: absolute;
	inset: auto 0 0;
	display: grid;
	grid-template-columns: 2.5rem 2.5rem minmax(2rem, 1fr) 2.5rem;
	align-items: center;
	gap: 0.3rem;
	padding: 0.35rem;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
	box-sizing: border-box;
	line-height: normal;
	z-index: 1;
}

.rero-pf-card:not(:first-child) .rero-pf-video-controls {
	display: none;
}

.rero-pf-video-button {
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 0;
	border-radius: 0.25rem;
	background: transparent;
	color: #fff;
	cursor: pointer;
}

.rero-pf-video-button svg {
	width: 1.35rem;
	height: 1.35rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.rero-pf-video-button:hover,
.rero-pf-video-button:focus-visible {
	background: rgba(255, 255, 255, 0.2);
}

.rero-pf-video-button:focus-visible,
.rero-pf-video-seek:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -2px;
}

.rero-pf-video-seek {
	width: 100%;
	min-width: 0;
	height: 2.5rem;
	margin: 0;
	appearance: none;
	-webkit-appearance: none;
	background: transparent;
	cursor: pointer;
}

.rero-pf-video-seek::-webkit-slider-runnable-track {
	height: 0.3rem;
	border-radius: 1rem;
	background: linear-gradient(to right, #fff var(--rero-video-progress, 0%), rgba(255, 255, 255, 0.45) var(--rero-video-progress, 0%));
}

.rero-pf-video-seek::-moz-range-track {
	height: 0.3rem;
	border-radius: 1rem;
	background: linear-gradient(to right, #fff var(--rero-video-progress, 0%), rgba(255, 255, 255, 0.45) var(--rero-video-progress, 0%));
}

.rero-pf-video-seek::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 0.85rem;
	height: 0.85rem;
	margin-top: -0.275rem;
	border: 0;
	border-radius: 50%;
	background: #fff;
}

.rero-pf-video-seek::-moz-range-thumb {
	width: 0.85rem;
	height: 0.85rem;
	border: 0;
	border-radius: 50%;
	background: #fff;
}

.rero-pf-video-seek:disabled {
	opacity: 0.5;
	cursor: default;
}

.rero-pf-card-media:fullscreen,
.rero-pf-card-media:-webkit-full-screen {
	display: grid;
	place-items: center;
	width: 100vw;
	height: 100vh;
	max-width: none;
	background: #000;
}

.rero-pf-card-media:fullscreen video,
.rero-pf-card-media:-webkit-full-screen video {
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

/* Non-cover: natural aspect ratio, border hugs the photo. */
.rero-pf-card-media img,
.rero-pf-card-media video {
	display: block;
	width: auto;
	height: auto;
	max-width: min(100%, var(--rero-pf-stack-max-w));
	max-height: calc(var(--rero-pf-stack-max-h) - 3.5rem);
	margin: 0;
	vertical-align: bottom;
	background: transparent;
}

/*
 * Cover only: same display size as the second gallery image,
 * letterboxed with a filled background inside the white border.
 * Uses the same max-width / max-height constraints as other images.
 */
.rero-pf-stack.has-cover-frame .rero-pf-card.is-cover-fit {
	width: min(
		100%,
		var(--rero-pf-stack-max-w),
		calc((var(--rero-pf-stack-max-h) - 3.5rem) * var(--rero-cover-ratio))
	);
	aspect-ratio: var(--rero-cover-ratio);
	height: auto;
	max-width: 100%;
	background: #0b1220;
}

.rero-pf-stack.has-cover-frame .rero-pf-card:nth-child(2).is-cover-fit,
.rero-pf-stack.has-cover-frame .rero-pf-card:nth-child(3).is-cover-fit {
	width: min(
		100%,
		var(--rero-pf-stack-max-w),
		calc((var(--rero-pf-stack-max-h) - 3.5rem) * var(--rero-cover-ratio))
	);
	aspect-ratio: var(--rero-cover-ratio);
	height: auto;
}

.rero-pf-stack.has-cover-frame .rero-pf-card.is-cover-fit .rero-pf-card-media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: #0b1220;
}

.rero-pf-stack.has-cover-frame .rero-pf-card.is-cover-fit .rero-pf-card-media img {
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	object-fit: contain;
	object-position: center;
	background: transparent;
}

.rero-pf-nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	appearance: none;
	-webkit-appearance: none;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #ffffff;
	line-height: 0;
	cursor: pointer;
	transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
	z-index: 5;
}

.rero-pf-nav-icon {
	display: block;
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	overflow: visible;
}

.rero-pf-nav:hover:not(:disabled),
.rero-pf-nav:focus-visible:not(:disabled) {
	background: rgba(255, 255, 255, 0.9);
	color: #000000;
	transform: scale(1.08);
}

.rero-pf-nav:disabled {
	opacity: 0.28;
	cursor: default;
}

.rero-pf-counter {
	display: none;
	grid-column: 1 / -1;
	margin: 0.15rem 0 0;
	color: #ffffff !important;
	font-size: 0.85rem;
	letter-spacing: 0.08em;
	text-align: center;
}

@media (max-width: 768px) {
	.rero-pf-hero,
	.rero-pf-hero-video {
		min-height: 56vh;
		height: 56vh;
	}

	.rero-pf-hero--image {
		min-height: 0;
		height: auto;
	}

	.rero-pf-hero-image {
		width: 100%;
		max-width: 86rem;
		height: auto;
	}

	.rero-pf-project {
		grid-template-columns: 1fr;
		padding: 0.75rem 0.9rem 1rem;
		margin-bottom: 1.25rem;
	}

	.rero-pf-media {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"stack"
			"count";
		padding: 0.5rem 0.15rem 0.85rem;
	}

	.rero-pf-stack {
		grid-area: stack;
		max-width: min(90%, var(--rero-pf-stack-max-w));
	}

	.rero-pf-counter {
		grid-area: count;
	}

	.rero-pf-nav {
		grid-area: stack;
		z-index: 8;
		display: flex;
		align-items: center;
		justify-content: center;
		align-self: center;
		width: 38px;
		height: 38px;
	}

	.rero-pf-nav--prev {
		justify-self: start;
	}

	.rero-pf-nav--next {
		justify-self: end;
	}

	.rero-pf {
		--rero-pf-stack-max-w: 34rem;
		--rero-pf-stack-max-h: 36rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rero-pf-card {
		transition: none;
	}
}

/* Astra footer: same textured fill as the portfolio grid on portfolio pages. */
body.has-rero-portfolio .site-footer,
body.has-rero-portfolio .site-footer .site-above-footer-wrap,
body.has-rero-portfolio .site-footer .site-primary-footer-wrap,
body.has-rero-portfolio .site-footer .ast-builder-grid-row-container,
body.has-rero-portfolio .site-footer .ast-builder-grid-row-container-inner {
	background-color: var(--rero-pf-ink, #1d283a) !important;
	background-image: var(--rero-pf-bg, url("https://rerodev.com/wp-content/uploads/2024/11/background.webp")) !important;
	background-repeat: repeat !important;
	background-position: top center !important;
	background-size: auto !important;
	background-attachment: fixed !important;
}

/* Keep below-footer on the theme solid color — no portfolio texture. */
body.has-rero-portfolio .site-footer .site-below-footer-wrap,
body.has-rero-portfolio .site-footer .site-below-footer-wrap .ast-builder-grid-row-container,
body.has-rero-portfolio .site-footer .site-below-footer-wrap .ast-builder-grid-row-container-inner {
	background-color: var(--ast-global-color-5) !important;
	background-image: none !important;
	background-attachment: scroll !important;
}

