/* Tree banner (JLW-2608). Reference: baum-banner-animation-demo.html on the ticket. */
.tree-banner {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 900;
	display: grid;
	grid-template-rows: auto 0fr;
	/* Width follows the content up to max-width, so longer texts and larger
	   system fonts wrap inside the card instead of running over its edge. */
	width: max-content;
	max-width: min(272px, calc(100vw - 48px));
	padding: 6px 18px 6px 6px;
	border-radius: 24px;
	background: #1E4A2C;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
	color: #fff;
	font-family: "TitilliumText22LRegular", Arial, sans-serif;
	text-decoration: none;
	/* Lets browsers that support it animate between max-content and 272px; others jump. */
	interpolate-size: allow-keywords;
	transition: grid-template-rows .2s ease, border-radius .2s ease, width .2s ease, padding .2s ease;
}

.tree-banner:hover,
.tree-banner:focus,
.tree-banner:visited {
	color: #fff;
	text-decoration: none;
}

/* Hidden start state only once the script runs, so the banner stays visible without JS. */
.tree-banner.tree-banner--js {
	visibility: hidden;
	transform: translateX(calc(-100% - 40px));
	opacity: 0;
}

.tree-banner.tree-banner--in {
	visibility: visible;
	animation: tree-banner-slide-in .5s cubic-bezier(.2, .8, .2, 1) forwards;
}

.tree-banner.tree-banner--shown {
	visibility: visible;
	transform: none;
	opacity: 1;
}

@keyframes tree-banner-slide-in {
	from { transform: translateX(calc(-100% - 40px)); opacity: 0; }
	to { transform: none; opacity: 1; }
}

.tree-banner__top {
	display: flex;
	align-items: center;
	gap: 10px;
}

.tree-banner__icon {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #C9DBC1;
}

.tree-banner__tree {
	width: 22px;
	height: 22px;
	transform-origin: 50% 92%;
}

.tree-banner__tree.tree-banner__tree--wiggle {
	animation: tree-banner-wiggle .7s ease-in-out;
}

@keyframes tree-banner-wiggle {
	0% { transform: rotate(0); }
	15% { transform: rotate(-7deg); }
	32% { transform: rotate(5.6deg); }
	48% { transform: rotate(-3.5deg); }
	64% { transform: rotate(2.1deg); }
	80% { transform: rotate(-.7deg); }
	100% { transform: rotate(0); }
}

.tree-banner__title {
	min-width: 0;
	overflow-wrap: anywhere;
}

.tree-banner__num {
	font-family: "TitilliumText22LBold", Arial, sans-serif;
	font-size: 22px;
	line-height: 26px;
}

.tree-banner__lbl {
	font-size: 16px;
	line-height: 20px;
}

.tree-banner__more {
	overflow: hidden;
	/* The hidden hover text must not widen the collapsed card. */
	contain: inline-size;
}

.tree-banner__text {
	display: block;
	margin-top: 10px;
	font-size: 15px;
	line-height: 22px;
}

.tree-banner__link {
	display: block;
	margin-top: 8px;
	color: #C9DBC1;
	font-family: "TitilliumText22LBold", Arial, sans-serif;
	font-size: 15px;
	line-height: 22px;
}

.tree-banner:focus-visible {
	grid-template-rows: auto 1fr;
	width: 272px;
	padding: 14px 18px 16px 14px;
	border-radius: 16px;
	/* Transparent outline instead of none: forced-colors mode drops the box-shadow ring but paints the outline. */
	outline: 2px solid transparent;
	outline-offset: 2px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .2), 0 0 0 2px #fff, 0 0 0 5px #004F8B;
}

/* Touch devices have no hover: a tap opens the landing page directly, so the card only expands for a real pointer. */
@media (hover: hover) {
	.tree-banner:hover {
		grid-template-rows: auto 1fr;
		width: 272px;
		padding: 14px 18px 16px 14px;
		border-radius: 16px;
	}
}

/* The mobile panel menu drops its inert attribute while open; the banner would cover menu items there. */
body:has(nav.jrpanelmenu:not([inert])) .tree-banner {
	visibility: hidden;
}

@media (max-width: 700px) {
	.tree-banner {
		left: 16px;
		bottom: 16px;
		max-width: min(240px, calc(100vw - 32px));
	}
}

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