/**
 * BrandID Mosaic — front-end styles.
 *
 * Layout strategy: one grid definition serves both modes. In grid mode the
 * slide wrappers created by JavaScript are display:contents, so every tile
 * lands in a single continuous grid. In carousel mode the track becomes a
 * scroll-snap flex row and each slide is its own grid.
 *
 * Row height comes from a container query, so a tile that spans two rows is
 * exactly twice as tall as one that spans a single row, gap included, without
 * any JavaScript measuring.
 */

.bidm {
	--bidm-cols: 4;
	--bidm-gap: 8px;
	--bidm-ratio: 1;
	--bidm-transition: 400ms;
	--bidm-arrow-size: 44px;
	--bidm-dot-size: 8px;
	--bidm-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

	position: relative;
	box-sizing: border-box;
}

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

/* ---------------------------------------------------------------------------
 * Filter bar
 * ------------------------------------------------------------------------ */

.bidm-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0 0 24px;
	padding: 0;
}

.bidm-filter {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 8px 18px;
	border: 1px solid #d9d2c9;
	border-radius: 999px;
	background: transparent;
	color: #3f3a35;
	font: inherit;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color var(--bidm-transition) var(--bidm-ease),
		color var(--bidm-transition) var(--bidm-ease),
		border-color var(--bidm-transition) var(--bidm-ease);
}

.bidm-filter:hover {
	background-color: rgba(0, 0, 0, 0.04);
}

.bidm-filter.is-active {
	background-color: #3f3a35;
	border-color: #3f3a35;
	color: #fff;
}

.bidm-filter:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.bidm-filter__count {
	font-size: 0.85em;
	opacity: 0.7;
}

/* ---------------------------------------------------------------------------
 * Viewport and track
 * ------------------------------------------------------------------------ */

.bidm-viewport {
	container-type: inline-size;
	position: relative;
	overflow: hidden;
}

.bidm-track {
	--bidm-cell-w: calc((100cqw - (var(--bidm-cols) - 1) * var(--bidm-gap)) / var(--bidm-cols));
	--bidm-row-h: calc(var(--bidm-cell-w) / var(--bidm-ratio));

	display: grid;
	grid-template-columns: repeat(var(--bidm-cols), minmax(0, 1fr));
	grid-auto-rows: var(--bidm-row-h);
	grid-auto-flow: row dense;
	gap: var(--bidm-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Slide wrappers exist in both modes; in grid mode they vanish from the box
   tree so their children join the parent grid. */
.bidm-slide {
	display: contents;
}

/* ---------------------------------------------------------------------------
 * Tiles
 * ------------------------------------------------------------------------ */

.bidm-item {
	grid-column-end: span var(--bidm-x, 1);
	grid-row-end: span var(--bidm-y, 1);
	position: relative;
	min-width: 0;
	margin: 0;
}

.bidm-item--fixed-col {
	grid-column-start: var(--bidm-col);
}

.bidm-item__inner {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 6px;
	background-color: #f1efec;
	transition: transform var(--bidm-transition) var(--bidm-ease),
		box-shadow var(--bidm-transition) var(--bidm-ease),
		border-color var(--bidm-transition) var(--bidm-ease);
}

.bidm-item__link {
	display: block;
	width: 100%;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

.bidm-item__link:focus-visible {
	outline: 3px solid #3f3a35;
	outline-offset: -3px;
}

/*
 * Prefixed with .bidm on purpose. Elementor ships `.elementor img { height: auto }`
 * and most themes reset `figure` margins; both are element+class selectors, so
 * they outrank a lone class and the photo would keep its natural height with the
 * tile background showing underneath.
 */
.bidm .bidm-item__media {
	position: absolute;
	inset: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

.bidm .bidm-item__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
	transition: transform var(--bidm-transition) var(--bidm-ease),
		filter var(--bidm-transition) var(--bidm-ease);
	will-change: transform;
}

.bidm-item__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 56px;
	height: 56px;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	pointer-events: none;
}

.bidm-item__play::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	width: 0;
	height: 0;
	transform: translate(-50%, -50%);
	border-style: solid;
	border-width: 9px 0 9px 15px;
	border-color: transparent transparent transparent #1c1c1c;
}

/* Overlay ---------------------------------------------------------------- */

.bidm-item__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 18px;
	background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.65) 100%);
	pointer-events: none;
}

.bidm--overlay-hover .bidm-item__overlay {
	opacity: 0;
	transition: opacity var(--bidm-transition) var(--bidm-ease);
}

.bidm--overlay-hover .bidm-item:hover .bidm-item__overlay,
.bidm--overlay-hover .bidm-item:focus-within .bidm-item__overlay {
	opacity: 1;
}

.bidm--overlay-never .bidm-item__overlay {
	display: none;
}

.bidm-item__content > * {
	margin: 0;
}

.bidm-item__title {
	color: #fff;
	font-size: 1.05rem;
	line-height: 1.25;
}

