/* GridForge front-end. Inherits fonts and colors from the active theme. */

.gf-wrap {
	--gf-radius: 4px;
	--gf-overlay: rgba(10, 12, 16, 0.62);
	--gf-focus: currentColor;
	position: relative;
	width: 100%;
}

/* ---------- No-JS fallback: plain CSS grid ---------- */
.gf-wrap:not(.gf-js) .gf-stage {
	display: grid;
	grid-template-columns: repeat(var(--gf-cols-d, 4), minmax(0, 1fr));
	gap: var(--gf-gutter, 16px);
}
@media (max-width: 1024px) {
	.gf-wrap:not(.gf-js) .gf-stage { grid-template-columns: repeat(var(--gf-cols-t, 3), minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.gf-wrap:not(.gf-js) .gf-stage { grid-template-columns: repeat(var(--gf-cols-m, 1), minmax(0, 1fr)); }
}

/* ---------- JS layout: items are positioned by the script ---------- */
.gf-js .gf-stage { position: relative; }
.gf-js .gf-item {
	position: absolute;
	top: 0;
	left: 0;
	will-change: transform;
}
.gf-js.gf-ready .gf-item {
	transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.3s ease, visibility 0s;
}
.gf-item.gf-hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}
.gf-js.gf-ready .gf-item.gf-hidden {
	transition: transform 0.4s, opacity 0.25s ease, visibility 0s 0.25s;
}

.gf-item { margin: 0; min-width: 0; }

.gf-link {
	position: relative;
	display: block;
	color: inherit;
	text-decoration: none;
	border-radius: var(--gf-radius);
	overflow: hidden;
}
.gf-link:focus-visible {
	outline: 2px solid var(--gf-focus);
	outline-offset: 2px;
}

/* ---------- Media ---------- */
.gf-media {
	position: relative;
	overflow: hidden;
	border-radius: var(--gf-radius);
	background: rgba(127, 127, 127, 0.15);
}
.gf-img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	transition: transform 0.5s ease;
}
.gf-noimg {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
}
.gf-wrap[data-layout="grid"] .gf-media { aspect-ratio: var(--gf-ratio, 4 / 3); }
.gf-wrap[data-layout="grid"] .gf-img,
.gf-wrap[data-layout="grid"] .gf-noimg { height: 100%; aspect-ratio: auto; object-fit: cover; }

.gf-hover-zoom .gf-link:hover .gf-img,
.gf-hover-zoom .gf-link:focus-visible .gf-img { transform: scale(1.05); }

/* ---------- Captions ----------
   Sizes are set in rem with a cap so theme heading styles can't inflate them. */
