/*
 * デバイスの紹介動画（inc/device-video.php）。
 *
 * 商品ページ: サムネイル列の末尾の動画サムネイル、メイン枠に出る動画。
 * コレクション: タイトルと商品カードの間の横長バナー。
 */

/* --- 商品ページ: メイン枠の動画 -------------------------------------------
 * 画像と同じ正方形の枠に収める。映像は 16:9 で背景が黒なので、contain で
 * 上下に黒が出ても境目は目立たない。枠の大きさが変わらないので、
 * サムネイルを切り替えても下の情報欄が動かない。 */
.astra-gallery__video {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #000;
}

.astra-gallery__video[hidden] {
	display: none;
}

/* --- 商品ページ: 動画のサムネイル -----------------------------------------
 * 100x100 の枠に cover で敷く（映像の中央＝端末が写る）。中央に再生マーク。 */
.astra-gallery__thumb--video button {
	position: relative;
}

.astra-gallery__thumb--video img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.astra-gallery__play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 32px;
	height: 32px;
	margin: -16px 0 0 -16px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	border: 1px solid rgba(255, 255, 255, 0.7);
	pointer-events: none;
}

.astra-gallery__play::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -6px 0 0 -4px;
	border-style: solid;
	border-width: 6px 0 6px 10px;
	border-color: transparent transparent transparent #fff;
}

/* --- コレクション: 横長バナー ---------------------------------------------
 * ページ幅いっぱい。PC は 21:9 に上下を軽く切って（映像の文字は縦の中央付近に
 * 出るので読める）、1商品だけのページでカードが画面の外へ押し出されないようにする。
 * スマホは切らずに 16:9。黒背景を生かして角だけ丸める。
 * 動画が読み込まれるまでは poster（同じ映像の1コマ）が出るので、
 * 枠の高さは最初から決まっていて、読み込み後にカードが押し下げられない。 */
.astra-device-banner {
	position: relative;
	margin: 0 0 2.4rem;
	border-radius: 12px;
	overflow: hidden;
	background: #000;
}

.astra-device-banner__video {
	display: block;
	width: 100%;
	aspect-ratio: 21 / 9;
	object-fit: cover;
	/* 動画自体は押せない（OS の再生ボタンが出ても触れない）。再生できなかったときは
	 * 下の自前の再生ボタンを重ねて、そちらで再生する。 */
	pointer-events: none;
}

/* --- 自動再生が拒否されたとき ---------------------------------------------
 * iOS の低電力モード・Safari の自動再生オフなどでは play() が拒否される。
 * そのときだけ device-video.js が .is-blocked を付け、バナー全面を覆う再生ボタンを出す。
 * 押すとユーザー操作として再生できる（低電力モードでも可）。 */
.astra-device-banner__play {
	display: none;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(0, 0, 0, 0.25);
	cursor: pointer;
}

.astra-device-banner.is-blocked .astra-device-banner__play {
	display: block;
}

.astra-device-banner__play span {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 64px;
	height: 64px;
	margin: -32px 0 0 -32px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	border: 1px solid rgba(255, 255, 255, 0.8);
}

.astra-device-banner__play span::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	margin: -11px 0 0 -7px;
	border-style: solid;
	border-width: 11px 0 11px 18px;
	border-color: transparent transparent transparent #fff;
}

@media (max-width: 749px) {
	.astra-device-banner {
		margin-bottom: 1.6rem;
		border-radius: 8px;
	}

	.astra-device-banner__video {
		aspect-ratio: 16 / 9;
	}
}

/* 動画を出している間、メイン画像は隠す（img の display が hidden 属性に勝たないように）。 */
.astra-gallery__main-img[hidden] {
	display: none;
}
