/* Galleries, the photo viewer and the home slider. */

/* ---------- Gallery ----------
   Three layouts over the same photographs, in the same order:
   columns (masonry), rows of equal height, or a square grid. */

.wbg-gallery {
	--wbg-size: 320px;
	--wbg-gap: 10px;
	margin: 0;
	padding: 0;
}

.wbg-gallery .wbg-item {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--raise, #1c1c1c);
	cursor: zoom-in;
}

.wbg-gallery .wbg-item img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (hover: hover) {
	.wbg-gallery .wbg-item:hover img { transform: scale(1.035); }
}

.wbg-gallery .wbg-item:focus-visible {
	outline: 3px solid var(--sodium, #f5a623);
	outline-offset: -3px;
}

.wbg-cap {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 34px 14px 12px;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
	color: #fff;
	font-size: 15px;
	font-style: italic;
	line-height: 1.3;
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
}

.wbg-item:hover .wbg-cap,
.wbg-item:focus-visible .wbg-cap { opacity: 1; }

/* Columns. Before the script runs the browser's own columns are used; the
   script then places each photo in the shortest column, which keeps the
   order reading left to right. */
.wbg-gallery[data-layout="masonry"] {
	column-width: var(--wbg-size);
	column-gap: var(--wbg-gap);
}

.wbg-gallery[data-layout="masonry"] .wbg-item {
	aspect-ratio: var(--r);
	margin-bottom: var(--wbg-gap);
	break-inside: avoid;
}

.wbg-gallery[data-layout="masonry"].is-placed {
	position: relative;
	column-width: auto;
	columns: auto;
}

.wbg-gallery[data-layout="masonry"].is-placed .wbg-item {
	position: absolute;
	top: 0;
	left: 0;
	margin: 0;
	aspect-ratio: auto;
}

/* Rows of equal height that fill the width. */
.wbg-gallery[data-layout="rows"] {
	--wbg-row: calc(var(--wbg-size) * 0.72);
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: var(--wbg-gap);
}

.wbg-gallery[data-layout="rows"]::after {
	content: "";
	flex-grow: 1000000000;
}

.wbg-gallery[data-layout="rows"] .wbg-item {
	flex-grow: calc(var(--r) * 100);
	flex-basis: calc(var(--r) * var(--wbg-row));
	max-width: 100%;
	aspect-ratio: var(--r);
}

@media (max-width: 600px) {
	.wbg-gallery[data-layout="rows"] { --wbg-row: calc(var(--wbg-size) * 0.42); }
}

/* One large photograph on its own, between paragraphs. */
.wbg-gallery[data-layout="feature"] .wbg-item {
	width: min(100%, calc(86vh * var(--r)));
	margin: 0 auto;
	aspect-ratio: var(--r);
}

/* Square grid. */
.wbg-gallery[data-layout="grid"] {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(max(96px, min(calc(var(--wbg-size) * 0.72), 30%)), 1fr));
	gap: var(--wbg-gap);
}

.wbg-gallery[data-layout="grid"] .wbg-item { aspect-ratio: 1; }

@media (max-width: 600px) {
	.wbg-gallery { --wbg-gap: 6px !important; }
}

/* ---------- Photo viewer ---------- */

.wbg-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	flex-direction: column;
	background: hsl(var(--h, 32) var(--s, 7%) 4%);
	color: #fff;
	font-family: var(--body, Georgia, serif);
	-webkit-tap-highlight-color: transparent;
}

.wbg-lb.is-open { display: flex; }

.wbg-lb-top {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 60px;
	padding: 0 6px 0 clamp(14px, 2.4vw, 28px);
}

.wbg-lb-info { display: flex; align-items: baseline; gap: 16px; min-width: 0; font-size: 16px; }
.wbg-lb-count { flex: 0 0 auto; color: rgba(255, 255, 255, 0.6); font-variant-numeric: tabular-nums; }
.wbg-lb-cap { overflow: hidden; font-style: italic; text-overflow: ellipsis; white-space: nowrap; }
.wbg-lb-tools { display: flex; flex: 0 0 auto; }

.wbg-lb button {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: #fff;
	cursor: pointer;
}

.wbg-lb-tools button,
.wbg-lb-prev,
.wbg-lb-next { width: 52px; height: 52px; transition: background 0.2s ease, color 0.2s ease; }

.wbg-lb-tools button:hover,
.wbg-lb-tools button:focus-visible,
.wbg-lb-tools button[aria-pressed="true"],
.wbg-lb-prev:hover,
.wbg-lb-next:hover { background: var(--sodium, #f5a623); color: #1a1612; }

.wbg-lb svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: square; }
.wbg-lb .wbg-fill { fill: currentColor; stroke: none; }

.wbg-lb-stage {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0 64px;
	touch-action: pan-y;
}

.wbg-lb-img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	opacity: 0;
	transition: opacity 0.3s ease;
	user-select: none;
	-webkit-user-drag: none;
}

.wbg-lb-img.is-loaded { opacity: 1; }
.wbg-lb-prev,
.wbg-lb-next { position: absolute; top: 50%; margin-top: -26px; }
.wbg-lb-prev { left: 6px; }
.wbg-lb-next { right: 6px; }

/* Film strip: every photo in the gallery, the current one marked. */
.wbg-lb-strip {
	display: flex;
	flex: 0 0 auto;
	gap: 4px;
	padding: 10px clamp(10px, 2vw, 24px) 12px;
	overflow-x: auto;
	scrollbar-width: none;
}

