/**
 * FormaGallery front-end styles.
 *
 * Self-contained and scoped under .formagallery — no Bootstrap, no theme
 * assets. Layout: 1 card per row on mobile, 3 from 768px, 4 from 1400px.
 * All card images are 4:3.
 */

.formagallery {
	--fg-ink: #16181d;
	--fg-body: #6a7280;
	--fg-muted: #8b9099;
	--fg-line: #e3e4e6;
	--fg-line-soft: #f0f0f1;
	--fg-badge: #1f2126;
	--fg-accent: #e01b24;
	--fg-blue: #0d86f0;
	--fg-blue-dark: #0b6fc6;
	--fg-placeholder: #efefef;
	--fg-radius: 0px;
	--fg-gap: 26px;
	--fg-max: 1440px;

	box-sizing: border-box;
	color: var(--fg-ink);
	font-size: 16px;
	line-height: 1.5;
}

.formagallery *,
.formagallery *::before,
.formagallery *::after {
	box-sizing: inherit;
}

.formagallery img {
	max-width: 100%;
	height: auto;
}

.formagallery .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ *
 * Hero
 * ------------------------------------------------------------------ */
/*
 * Block themes wrap post content in a narrow constrained column (Twenty
 * Twenty-Five: 645px), which would squeeze the grid. The wrapper carries
 * `alignwide` so the theme releases it to its wide width, and the doubled
 * class here outranks the core layout rule to settle on our own max-width.
 */
.formagallery.fg-gallery {
	max-width: var(--fg-max);
	margin-left: auto;
	margin-right: auto;
	padding: 0 20px 60px;
}

.fg-hero {
	padding: 34px 0 22px;
}

.fg-eyebrow {
	margin: 0 0 10px;
	color: var(--fg-accent);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.13em;
	text-transform: uppercase;
}

.fg-hero-title {
	margin: 0 0 12px;
	color: var(--fg-ink);
	font-size: clamp(30px, 4vw, 42px);
	font-weight: 800;
	line-height: 1.12;
	letter-spacing: -0.01em;
}

.fg-hero-sub {
	margin: 0;
	max-width: 60ch;
	color: var(--fg-body);
	font-size: 16px;
}

/* ------------------------------------------------------------------ *
 * Search bar
 * ------------------------------------------------------------------ */
.formagallery .fg-search {
	position: relative;
	display: flex;
	align-items: stretch;
	margin: 0 0 26px;
	border: 1px solid var(--fg-line);
	background: #fff;
}

.fg-search-icon {
	display: flex;
	align-items: center;
	padding: 0 6px 0 18px;
	color: var(--fg-muted);
	pointer-events: none;
}

.formagallery .fg-search-input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 16px 14px;
	border: 0;
	background: transparent;
	color: var(--fg-ink);
	font-size: 16px;
	line-height: 1.4;
	outline: none;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

.formagallery .fg-search-input::placeholder {
	color: var(--fg-muted);
	opacity: 1;
}

.formagallery .fg-search-btn {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--fg-blue);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}

.formagallery .fg-search-btn:hover,
.formagallery .fg-search-btn:focus {
	background: var(--fg-blue-dark);
}

/* ------------------------------------------------------------------ *
 * Category pills
 * ------------------------------------------------------------------ */
.fg-cats {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 0 0 26px;
	border-bottom: 1px solid var(--fg-line);
	margin-bottom: 32px;
}

