/**
 * Mafron Projects — front-end styles.
 *
 * Colours and metrics come from the theme's tokens where they exist, with the
 * Mafron palette as the fallback so the plugin still looks right on its own.
 */

.mafpj-section,
.mafpj-gallery-grid,
.mafpj-cards {
	--mafpj-gold: var(--maf-gold, #c08d2d);
	--mafpj-gold-600: var(--maf-gold-600, #a8761f);
	--mafpj-ink: var(--maf-ink, #171717);
	--mafpj-ink-2: var(--maf-ink-2, #3d3d3d);
	--mafpj-muted: var(--maf-muted, #6e6e6e);
	--mafpj-line: var(--maf-line, #ece5d9);
	--mafpj-bg-soft: var(--maf-bg-soft, #faf7f2);
	--mafpj-radius: var(--maf-radius, 8px);
	--mafpj-shadow: var(--maf-shadow, 0 18px 44px rgba(28, 28, 28, .09));
	--mafpj-shadow-lg: var(--maf-shadow-lg, 0 30px 70px rgba(28, 28, 28, .14));
	--mafpj-display: var(--maf-display, "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
	--mafpj-gap: 24px;
}

/* ==========================================================================
   Section scaffolding
   ========================================================================== */

.mafpj-section {
	padding: var(--maf-section-y, 92px) 0;
}

.mafpj-home {
	background: var(--mafpj-bg-soft);
}

.mafpj-container {
	width: 100%;
	max-width: var(--maf-container, 1200px);
	margin: 0 auto;
	padding: 0 var(--maf-gutter, 24px);
}

.mafpj-section__head {
	max-width: 640px;
	margin: 0 0 44px;
}

.mafpj-eyebrow {
	margin: 0 0 10px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--mafpj-gold);
}

.mafpj-section__title {
	margin: 0 0 14px;
	font-family: var(--mafpj-display);
	font-size: clamp(28px, 3.4vw, 40px);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -.02em;
	color: var(--mafpj-ink);
}

.mafpj-section__text {
	margin: 0;
	color: var(--mafpj-muted);
	font-size: 17px;
	line-height: 1.7;
}

.mafpj-section__cta {
	margin: 40px 0 0;
	text-align: center;
}

.mafpj-btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 26px;
	border: 1px solid var(--mafpj-gold);
	border-radius: var(--mafpj-radius);
	background: transparent;
	color: var(--mafpj-gold-600);
	font-weight: 700;
	font-size: 15px;
	line-height: 1;
	text-decoration: none;
	transition: background .2s ease, color .2s ease, transform .2s ease;
}

.mafpj-btn:hover,
.mafpj-btn:focus-visible {
	background: var(--mafpj-gold);
	color: #fff;
	transform: translateY(-1px);
}

.mafpj-btn svg {
	width: 18px;
	height: 18px;
	flex: none;
}

.mafpj-empty {
	margin: 0;
	padding: 28px;
	border: 1px dashed var(--mafpj-line);
	border-radius: var(--mafpj-radius);
	color: var(--mafpj-muted);
	text-align: center;
}

/* ==========================================================================
   Plugin page hero (only used when the theme has none)
   ========================================================================== */

.mafpj-hero {
	padding: 72px 0 48px;
	background: var(--mafpj-bg-soft);
	border-bottom: 1px solid var(--mafpj-line);
}

.mafpj-hero__title {
	margin: 0 0 12px;
	font-family: var(--mafpj-display);
	font-size: clamp(30px, 4vw, 46px);
	color: var(--mafpj-ink);
}

.mafpj-hero__text {
	margin: 0;
	max-width: 660px;
	color: var(--mafpj-muted);
}

/* ==========================================================================
   Category filters
   ========================================================================== */

.mafpj-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 36px;
}

.mafpj-filters__item {
	padding: 9px 18px;
	border: 1px solid var(--mafpj-line);
	border-radius: 999px;
	background: #fff;
	color: var(--mafpj-ink-2);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: border-color .2s ease, color .2s ease, background .2s ease;
}

.mafpj-filters__item:hover,
.mafpj-filters__item:focus-visible {
	border-color: var(--mafpj-gold);
	color: var(--mafpj-gold-600);
}

.mafpj-filters__item.is-active {
	background: var(--mafpj-ink);
	border-color: var(--mafpj-ink);
	color: #fff;
}

/* ==========================================================================
   Project cards
   ========================================================================== */

.mafpj-cards {
	display: grid;
	gap: var(--mafpj-gap);
	grid-template-columns: repeat(var(--mafpj-columns, 3), minmax(0, 1fr));
}

.mafpj-cards.mafpj-cols-1 { --mafpj-columns: 1; }
.mafpj-cards.mafpj-cols-2 { --mafpj-columns: 2; }
.mafpj-cards.mafpj-cols-3 { --mafpj-columns: 3; }
.mafpj-cards.mafpj-cols-4 { --mafpj-columns: 4; }

.mafpj-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: #fff;
	border: 1px solid var(--mafpj-line);
	border-radius: var(--mafpj-radius);
	box-shadow: var(--maf-shadow-sm, 0 4px 14px rgba(28, 28, 28, .06));
	transition: transform .25s ease, box-shadow .25s ease;
}

.mafpj-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--mafpj-shadow);
}

.mafpj-card__media {
	position: relative;
	aspect-ratio: 4 / 3;
	background: var(--mafpj-bg-soft);
	overflow: hidden;
}

.mafpj-card__cover {
	display: block;
	height: 100%;
}

.mafpj-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .5s ease;
}

.mafpj-card:hover .mafpj-card__media img {
	transform: scale(1.04);
}

.mafpj-card__flag {
	position: absolute;
	left: 14px;
	bottom: 14px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border-radius: 999px;
	background: rgba(23, 23, 23, .78);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .02em;
	backdrop-filter: blur(4px);
}

.mafpj-card__flag svg {
	width: 12px;
	height: 12px;
}

.mafpj-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: 22px 24px 24px;
}

