/**
 * beautiful isnt beautiful — 独立作品ページ専用スタイル
 *
 * 対象: /beautiful-isnt-beautiful/ (page-beautiful-isnt-beautiful.php)
 *
 * スコープ:
 *   すべて body.bib-page / .bib-* に閉じ込める。専用テンプレートは
 *   get_header()/get_footer() を呼ばず自前で HTML 文書を組み立て、
 *   functions.php 側でサイト共通 CSS をこのページだけ dequeue している。
 *   冒頭のリセットは dequeue 取りこぼし時の多層防御。
 *
 * タイポgrafィ:
 *   - 3 語 (beautiful / isnt / beautiful) は font-size・letter-spacing を
 *     完全に統一 (Questrial / weight 400 / lowercase / letter-spacing 1rem)。
 *   - 1 文字ずつの flex 均等配置は廃止。各語は通常の文字列 + nowrap。
 *   - PC は上段=top寄せ / 中段=完全中央 / 下段=bottom寄せ。SP は 3 語とも
 *     回転させて縦方向に配置 (上=左/-90°, 中=中央/-90°, 下=右/+90°)。
 *   - font-size は横幅(vw)基準で大きく、ただし vh で頭打ちして 3 語が
 *     縦に重ならないようにする (letter-spacing 1rem では「完全フル幅」と
 *     「3 語の非重なり」が縦横比次第で両立しないため、重なり回避を優先)。
 *
 * マスク (クロスアサイン):
 *   - 文字色ではなく、反対側のビジュアルを文字マスクとして見せる。
 *   - 同じタイトルを 2 枚重ね、clip-path で半分ずつ表示:
 *       .bib-title-mask--left  … 左半分。背景= 右(醜)側ビジュアル
 *       .bib-title-mask--right … 右半分。背景= 左(美)側ビジュアル
 *     どちらも background-clip:text で文字に流し込む。
 *   - 左右ビジュアルは CSS 変数 --bib-bg-left / --bib-bg-right。既定は
 *     グラデーション、専用画像があれば PHP が inline で url(...) に上書き。
 *     これにより画像が無いグラデ背景でも同じクロスマスクが成立する。
 *   - SP は上下 2 分割なので clip-path を上下に切替 (上半分=下側ビジュアル /
 *     下半分=上側ビジュアル)。
 */

