/* Cookie の同意バナー */

/* 色はバナーと設定画面（別の要素）の両方で使う */
.jhs-cookie,
.jhs-cookie-dialog {
	--jhs-cookie-text: #1f2328;
	--jhs-cookie-muted: #5b616b;
	--jhs-cookie-line: #e3e5e8;
}

.jhs-cookie {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 100000; /* ページトップのボタン（99999）より上 */
	width: min(440px, calc(100vw - 48px));
	margin: 0;
	padding: 0;
	border: 1px solid var(--jhs-cookie-line);
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 12px 40px rgba(17, 24, 39, 0.16), 0 2px 6px rgba(17, 24, 39, 0.06);
	color: var(--jhs-cookie-text);
	font-size: 14px;
	line-height: 1.75;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.jhs-cookie[hidden] {
	display: none;
}

.jhs-cookie__inner {
	padding: 22px 24px 20px;
}

.jhs-cookie__title {
	margin: 0 0 8px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--jhs-cookie-text);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.5;
	letter-spacing: 0.02em;
}

.jhs-cookie__title::before,
.jhs-cookie__title::after,
.jhs-cookie-dialog__title::before,
.jhs-cookie-dialog__title::after,
.jhs-cookie-cat__name::before,
.jhs-cookie-cat__name::after {
	content: none;
}

.jhs-cookie__text {
	margin: 0 0 16px;
	color: var(--jhs-cookie-muted);
	text-align: left;
}

.jhs-cookie__text a {
	color: var(--jhs-cookie-text);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.jhs-cookie__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

/* 「すべて許可」と「必須のみ」は同じ大きさ・同じ強さで並べる */
.jhs-cookie__btn {
	flex: 1 1 0;
	min-width: 120px;
	min-height: 44px;
	padding: 10px 16px;
	border: 1px solid var(--jhs-cookie-text);
	border-radius: 999px;
	background: #fff;
	color: var(--jhs-cookie-text);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.jhs-cookie__btn:hover {
	background: #f3f4f6;
}

.jhs-cookie__btn--primary {
	border-color: var(--jhs-cookie-text);
	background: var(--jhs-cookie-text);
	color: #fff;
}

.jhs-cookie__btn--primary:hover {
	background: #000;
}

.jhs-cookie__link {
	flex: 1 0 100%;
	margin-top: 2px;
	padding: 6px 0 0;
	border: 0;
	background: none;
	color: var(--jhs-cookie-muted);
	font-size: 13px;
	text-align: center;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

.jhs-cookie__btn:focus-visible,
.jhs-cookie__link:focus-visible,
.jhs-cookie-dialog__x:focus-visible,
.jhs-cookie-switch input:focus-visible + .jhs-cookie-switch__track {
	outline: 3px solid #1a73e8;
	outline-offset: 2px;
}

/* 設定画面 */
.jhs-cookie-dialog {
	width: min(560px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	padding: 0;
	border: 0;
	border-radius: 14px;
	box-shadow: 0 20px 60px rgba(17, 24, 39, 0.25);
	color: #1f2328;
	font-size: 14px;
	line-height: 1.75;
}

.jhs-cookie-dialog::backdrop {
	background: rgba(17, 24, 39, 0.55);
}

.jhs-cookie-dialog__panel {
	display: flex;
	flex-direction: column;
	max-height: inherit;
	margin: 0;
}

.jhs-cookie-dialog__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px 14px 24px;
	border-bottom: 1px solid #e3e5e8;
}

.jhs-cookie-dialog__title {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.4;
}

.jhs-cookie-dialog__x {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: none;
	color: #5b616b;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.jhs-cookie-dialog__x:hover {
	background: #f3f4f6;
}

.jhs-cookie-dialog__body {
	overflow-y: auto;
	padding: 18px 24px 8px;
	color: #5b616b;
}

.jhs-cookie-dialog__body > p {
	margin: 0 0 16px;
}

.jhs-cookie-cat {
	padding: 16px 0;
	border-top: 1px solid #e3e5e8;
}

.jhs-cookie-cat__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.jhs-cookie-cat__name {
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: #1f2328;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.5;
}

.jhs-cookie-cat__always {
	color: #1f7a3f;
	font-size: 13px;
	font-weight: 700;
}

.jhs-cookie-cat__desc {
	margin: 0;
	font-size: 13px;
}

/* 切り替えスイッチ */
.jhs-cookie-switch {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	cursor: pointer;
}

.jhs-cookie-switch input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}

.jhs-cookie-switch__track {
	position: relative;
	width: 44px;
	height: 26px;
	border-radius: 999px;
	background: #c4c8ce;
	transition: background-color 0.2s ease;
}

.jhs-cookie-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
	transition: transform 0.2s ease;
}

.jhs-cookie-switch input:checked + .jhs-cookie-switch__track {
	background: #1f2328;
}

.jhs-cookie-switch input:checked + .jhs-cookie-switch__track::after {
	transform: translateX(18px);
}

.jhs-cookie-switch__text {
	min-width: 5em;
	color: #1f2328;
	font-size: 13px;
	font-weight: 700;
}

.jhs-cookie-dialog__foot {
	display: flex;
	gap: 8px;
	padding: 14px 24px 20px;
	border-top: 1px solid #e3e5e8;
}

/* フッターの「Cookie 設定」 */
.jhs-cookie-footer-link {
	margin: 4px 0 0;
	font-size: 12px;
	text-align: center;
}

.jhs-cookie-footer-link a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* スマートフォン：画面下に横いっぱいのシートとして出す */
@media (max-width: 575.98px) {
	.jhs-cookie {
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		border-right: 0;
		border-bottom: 0;
		border-left: 0;
		border-radius: 16px 16px 0 0;
	}

	.jhs-cookie__inner {
		padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
	}

	.jhs-cookie-dialog__foot {
		flex-direction: column-reverse;
	}
}

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