.mafpj-card__eyebrow {
	margin: 0 0 8px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--mafpj-gold);
}

.mafpj-card__title {
	margin: 0 0 8px;
	font-family: var(--mafpj-display);
	font-size: 20px;
	line-height: 1.3;
	color: var(--mafpj-ink);
}

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

.mafpj-card__title a:hover {
	color: var(--mafpj-gold-600);
}

.mafpj-card__meta {
	margin: 0 0 10px;
	font-size: 13px;
	color: var(--mafpj-muted);
}

.mafpj-card__text {
	margin: 0 0 18px;
	font-size: 15px;
	line-height: 1.65;
	color: var(--mafpj-ink-2);
}

.mafpj-card__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: auto 0 0;
	padding-top: 16px;
	border-top: 1px solid var(--mafpj-line);
}

.mafpj-card__count {
	font-size: 13px;
	color: var(--mafpj-muted);
}

.mafpj-textlink {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: var(--mafpj-gold-600);
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
}

.mafpj-textlink svg {
	width: 16px;
	height: 16px;
	transition: transform .2s ease;
}

.mafpj-textlink:hover svg {
	transform: translateX(3px);
}

/* ==========================================================================
   Gallery grid
   ========================================================================== */

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

.mafpj-gallery-grid.mafpj-cols-1 { --mafpj-columns: 1; }
.mafpj-gallery-grid.mafpj-cols-2 { --mafpj-columns: 2; }
.mafpj-gallery-grid.mafpj-cols-3 { --mafpj-columns: 3; }
.mafpj-gallery-grid.mafpj-cols-4 { --mafpj-columns: 4; }
.mafpj-gallery-grid.mafpj-cols-5 { --mafpj-columns: 5; }

.mafpj-tile {
	margin: 0;
}

.mafpj-tile__button {
	position: relative;
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: var(--mafpj-radius);
	overflow: hidden;
	background: var(--mafpj-bg-soft);
	aspect-ratio: 4 / 3;
	cursor: pointer;
	color: #fff;
}

.mafpj-tile__button:not(button) {
	cursor: default;
}

.mafpj-tile__img,
.mafpj-tile__blank {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .5s ease, filter .3s ease;
}