.bidm-item__subtitle,
.bidm-item__excerpt {
	color: rgba(255, 255, 255, 0.82);
	font-size: 0.9rem;
	line-height: 1.4;
}

.bidm-item__cat {
	display: block;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.78rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.bidm-item__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 4px 10px;
	border-radius: 999px;
	background: #fff;
	color: #1c1c1c;
	font-size: 0.72rem;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

/* Filtering transitions --------------------------------------------------- */

.bidm-item.is-leaving {
	opacity: 0;
	transform: scale(0.96);
	transition: opacity 180ms ease, transform 180ms ease;
}

.bidm-item.is-entering {
	animation: bidm-enter 320ms var(--bidm-ease) both;
}

@keyframes bidm-enter {
	from {
		opacity: 0;
		transform: translateY(12px) scale(0.98);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

.bidm-item[hidden] {
	display: none !important;
}

/* ---------------------------------------------------------------------------
 * Carousel mode
 * ------------------------------------------------------------------------ */

.bidm.is-carousel .bidm-track {
	display: flex;
	grid-auto-flow: unset;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	-ms-overflow-style: none;
	overscroll-behavior-x: contain;
	touch-action: pan-y pinch-zoom;
}

.bidm.is-carousel .bidm-track::-webkit-scrollbar {
	display: none;
}

.bidm.is-carousel .bidm-slide {
	display: grid;
	flex: 0 0 100%;
	width: 100%;
	min-width: 100%;
	grid-template-columns: repeat(var(--bidm-cols), minmax(0, 1fr));
	grid-auto-rows: var(--bidm-row-h);
	grid-auto-flow: row dense;
	gap: var(--bidm-gap);
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

/* Snapping has to stand down while a scripted scroll runs, otherwise the
   browser fights the tween and the slide never lands where it was asked to. */
.bidm.is-carousel.is-dragging .bidm-track,
.bidm.is-carousel.is-animating .bidm-track {
	scroll-snap-type: none;
}

.bidm.is-carousel.is-dragging .bidm-track {
	cursor: grabbing;
}

.bidm.is-carousel.is-draggable .bidm-track {
	cursor: grab;
}

.bidm.is-carousel.is-dragging .bidm-item__link {
	pointer-events: none;
}

/* Arrows ------------------------------------------------------------------ */

.bidm-arrows {
	display: none;
}

.bidm.is-carousel .bidm-arrows {
	display: block;
}

.bidm-arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--bidm-arrow-size);
	height: var(--bidm-arrow-size);
	transform: translateY(-50%);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #1c1c1c;
	cursor: pointer;
	transition: background-color var(--bidm-transition) var(--bidm-ease), opacity 200ms ease;
}

.bidm-arrow svg {
	width: 55%;
	height: 55%;
}

.bidm-arrow--prev {
	left: 12px;
}

.bidm-arrow--next {
	right: 12px;
}

.bidm-arrow:disabled {
	opacity: 0.35;
	cursor: default;
}

.bidm-arrow:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.bidm--arrows-outside .bidm-arrow--prev {
	left: calc(var(--bidm-arrow-size) * -0.5 - 8px);
}

.bidm--arrows-outside .bidm-arrow--next {
	right: calc(var(--bidm-arrow-size) * -0.5 - 8px);
}

.bidm--arrows-bottom .bidm-arrow {
	position: static;
	transform: none;
}

.bidm--arrows-bottom .bidm-arrows {
	display: none;
}

.bidm--arrows-bottom.is-carousel .bidm-arrows {
	display: flex;
	justify-content: center;
	gap: 8px;
	margin-top: 16px;
}

/* Dots -------------------------------------------------------------------- */

.bidm-dots {
	display: none;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: 16px;
}

.bidm.is-carousel .bidm-dots {
	display: flex;
}

.bidm-dot {
	width: var(--bidm-dot-size);
	height: var(--bidm-dot-size);
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #d3ccc3;
	cursor: pointer;
	transition: background-color 200ms ease, transform 200ms ease;
}

.bidm-dot.is-active {
	background: #3f3a35;
	transform: scale(1.25);
}

.bidm-dot:focus-visible {
	outline: 2px solid #3f3a35;
	outline-offset: 3px;
}

/* Progress ---------------------------------------------------------------- */

.bidm-progress {
	display: none;
	height: 3px;
	margin-top: 16px;
	border-radius: 999px;
	background: #e6e1da;
	overflow: hidden;
}

.bidm.is-carousel .bidm-progress {
	display: block;
}

.bidm-progress__bar {
	display: block;
	width: 0;
	height: 100%;
	border-radius: inherit;
	background: #3f3a35;
	transition: width 200ms var(--bidm-ease);
}

/* ---------------------------------------------------------------------------
 * Masonry
 * ------------------------------------------------------------------------ */

.bidm--engine-masonry .bidm-track,
.bidm--engine-masonry.is-carousel .bidm-slide {
	grid-auto-rows: var(--bidm-unit, 8px);
	grid-auto-flow: row;
}

.bidm--engine-masonry .bidm-item__inner {
	height: auto;
}

/* Doubled class so these keep winning over the .bidm-prefixed rules above. */
.bidm.bidm--engine-masonry .bidm-item__media {
	position: static;
}

.bidm.bidm--engine-masonry .bidm-item__img {
	height: auto;
}

/* ---------------------------------------------------------------------------
 * Pagination, states
 * ------------------------------------------------------------------------ */

.bidm-loadmore {
	display: flex;
	justify-content: center;
	margin-top: 32px;
}

.bidm-loadmore__button {
	padding: 14px 32px;
	border: 0;
	border-radius: 999px;
	background: #3f3a35;
	color: #fff;
	font: inherit;
	cursor: pointer;
	transition: background-color var(--bidm-transition) var(--bidm-ease);
}

.bidm-loadmore__button:disabled {
	opacity: 0.6;
	cursor: default;
}

.bidm-empty {
	margin: 32px 0;
	text-align: center;
	opacity: 0.7;
}

.bidm-status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	border: 0;
	clip-path: inset(50%);
	white-space: nowrap;
}

.bidm-spinner {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 4;
	transform: translate(-50%, -50%);
	opacity: 0;
	pointer-events: none;
	transition: opacity 200ms ease;
}

.bidm.is-loading .bidm-spinner {
	opacity: 1;
}

.bidm.is-loading .bidm-track {
	opacity: 0.45;
	transition: opacity 200ms ease;
}

.bidm-spinner span {
	display: block;
	width: 32px;
	height: 32px;
	border: 3px solid rgba(0, 0, 0, 0.15);
	border-top-color: #3f3a35;
	border-radius: 50%;
	animation: bidm-spin 700ms linear infinite;
}

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

/* ---------------------------------------------------------------------------
 * Lightbox
 * ------------------------------------------------------------------------ */

.bidm-sentinel {
	width: 100%;
	height: 1px;
}

.bidm-parked {
	display: none;
}

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

.bidm-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 5vmin;
	background: rgba(14, 13, 12, 0.94);
	opacity: 0;
	visibility: hidden;
	transition: opacity 250ms ease, visibility 250ms;
}

