/* ========================================
   FV（ファーストビュー）- index.css から分離
   ※ index.css の同名スタイルを上書きする
======================================== */

/* ---- セクション本体 ---- */
.fv {
	position: relative;
	width: 100%;
	background: linear-gradient(to bottom, #ffffff 0%, #fffaee 50%, #fff3c4 100%);
	display: flex;
	flex-direction: column;
	padding: calc(var(--header-height-sp) + 2rem) 0.75rem 0;
	gap: 1rem;
}

@media (min-width: 768px) {
	.fv {
		padding: calc(var(--header-height-pc) + 3rem) 1.25rem 0;
		gap: 1.25rem;
	}
}

/* ---- キャッチコピー ---- */
.fv__catchcopy {
	width: 100%;
	text-align: center;
	padding: 0.25rem 0;
}

/* メインコピー */
.fv__maincopy {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: baseline;
	gap: 0;
	margin: 0 0 0.375rem;
	font-size: clamp(1.375rem, 4vw, 2.25rem);
	font-weight: 700;
	color: var(--color-text);
	letter-spacing: 0.06em;
	line-height: 1.3;
}

.fv__mc-blue {
	color: #0a4a7a;
}
.fv__mc-yellow {
	color: #e8b400;
}

.fv__catchcopy-text {
	display: inline-block;
	font-size: clamp(0.75rem, 3.5vw, 1rem);
	font-weight: 700;
	color: #0a4a7a;
	letter-spacing: 0.06em;
	white-space: nowrap;
	padding: 0.25rem 0.75rem;
	border-top: 2px solid rgba(10, 74, 122, 0.3);
	border-bottom: 2px solid rgba(10, 74, 122, 0.3);
}

@media (min-width: 768px) {
	.fv__catchcopy-text {
		font-size: 1rem;
		letter-spacing: 0.12em;
		padding: 0.375rem 1.25rem;
	}
}

/* ---- ギャラリー + ライト + ハウススライダー まとめ ---- */
.fv__visual {
	display: flex;
	flex-direction: column;
	gap: 0;
	width: 100%;
}

/* ---- イメージギャラリー ---- */
.fv__gallery {
	width: 100%;
	aspect-ratio: 16 / 9;
	display: grid;
	grid-template-columns: 1fr 2fr 1fr;
	grid-template-rows: 1fr 1fr;
	gap: 0.5rem;
	position: relative;
}

@media (min-width: 768px) {
	.fv__gallery {
		aspect-ratio: 16 / 8;
		gap: 0.75rem;
	}
}

@media (min-width: 1024px) {
	.fv__gallery {
		aspect-ratio: 16 / 7;
	}
}

@media (min-width: 1200px) {
	.fv__gallery {
		aspect-ratio: 16 / 6;
		max-width: 1280px;
		margin: 0 auto;
	}
}

@media (min-width: 1440px) {
	.fv__gallery {
		aspect-ratio: 16 / 6;
	}
}

/* 配置 */
.fv__gallery-item--1 {
	grid-column: 1;
	grid-row: 1;
}
.fv__gallery-item--2 {
	grid-column: 2;
	grid-row: 1 / 3;
}
.fv__gallery-item--3 {
	grid-column: 3;
	grid-row: 1;
}
.fv__gallery-item--4 {
	grid-column: 1;
	grid-row: 2;
}
.fv__gallery-item--5 {
	grid-column: 3;
	grid-row: 2;
}

.fv__gallery-item {
	border-radius: var(--radius-md);
	overflow: hidden;
	min-height: 80px;
	border: 2px solid #0a4a7a;
}

@media (min-width: 768px) {
	.fv__gallery-item {
		border: 3px solid #0a4a7a;
	}
}

.fv__gallery-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.6s ease;
}

.fv__gallery-item:hover img {
	transform: scale(1.04);
}

/* ---- ライト + ハーフカード まとめ ---- */
.fv__halves-group {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0;
}

/* ペンダントライト画像 */
.fv__light-img {
	width: 56px;
	height: auto;
	flex-shrink: 0;
}

@media (min-width: 768px) {
	.fv__light-img {
		width: 80px;
	}
}

/* ---- ハーフカード（小さめ・下部） ---- */
.fv__halves {
	display: flex;
	width: 100%;
	max-width: clamp(300px, 80vw, 640px);
	height: clamp(64px, 11vw, 110px);
	margin: 0 auto;
	overflow: hidden;
	border-radius: var(--radius-lg);
	box-shadow: none;
	flex-shrink: 0;
}

.fv__half {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}