.formagallery .fg-cat {
	display: inline-block;
	padding: 9px 18px;
	border: 1px solid var(--fg-line);
	background: #fff;
	color: var(--fg-ink);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.formagallery .fg-cat:hover,
.formagallery .fg-cat:focus {
	border-color: var(--fg-ink);
	color: var(--fg-ink);
	text-decoration: none;
}

.formagallery .fg-cat.is-active {
	border-color: var(--fg-badge);
	background: var(--fg-badge);
	color: #fff;
}

/* ------------------------------------------------------------------ *
 * Grid — 1 / 3 / 4 columns
 * ------------------------------------------------------------------ */
.formagallery .fg-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 34px var(--fg-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.formagallery .fg-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1200px) {
	.formagallery .fg-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (min-width: 1400px) {
	.formagallery .fg-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.formagallery .fg-card {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* --- media: fixed 4:3, badge + expand overlay --- */
.fg-card-media {
	position: relative;
	background: var(--fg-placeholder);
}

.formagallery .fg-card-open {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--fg-placeholder);
	cursor: pointer;
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

/* Fallback for browsers without aspect-ratio support. */
@supports not (aspect-ratio: 4 / 3) {
	.formagallery .fg-card-open {
		height: 0;
		padding-bottom: 75%;
		position: relative;
	}
	.formagallery .fg-card-img {
		position: absolute;
		inset: 0;
	}
}

.formagallery .fg-card-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.formagallery .fg-card-open:hover .fg-card-img {
	transform: scale(1.035);
}

.formagallery .fg-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 2;
	display: inline-block;
	padding: 5px 10px;
	background: var(--fg-badge);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.2;
	text-decoration: none;
	text-transform: uppercase;
}

.formagallery .fg-badge:hover,
.formagallery .fg-badge:focus {
	background: #000;
	color: #fff;
	text-decoration: none;
}

.formagallery .fg-badge-static {
	position: static;
	margin: 0 0 14px;
}

.formagallery .fg-expand {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 0;
	background: #fff;
	color: var(--fg-ink);
	cursor: pointer;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
	transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.formagallery .fg-expand:hover,
.formagallery .fg-expand:focus {
	background: var(--fg-badge);
	color: #fff;
	transform: scale(1.06);
}

.formagallery .fg-card-title {
	margin: 14px 0 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.35;
}

.formagallery .fg-card-title a {
	color: var(--fg-ink);
	text-decoration: none;
}

.formagallery .fg-card-title a:hover,
.formagallery .fg-card-title a:focus {
	text-decoration: underline;
}

.formagallery .fg-card.is-open .fg-card-title a {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 * Expanding "PROJECT DETAIL" row
 * ------------------------------------------------------------------ */
.formagallery .fg-detail-slot {
	grid-column: 1 / -1;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.35s ease;
}

.fg-detail {
	padding: 26px 0 6px;
}

.fg-detail-eyebrow {
	margin: 0 0 12px;
	color: var(--fg-accent);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.13em;
	text-transform: uppercase;
}

.fg-detail-box {
	position: relative;
	display: grid;
	grid-template-columns: 1fr;
	border: 1px solid var(--fg-line);
	background: #fff;
}

@media (min-width: 768px) {
	.fg-detail-box {
		grid-template-columns: 45% 1fr;
	}
}

.fg-detail-media {
	display: flex;
	flex-direction: column;
	background: #fff;
}

.formagallery .fg-detail-main {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--fg-placeholder);
	cursor: zoom-in;
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

.formagallery .fg-detail-main img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fg-detail-thumbs {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 8px;
	padding: 8px;
}

.formagallery .fg-detail-thumb {
	display: block;
	margin: 0;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 0;
	background: var(--fg-placeholder);
	cursor: pointer;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	transition: border-color 0.15s ease;
}

.formagallery .fg-detail-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.formagallery .fg-detail-thumb:hover {
	border-color: var(--fg-line);
}

.formagallery .fg-detail-thumb.is-active {
	border-color: var(--fg-accent);
}

.fg-detail-body {
	padding: 30px 34px 34px;
}

.formagallery .fg-detail-title {
	margin: 0 0 14px;
	font-size: clamp(21px, 2.4vw, 28px);
	font-weight: 800;
	line-height: 1.2;
}

.formagallery .fg-detail-title a {
	color: var(--fg-ink);
	text-decoration: none;
}

.fg-detail-text {
	margin: 0 0 24px;
	color: var(--fg-body);
	font-size: 15px;
	line-height: 1.65;
}

.fg-detail-text p {
	margin: 0 0 12px;
}

.fg-detail-text p:last-child {
	margin-bottom: 0;
}

.formagallery .fg-detail-close {
	position: absolute;
	top: 8px;
	right: 10px;
	z-index: 3;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--fg-muted);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.formagallery .fg-detail-close:hover,
.formagallery .fg-detail-close:focus {
	color: var(--fg-ink);
}

.fg-detail-result:not(:empty) {
	margin-top: 14px;
	color: var(--fg-body);
	font-size: 14px;
}

.fg-detail-links {
	display: flex;
	flex-wrap: wrap;
	gap: 22px;
	margin-top: 18px;
}

.formagallery .fg-detail-links a {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	color: var(--fg-body);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-decoration: none;
	text-transform: uppercase;
}

.formagallery .fg-detail-links a:hover,
.formagallery .fg-detail-links a:focus {
	color: var(--fg-ink);
	text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 * Primary call to action
 * ------------------------------------------------------------------ */
.formagallery .fg-cta {
	display: block;
	width: 100%;
	margin: 0;
	padding: 16px 26px;
	border: 0;
	border-radius: 0;
	background: var(--fg-blue);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.08em;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s ease;
}

.formagallery .fg-cta:hover,
.formagallery .fg-cta:focus {
	background: var(--fg-blue-dark);
	color: #fff;
}

.formagallery .fg-cta[disabled] {
	opacity: 0.65;
	cursor: default;
}

.formagallery .fg-cta-compact {
	width: auto;
	padding: 11px 20px;
	font-size: 13px;
	letter-spacing: 0.05em;
}

/* ------------------------------------------------------------------ *
 * Results footer / loading
 * ------------------------------------------------------------------ */
.fg-note {
	margin: 42px 0 0;
	color: var(--fg-muted);
	font-size: 13px;
}

.fg-empty {
	margin: 40px 0;
	color: var(--fg-body);
	font-size: 16px;
}

.fg-loading {
	display: flex;
	justify-content: center;
	padding: 30px 0 6px;
}

.formagallery-spinner {
	display: inline-block;
	width: 26px;
	height: 26px;
	border: 3px solid var(--fg-line);
	border-top-color: var(--fg-blue);
	border-radius: 50%;
	animation: formagallery-spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
	.formagallery-spinner {
		animation-duration: 3s;
	}
	.formagallery .fg-card-img,
	.formagallery .fg-detail-slot {
		transition: none;
	}
}

/* ------------------------------------------------------------------ *
 * Lightbox (expand button → full image)
 * ------------------------------------------------------------------ */
.fg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 60px 20px;
}

.fg-lightbox[hidden] {
	display: none;
}

.fg-lb-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(8, 9, 11, 0.92);
}

.fg-lb-figure {
	position: relative;
	z-index: 1;
	max-width: 100%;
	max-height: 100%;
	margin: 0;
	text-align: center;
}

.fg-lb-figure img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 150px);
	margin: 0 auto;
	object-fit: contain;
}

.fg-lb-caption {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin-top: 16px;
	color: #f2f2f3;
	font-size: 14px;
}

.fg-lb-count {
	color: #9a9ea6;
	font-size: 13px;
}

.formagallery .fg-lb-close,
.formagallery .fg-lb-nav {
	position: absolute;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	cursor: pointer;
	transition: background 0.15s ease;
}

.formagallery .fg-lb-close:hover,
.formagallery .fg-lb-nav:hover,
.formagallery .fg-lb-close:focus,
.formagallery .fg-lb-nav:focus {
	background: rgba(255, 255, 255, 0.24);
	color: #fff;
}

.formagallery .fg-lb-close {
	top: 18px;
	right: 18px;
	width: 44px;
	height: 44px;
	font-size: 30px;
	line-height: 1;
}

.formagallery .fg-lb-nav {
	top: 50%;
	width: 48px;
	height: 68px;
	margin-top: -34px;
	font-size: 34px;
	line-height: 1;
}

.formagallery .fg-lb-prev {
	left: 14px;
}

.formagallery .fg-lb-next {
	right: 14px;
}

.formagallery .fg-lb-nav[hidden] {
	display: none;
}

body.formagallery-modal-open {
	overflow: hidden;
}

/* ------------------------------------------------------------------ *
 * Pricing modal + form
 * ------------------------------------------------------------------ */
.fg-modal {
	position: fixed;
	inset: 0;
	z-index: 100001;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	overflow-y: auto;
	padding: 40px 16px;
}

.fg-modal[hidden] {
	display: none;
}

.fg-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(20, 22, 26, 0.55);
}

.fg-modal-dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 460px;
	padding: 32px 34px 34px;
	background: #fff;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.formagallery .fg-modal-close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	color: var(--fg-muted);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.formagallery .fg-modal-close:hover,
.formagallery .fg-modal-close:focus {
	color: var(--fg-ink);
}

.fg-modal-eyebrow {
	margin: 0 0 6px;
	color: var(--fg-accent);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.13em;
	text-transform: uppercase;
}

.formagallery .fg-modal-title {
	margin: 0 0 10px;
	padding-right: 30px;
	font-size: 22px;
	font-weight: 800;
	line-height: 1.25;
}

.fg-modal-intro {
	margin: 0 0 22px;
	color: var(--fg-body);
	font-size: 14px;
	line-height: 1.55;
}

.fg-form-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.formagallery .fg-field {
	margin: 0;
	min-width: 0;
}

.formagallery .fg-full {
	grid-column: 1 / -1;
}

.formagallery .fg-half {
	grid-column: span 1;
}

@media (max-width: 480px) {
	.formagallery .fg-half {
		grid-column: 1 / -1;
	}
}

.formagallery .fg-field label {
	display: block;
	margin-bottom: 6px;
	color: var(--fg-ink);
	font-size: 13px;
	font-weight: 700;
}

.formagallery .fg-form .form-control {
	display: block;
	width: 100%;
	margin: 0;
	padding: 11px 13px;
	border: 1px solid var(--fg-line);
	border-radius: 0;
	background: #fff;
	color: var(--fg-ink);
	font-family: inherit;
	font-size: 15px;
	line-height: 1.4;
	box-shadow: none;
	-webkit-appearance: none;
	appearance: none;
}

.formagallery .fg-form select.form-control {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236a7280' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 32px;
}

.formagallery .fg-form .form-control:focus {
	border-color: var(--fg-blue);
	outline: 2px solid rgba(13, 134, 240, 0.18);
	outline-offset: 0;
}

.formagallery .fg-form .form-control::placeholder {
	color: var(--fg-muted);
	opacity: 1;
}

.formagallery .fg-form textarea.form-control {
	min-height: 96px;
	resize: vertical;
}

.fg-submit-row {
	margin-top: 6px;
}

.formagallery .fg-cta-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	letter-spacing: 0.04em;
	text-transform: none;
	font-size: 15px;
}

