/*
 * サンプルLPの入口の幕と、常時出している注意書き
 *
 * LP側のCSSとぶつからないよう、クラス名はすべて kj- で始める。
 * 幕は html.kj-gated が付いている間だけ出す。このクラスは PHP が最初から
 * 書き出すので、JavaScript を待たずに1フレーム目から中身を隠せる。
 */

/* ==========================================================================
   入口の幕
   ========================================================================== */

.kj-gate {
	display: none;
}

.kj-gated .kj-gate {
	position: fixed;
	z-index: 2147483000;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 24px;
	background: #0c2e5d;
	color: #ffffff;
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* 幕・動画が出ている間は後ろを動かさない */
.kj-gated body,
.kj-opening body {
	overflow: hidden;
}

/* 幕・動画の裏では中身を出さない。幕は不透明なので重ねるだけでも
   隠れるが、拡大して出すときの初期状態をここで作っておく。 */
.kj-gated .wp-site-blocks,
.kj-opening .wp-site-blocks {
	opacity: 0;
}

.kj-gated .kj-notice,
.kj-opening .kj-notice {
	display: none;
}

.kj-gate__panel {
	max-width: 33rem;
	margin: auto;
	padding: clamp(26px, 5vw, 44px);
	background: #ffffff;
	color: #102a46;
	text-align: center;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.kj-gate__eyebrow {
	margin: 0 0 18px;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 11px;
	letter-spacing: 0.16em;
	color: #6b7a8d;
}

.kj-gate__lead {
	margin: 0 0 14px;
	font-size: clamp(17px, 2.4vw, 20px);
	font-weight: 700;
	line-height: 1.8;
}

.kj-gate__note {
	margin: 0 0 26px;
	font-size: 13.5px;
	line-height: 2;
	color: #46566b;
}

.kj-gate__button {
	appearance: none;
	width: 100%;
	padding: 15px 24px;
	border: 0;
	background: #0c2e5d;
	color: #ffffff;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.04em;
	cursor: pointer;
	transition: background 0.2s;
}

.kj-gate__button:hover {
	background: #163f78;
}

.kj-gate__button:focus-visible {
	outline: 3px solid #c9972e;
	outline-offset: 2px;
}

.kj-gate__back {
	display: inline-block;
	margin-top: 18px;
	font-size: 12.5px;
	color: #46566b;
	text-decoration: underline;
	text-underline-offset: 3px;
}


/* ==========================================================================
   常時出している注意書き
   ========================================================================== */

.kj-notice {
	position: fixed;
	z-index: 2147482000;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px 18px;
	padding: 10px 16px;
	padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	background: #102a46;
	color: #dce6f2;
	font-size: 12.5px;
	line-height: 1.7;
	text-align: center;
}

.kj-notice a {
	color: #ffffff;
	text-decoration: underline;
	text-underline-offset: 3px;
	white-space: nowrap;
}

/* バーがフッターに重ならないよう、そのぶん下に余白を足す */
.kj-has-notice body {
	padding-bottom: 76px;
}

@media (max-width: 600px) {
	.kj-notice {
		font-size: 12px;
	}

	.kj-has-notice body {
		padding-bottom: 96px;
	}
}


/* ==========================================================================
   オープニング動画と、そのあとの登場
   ========================================================================== */

.kj-opening-layer {
	position: fixed;
	z-index: 2147482900;
	inset: 0;
	background: #0c2e5d;
	opacity: 1;
	transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.kj-opening-layer[hidden] {
	display: none;
}

.kj-opening-layer video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* サイトが出てくるのに合わせて、動画は少し寄りながら消える */
.kj-opening-layer.is-leaving {
	opacity: 0;
	transform: scale(1.12);
	pointer-events: none;
}

/* ---- 動画中の操作 ---- */

.kj-opening-layer__controls {
	position: absolute;
	right: 16px;
	bottom: 16px;
	bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	display: flex;
	gap: 10px;
}

.kj-opening-layer__button {
	appearance: none;
	padding: 9px 16px;
	border: 1px solid rgba(255, 255, 255, 0.55);
	border-radius: 999px;
	background: rgba(12, 46, 93, 0.5);
	color: #ffffff;
	font: inherit;
	font-size: 12.5px;
	line-height: 1.4;
	letter-spacing: 0.04em;
	cursor: pointer;
	backdrop-filter: blur(6px);
	transition: background 0.2s, border-color 0.2s;
}

.kj-opening-layer__button:hover {
	background: rgba(12, 46, 93, 0.8);
	border-color: #ffffff;
}

.kj-opening-layer__button:focus-visible {
	outline: 3px solid #c9972e;
	outline-offset: 2px;
}

/* ---- 画面の中央からサイトが出てくる ---- */

/* 起点は extras.js ならぬ gate.js が画面の高さの半分を入れる。
   .wp-site-blocks は画面よりずっと背が高いので、既定の「要素の中央」だと
   ずっと下のほうを起点に広がってしまう。 */
.kj-revealing .wp-site-blocks {
	transform-origin: 50% var(--kj-origin-y, 50vh);
	animation: kj-emerge 1s cubic-bezier(0.16, 1, 0.3, 1) both;
	will-change: transform, opacity;
}

@keyframes kj-emerge {
	from {
		opacity: 0;
		transform: scale(0.62);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* 注意書きのバーは、サイトが出そろってから少し遅れて出す */
.kj-revealing .kj-notice {
	animation: kj-notice-in 0.5s ease 0.75s both;
}

@keyframes kj-notice-in {
	from {
		opacity: 0;
		transform: translateY(100%);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* スマホは横幅が狭く、動画が大きく切り取られる。操作ボタンを小さくして
   映像の邪魔をしないようにする。 */
@media (max-width: 600px) {
	.kj-opening-layer__controls {
		right: 12px;
		bottom: calc(12px + env(safe-area-inset-bottom, 0px));
		gap: 8px;
	}

	.kj-opening-layer__button {
		padding: 8px 13px;
		font-size: 12px;
	}
}

/* 動きを減らす設定のときは、動画も拡大も出さない */
@media (prefers-reduced-motion: reduce) {
	.kj-opening-layer {
		display: none !important;
	}

	.kj-revealing .wp-site-blocks {
		animation: none;
	}

	.kj-revealing .kj-notice {
		animation: none;
	}
}