.mafpj-tile__blank {
	background: linear-gradient(140deg, #2b2b2b, #4b4235);
}

.mafpj-tile__button::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, .45));
	opacity: 0;
	transition: opacity .25s ease;
}

.mafpj-tile__button:hover .mafpj-tile__img,
.mafpj-tile__button:focus-visible .mafpj-tile__img {
	transform: scale(1.05);
}

.mafpj-tile__button:hover::after,
.mafpj-tile__button:focus-visible::after {
	opacity: 1;
}

.mafpj-tile__button:focus-visible {
	outline: 3px solid var(--mafpj-gold);
	outline-offset: 3px;
}

.mafpj-tile__play,
.mafpj-tile__zoom {
	position: absolute;
	z-index: 1;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: rgba(23, 23, 23, .55);
	backdrop-filter: blur(3px);
	transition: transform .25s ease, background .25s ease, opacity .25s ease;
}

.mafpj-tile__play {
	inset: 0;
	margin: auto;
	width: 62px;
	height: 62px;
	background: rgba(23, 23, 23, .62);
	border: 2px solid rgba(255, 255, 255, .85);
}

.mafpj-tile__play svg {
	width: 24px;
	height: 24px;
	margin-left: 3px;
}

.mafpj-tile__button:hover .mafpj-tile__play {
	transform: scale(1.08);
	background: var(--mafpj-gold);
	border-color: var(--mafpj-gold);
}

.mafpj-tile__zoom {
	right: 12px;
	bottom: 12px;
	width: 38px;
	height: 38px;
	opacity: 0;
}

.mafpj-tile__zoom svg {
	width: 18px;
	height: 18px;
}

.mafpj-tile__button:hover .mafpj-tile__zoom,
.mafpj-tile__button:focus-visible .mafpj-tile__zoom {
	opacity: 1;
}

.mafpj-tile__duration {
	position: absolute;
	right: 10px;
	bottom: 10px;
	z-index: 1;
	padding: 3px 8px;
	border-radius: 4px;
	background: rgba(0, 0, 0, .72);
	color: #fff;
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.mafpj-tile__caption {
	margin: 8px 2px 0;
	font-size: 13px;
	line-height: 1.5;
	color: var(--mafpj-muted);
}

/* ==========================================================================
   Single project
   ========================================================================== */

.mafpj-single__grid {
	display: grid;
	gap: 48px;
	grid-template-columns: minmax(0, 1fr) 300px;
	align-items: start;
}

.mafpj-single__body > .mafpj-gallery-grid {
	margin-top: 32px;
}

.mafpj-facts {
	padding: 24px;
	margin: 0 0 20px;
	background: var(--mafpj-bg-soft);
	border: 1px solid var(--mafpj-line);
	border-radius: var(--mafpj-radius);
}

.mafpj-facts__title {
	margin: 0 0 14px;
	font-family: var(--mafpj-display);
	font-size: 15px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--mafpj-ink);
}

.mafpj-facts__list {
	margin: 0;
}

.mafpj-facts__row {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 9px 0;
	border-bottom: 1px solid var(--mafpj-line);
}

.mafpj-facts__row:last-child {
	border-bottom: 0;
	padding-bottom: 0;
}

.mafpj-facts__row dt {
	font-size: 13px;
	color: var(--mafpj-muted);
}

.mafpj-facts__row dd {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	text-align: right;
	color: var(--mafpj-ink);
}

.mafpj-facts__terms {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
}

.mafpj-chip {
	padding: 6px 13px;
	border-radius: 999px;
	background: #fff;
	border: 1px solid var(--mafpj-line);
	color: var(--mafpj-ink-2);
	font-size: 13px;
	text-decoration: none;
}

.mafpj-chip:hover {
	border-color: var(--mafpj-gold);
	color: var(--mafpj-gold-600);
}

.mafpj-single__back {
	margin: 0;
}

.mafpj-single__back .mafpj-textlink:hover svg {
	transform: translateX(-3px);
}

.mafpj-related {
	background: var(--mafpj-bg-soft);
}

/* ==========================================================================
   Lightbox
   ========================================================================== */