.wbg-lb-strip::-webkit-scrollbar { display: none; }

.wbg-lb-strip button {
	flex: 0 0 auto;
	width: 84px;
	height: 56px;
	overflow: hidden;
	opacity: 0.4;
	outline-offset: -3px;
	transition: opacity 0.2s ease;
}

.wbg-lb-strip button:hover { opacity: 0.8; }
.wbg-lb-strip button[aria-current="true"] { opacity: 1; outline: 3px solid var(--sodium, #f5a623); }
.wbg-lb-strip img { display: block; width: 100%; height: 100%; object-fit: cover; }

body.wbg-lb-open { overflow: hidden; }

@media (max-width: 700px) {
	.wbg-lb-stage { padding: 0; }
	.wbg-lb-prev,
	.wbg-lb-next { display: none !important; }
	.wbg-lb-strip button { width: 60px; height: 42px; }
}

/* ---------- Home slider ---------- */

.wbg-slider {
	position: relative;
	width: 100%;
	height: calc(var(--wbg-vh, 100) * 1vh);
	height: calc(var(--wbg-vh, 100) * 1svh);
	min-height: 520px;
	overflow: hidden;
	background: #0b0a09;
	color: #fff;
	outline: none;
}

.wbg-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 1.4s ease, visibility 0s linear 1.4s;
}

.wbg-slide.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity 1.4s ease, visibility 0s;
	z-index: 1;
}

.wbg-slider .wbg-slide-img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	transform: scale(1.08);
	transition: transform 0s linear 1.4s;
}

/* Slow drift while the slide is showing. */
.wbg-slide.is-active .wbg-slide-img {
	transform: scale(1);
	transition: transform calc(var(--wbg-secs, 6s) + 1.6s) linear;
}

/* Darkens the corner the words sit in, leaves the rest of the photograph alone. */
.wbg-slide::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0) 58%),
		linear-gradient(to right, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 60%);
	pointer-events: none;
}

.wbg-slide-caption {
	position: absolute;
	right: var(--gutter, 5vw);
	bottom: clamp(64px, 11vh, 130px);
	z-index: 6;
	max-width: 30ch;
	text-align: right;
	opacity: 0;
	transition: opacity 0.9s ease 0.5s;
}

.wbg-slide.is-active .wbg-slide-caption { opacity: 1; }

.wbg-slider .wbg-slide-title {
	margin: 0 0 4px;
	color: #fff;
	font-size: 17px;
	font-style: italic;
	line-height: 1.35;
	text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}

.wbg-slider .wbg-slide-link {
	color: #fff;
	font-size: 17px;
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: var(--sodium, #f5a623);
	text-decoration-thickness: 2px;
	text-underline-offset: 4px;
	text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
}

.wbg-slider .wbg-slide-link:hover { color: var(--sodium, #f5a623); }

.wbg-slider .wbg-nav {
	position: absolute;
	top: 50%;
	z-index: 6;
	width: 56px;
	height: 56px;
	margin-top: -28px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: rgba(0, 0, 0, 0.3);
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.3s ease, background 0.2s ease;
}

.wbg-slider:hover .wbg-nav,
.wbg-slider:focus-within .wbg-nav { opacity: 1; }
.wbg-slider .wbg-nav:hover { background: var(--sodium, #f5a623); }

.wbg-nav::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 13px;
	height: 13px;
	border-top: 3px solid #fff;
	border-right: 3px solid #fff;
}

.wbg-nav:hover::before { border-color: #1a1612; }
.wbg-prev { left: 0; }
.wbg-next { right: 0; }
.wbg-prev::before { transform: translate(-30%, -50%) rotate(-135deg); }
.wbg-next::before { transform: translate(-70%, -50%) rotate(45deg); }

.wbg-dots {
	position: absolute;
	left: var(--gutter, 5vw);
	right: var(--gutter, 5vw);
	bottom: clamp(20px, 4vh, 44px);
	z-index: 6;
	display: flex;
	gap: 6px;
}

.wbg-dots button {
	position: relative;
	flex: 1 1 0;
	max-width: 120px;
	height: 24px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.wbg-dots button::before,
.wbg-dots button::after {
	content: "";
	position: absolute;
	left: 0;
	top: 10px;
	height: 3px;
}

.wbg-dots button::before { width: 100%; background: rgba(255, 255, 255, 0.3); }
.wbg-dots button::after { width: 0; background: var(--sodium, #f5a623); }
.wbg-dots button.is-done::after { width: 100%; }

.wbg-dots button.is-active::after {
	animation: wbg-progress var(--wbg-secs, 6s) linear forwards;
}

.wbg-slider.is-paused .wbg-dots button.is-active::after {
	animation: none;
	width: 100%;
}

@keyframes wbg-progress {
	from { width: 0; }
	to { width: 100%; }
}

.wbg-slider-empty {
	padding: calc(var(--header, 76px) + 40px) var(--gutter, 5vw) 40px;
	background: var(--raise, #1c1c1c);
	font-size: 17px;
}

@media (max-width: 800px) {
	.wbg-slider .wbg-nav { display: none; }
	.wbg-slide-caption { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.wbg-slider .wbg-slide-img,
	.wbg-slide.is-active .wbg-slide-img { transform: none; transition: none; }
	.wbg-gallery .wbg-item img { transition: none; }
}