/* ===== リセット (html margin は admin bar 用に触らない) ===== */
body.bib-page {
	margin: 0;
	padding: 0;
	background: #04101c;
	color: #fff;
	overflow-x: hidden;
	font-family: "Questrial", "Century Gothic", "Futura", "Avenir Next", "Avenir", sans-serif;
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

body.bib-page * {
	box-sizing: border-box;
}

/* ===== ステージ: 1 画面完結 / PC 左右 2 分割 ===== */
.bib-stage {
	position: relative;
	isolation: isolate;
	width: 100%;
	min-height: 100vh;
	min-height: 100svh;
	margin: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	overflow: hidden;
	background: #04101c;

	/* クロスマスク & 仮背景で共用する左右ビジュアル。
	   既定はグラデ。専用画像があれば PHP が inline style で url(...) に上書き。
	   --bib-bg-left = 美 (オーロラ) / --bib-bg-right = 醜 (有毒廃棄物) */
	--bib-bg-left:
		radial-gradient(80% 50% at 30% 35%, rgba(64, 224, 170, 0.45), transparent 60%),
		radial-gradient(70% 42% at 72% 24%, rgba(120, 180, 255, 0.30), transparent 62%),
		linear-gradient(180deg, #04101c 0%, #07203a 45%, #0a2e3a 70%, #06121d 100%);
	--bib-bg-right:
		radial-gradient(78% 48% at 60% 40%, rgba(150, 140, 60, 0.30), transparent 60%),
		radial-gradient(60% 40% at 28% 30%, rgba(90, 70, 40, 0.35), transparent 65%),
		linear-gradient(180deg, #14110b 0%, #211d12 42%, #2a2418 70%, #0d0b07 100%);
}

/* ===== ペイン (今日の 2 つの存在) ===== */
.bib-pane {
	position: relative;
	overflow: hidden;
	min-height: 50svh;
}

.bib-pane--left {
	border-right: 1px solid rgba(255, 255, 255, 0.10);
}

.bib-pane__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* 画像が無いときの仮背景 (作品用の抽象グラデーション)。専用画像が
   置かれたら page テンプレートが <img> に切り替えるため出なくなる。 */
.bib-pane__placeholder {
	position: absolute;
	inset: 0;
}

.bib-pane--left .bib-pane__placeholder {
	background-image: var(--bib-bg-left);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

.bib-pane--right .bib-pane__placeholder {
	background-image: var(--bib-bg-right);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* 対象名 (小さく / 説明ラベルは付けない) */
.bib-pane__name {
	position: absolute;
	bottom: clamp(16px, 3.4vw, 38px);
	left: clamp(16px, 3.4vw, 44px);
	z-index: 3;
	max-width: 45%;
	font-size: clamp(0.66rem, 1.05vw, 0.86rem);
	font-weight: 400;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.82);
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
	overflow-wrap: anywhere;
}

.bib-pane--right .bib-pane__name {
	left: auto;
	right: clamp(16px, 3.4vw, 44px);
	text-align: right;
}

/* ===== ロゴ (上部中央 / クリックでホーム) ===== */
.bib-logo {
	position: absolute;
	top: clamp(14px, 3vh, 34px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 6;
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	filter: brightness(0) invert(1) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
}

.bib-logo__img {
	display: block;
	width: auto;
	height: clamp(20px, 2.8vh, 30px);
}

.bib-logo__text {
	font-size: clamp(0.8rem, 1.4vw, 1rem);
	font-weight: 400;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: #fff;
}

/* ===== 中央タイポ: 画面全体に 2 枚重ね + クロスマスク ===== */
.bib-title {
	position: absolute;
	inset: 0;
	z-index: 4;
	margin: 0;
	pointer-events: none;
	font-weight: 400;
	text-transform: lowercase;
	letter-spacing: 1rem;
	/* 3 語共通サイズ。横幅(vw)で大きく、vh で頭打ち (重なり回避優先)。 */
	--bib-size: clamp(2.5rem, 23vw, 28vh);
}

.bib-title-layer {
	position: absolute;
	inset: 0;
}

/* クロスアサイン: 左半分(美側に重なる)の文字 = 右(醜)側ビジュアル /
   右半分(醜側に重なる)の文字 = 左(美)側ビジュアル。clip-path で半分ずつ表示。 */
.bib-title-mask--left {
	clip-path: inset(0 50% 0 0);
}

.bib-title-mask--right {
	clip-path: inset(0 0 0 50%);
}

.bib-word {
	position: absolute;
	left: 0;
	right: 0;
	margin: 0;
	text-align: center;
	white-space: nowrap;
	font-size: var(--bib-size);
	line-height: 1;
	/* 文字をマスクにして「反対側」のビジュアルを流し込む。
	   background-attachment: fixed でビジュアルをビューポート基準に固定し、
	   各語が画面全体の絵を覗く窓のように見える。
	   ※ background-clip:text はレイヤー(親)ではなく語(.bib-word)自身に当てる。
	     語が絶対配置の子なので、親に当ててもクリップ対象テキストが無く透明に
	     なってしまうため。 */
	background-repeat: no-repeat;
	background-position: center;
	background-size: cover;
	background-attachment: fixed;
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	-webkit-text-fill-color: transparent;
}

.bib-title-mask--left .bib-word {
	background-image: var(--bib-bg-right);
}

.bib-title-mask--right .bib-word {
	background-image: var(--bib-bg-left);
}

.bib-word--top {
	top: clamp(36px, 4.5vh, 78px);
}

.bib-word--mid {
	top: 50%;
	transform: translateY(-50%);
}

.bib-word--bot {
	bottom: clamp(72px, 11vh, 140px);
}

/* ===== Today's + 日付 (下部中央) ===== */
.bib-today {
	position: absolute;
	left: 50%;
	bottom: clamp(36px, 6.5vh, 80px);
	transform: translateX(-50%);
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.45em;
	margin: 0;
	text-align: center;
	font-size: clamp(0.6rem, 0.95vw, 0.78rem);
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: 0.4em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.82);
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* 日付は ARCHIVE への導線 (<a>)。既定リンク色/下線は消し、見た目は据え置き。
   hover/focus は作品感を壊さないよう opacity と既存下線の微強調のみ。 */
.bib-today__date {
	position: relative;
	padding-top: 0.7em;
	letter-spacing: 0.3em;
	opacity: 0.9;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
	transition: opacity 0.25s ease;
}

.bib-today__date::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	width: 38px;
	height: 1px;
	background: rgba(255, 255, 255, 0.5);
	transform: translateX(-50%);
	transition: background 0.25s ease, width 0.25s ease;
}

.bib-today__date:hover,
.bib-today__date:focus-visible {
	opacity: 1;
	outline: none;
}

.bib-today__date:hover::before,
.bib-today__date:focus-visible::before {
	background: rgba(255, 255, 255, 0.85);
	width: 48px;
}

/* ===== コピーライト (最下部中央) ===== */
.bib-copy {
	position: absolute;
	left: 50%;
	bottom: clamp(12px, 2.4vh, 26px);
	transform: translateX(-50%);
	z-index: 6;
	margin: 0;
	font-size: clamp(0.6rem, 1vw, 0.74rem);
	font-weight: 400;
	letter-spacing: 0.18em;
	text-transform: lowercase;
	white-space: nowrap;
	color: rgba(255, 255, 255, 0.62);
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* ===== SP: 上下 2 分割 + 3 語を回転して縦配置 + 上下クロスマスク ===== */
@media (max-width: 767px) {
	.bib-stage {
		grid-template-columns: 1fr;
		grid-template-rows: 1fr 1fr;
	}

	.bib-pane--left {
		border-right: 0;
		border-bottom: 1px solid rgba(255, 255, 255, 0.10);
	}

	/* クロスマスクを上下分割に切替。
	   --left レイヤ(背景=右/醜=下ペイン)は上半分を表示 → 上の文字に下の絵。
	   --right レイヤ(背景=左/美=上ペイン)は下半分を表示 → 下の文字に上の絵。 */
	.bib-title-mask--left {
		clip-path: inset(0 0 50% 0);
	}

	.bib-title-mask--right {
		clip-path: inset(50% 0 0 0);
	}

	/* 回転すると語の横幅が縦方向の長さになる。3 列が横で重ならないよう
	   横幅(vw)基準で抑え、vh でも頭打ち。画面外への大きなはみ出しを防ぐ。 */
	.bib-title {
		--bib-size: clamp(1.4rem, 22vw, 14vh);
	}

	.bib-word {
		left: auto;
		right: auto;
		text-align: center;
	}

	/* 上の beautiful: 左付き / -90° */
	.bib-word--top {
		top: 50%;
		left: 22%;
		transform: translate(-50%, -50%) rotate(-90deg);
	}

	/* isnt: 中央 / -90° */
	.bib-word--mid {
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%) rotate(-90deg);
	}

	/* 下の beautiful: 右付き / +90° */
	.bib-word--bot {
		top: 50%;
		bottom: auto;
		left: 78%;
		transform: translate(-50%, -50%) rotate(90deg);
	}

	.bib-pane__name {
		max-width: 48%;
	}

	/* Today's とコピーライトを左下へ逃がす。SP は上の対象名=左揃え /
	   下の対象名=右揃えのため、中央/右寄りだと下側の対象名と重なりやすい。
	   左端に固定 (left clamp / right:auto / 中央寄せ解除) して衝突を避ける。
	   PC の中央配置は維持 (この調整は SP メディアクエリ内のみ)。
	   z-index は既定で Today's=5 / © =6 > 対象名=3 なので前面に出る。 */
	.bib-today {
		left: clamp(16px, 4vw, 28px);
		right: auto;
		transform: none;
		align-items: flex-start;
		text-align: left;
	}

	.bib-copy {
		left: clamp(16px, 4vw, 28px);
		right: auto;
		transform: none;
		text-align: left;
	}
}

/* ===== ふわっと表示 (reduced-motion では無効) ===== */
@media (prefers-reduced-motion: no-preference) {
	.bib-title,
	.bib-pane__name,
	.bib-logo,
	.bib-today,
	.bib-copy {
		animation: bib-fade 1.2s ease both;
	}

	@keyframes bib-fade {
		from {
			opacity: 0;
		}
		to {
			opacity: 1;
		}
	}
}
