/**
 * POPM Portfolio Grid — frontend styles.
 * Every rule is scoped under .popm-portfolio so nothing leaks into the
 * theme, Elementor, the pricing widget, or other widgets. Colors/sizes are
 * CSS variables overridden per-instance by Elementor Style controls.
 * Defaults match popitoutmedia.com: purple #7900C2, yellow is reserved for
 * the pricing badge, black/white/grey, Inter inherited (no webfont loaded).
 */

.popm-portfolio {

	background: var(--popm-bg, #ffffff);
	font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	padding: 80px 20px;
	box-sizing: border-box;
}

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

.popm-portfolio [hidden] { display: none !important; }

.popm-portfolio__inner {
	max-width: var(--popm-max-width, 1180px);
	margin-inline: auto;
}

/* ---------- Header ---------- */
.popm-portfolio__Header {
	text-align: center;
	max-width: 760px;
	margin: 0 auto 30px;
}

.popm-portfolio__title {
	color: var(--popm-heading, #000000);
	font-size: 42px;
	line-height: 1.12;
	font-weight: 800;
	letter-spacing: -0.02em;
	margin: 0 0 12px;
}

.popm-portfolio__subtitle,
.popm-portfolio__subtitle p {
	color: var(--popm-muted, #4b4b4b);
	font-size: 17.5px;
	line-height: 1.6;
	margin: 0;
}

/* ---------- Filter tabs ---------- */
.popm-filters {
	display: flex;
	flex-wrap: wrap;
	gap: var(--popm-tab-gap, 8px);
	justify-content: center;
	margin: 0 auto 30px;
	max-width: 100%;
}

.popm-filters button {
	appearance: none;
	font: inherit;
	font-size: 15px;
	font-weight: 650;
	line-height: 1.3;
	color: var(--popm-tab-text, #000000);
	background: var(--popm-tab-bg, #f2f2f2);
	border: 1.5px solid var(--popm-tab-border, #e5e5e5);
	border-radius: var(--popm-tab-radius, 50px);
	padding: 11px 20px;
	min-height: 46px;
	cursor: pointer;
	white-space: nowrap;
	transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.popm-filters button:hover { border-color: var(--popm-tab-active-bg, #7900c2); }

.popm-filters button.is-active,
.popm-filters button[aria-selected="true"] {
	background: var(--popm-tab-active-bg, #7900c2);
	color: var(--popm-tab-active-text, #ffffff);
	border-color: var(--popm-tab-active-bg, #7900c2);
	text-decoration: underline;
	text-underline-offset: 4px;
	text-decoration-thickness: 2px;
}

.popm-filters button:focus-visible,
.popm-load-more:focus-visible,
.popm-carousel-btn:focus-visible,
.popm-carousel-dot:focus-visible,
.popm-media-trigger:focus-visible,
.popm-modal__close:focus-visible,
.popm-card__link:focus-visible {
	outline: 3px solid var(--popm-tab-active-bg, #7900c2);
	outline-offset: 3px;
}

/* ---------- Grid & cards ---------- */
.popm-grid {
	display: grid;
	grid-template-columns: repeat(var(--popm-cols, 3), minmax(0, 1fr));
	column-gap: var(--popm-gap-x, 22px);
	row-gap: var(--popm-gap-y, 26px);
	grid-auto-rows: auto;
	align-items: start;
}

.popm-card {
	background: var(--popm-card-bg, rgba(255, 255, 255, 0));
	border: 1px solid var(--popm-card-border, rgba(0, 0, 0, 0));
	border-radius: var(--popm-card-radius, 14px);
	box-shadow: none;
	overflow: hidden;
	min-width: 0;
	align-self: start;
}

.popm-card--vertical {
	width: min(100%, var(--popm-vertical-max, 288px));
	justify-self: center;
}

.popm-card--square {
	width: min(100%, 340px);
	justify-self: center;
}

.popm-media {
	position: relative;
	background: var(--popm-player-bg, #000000);
	border-radius: inherit;
	overflow: hidden;
}

/* Editor-only poster: replaces live players inside Elementor so editing stays fast. */
.popm-editor-player {
	position: absolute;
	inset: 0;
	display: block;
	background: var(--popm-player-bg, #000000);
}

.popm-editor-player__badge {
	position: absolute;
	left: 50%;
	bottom: 12px;
	transform: translateX(-50%);
	max-width: calc(100% - 20px);
	background: rgba(10, 10, 10, 0.78);
	color: #ffffff;
	font-size: 12px;
	font-weight: 650;
	line-height: 1.35;
	text-align: center;
	padding: 7px 12px;
	border-radius: 999px;
	pointer-events: none;
}

/* Direct embedded players (YouTube / Vimeo iframe, or native file video). */
.popm-player {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
	background: var(--popm-player-bg, #000000);
}

.popm-media--horizontal { aspect-ratio: 16 / 9; }
.popm-media--vertical { aspect-ratio: 9 / 16; }
.popm-media--square { aspect-ratio: 1 / 1; }

.popm-cover {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .35s ease;
}

.popm-card--fit-cover:hover .popm-cover,
.popm-card--fit-cover:focus-within .popm-cover { transform: scale(1.025); }

.popm-card--fit-contain .popm-cover { object-fit: contain; }

.popm-media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--popm-overlay, rgba(0, 0, 0, 0.12));
	opacity: 0;
	transition: opacity .2s ease;
	pointer-events: none;
}

.popm-card:hover .popm-media::after,
.popm-card:focus-within .popm-media::after { opacity: 1; }

.popm-media__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: #ffffff;
	font-size: 14px;
	font-weight: 600;
	padding: 20px;
}

.popm-media-trigger {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	width: 100%;
	height: 100%;
	padding: 12px;
	margin: 0;
	background: transparent;
	border: none;
	cursor: pointer;
	text-decoration: none;
}

.popm-media-trigger[data-media-kind="image"] { cursor: zoom-in; }
.popm-media-trigger--link { cursor: pointer; }

.popm-play {
	flex: 0 0 auto;
	width: var(--popm-play-size, 44px);
	height: var(--popm-play-size, 44px);
	border: 1px solid rgba(255, 255, 255, 0.42);
	border-radius: 50%;
	background: var(--popm-play-bg, rgba(10, 10, 10, 0.72));
	color: var(--popm-play-text, #ffffff);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
	backdrop-filter: blur(10px) saturate(1.1);
	-webkit-backdrop-filter: blur(10px) saturate(1.1);
	transition: transform .18s ease, background-color .18s ease;
}

.popm-play svg { width: 45%; height: 45%; display: block; margin-left: 2px; }

.popm-card:hover .popm-play,
.popm-media-trigger:focus-visible .popm-play {
	background: rgba(0, 0, 0, 0.86);
	transform: translateY(-1px) scale(1.06);
}

.popm-editor-warning {
	position: absolute;
	left: 10px;
	right: 10px;
	bottom: 10px;
	z-index: 3;
	background: #fffbeb;
	color: #92400e;
	border: 1.5px dashed #d97706;
	border-radius: 8px;
	font-size: 12.5px;
	font-weight: 600;
	padding: 7px 10px;
	text-align: center;
}

/* ---------- Card details ---------- */
.popm-details { padding: 12px 2px 0; }

.popm-card__cats {
	color: var(--popm-result, #7900c2);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: .07em;
	text-transform: uppercase;
	margin: 0 0 7px;
}

.popm-card__title {
	color: var(--popm-card-title, #000000);
	font-size: 18px;
	font-weight: 750;
	line-height: 1.32;
	margin: 0 0 5px;
	overflow-wrap: break-word;
}

.popm-card__client {
	color: var(--popm-client, #4b4b4b);
	font-size: 14.5px;
	font-weight: 600;
	margin: 0 0 6px;
	overflow-wrap: break-word;
}

.popm-card__result {
	color: var(--popm-result, #7900c2);
	font-size: 14.5px;
	font-weight: 700;
	margin: 0 0 6px;
	overflow-wrap: break-word;
}

.popm-card__desc {
	color: var(--popm-muted, #4b4b4b);
	font-size: 14.5px;
	line-height: 1.6;
	margin: 0 0 8px;
	overflow-wrap: break-word;
}

.popm-card__link {
	color: var(--popm-result, #7900c2);
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	display: inline-block;
	padding: 6px 0;
}

.popm-card__link:hover { text-decoration: underline; }

/* ---------- Carousel (one columns x rows page at a time) ---------- */
.popm-grid--carousel .popm-card { animation: popm-page-in .45s ease both; }
.popm-grid--carousel.is-reverse .popm-card { animation-name: popm-page-in-reverse; }

@keyframes popm-page-in {
	from { opacity: 0; transform: translateX(26px); }
	to { opacity: 1; transform: translateX(0); }
}

@keyframes popm-page-in-reverse {
	from { opacity: 0; transform: translateX(-26px); }
	to { opacity: 1; transform: translateX(0); }
}

.popm-carousel-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-top: 24px;
}

.popm-carousel-btn {
	appearance: none;
	flex: 0 0 auto;
	width: max(44px, var(--popm-carousel-btn-size, 46px));
	height: max(44px, var(--popm-carousel-btn-size, 46px));
	border-radius: 50%;
	border: 1px solid var(--popm-carousel-btn-border, rgba(17, 17, 17, 0.14));
	background: var(--popm-carousel-btn-bg, #111111);
	color: var(--popm-carousel-btn-text, #ffffff);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 11px;
	transition: transform .18s ease, opacity .18s ease;
}

.popm-carousel-btn:hover { transform: translateY(-1px); }
.popm-carousel-btn:disabled { opacity: .35; cursor: default; transform: none; }
.popm-carousel-btn svg { width: 100%; height: 100%; display: block; }

.popm-carousel-dots {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 2px;
}

.popm-carousel-dot {
	appearance: none;
	width: 32px;
	height: 32px;
	min-width: 32px;
	border: 0;
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	position: relative;
	padding: 0;
}

.popm-carousel-dot::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--popm-carousel-dot, #d6d6d6);
	transition: background-color .18s ease, transform .18s ease;
}

.popm-carousel-dot.is-active::after,
.popm-carousel-dot[aria-current="true"]::after {
	background: var(--popm-carousel-dot-active, #7900c2);
	transform: scale(1.25);
}

/* ---------- Load more & empty state ---------- */
.popm-more { text-align: center; margin-top: 30px; }

.popm-load-more {
	appearance: none;
	font: inherit;
	font-size: 16px;
	font-weight: 700;
	background: var(--popm-more-bg, #7900c2);
	color: var(--popm-more-text, #ffffff);
	border: 2px solid transparent;
	border-radius: 50px;
	padding: 14px 36px;
	min-height: 52px;
	cursor: pointer;
	transition: filter .18s ease;
}

.popm-load-more:hover { filter: brightness(1.12); }

.popm-empty {
	max-width: 720px;
	margin: 10px auto 0;
	text-align: center;
	color: var(--popm-muted, #4b4b4b);
	font-size: 16px;
	line-height: 1.65;
	background: #f8f8f8;
	border: 1px solid var(--popm-card-border, #e5e5e5);
	border-radius: 14px;
	padding: 26px 28px;
}

.popm-empty--editor {
	background: #fffbeb;
	border: 1.5px dashed #d97706;
	color: #92400e;
}

/* ---------- Lightbox / modal ---------- */
.popm-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: var(--popm-modal-bg, rgba(0, 0, 0, 0.92));
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 22px;
}

.popm-modal__dialog {
	position: relative;
	width: min(960px, 100%);
	max-height: calc(100vh - 44px);
	display: flex;
	flex-direction: column;
	align-items: center;
}

.popm-modal[data-orientation="vertical"] .popm-modal__dialog { width: min(430px, 100%); }
.popm-modal[data-orientation="square"] .popm-modal__dialog { width: min(720px, 100%); }

.popm-modal__content {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
}

.popm-modal__content iframe,
.popm-modal__content video {
	width: 100%;
	max-height: calc(100vh - 170px);
	aspect-ratio: 16 / 9;
	border: none;
	border-radius: 12px;
	background: #000000;
}

.popm-modal[data-orientation="vertical"] .popm-modal__content iframe,
.popm-modal[data-orientation="vertical"] .popm-modal__content video {
	aspect-ratio: 9 / 16;
	max-height: calc(100vh - 170px);
}

.popm-modal[data-orientation="square"] .popm-modal__content iframe,
.popm-modal[data-orientation="square"] .popm-modal__content video { aspect-ratio: 1 / 1; }

.popm-modal__content img {
	max-width: 100%;
	max-height: calc(100vh - 170px);
	width: auto;
	height: auto;
	border-radius: 12px;
	object-fit: contain;
}

.popm-modal__caption {
	color: var(--popm-modal-text, #ffffff);
	font-size: 16px;
	font-weight: 650;
	text-align: center;
	margin: 16px 40px 0;
	overflow-wrap: break-word;
}

.popm-modal__close {
	position: absolute;
	top: -6px;
	right: -6px;
	z-index: 2;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 2px solid var(--popm-modal-text, #ffffff);
	background: rgba(0, 0, 0, 0.55);
	color: var(--popm-modal-text, #ffffff);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 11px;
}

.popm-modal__close svg { width: 100%; height: 100%; display: block; }

body.popm-modal-open,
html.popm-modal-open { overflow: hidden; }

/* ---------- Utilities ---------- */
.popm-sr-only {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.popm-portfolio { padding: 64px 18px; }
	.popm-portfolio__title { font-size: 36px; }
}

@media (max-width: 640px) {
	.popm-portfolio { padding: 44px 12px; }
	.popm-portfolio__title { font-size: 30px; }

	/* Tighter, thumb-friendly rhythm on phones (never exceeds owner gaps). */
	.popm-grid {
		column-gap: min(var(--popm-gap-x, 22px), 14px);
		row-gap: min(var(--popm-gap-y, 26px), 18px);
	}

	/* Vertical Shorts/Reels stay swipe-friendly instead of towering full-width. */
	.popm-card--vertical { width: min(78vw, 250px); }

	/* One compact, scrollable dot row next to 44px arrows. */
	.popm-carousel-controls { gap: 10px; margin-top: 18px; }
	.popm-carousel-dots {
		flex-wrap: nowrap;
		overflow-x: auto;
		max-width: 46vw;
		scrollbar-width: none;
	}
	.popm-carousel-dots::-webkit-scrollbar { display: none; }
	.popm-carousel-dot { width: 28px; height: 28px; min-width: 28px; }

	/* One horizontally scrollable tab row — never wrapped. */
	.popm-filters {
		flex-wrap: nowrap;
		justify-content: flex-start;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		padding: 4px 2px 10px;
		margin-bottom: 24px;
	}
	.popm-filters::-webkit-scrollbar { display: none; }
	.popm-filters button { flex: 0 0 auto; }

	.popm-media-trigger { padding: 10px; }
	.popm-modal { padding: 14px; }
	.popm-modal__close { top: -2px; right: -2px; }
}

@media (max-width: 360px) {
	.popm-portfolio__title { font-size: 27px; }
	.popm-details { padding: 12px 14px 14px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.popm-portfolio *,
	.popm-portfolio *::before,
	.popm-portfolio *::after {
		animation-duration: .01ms !important;
		transition-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}