.bidm-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.bidm-lightbox__stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	max-height: 100%;
}

.bidm-lightbox__slot {
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	max-height: 100%;
}

.bidm-lightbox__media {
	display: block;
	max-width: 100%;
	max-height: 85vh;
	width: auto;
	height: auto;
	border-radius: 4px;
	object-fit: contain;
}

.bidm-lightbox__frame {
	width: min(90vw, 1280px);
	aspect-ratio: 16 / 9;
	max-height: 85vh;
	border: 0;
	border-radius: 4px;
}

.bidm-lightbox__caption {
	position: absolute;
	right: 0;
	bottom: -2.6em;
	left: 0;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.9rem;
	text-align: center;
}

.bidm-lightbox__ui {
	position: absolute;
	border: 0;
	background: rgba(255, 255, 255, 0.1);
	color: #fff;
	cursor: pointer;
	transition: background-color 200ms ease;
}

.bidm-lightbox__ui:hover {
	background: rgba(255, 255, 255, 0.22);
}

.bidm-lightbox__ui:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.bidm-lightbox__close {
	top: 16px;
	right: 16px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	font-size: 20px;
	line-height: 44px;
}

.bidm-lightbox__prev,
.bidm-lightbox__next {
	top: 50%;
	width: 48px;
	height: 48px;
	transform: translateY(-50%);
	border-radius: 50%;
}

.bidm-lightbox__prev {
	left: 16px;
}

.bidm-lightbox__next {
	right: 16px;
}

.bidm-lightbox__counter {
	position: absolute;
	top: 22px;
	left: 24px;
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.85rem;
	font-variant-numeric: tabular-nums;
}

body.bidm-lightbox-open {
	overflow: hidden;
}

/* ---------------------------------------------------------------------------
 * Fallbacks and preferences
 * ------------------------------------------------------------------------ */

@supports not (container-type: inline-size) {
	.bidm-track,
	.bidm.is-carousel .bidm-slide {
		grid-auto-rows: minmax(0, auto);
	}

	.bidm:not(.bidm--engine-masonry) .bidm-item {
		aspect-ratio: calc(var(--bidm-x, 1) * var(--bidm-ratio)) / var(--bidm-y, 1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.bidm *,
	.bidm-lightbox * {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}

	.bidm-item:hover .bidm-item__img {
		transform: none !important;
	}
}

/* Right-to-left: the scroll axis flips on its own, only static offsets need help. */
[dir="rtl"] .bidm-item__badge {
	right: 12px;
	left: auto;
}

[dir="rtl"] .bidm-lightbox__counter {
	right: 24px;
	left: auto;
}
