/*
 * PureCSS.com
 * https://purecss.com/liquid-glass/
 * A glass panel that refracts the page behind it using an SVG displacement filter.
 */

/* the stripes make the bending easy to see; straight lines show every kink */
.demo-liquid-glass {
	--lg-scene: repeating-linear-gradient(115deg, #ff9040 0 18px, #ffd444 18px 36px, #57d9a3 36px 54px, #38bdf8 54px 72px, #c084fc 72px 90px);
}

/* the scene fills the home card rather than shrinking to its panel */
.card-preview .demo-liquid-glass {
	width: 100%;
}

.card-preview .demo-liquid-glass .lg-scene {
	width: 100%;
	height: 180px;
	border-radius: 0;
}

.demo-liquid-glass .lg-defs {
	position: absolute;
	width: 0;
	height: 0;
}

.demo-liquid-glass .lg-scene {
	width: min(100%, 420px);
	height: 220px;
	display: grid;
	place-items: center;
	overflow: hidden;
	position: relative;
	border-radius: var(--radius-lg);
}

/* the scene drifts right to left, one stripe period every 40s, so the stripes
   keep sliding through the glass; the layer is one period wider than the scene
   and 99.3px is that period across (90px / sin 115deg), so the loop has no seam */
.demo-liquid-glass .lg-scene::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: calc(100% + 100px);
	background: var(--lg-scene);
	animation: lg-drift 40s linear infinite;
}

@keyframes lg-drift {
	to {
		transform: translateX(-99.3px);
	}
}

/* the copy inside the variant's panel drifts with it; it moves its background
   rather than itself, so the bends stay put and the stripes pass through them */
@keyframes lg-drift-copy {
	to {
		background-position: -99.3px 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.demo-liquid-glass .lg-scene::before,
	.demo-liquid-glass .lg-copy::before {
		animation: none;
	}
}

/* frosted glass as the base, because Firefox and Safari accept url() here and then paint nothing */
.demo-liquid-glass .lg-panel {
	position: relative;
	overflow: hidden;
	width: min(80%, 290px);
	padding: 1.15rem 1.3rem;
	border: 1px solid rgba(255, 255, 255, .6);
	border-radius: 22px;
	color: #101012;
	background: rgba(255, 255, 255, .16);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 10px 28px rgba(0, 0, 0, .28);
	-webkit-backdrop-filter: blur(9px) saturate(1.3);
	backdrop-filter: blur(9px) saturate(1.3);
}

@supports (-webkit-app-region: inherit) {
	/* Chromium only: the one engine that runs an SVG filter inside backdrop-filter */
	.demo-liquid-glass .lg-panel {
		backdrop-filter: url(#lg-bend) blur(1px) saturate(1.4);
	}
}

.demo-liquid-glass .lg-title {
	position: relative;
	display: block;
	font-weight: 700;
}

.demo-liquid-glass .lg-text {
	position: relative;
	margin: .2rem 0 0;
	font-size: .85rem;
}

/* ── Variant: a filtered copy of the scene ── */

/* a copy of the scene inside the panel, because filter runs url() in all three engines */
.demo-liquid-glass .lg-copy {
	background: rgba(255, 255, 255, .05);
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

.demo-liquid-glass .lg-copy::before {
	content: "";
	position: absolute;
	inset: -30px;
	background: var(--lg-scene) 0 0 / calc(100% + 100px) 100% no-repeat;
	filter: url(#lg-bend);
	animation: lg-drift-copy 40s linear infinite;
}