.mafpj-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	background: rgba(12, 12, 12, .94);
	opacity: 0;
	visibility: hidden;
	transition: opacity .25s ease, visibility .25s ease;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}

.mafpj-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.mafpj-lightbox__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 20px;
	color: rgba(255, 255, 255, .82);
	font-size: 14px;
}

.mafpj-lightbox__counter {
	font-variant-numeric: tabular-nums;
	letter-spacing: .06em;
}

.mafpj-lightbox__stage {
	position: relative;
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 20px;
	min-height: 0;
}

.mafpj-lightbox__frame {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: min(1200px, 100%);
	max-height: 100%;
	width: 100%;
}

.mafpj-lightbox__frame img,
.mafpj-lightbox__frame video {
	max-width: 100%;
	max-height: calc(100vh - 190px);
	width: auto;
	height: auto;
	display: block;
	border-radius: 4px;
	background: #000;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.mafpj-lightbox__embed {
	position: relative;
	width: 100%;
	max-width: 1100px;
	aspect-ratio: 16 / 9;
	max-height: calc(100vh - 190px);
	background: #000;
	border-radius: 4px;
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.mafpj-lightbox__embed iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.mafpj-lightbox__caption {
	margin: 0;
	padding: 16px 24px 26px;
	color: rgba(255, 255, 255, .8);
	font-size: 14px;
	line-height: 1.6;
	text-align: center;
	min-height: 22px;
}

.mafpj-lightbox__btn {
	display: grid;
	place-items: center;
	width: 46px;
	height: 46px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, .22);
	border-radius: 50%;
	background: rgba(255, 255, 255, .07);
	color: #fff;
	cursor: pointer;
	transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.mafpj-lightbox__btn:hover {
	background: var(--maf-gold, #c08d2d);
	border-color: var(--maf-gold, #c08d2d);
}

.mafpj-lightbox__btn:focus-visible {
	outline: 3px solid var(--maf-gold, #c08d2d);
	outline-offset: 2px;
}

.mafpj-lightbox__btn svg {
	width: 22px;
	height: 22px;
}

.mafpj-lightbox__btn[hidden] {
	display: none;
}

.mafpj-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
}

.mafpj-lightbox__nav--prev { left: 16px; }
.mafpj-lightbox__nav--next { right: 16px; }

.mafpj-lightbox__spinner {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 34px;
	height: 34px;
	border: 3px solid rgba(255, 255, 255, .25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: mafpj-spin .8s linear infinite;
}

.mafpj-lightbox__spinner[hidden] {
	display: none;
}

@keyframes mafpj-spin {
	to { transform: rotate(360deg); }
}

.mafpj-noscroll {
	overflow: hidden !important;
}

.mafpj-sr {
	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) {
	.mafpj-single__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 36px;
	}

	.mafpj-cards.mafpj-cols-4 { --mafpj-columns: 3; }
	.mafpj-gallery-grid.mafpj-cols-5 { --mafpj-columns: 4; }
}

@media (max-width: 860px) {
	.mafpj-section {
		padding: 60px 0;
	}

	.mafpj-cards.mafpj-cols-3,
	.mafpj-cards.mafpj-cols-4 { --mafpj-columns: 2; }

	.mafpj-gallery-grid.mafpj-cols-4,
	.mafpj-gallery-grid.mafpj-cols-5 { --mafpj-columns: 3; }
}

@media (max-width: 600px) {
	.mafpj-cards { --mafpj-columns: 1 !important; }
	.mafpj-gallery-grid { --mafpj-columns: 2 !important; gap: 10px; }

	.mafpj-lightbox__nav--prev { left: 8px; }
	.mafpj-lightbox__nav--next { right: 8px; }

	.mafpj-lightbox__frame img,
	.mafpj-lightbox__frame video,
	.mafpj-lightbox__embed {
		max-height: calc(100vh - 160px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.mafpj-card,
	.mafpj-card__media img,
	.mafpj-tile__img,
	.mafpj-tile__play,
	.mafpj-tile__zoom,
	.mafpj-lightbox,
	.mafpj-textlink svg {
		transition: none !important;
	}

	.mafpj-lightbox__spinner {
		animation-duration: 2s;
	}
}
