/* Logo Flip Grid — front-end styles
   Every value below can be overridden per instance through CSS custom
   properties, which the renderer sets inline on the .lfg element. */

.lfg {
	--lfg-bg: #fafafa;
	--lfg-card: #ffffff;
	--lfg-radius: 10px;
	--lfg-card-h: 140px;
	--lfg-logo-h: 70px;
	--lfg-logo-w: 156px;
	--lfg-gap: 5px;
	--lfg-title-gap: 72px;
	--lfg-title-color: rgba(0, 0, 0, 0.8);
	--lfg-title-size: 20px;
	--lfg-pad-top: 90px;
	--lfg-pad-bottom: 180px;
	--lfg-pad-x: 30px;
	--lfg-max-w: 1400px;
	--lfg-cols: 5;
	--lfg-cols-t: 5;
	--lfg-cols-m: 2;
	--lfg-duration: 1000ms;
	--lfg-ease: cubic-bezier(0.175, 0.885, 0.32, 1.275); /* ease-out-back, like the original */

	box-sizing: border-box;
	width: 100%;
	background: var(--lfg-bg);
	padding: var(--lfg-pad-top) var(--lfg-pad-x) var(--lfg-pad-bottom);
}

.lfg *,
.lfg *::before,
.lfg *::after {
	box-sizing: border-box;
}

.lfg-inner {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--lfg-title-gap);
	width: 100%;
	max-width: var(--lfg-max-w);
	margin: 0 auto;
}

.lfg-title {
	margin: 0;
	padding: 0;
	text-align: center;
	font-size: var(--lfg-title-size);
	font-weight: 400;
	line-height: 1.45;
	color: var(--lfg-title-color);
}

.lfg-grid {
	display: grid;
	grid-template-columns: repeat(var(--lfg-cols), minmax(0, 1fr));
	gap: var(--lfg-gap);
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Card: provides the 3D perspective. */
.lfg-card {
	position: relative;
	height: var(--lfg-card-h);
	margin: 0;
	padding: 0;
	perspective: 500px;
	-webkit-perspective: 500px;
}

/* Flipper: the element that rotates (driven by JS). */
.lfg-flip {
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	-webkit-transform-style: preserve-3d;
	transform: rotateY(0deg);
	transition: transform var(--lfg-duration) var(--lfg-ease);
	will-change: transform;
}

/* Faces. */
.lfg-face {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--lfg-card);
	border-radius: var(--lfg-radius);
	overflow: hidden;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.lfg-back {
	transform: rotateY(180deg);
}

.lfg-face img {
	display: block;
	height: var(--lfg-logo-h);
	width: auto;
	max-width: min(var(--lfg-logo-w), 90%);
	max-height: 100%;
	margin: 0;
	object-fit: contain;
	border: 0;
	box-shadow: none;
}

/* Editor-only hint when demo logos are shown. */
.lfg-demo-note {
	margin: 0;
	text-align: center;
	font-size: 13px;
	color: #8a8a8a;
}

/* Responsive. */
@media (max-width: 1024px) {
	.lfg {
		padding-left: min(var(--lfg-pad-x), 15px);
		padding-right: min(var(--lfg-pad-x), 15px);
	}
	.lfg-grid {
		grid-template-columns: repeat(var(--lfg-cols-t), minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.lfg {
		padding-top: calc(var(--lfg-pad-top) * 0.67);
		padding-bottom: calc(var(--lfg-pad-bottom) * 0.67);
	}
	.lfg-inner {
		gap: calc(var(--lfg-title-gap) * 0.83);
	}
	.lfg-title {
		font-size: calc(var(--lfg-title-size) * 0.8);
	}
	.lfg-grid {
		grid-template-columns: repeat(var(--lfg-cols-m), minmax(0, 1fr));
	}
}

@media (prefers-reduced-motion: reduce) {
	.lfg-flip {
		transition: none;
	}
}
