/* 追従バナー
 * 位置や大きさはテーマ側で上書きできるよう、CSS変数にまとめている。 */
:root {
	--afb-width: 400px;
	--afb-right: 24px;
	--afb-bottom: 24px;
	--afb-z: 900;
}

.afb {
	position: fixed;
	right: var(--afb-right);
	bottom: var(--afb-bottom);
	z-index: var(--afb-z);
	width: var(--afb-width);
	border-radius: 6px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
	opacity: 0;
	transform: translateX(calc(100% + var(--afb-right) + 16px));
	transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.afb.is-visible {
	opacity: 1;
	transform: none;
}

.afb[hidden] {
	display: none;
}

.afb__link {
	display: block;
	border-radius: inherit;
	overflow: hidden;
}

.afb__link:focus-visible {
	outline: 3px solid #0090a8;
	outline-offset: 2px;
}

.afb__img {
	display: block;
	width: 100%;
	height: auto;
	transition: opacity 0.2s;
}

.afb__link:hover .afb__img {
	opacity: 0.88;
}

.afb__close {
	position: absolute;
	top: -12px;
	right: -12px;
	width: 30px;
	height: 30px;
	padding: 0;
	border: 1px solid #ddd;
	border-radius: 50%;
	background: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.afb__close svg {
	width: 11px;
	height: 11px;
	fill: none;
	stroke: #333;
	stroke-width: 1.8;
}

.afb__close:focus-visible {
	outline: 3px solid #0090a8;
	outline-offset: 2px;
}

@media (max-width: 1199px) and (min-width: 768px) {
	:root {
		--afb-width: 340px;
	}
}

@media (max-width: 767px) {
	.afb {
		right: 0;
		left: 0;
		bottom: 0;
		width: auto;
		border-radius: 0;
		box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
		padding-bottom: env(safe-area-inset-bottom);
		background: #fff;
		transform: translateY(100%);
	}

	.afb.is-visible {
		transform: none;
	}

	.afb--pc-only {
		display: none !important;
	}

	.afb__close {
		top: -14px;
		right: 8px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.afb,
	.afb__img {
		transition: none;
	}
}

@media print {
	.afb {
		display: none !important;
	}
}
