/* CTAの海賊 - フロントエンド共通スタイル */

.aci-cta {
	margin: 24px 0;
}

/* ====== デバイス制御（CSS二重ガード） ====== */
@media (max-width: 767px) {
	.aci-device-pc:not(.aci-cta-popup-overlay):not(.aci-cta-fixed-bottom):not(.aci-cta-bottom-right) {
		display: none !important;
	}
}
@media (min-width: 768px) {
	.aci-device-sp:not(.aci-cta-popup-overlay):not(.aci-cta-fixed-bottom):not(.aci-cta-bottom-right) {
		display: none !important;
	}
}

/* ====== 共通: 閉じるボタン ====== */
.aci-cta-close {
	position: absolute;
	top: -12px;
	right: -12px;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid #333;
	color: #333;
	font-size: 18px;
	font-weight: bold;
	line-height: 1;
	cursor: pointer;
	z-index: 1;
	box-shadow: 0 2px 6px rgba(0,0,0,0.2);
	padding: 0;
}
.aci-cta-close:hover {
	background: #333;
	color: #fff;
}

.aci-hidden { display: none !important; }
.aci-visible { display: flex; }

/* ====== ポップアップ ====== */
.aci-cta-popup-overlay {
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: 99999;
	align-items: center;
	justify-content: center;
	padding: 20px;
	margin: 0;
	box-sizing: border-box;
}
/* 通常モード: 内容のサイズに自動フィット（max 95vw / 95vh） */
.aci-cta-popup-content {
	position: relative;
	width: auto;
	max-width: 95vw;
	max-height: 95vh;
	overflow: auto;
	background: transparent;
}
.aci-cta-popup-body {
	background: transparent;
}

/* ====== ポップアップ・画像モード ====== */
.aci-cta-popup-image-mode .aci-cta-popup-content {
	max-width: 95vw;
	max-height: 95vh;
	background: transparent;
	overflow: visible;
}
.aci-cta-popup-image-mode .aci-cta-popup-body {
	line-height: 0;
	background: transparent;
}
.aci-popup-image {
	display: block;
	width: auto;
	height: auto;
	max-width: 95vw;
	max-height: 95vh;
	border-radius: 4px;
}
.aci-cta-popup-image-mode a {
	display: inline-block;
	line-height: 0;
}

/* ====== 下部固定（全幅バー） ====== */
.aci-cta-fixed-bottom {
	position: fixed;
	left: 0; right: 0; bottom: 0;
	z-index: 9998;
	margin: 0;
	background: #fff;
	box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}
.aci-cta-fixed-bottom .aci-cta-close {
	top: -12px;
	right: 12px;
}
.aci-cta-fixed-bottom-body {
	padding: 0;
}

/* ====== 画面右下（カード） ====== */
.aci-cta-bottom-right {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9997;
	max-width: 360px;
	margin: 0;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.aci-cta-bottom-right .aci-cta-close {
	top: -12px;
	right: -12px;
}
.aci-cta-bottom-right-body {
	padding: 0;
}

/* ====== 画面左下（カード） ====== */
.aci-cta-bottom-left {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 9997;
	max-width: 360px;
	margin: 0;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.aci-cta-bottom-left .aci-cta-close {
	top: -12px;
	left: -12px;
	right: auto;
}
.aci-cta-bottom-left-body {
	padding: 0;
}

/* ====== モバイル時の下部固定/右下/左下のレスポンシブ ====== */
@media (max-width: 767px) {
	.aci-cta-bottom-right,
	.aci-cta-bottom-left {
		left: 12px;
		right: 12px;
		max-width: none;
	}
}

/* ====== サイドバー: 余白リセット + 画像はみ出し防止 ====== */
.aci-cta-sidebar {
	margin: 0;
	max-width: 100%;
	box-sizing: border-box;
	overflow: hidden;
	word-break: break-word;
}
.aci-cta-sidebar img,
.aci-cta-sidebar .aci-cta-image,
.aci-cta-sidebar .aci-popup-image,
.aci-cta-sidebar .aci-preset-logo,
.aci-cta-sidebar .aci-preset-image,
.aci-cta-sidebar .aci-preset {
	max-width: 100% !important;
	height: auto;
	box-sizing: border-box;
}
.aci-cta-sidebar .aci-preset {
	margin: 0 !important;
}
.aci-cta-sidebar .aci-cta-link {
	display: block;
	max-width: 100%;
}

/* ====== 画像モード共通 ====== */
.aci-cta-link {
	display: inline-block;
	line-height: 0;
	text-decoration: none;
}
.aci-cta-image {
	display: block;
	max-width: 100%;
	height: auto;
}

/* 画像モード時、本文系CTA(toc_above/toc_below/h2_every/content_end)はセンタリング */
.aci-cta-toc-above .aci-cta-link,
.aci-cta-toc-below .aci-cta-link,
.aci-cta-h2-every .aci-cta-link,
.aci-cta-content-end .aci-cta-link {
	display: block;
	margin: 0 auto;
	text-align: center;
}
.aci-cta-toc-above .aci-cta-image,
.aci-cta-toc-below .aci-cta-image,
.aci-cta-h2-every .aci-cta-image,
.aci-cta-content-end .aci-cta-image {
	margin: 0 auto;
}