.gf-wrap .gf-title {
	margin: 0;
	padding: 0;
	font-size: clamp(0.8125rem, 0.5vw + 0.7rem, 1rem);
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
	color: inherit;
}
.gf-wrap .gf-meta {
	margin: 0.2rem 0 0;
	font-size: 0.75rem;
	line-height: 1.3;
	opacity: 0.8;
}
.gf-wrap .gf-excerpt {
	margin: 0.4rem 0 0;
	font-size: 0.8125rem;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.gf-skin-below .gf-caption { padding: 0.65rem 0.1rem 0.2rem; }

.gf-skin-overlay .gf-caption,
.gf-skin-overlay-always .gf-caption {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 0.75rem 2.25rem 0.75rem 0.75rem; /* right padding keeps text clear of the sold dot */
	color: #fff;
	background: linear-gradient(to top, var(--gf-overlay) 0%, rgba(10, 12, 16, 0) 60%);
	opacity: 0;
	transition: opacity 0.25s ease;
}
.gf-skin-overlay-always .gf-caption { opacity: 1; }
.gf-skin-overlay .gf-link:hover .gf-caption,
.gf-skin-overlay .gf-link:focus-visible .gf-caption { opacity: 1; }
@media (hover: none) {
	.gf-skin-overlay .gf-caption { opacity: 1; }
}

/* ---------- Sold marker (red dot, bottom-right of the image) ----------
   Nothing is layered over the image. The <img> gets a circular hole (mask) at its
   bottom-right and the red dot is painted on the wrapper behind that hole.
   Zoom-on-hover is anchored at the dot so the hole and the dot stay aligned. */
.gf-item[data-gf-mk] .gf-media {
	background-image: radial-gradient(circle at calc(100% - 18px) calc(100% - 18px), #d7192b 0, #d7192b 8px, #fff 8.5px, #fff 11.2px, transparent 11.7px);
}
.gf-item[data-gf-mk] .gf-img {
	-webkit-mask-image: radial-gradient(circle at calc(100% - 18px) calc(100% - 18px), transparent 0, transparent 10px, #000 10.5px);
	mask-image: radial-gradient(circle at calc(100% - 18px) calc(100% - 18px), transparent 0, transparent 10px, #000 10.5px);
	transform-origin: calc(100% - 18px) calc(100% - 18px);
}

/* ---------- Pinterest Save button ---------- */
.gf-wrap:not(.gf-js) .gf-item { position: relative; }
.gf-pin {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 3;
	appearance: none;
	cursor: pointer;
	padding: 0.4rem 0.85rem;
	font: inherit;
	font-size: 0.8125rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	color: #fff;
	background: #e60023;
	border: 0;
	border-radius: 999px;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
	opacity: 0;
	transition: opacity 0.2s ease, background-color 0.2s ease;
}
.gf-item:hover .gf-pin,
.gf-item:focus-within .gf-pin,
.gf-pin:focus-visible { opacity: 1; }
.gf-pin:hover { background: #ad081b; }
.gf-pin:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 4px #e60023; }
@media (hover: none) {
	.gf-pin { opacity: 1; }
}

/* ---------- Filters ---------- */
.gf-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	margin: 0 0 1.25em;
}
.gf-filter {
	appearance: none;
	cursor: pointer;
	padding: 0.4em 0.9em;
	font: inherit;
	font-size: 0.9em;
	color: inherit;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: 999px;
	opacity: 0.65;
	transition: opacity 0.2s, background-color 0.2s, color 0.2s;
}
.gf-filter:hover { opacity: 1; }
.gf-filter.is-active {
	opacity: 1;
	font-weight: 600;
	background: rgba(127, 127, 127, 0.2);
}
.gf-filter:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* ---------- Load more ---------- */
.gf-more-wrap { margin-top: 1.5em; text-align: center; }
.gf-more {
	appearance: none;
	cursor: pointer;
	padding: 0.7em 1.6em;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 1px solid currentColor;
	border-radius: var(--gf-radius);
}
.gf-more:hover { opacity: 0.7; }
.gf-more[disabled] { opacity: 0.5; cursor: progress; }
.gf-more:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.gf-status { display: flex; justify-content: center; margin: 0.75em 0 0; text-align: center; font-size: 0.9em; }
.gf-admin-note { margin: 0.75em 0 0; font-size: 0.85em; }

/* Themes often add drop caps (::first-letter). Neutralize them inside the grid. */
.gf-wrap .gf-status::first-letter,
.gf-wrap .gf-admin-note::first-letter,
.gf-wrap .gf-title::first-letter,
.gf-wrap .gf-meta::first-letter,
.gf-wrap .gf-excerpt::first-letter,
.gf-wrap .gf-caption::first-letter,
.gf-wrap .gf-more::first-letter,
.gf-wrap .gf-filter::first-letter {
	float: none !important;
	margin: 0 !important;
	padding: 0 !important;
	font-size: inherit !important;
	font-weight: inherit !important;
	font-family: inherit !important;
	line-height: inherit !important;
	color: inherit !important;
	text-transform: none !important;
	initial-letter: normal !important;
	text-shadow: none !important;
	background: none !important;
	border: 0 !important;
}
.gf-status:empty { display: none; }

/* ---------- Lightbox ---------- */
body.gf-lb-open { overflow: hidden; }
.gf-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(8, 9, 12, 0.92);
}
.gf-lb[hidden] { display: none; }
.gf-lb-fig {
	margin: 0;
	max-width: min(92vw, 1400px);
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.gf-lb-fig img {
	display: block;
	max-width: 100%;
	max-height: 82vh;
	width: auto;
	height: auto;
	object-fit: contain;
}
.gf-lb-fig figcaption {
	margin-top: 0.75em;
	color: #e8e8e8;
	font-size: 0.95em;
	text-align: center;
}
.gf-lb-fig figcaption:empty { display: none; }
.gf-lb-btn {
	appearance: none;
	position: absolute;
	cursor: pointer;
	width: 48px;
	height: 48px;
	font-size: 32px;
	line-height: 1;
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
	border: 0;
	border-radius: 50%;
}
.gf-lb-btn:hover { background: rgba(255, 255, 255, 0.22); }
.gf-lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.gf-lb-close { top: 16px; right: 16px; }
.gf-lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.gf-lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.gf-lb.gf-single .gf-lb-prev,
.gf-lb.gf-single .gf-lb-next { display: none; }

@media (prefers-reduced-motion: reduce) {
	.gf-js.gf-ready .gf-item,
	.gf-img,
	.gf-skin-overlay .gf-caption,
	.gf-skin-overlay-always .gf-caption { transition: none; }
	.gf-infinite.gf-busy .gf-more-wrap::after { animation: none; }
	.gf-hover-zoom .gf-link:hover .gf-img { transform: none; }
}

/* ---------- Smooth infinite scroll ---------- */
.gf-js .gf-item.gf-new { opacity: 0; transition: none !important; }
.gf-infinite .gf-more-wrap { position: relative; min-height: 44px; margin-top: 1rem; }
.gf-infinite .gf-more {
	position: absolute;
	left: 0;
	bottom: 0;
	width: 100%;
	height: 1px;
	padding: 0;
	border: 0;
	opacity: 0;
	overflow: hidden;
	pointer-events: none;
}
.gf-infinite.gf-busy .gf-more-wrap::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 10px;
	width: 22px;
	height: 22px;
	margin-left: -11px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	opacity: 0.55;
	animation: gf-spin 0.7s linear infinite;
}
@keyframes gf-spin { to { transform: rotate(360deg); } }

/* ---------- Drop-cap immunity for the text under/over each image ----------
   ::first-letter only exists on block containers, and it does not reach through
   flex containers. Making the caption and its lines flex containers means neither a
   theme rule on the title/text itself nor one on an ancestor (a, article, div, p)
   can turn the first letter into a drop cap. */
.gf-wrap .gf-caption,
.gf-wrap .gf-title,
.gf-wrap .gf-meta {
	display: flex;
	flex-direction: column;
}
.gf-wrap .gf-excerpt {
	display: -webkit-box;
	-webkit-box-orient: vertical;
}
