/*
 * FLOOR360 Site Kit: justified image grid.
 * Each tile's flex-grow and flex-basis are proportional to its aspect ratio (--ar), so every tile in a
 * row ends up the same height and rows fill the container width. No JavaScript needed for layout.
 */

/*
 * --f360-jig-row is the configured row height (set inline per grid); --f360-jig-h is the height rows
 * are sized from, derived here so the small-screen rule below still applies over the inline value.
 */
.f360-jig {
	--f360-jig-row: 230px;
	--f360-jig-h: var(--f360-jig-row);
	--f360-jig-gap: 4px;
	display: flex;
	flex-wrap: wrap;
	gap: var(--f360-jig-gap);
	margin: 0 0 1.5em;
	padding: 0;
	list-style: none;
}

/* Absorbs leftover space so the last row keeps its natural size instead of stretching. */
.f360-jig::after {
	content: "";
	flex-grow: 999999;
}

.f360-jig--last-justify::after { display: none; }
.f360-jig--last-center { justify-content: center; }
.f360-jig--last-center::after { display: none; }

.f360-jig__item {
	position: relative;
	overflow: hidden;
	margin: 0;
	flex-grow: calc(var(--ar, 1.333) * 100);
	flex-basis: calc(var(--ar, 1.333) * var(--f360-jig-h) * 0.82);
	background: #ececec;
}

.f360-jig__item img {
	display: block;
	width: 100%;
	height: auto;
	max-height: var(--f360-jig-row);
	aspect-ratio: var(--ar, 1.333);
	object-fit: cover;
	transition: transform 0.4s ease, filter 0.4s ease;
}

.f360-jig__link { display: block; color: inherit; }

.f360-jig__link:focus-visible {
	outline: 3px solid #b15d26;
	outline-offset: -3px;
}

.f360-jig__item:hover img,
.f360-jig__link:focus-visible img { transform: scale(1.03); }

.f360-jig__caption {
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	padding: 24px 12px 10px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
	color: #fff;
	font-size: 13px;
	line-height: 1.35;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}

.f360-jig__item:hover .f360-jig__caption,
.f360-jig__item:focus-within .f360-jig__caption {
	opacity: 1;
	transform: none;
}

@media (max-width: 480px) {
	.f360-jig { --f360-jig-h: calc(var(--f360-jig-row) * 0.7); }
}

@media (hover: none) {
	.f360-jig__caption { display: none; }
}

/* ---- Lightbox ---- */
.f360-lb {
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(12, 12, 14, 0.94);
	color: #fff;
}

.f360-lb::backdrop { background: rgba(12, 12, 14, 0.94); }

.f360-lb__figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 56px 64px 24px;
	box-sizing: border-box;
}

.f360-lb__img {
	max-width: 100%;
	max-height: calc(100% - 48px);
	object-fit: contain;
	user-select: none;
}

.f360-lb__caption {
	min-height: 24px;
	margin-top: 12px;
	font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	text-align: center;
}

.f360-lb__counter {
	position: absolute;
	top: 18px;
	left: 20px;
	font: 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	opacity: 0.8;
}

.f360-lb__btn {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	color: #fff;
	cursor: pointer;
}

.f360-lb__btn:hover,
.f360-lb__btn:focus-visible { background: rgba(255, 255, 255, 0.2); }
.f360-lb__btn:focus-visible { outline: 2px solid #fff; }
.f360-lb__close { top: 8px; right: 8px; }
.f360-lb__prev { top: 50%; left: 8px; transform: translateY(-50%); }
.f360-lb__next { top: 50%; right: 8px; transform: translateY(-50%); }

@media (max-width: 600px) {
	.f360-lb__figure { padding: 56px 8px 24px; }
	.f360-lb__prev,
	.f360-lb__next { top: auto; bottom: 8px; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.f360-jig__item img,
	.f360-jig__caption { transition: none; }
}
