/* スマートフォン・タブレット用のフローティングボタンスタイル */

/* 親テーマのトップへ戻るボタンを非表示 */
#return_top {
	display: none !important; /* 親テーマのトップへ戻るボタンを強制的に非表示 */
}

/* スクロール制御 */
body.no-scroll {
	overflow: hidden;
}

/* フローティングボタン全体のコンテナ */
.floating-buttons {
	position: fixed;
	bottom: 20px;
	right: 20px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	z-index: 999;
}

/* 各ボタンの共通スタイル */
.floating-button {
	width: 50px;
	height: 50px;
	border-radius: 50%;
	color: #fff;
	border: none;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	transition: transform 0.25s;
	opacity: 0;
	visibility: hidden;
}

.floating-button.visible {
	opacity: 1;
	visibility: visible;
}

.floating-button:hover {
	transform: translateY(-3px);
}

/* ボタンのアイコンスタイル */
.button-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 2px;
}

.button-icon svg {
	width: 20px;
	height: 20px;
	stroke-width: 2.5;
}

/* ボタンのテキストスタイル */
.button-text {
	font-size: 9px;
	line-height: 1;
	font-weight: 600;
	color: var(--brand-color, #377391);
}

/* 目次ボタンの個別スタイル */
/* 上へ戻るボタンの個別スタイル */
.toc-button,
.to-top-button {
	background-color: #fff;
	border: 1px solid var(--brand-color, #377391);
	color: var(--brand-color, #377391);
}

/* 目次ポップアップ */
.toc-popup {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 9999;
	opacity: 0;
	transition: opacity 0.25s ease-in-out;
}

.toc-popup.active {
	display: block;
	opacity: 1;
}

.toc-popup.closing {
	opacity: 0;
}

.toc-popup-content {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: calc(100% - 40px);
	max-width: 480px;
	max-height: 85vh;
	background-color: #fff;
	border-radius: 8px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 8px 16px -4px rgba(0, 0, 0, 0.1);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: c-modal--opening 0.4s;
	transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out;
}

.toc-popup.closing .toc-popup-content {
	transform: translate(-50%, -50%) scale(0.9);
	opacity: 0;
}

@keyframes c-modal--opening {
	0% {
		transform: translate(-50%, -50%) scale(0.9);
		opacity: 0;
	}
	100% {
		transform: translate(-50%, -50%) scale(1);
		opacity: 1;
	}
}

.toc-popup-header {
	position: relative;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 1.25em 2em;
	border-bottom: solid 1px rgba(200, 200, 200, 0.5);
}

.toc-popup-header p {
	margin: 0;
	padding: 0;
	font-size: 1rem;
	font-weight: 700;
	color: #333;
	line-height: 1.5;
}

.close-toc {
	position: absolute;
	top: 0;
	right: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 3.5em;
	height: 3.5em;
	background: none;
	border: none;
	color: #666;
	font-size: 1em;
	cursor: pointer;
	transition: 0.25s;
}

.close-toc:hover {
	color: #333;
}

/* ×マーク */
.close-toc::before,
.close-toc::after {
	content: "";
	position: absolute;
	width: 1.5px;
	height: 1em;
	background: currentColor;
	transform: rotate(45deg);
}

.close-toc::after {
	transform: rotate(-45deg);
}

.toc-popup-body {
	padding: 1.25em;
	overflow-y: auto;
	max-height: calc(85vh - 5.5em);
	-webkit-overflow-scrolling: touch; /* iOS用スクロール最適化 */
	scroll-behavior: smooth;
}

/* 目次リスト */
.toc-list {
	list-style: none;
	padding: 0;
	margin: 0;
	counter-reset: toc-counter;
}

.toc-item {
	position: relative;
	padding-bottom: 0.75em;
	line-height: 1.5;
}

.toc-level-2 {
	font-weight: 700;
	font-size: 0.95em;
	margin-bottom: 0.75em;
	padding-left: 32px;
	counter-increment: toc-counter;
	display: flex;
	align-items: flex-start;
	min-height: 23px;
	padding-bottom: 0;
	line-height: 1.4;
}

.toc-level-2::before {
	content: counter(toc-counter);
	position: absolute;
	left: 0;
	top: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 23px;
	height: 23px;
	border-radius: 50%;
	background-color: var(--brand-color, #377391);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
}

.toc-level-3 {
	font-size: 0.9em;
	margin-left: 8px;
	padding-left: 12px;
	position: relative;
	color: #606060;
	margin-bottom: 0.5em;
	padding-bottom: 0;
}

/* 左側の線を疑似要素として再実装 */
.toc-level-3::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 2px;
	background-color: #eee;
}

.toc-link {
	color: inherit;
	text-decoration: none;
	display: block;
	transition: color 0.25s;
	overflow: hidden;
	padding: 3px 0;
}

.toc-level-3 .toc-link {
	padding: 0.25em 0;
}

.toc-link:hover {
	color: var(--color_main, #3fa3ff);
}

/* スクロールバーのカスタマイズ */
.toc-popup-body::-webkit-scrollbar {
	width: 10px;
}

.toc-popup-body::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 5px;
}

.toc-popup-body::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 5px;
}

.toc-popup-body::-webkit-scrollbar-thumb:hover {
	background: #aaa;
}

/* レスポンシブ調整 */
@media (min-width: 768px) {
	/* PC表示用のスタイル調整 */
	.floating-buttons {
		bottom: 30px; /* 下部の位置を調整 */
		right: 30px; /* 右側の位置を調整 */
		gap: 12px; /* ボタン間の間隔を広げる */
	}

	.floating-button {
		width: 60px; /* ボタンサイズを大きく */
		height: 60px;
		opacity: 0.8; /* やや透明に */
		transition: opacity 0.25s, transform 0.25s; /* 透明度とトランスフォームのトランジション */
	}

	.floating-button.visible {
		opacity: 0.8; /* 表示時の透明度 */
	}

	.floating-button:hover {
		opacity: 1; /* ホバー時は完全に不透明に */
		transform: translateY(-3px);
	}

	.button-icon svg {
		width: 24px; /* アイコンサイズを大きく */
		height: 24px;
	}

	.button-text {
		font-size: 10px; /* フォントサイズを少し大きく */
		margin-top: 2px; /* テキストの上部マージンを追加 */
	}

	/* ポップアップの調整 */
	.toc-popup-content {
		max-width: 540px; /* デスクトップではポップアップを少し大きく */
	}
}