.fv__half--left {
	background: #fed102;
	border-right: 2px solid #e8b400;
}

.fv__half--right {
	background: #0a4a7a;
}

.fv__half-text {
	display: flex;
	margin: 0;
	padding: 0.5rem;
	font-size: clamp(1rem, 2.5vw, 2rem);
	font-weight: 700;
	color: var(--color-white);
	letter-spacing: 0.06em;
	line-height: 1;
	user-select: none;
	white-space: nowrap;
}

.fv__half-char {
	display: inline-block;
	opacity: 0;
	/* animation は JS から .is-fv-ready クラス付与で起動 */
}

.fv__half--left .fv__half-char {
	transform: translateX(-0.5em);
}
.fv__half--right .fv__half-char {
	transform: translateX(0.5em);
}

/* スプラッシュ完了後に「.is-fv-ready」が付いたらアニメーション開始 */
.fv__catchcopy.is-fv-ready .fv__half-char {
	animation: fvCharIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
	animation-delay: calc(var(--i) * 0.1s);
}

@keyframes fvCharIn {
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

.fv__highlight-yellow {
	color: #fed102;
}
.fv__highlight-white {
	color: #0a4a7a;
}

/* ---- 家スライダー ---- */
.fv__scene {
	width: 100%;
	flex-shrink: 0;
}

@keyframes bulbPulse {
	0%,
	100% {
		filter: drop-shadow(0 0 6px rgba(232, 180, 0, 0.7));
		opacity: 0.9;
	}
	50% {
		filter: drop-shadow(0 0 20px rgba(232, 180, 0, 1));
		opacity: 1;
	}
}

.fv__houses-inner {
	position: relative; /* offsetLeft の基準にするため */
	display: flex;
	align-items: flex-end;
	width: max-content;
	padding-top: 28px;
	gap: 40px;
	animation: housesScroll 32s linear infinite;
}

@keyframes housesScroll {
	from {
		transform: translateX(0);
	}
	to {
		transform: translateX(-50%);
	}
}

.fv__house {
	flex-shrink: 0;
	width: 56px;
	height: auto;
	margin-right: 0;
	color: rgba(255, 255, 255, 0.2);
	transition: color 0.3s ease;
	position: relative;
	background: rgba(255, 255, 255, 0.3);
	border: 2px dashed rgba(232, 180, 0, 0.3);
	border-radius: var(--radius-md);
	padding: 6px;
}

@media (min-width: 768px) {
	.fv__house {
		width: 80px;
		margin-right: 0;
		padding: 8px;
	}

	.fv__houses-inner {
		gap: 48px;
	}
}

.fv__house svg {
	width: 100%;
	height: 100%;
	display: block;
}

.fv__house.is-lit {
	color: var(--color-primary);
}

.fv__house-window {
	transition: fill 0.3s ease;
}

.fv__house.is-lit .fv__house-window {
	fill: rgba(232, 180, 0, 0.4);
}

.fv__house.has-smiles {
	color: #378add;
}

.fv__house.has-smiles .fv__house-window {
	fill: rgba(55, 138, 221, 0.35);
}

/* 笑顔アイコン */
.fv__house-smile {
	position: absolute;
	font-size: 1.25rem;
	opacity: 0;
	pointer-events: none;
}

.fv__house-smile--top {
	top: -20px;
	left: 50%;
	transform: translateX(-50%) scale(0);
}
.fv__house-smile--left {
	top: 50%;
	left: -20px;
	transform: translateY(-50%) scale(0);
}
.fv__house-smile--right {
	top: 50%;
	right: -20px;
	transform: translateY(-50%) scale(0);
}

.fv__house.has-smiles .fv__house-smile--top {
	opacity: 1;
	animation: smilePopTop 0.4s ease forwards;
}
.fv__house.has-smiles .fv__house-smile--left {
	opacity: 1;
	animation: smilePopSide 0.4s ease 0.12s forwards;
}
.fv__house.has-smiles .fv__house-smile--right {
	opacity: 1;
	animation: smilePopSide 0.4s ease 0.24s forwards;
}

@keyframes smilePopTop {
	0% {
		transform: translateX(-50%) scale(0);
	}
	60% {
		transform: translateX(-50%) scale(1.2);
	}
	100% {
		transform: translateX(-50%) scale(1);
	}
}
@keyframes smilePopSide {
	0% {
		transform: translateY(-50%) scale(0);
	}
	60% {
		transform: translateY(-50%) scale(1.2);
	}
	100% {
		transform: translateY(-50%) scale(1);
	}
}

@media (prefers-reduced-motion: reduce) {
	.fv__houses-inner {
		animation: none;
	}
	.fv__bulb-head {
		animation: none;
	}
}

.fv__houses-sep {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	align-self: center;
	font-family: var(--font-en);
	font-size: 1.5rem;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--color-primary);
	opacity: 0.5;
	white-space: nowrap;
	padding: 0 0.75rem;
}