.formagallery .fg-cta-submit .formagallery-spinner {
	width: 16px;
	height: 16px;
	border-width: 2px;
	border-color: rgba(255, 255, 255, 0.45);
	border-top-color: #fff;
}

/*
 * Honeypot. Kept in the layout (bots ignore display:none) but pushed out of
 * sight and out of the tab order.
 */
.formagallery .fg-hp {
	position: absolute !important;
	left: -9999px !important;
	top: auto !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}

.formagallery-lead-result:empty {
	display: none;
}

.formagallery-lead-result {
	margin-top: 4px;
	color: var(--fg-body);
	font-size: 14px;
}

.fg-lead-inline {
	max-width: var(--fg-max);
	margin: 0 auto;
	padding: 30px 20px 60px;
}

.fg-lead-inline .fg-modal-dialog {
	max-width: 560px;
	margin: 0 auto;
	border: 1px solid var(--fg-line);
	box-shadow: none;
}

/* ------------------------------------------------------------------ *
 * Single project view
 * ------------------------------------------------------------------ */
.fg-single-container {
	max-width: var(--fg-max);
	margin: 0 auto;
	padding: 0 20px;
}

.fg-single-bar {
	border-bottom: 1px solid var(--fg-line);
	margin-bottom: 30px;
}

.fg-single-bar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	padding-top: 16px;
	padding-bottom: 16px;
}

