/* Home collage — columns travelling at different speeds. */

.xfb-collage {
	--xfb-col-gap: clamp(1rem, 2.4vw, 2.5rem);

	position: relative;
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	gap: var(--xfb-col-gap);
	align-items: start;
	width: 100%;
	height: calc(100svh - var(--xfb-header-height, 0px));
	margin-top: calc(-1 * var(--xfb-header-height, 0px));
	padding-top: var(--xfb-header-height, 0px);
	min-height: 34rem;
	padding: 0 var(--xfb-col-gap);
	overflow: hidden;
	background: var(--xfb-canvas, #fff);
	visibility: hidden;
}

.xfb-collage.is-ready {
	visibility: visible;
}

.xfb-col {
	min-width: 0;
}

.xfb-col__track {
	display: flex;
	flex-direction: column;
	gap: var(--xfb-tile-gap, 8rem);
	align-items: center;
	will-change: transform;
}

.xfb-tile {
	position: relative;
	display: block;
	flex: 0 0 auto;
	text-decoration: none;
	cursor: pointer;
	/* Width and height are set by JS so every photo carries the same visual
	   weight while keeping its own proportions. */
}

.xfb-tile img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* The work is the protagonist: no filters, no overlays. */
	transition: opacity 400ms ease;
}

.xfb-tile__code {
	position: absolute;
	left: 0;
	bottom: -1.5em;
	font-size: 0.7rem;
	letter-spacing: 0.14em;
	color: var(--xfb-ink, #111);
	opacity: 0;
	transition: opacity 200ms ease;
	pointer-events: none;
	white-space: nowrap;
}

.xfb-tile:hover .xfb-tile__code,
.xfb-tile:focus-visible .xfb-tile__code {
	opacity: 1;
}

.xfb-collage.is-hovering .xfb-tile img {
	opacity: 0.3;
}

.xfb-collage.is-hovering .xfb-tile:hover img,
.xfb-collage.is-hovering .xfb-tile:focus-visible img {
	opacity: 1;
}

.xfb-tile:focus-visible {
	outline: 1px solid var(--xfb-ink, #111);
	outline-offset: 4px;
}

.xfb-collage-empty {
	display: grid;
	place-content: center;
	gap: 0.5rem;
	min-height: 60vh;
	text-align: center;
	padding: 2rem;
}

.xfb-collage-empty__hint {
	font-size: 0.875rem;
	opacity: 0.7;
}

/* The movement is the differential, but it is never mandatory. */
@media (prefers-reduced-motion: reduce) {
	.xfb-collage {
		height: auto;
		overflow: visible;
		grid-auto-flow: row;
		grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
		padding: var(--xfb-col-gap);
	}

	.xfb-col__track {
		transform: none !important;
	}

	.xfb-tile__code {
		position: static;
		display: block;
		margin-top: 0.5rem;
		opacity: 1;
	}

	.xfb-collage.is-hovering .xfb-tile img {
		opacity: 1;
	}
}

.xfb-collage.is-static {
	height: auto;
	overflow: visible;
	grid-auto-flow: row;
	grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
	padding: var(--xfb-col-gap);
}

.xfb-collage.is-static .xfb-col__track {
	transform: none !important;
}

.xfb-collage.is-static .xfb-tile__code {
	position: static;
	display: block;
	margin-top: 0.5rem;
	opacity: 1;
}


/* Floating viewer ------------------------------------------------------ */

/* While a work is open the field behind it recedes almost to the canvas. */
.xfb-collage.is-viewing .xfb-tile img {
	opacity: 0.12;
}

.xfb-viewer {
	position: fixed;
	inset: 0;
	z-index: 30;
	display: grid;
	grid-template-rows: 1fr auto;
	gap: 0.75rem;
	padding: clamp(3.5rem, 7vh, 6rem) var(--xfb-margin) clamp(1.5rem, 4vh, 2.5rem);
	background: rgba(247, 247, 245, 0.92);
	backdrop-filter: blur(2px);
}

.xfb-viewer[hidden] {
	display: none;
}

.xfb-viewer__figure {
	display: grid;
	place-items: center;
	margin: 0;
	min-height: 0;
}

.xfb-viewer__figure img {
	/* Measured off the Figma: the open photo sits at ~55% of the viewport. */
	max-width: min(56vw, 820px);
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.xfb-viewer__meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	max-width: min(56vw, 820px);
	margin: 0 auto;
	width: 100%;
	font-size: 0.72rem;
	letter-spacing: 0.06em;
}

.xfb-viewer__code {
	color: var(--xfb-muted);
}

.xfb-viewer__link {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.28em;
}

.xfb-viewer__close {
	position: absolute;
	top: clamp(1rem, 3vh, 2rem);
	right: var(--xfb-margin);
	width: 2.25rem;
	height: 2.25rem;
	border: 0;
	background: none;
	font-size: 1.5rem;
	line-height: 1;
	color: inherit;
	cursor: pointer;
	opacity: 0.6;
	border-radius: 50%;
}

.xfb-viewer__close:hover {
	opacity: 1;
}

/* Keep the keyboard ring, but as a hairline that belongs to the design
   instead of the browser's default blue block. */
.xfb-viewer__close:focus-visible,
.xfb-viewer__link:focus-visible {
	opacity: 1;
	outline: 1px solid var(--xfb-ink);
	outline-offset: 3px;
}
