/*
 * Floating Baubuch card (includes/baubuch-float.php).
 *
 * Ported from src-v2/baubuch-cta.jsx (BaubuchCTA): the desktop card in its
 * default "stacked" layout and beige theme, and the compact mobile pill with
 * the card it opens. All values are the design's inline styles.
 *
 * Hidden state uses visibility on a delay, so the links cannot be tabbed to
 * while the card is off screen. The 900px breakpoint matches header.css.
 */

.fmt-baubuch-float {
	--fmt-bb-bg: #fbf6e9;
	--fmt-bb-border: rgba(20, 18, 12, .08);

	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 100;
	transform: translateY(160%);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: transform .55s cubic-bezier(.16, 1, .3, 1), opacity .35s ease, visibility 0s linear .55s;
}
.fmt-baubuch-float.is-visible {
	transform: translateY(0);
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transition: transform .55s cubic-bezier(.16, 1, .3, 1), opacity .35s ease, visibility 0s;
}
.fmt-baubuch-float.is-dismissed {
	display: none;
}

/* ---------------------------------------------------------- Card -- */

.fmt-baubuch-float__card {
	position: relative;
	overflow: hidden;
	background: var(--fmt-bb-bg);
	border: 1px solid var(--fmt-bb-border);
}
.fmt-baubuch-float__card--desktop {
	display: flex;
	flex-direction: column;
	width: 208px;
	border-radius: 4px;
	box-shadow: 0 30px 50px -20px rgba(20, 18, 12, .35), 0 10px 24px -12px rgba(20, 18, 12, .25);
	cursor: pointer;
}

.fmt-baubuch-float__body {
	padding: 14px 16px;
}

.fmt-baubuch-float__img {
	background-size: cover;
	background-position: center;
}
.fmt-baubuch-float__img--below {
	min-height: 132px;
	border-top: 1px solid var(--fmt-bb-border);
}

.fmt-baubuch-float__eyebrow {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
	font-size: 10px;
	line-height: 1.4;
	color: var(--ink-mute);
	text-transform: uppercase;
	letter-spacing: .15em;
}

.fmt-baubuch-float__title {
	display: block;
	margin-bottom: 4px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.01em;
	color: var(--ink);
	text-decoration: none;
}

/* The title link covers the whole desktop card; the close button sits above. */
.fmt-baubuch-float__stretch::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}
.fmt-baubuch-float__stretch:focus-visible {
	outline: none;
}
.fmt-baubuch-float__stretch:focus-visible::after {
	outline: 2px solid var(--red);
	outline-offset: -2px;
}

.fmt-baubuch-float__meta {
	margin-bottom: 8px;
	font-size: 11px;
	line-height: 1.5;
	color: var(--ink-soft);
}

.fmt-baubuch-float__cta {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	font-weight: 500;
	color: var(--red);
	text-decoration: none;
}

.fmt-baubuch-float__close {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(20, 18, 12, .06);
	color: var(--ink-soft);
	cursor: pointer;
}

/* -------------------------------------------------------- Mobile -- */

.fmt-baubuch-float__mobile {
	display: none;
}

@media (max-width: 900px) {
	.fmt-baubuch-float {
		right: 16px;
		bottom: 16px;
	}

	.fmt-baubuch-float__card--desktop {
		display: none;
	}
	.fmt-baubuch-float__mobile {
		display: block;
	}

	/* The pill: one button opens the card, the small round one dismisses. */
	.fmt-baubuch-float__pill {
		display: inline-flex;
		align-items: center;
		gap: 2px;
		padding: 10px 14px 10px 12px;
		background: var(--fmt-bb-bg);
		border: 1px solid var(--fmt-bb-border);
		border-radius: 999px;
		box-shadow: 0 18px 34px -16px rgba(20, 18, 12, .4), 0 6px 16px -10px rgba(20, 18, 12, .25);
	}
	.fmt-baubuch-float.is-open .fmt-baubuch-float__pill {
		display: none;
	}

	.fmt-baubuch-float__pill-open {
		display: inline-flex;
		align-items: center;
		gap: 10px;
		padding: 0;
		border: none;
		background: none;
		font: inherit;
		color: inherit;
		cursor: pointer;
	}
	.fmt-baubuch-float__pill-icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: 30px;
		height: 30px;
		border-radius: 50%;
		background: var(--red);
		color: #fff;
	}
	.fmt-baubuch-float__pill-label {
		font-size: 14px;
		font-weight: 500;
		letter-spacing: -0.01em;
		color: var(--ink);
	}
	.fmt-baubuch-float__pill-arrow {
		display: inline-flex;
		color: var(--red);
	}
	.fmt-baubuch-float__pill-close {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: 22px;
		height: 22px;
		margin-left: 10px;
		padding: 0;
		border: none;
		border-radius: 50%;
		background: rgba(20, 18, 12, .06);
		color: var(--ink-soft);
		cursor: pointer;
	}

	/* The card the pill opens into. */
	.fmt-baubuch-float__card--mobile {
		width: 244px;
		border-radius: 8px;
		box-shadow: 0 26px 46px -18px rgba(20, 18, 12, .42), 0 8px 20px -12px rgba(20, 18, 12, .28);
		cursor: pointer;
	}
	.fmt-baubuch-float__card--mobile[hidden] {
		display: none;
	}
	.fmt-baubuch-float__card--mobile .fmt-baubuch-float__body {
		padding: 14px 16px 16px;
	}
	.fmt-baubuch-float__card--mobile .fmt-baubuch-float__title {
		margin-bottom: 6px;
	}
	.fmt-baubuch-float__card--mobile .fmt-baubuch-float__cta {
		gap: 6px;
		font-size: 13px;
	}
	.fmt-baubuch-float__img--top {
		aspect-ratio: 16 / 10;
		border-bottom: 1px solid var(--fmt-bb-border);
	}
	.fmt-baubuch-float__text {
		margin: 0 0 12px;
		font-size: 12px;
		line-height: 1.5;
		color: var(--ink-soft);
	}
	.fmt-baubuch-float__fold {
		position: absolute;
		top: 8px;
		right: 8px;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 26px;
		height: 26px;
		padding: 0;
		border: 1px solid rgba(20, 18, 12, .08);
		border-radius: 50%;
		background: #fff;
		color: var(--ink);
		box-shadow: 0 2px 8px -2px rgba(20, 18, 12, .35);
		cursor: pointer;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fmt-baubuch-float,
	.fmt-baubuch-float.is-visible {
		transform: none;
		transition: opacity .2s ease, visibility 0s linear .2s;
	}
	.fmt-baubuch-float.is-visible {
		transition: opacity .2s ease, visibility 0s;
	}
}