.formagallery .fg-breadcrumb .breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
}

.formagallery .fg-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
	content: "/";
	margin-right: 8px;
	color: var(--fg-muted);
}

.formagallery .fg-breadcrumb .breadcrumb-item {
	display: flex;
	align-items: center;
	color: var(--fg-muted);
}

.formagallery .fg-breadcrumb a {
	color: var(--fg-muted);
	text-decoration: none;
}

.formagallery .fg-breadcrumb a:hover,
.formagallery .fg-breadcrumb a:focus {
	color: var(--fg-ink);
	text-decoration: underline;
}

.formagallery .fg-breadcrumb .is-current {
	color: var(--fg-ink);
	font-weight: 700;
}

/* Per the spec the single view hides the top CTA on phones — the CTA
   under the description carries the action there. */
@media (max-width: 767px) {
	.formagallery .fg-single-topcta {
		display: none;
	}
}

.formagallery .fg-single-title {
	margin: 0 0 24px;
	font-size: clamp(26px, 3.4vw, 38px);
	font-weight: 800;
	line-height: 1.15;
}

.fg-single-viewer {
	margin-bottom: 30px;
}

.fg-single-main {
	position: relative;
	background: var(--fg-placeholder);
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

.fg-single-main img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.formagallery .fg-single-nav {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	margin-top: -19px;
	padding: 0;
	border: 1px solid var(--fg-line);
	border-radius: 0;
	background: #fff;
	color: var(--fg-ink);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

.formagallery .fg-single-nav:hover,
.formagallery .fg-single-nav:focus {
	background: var(--fg-badge);
	color: #fff;
}

.formagallery .fg-single-prev {
	left: 14px;
}

.formagallery .fg-single-next {
	right: 14px;
}

/* Thumb strip. Fixed 150px tracks rather than 4 × 1fr: the viewer spans the
   full content column on single views, so fr tracks blew the thumbnails up to
   ~290px each. auto-fill keeps them left-aligned and wraps as needed. */
.fg-single-thumbs {
	display: grid;
	grid-template-columns: repeat(auto-fill, 150px);
	justify-content: start;
	gap: 12px;
	margin-top: 12px;
}

@media (max-width: 480px) {
	/* Narrow phones: two per row rather than one 150px thumb + dead space. */
	.fg-single-thumbs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.formagallery .fg-single-thumb {
	display: block;
	margin: 0;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 0;
	background: var(--fg-placeholder);
	cursor: pointer;
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

.formagallery .fg-single-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.formagallery .fg-single-thumb.is-active {
	border-color: var(--fg-accent);
}

.fg-single-content {
	max-width: 78ch;
	margin-bottom: 28px;
	color: var(--fg-body);
	font-size: 16px;
	line-height: 1.7;
}

.fg-single-subhead {
	margin: 0 0 12px;
	color: var(--fg-ink);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.13em;
	text-transform: uppercase;
}

.fg-single-categories {
	margin-bottom: 28px;
}

.formagallery .fg-cats-inline {
	padding: 0;
	border-bottom: 0;
	margin-bottom: 0;
}

.fg-single-cta-row {
	margin-bottom: 40px;
}

.fg-single-cta-row .fg-cta {
	width: auto;
	min-width: 240px;
}

.fg-single-cta-row .showResult:not(:empty) {
	margin-top: 12px;
	color: var(--fg-body);
	font-size: 14px;
}

.fg-single-download {
	margin-bottom: 40px;
}

.formagallery .fg-single-download a {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--fg-body);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-decoration: none;
	text-transform: uppercase;
}

.formagallery .fg-single-download a:hover,
.formagallery .fg-single-download a:focus {
	color: var(--fg-ink);
	text-decoration: underline;
}

.fg-single-expand {
	top: auto;
	bottom: 14px;
	right: 14px;
}

/* --- related --- */
.fg-related-items {
	padding-top: 34px;
	padding-bottom: 50px;
	border-top: 1px solid var(--fg-line);
}

.formagallery .fg-related-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.formagallery .fg-related-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.formagallery .fg-related-item a {
	display: block;
	color: var(--fg-ink);
	text-decoration: none;
}

.fg-related-media {
	display: block;
	background: var(--fg-placeholder);
	aspect-ratio: 4 / 3;
	overflow: hidden;
}

.formagallery .fg-related-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fg-related-title {
	display: block;
	margin-top: 10px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
}

.formagallery .fg-related-item a:hover .fg-related-title {
	text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 * Icons
 * ------------------------------------------------------------------ */
.formagallery-icon-download,
.formagallery-icon-expand {
	flex: 0 0 auto;
}


/* --- Theme compatibility: workbenches ---------------------------------------
 * The workbenches theme paints a red triangle marker on every <li> inside
 * <main id="main"> (`#main li:before` — the same marker the nav uses) and
 * indents each list item 20px. The gallery grid, the related-projects strip and
 * the breadcrumb are all lists, so every card inherited a stray red triangle and
 * a 20px offset. The theme's selectors carry ID specificity, so these must too.
 */
#main .formagallery li::before,
#main .formagallery li:before {
	content: none;
	display: none;
	border: 0;
}

#main .formagallery li {
	padding-left: 0;
	margin-bottom: 0;
	line-height: inherit;
}

/* Deterministic card sizing (workbenches).
 * The theme's cascade was letting the grid items shrink-wrap instead of stretch,
 * after which `aspect-ratio: 4/3` on the button resolved circularly against the
 * image's intrinsic size and collapsed the media to half the column width.
 * This replaces the aspect-ratio chain with a padding-bottom ratio box whose
 * height is derived only from its own width, plus absolute fills. No circular
 * dependency, no intrinsic-size fallback, nothing left for the theme to defeat.
 */
#main .formagallery .fg-grid {
	justify-items: stretch;
	align-items: start;
}

#main .formagallery .fg-card {
	width: 100%;
	min-width: 0;
	justify-self: stretch;
	padding-left: 0;
	margin-bottom: 0;
}