@media (min-width: 768px) {
	.fv__houses-sep {
		font-size: 2rem;
		padding: 0 1rem;
	}
}

/* ---- 家SVG描画（トラック内を流れる） ---- */
.fv__home-svg {
	display: block;
	width: 56px;
	height: auto;
	overflow: visible;
}

@media (min-width: 768px) {
	.fv__home-svg {
		width: 80px;
	}
}

/* 家トラック 最大幅・中央寄せ */
.fv__houses-track {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	overflow: hidden;
	/* 左右5%：左端のフェードで輺只に出るアイコンを隠す */
	/* 右5%：triggerX（=right-5%）までのis-predrawn状態（描画前の青詞形）を隠す */
	clip-path: inset(0 5% 0 5%);
}

/* 各ストローク要素の描画アニメ（JSの .is-drawing クラスで発火） */
.fvhp {
	stroke: #0a4a7a;
	stroke-dasharray: 100;
	stroke-dashoffset: 100;
}

.fv__house.is-drawing .fvhp {
	animation: fvHomeDraw 0.8s ease forwards;
}

/* is-gold: 0.3sで白から黄色に変化 */
.fv__house.is-gold .fvhp {
	stroke-dashoffset: 0 !important;
	animation: fvToGold 0.3s ease forwards !important;
}

@keyframes fvToGold {
	from {
		stroke: #0a4a7a;
	}
	to {
		stroke: #fed102;
	}
}

/* is-predrawn: 初回表示時は描画完了状態で開始 */
.fv__house.is-predrawn .fvhp {
	stroke: #0a4a7a;
	stroke-dashoffset: 0;
	animation: none;
}

/* 要素ごとに描画開始をずらす */
.fv__house.is-drawing .fv__home-svg line:nth-child(1) {
	animation-delay: 0.2s;
}
.fv__house.is-drawing .fv__home-svg polyline:nth-child(2) {
	animation-delay: 0.5s;
}
.fv__house.is-drawing .fv__home-svg path:nth-child(3) {
	animation-delay: 0.7s;
}
.fv__house.is-drawing .fv__home-svg polyline:nth-child(4) {
	animation-delay: 0.5s;
}
.fv__house.is-drawing .fv__home-svg path:nth-child(5) {
	animation-delay: 0.7s;
}
.fv__house.is-drawing .fv__home-svg line:nth-child(6) {
	animation-delay: 0.3s;
}
.fv__house.is-drawing .fv__home-svg line:nth-child(7) {
	animation-delay: 0.6s;
}
.fv__house.is-drawing .fv__home-svg path:nth-child(8) {
	animation-delay: 0.4s;
}

@keyframes fvHomeDraw {
	to {
		stroke-dashoffset: 0;
	}
}

/* is-redrawn: 左半分到達時に黄色ストロークで再描画 */
.fv__house.is-redrawn .fvhp {
	stroke: #fed102 !important;
	stroke-dashoffset: 100;
	animation: fvHomeRedraw 0.8s ease forwards !important;
}

.fv__house.is-redrawn .fv__home-svg line:nth-child(1) {
	animation-delay: 0.2s !important;
}
.fv__house.is-redrawn .fv__home-svg polyline:nth-child(2) {
	animation-delay: 0.5s !important;
}
.fv__house.is-redrawn .fv__home-svg path:nth-child(3) {
	animation-delay: 0.7s !important;
}
.fv__house.is-redrawn .fv__home-svg polyline:nth-child(4) {
	animation-delay: 0.5s !important;
}
.fv__house.is-redrawn .fv__home-svg path:nth-child(5) {
	animation-delay: 0.7s !important;
}
.fv__house.is-redrawn .fv__home-svg line:nth-child(6) {
	animation-delay: 0.3s !important;
}
.fv__house.is-redrawn .fv__home-svg line:nth-child(7) {
	animation-delay: 0.6s !important;
}
.fv__house.is-redrawn .fv__home-svg path:nth-child(8) {
	animation-delay: 0.4s !important;
}

@keyframes fvHomeRedraw {
	from {
		stroke-dashoffset: 100;
	}
	to {
		stroke-dashoffset: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.fvhp {
		stroke-dashoffset: 0;
	}
}