#main .formagallery .fg-card-media {
	position: relative;
	display: block;
	width: 100%;
	max-width: none;
	min-width: 0;
	height: 0;
	padding: 0 0 75% 0;      /* 4:3, measured against the card's own width */
	overflow: hidden;
	background: var(--fg-placeholder);
}

#main .formagallery .fg-card-open {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	aspect-ratio: auto;      /* neutralise the circular sizing */
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	overflow: hidden;
	cursor: pointer;
}

#main .formagallery .fg-card-img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	display: block;
}

/* Deterministic ratio boxes: related + single viewer (workbenches).
 * Same failure mode as the cards above — these also size themselves with
 * `aspect-ratio: 4/3`, so the theme's cascade can collapse them the same way.
 * Converted to the padding-bottom ratio box + absolute fill for the same reason.
 */
#main .formagallery .fg-related-grid {
	justify-items: stretch;
}

#main .formagallery .fg-related-item {
	width: 100%;
	min-width: 0;
	justify-self: stretch;
	padding-left: 0;
	margin-bottom: 0;
}

#main .formagallery .fg-related-media,
#main .formagallery .fg-single-main {
	position: relative;
	display: block;
	width: 100%;
	max-width: none;
	min-width: 0;
	height: 0;
	padding: 0 0 75% 0;
	aspect-ratio: auto;
	overflow: hidden;
	background: var(--fg-placeholder);
}

#main .formagallery .fg-related-media img,
#main .formagallery .fg-single-main img,
#main .formagallery #fg-single-main-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	display: block;
}
