@charset "utf-8";
/* CSS Document */

/* ===================================
   กล่องพื้นหลัง
=================================== */
.bg-idea {
	position: relative;
	overflow: hidden;
	float: left;
	width: 80%;
	margin-left: 10%;
	height: auto;
	background-image: url(../images/p-idea-01.webp);
	background-repeat: no-repeat;
	background-position: center top;
	background-size: 100% auto;
}

/* ===================================
   ชั้นที่ 1: ไอคอนกระจายทั้งกล่อง
=================================== */
.idea-icons {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}
.idea-icon {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: var(--s, 5%);
	color: #ffffff;
	animation: icon-float var(--d, 8s) ease-in-out var(--dl, 0s) infinite;
}
.idea-icon svg {
	display: block;
	width: 100%;
	height: auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.4;
	stroke-linecap: round;
	stroke-linejoin: round;
	animation: icon-light 7s infinite steps(1, end);   /* สว่างพร้อมหลอดไฟ */
}
.idea-icon.gray { color: #9a9a9a; }

/* ===================================
   ชั้นที่ 2: หลอดไฟ ติดๆ ดับๆ
=================================== */
.icon-light {
	position: relative;
	z-index: 2;
	float: left;
	width: 100%;
	text-align: center;
	margin-top: 25%;
}
.bulb {
	position: relative;
	display: inline-block;
	width: 50%;
}
.bulb img {
	position: relative;
	z-index: 1;
	display: block;
	width: 100%;
	height: auto;
	animation: bulb-flicker 7s infinite steps(1, end);
}
/* แสงเรืองรอบหลอด */
.bulb-glow {
	position: absolute;
	left: 50%;
	top: 32%;
	width: 160%;
	aspect-ratio: 1;
	transform: translate(-50%, -50%);
	background: radial-gradient(circle,
		rgba(255, 255, 255, 0.35) 0%,
		rgba(255, 255, 255, 0.12) 30%,
		rgba(255, 255, 255, 0) 62%);
	pointer-events: none;
	animation: glow-flicker 7s infinite steps(1, end);
}

/* ===================================
   จังหวะไฟ (ทุก keyframes ใช้เปอร์เซ็นต์ชุดเดียวกัน)
   0–4% ดับ → 4–20% กะพริบติด → 20–78% สว่างค้าง
   → 78–90% กะพริบจะดับ → 90–100% ดับ
=================================== */
@keyframes bulb-flicker {
	0%, 6%, 9%, 13%, 16%, 80%, 84%, 87%, 90%, 100% {
		filter: brightness(0.4) drop-shadow(0 0 0 rgba(255, 255, 255, 0));
		opacity: 0.55;
	}
	4%, 7%, 11%, 14%, 20%, 78%, 82%, 85%, 88% {
		filter: brightness(1.15) drop-shadow(0 0 22px rgba(255, 255, 255, 0.7));
		opacity: 1;
	}
}
@keyframes glow-flicker {
	0%, 6%, 9%, 13%, 16%, 80%, 84%, 87%, 90%, 100% { opacity: 0; }
	4%, 7%, 11%, 14%, 20%, 78%, 82%, 85%, 88%      { opacity: 1; }
}
@keyframes icon-light {
	0%, 6%, 9%, 13%, 16%, 80%, 84%, 87%, 90%, 100% {
		opacity: 0.18;
		filter: none;
	}
	4%, 7%, 11%, 14%, 20%, 78%, 82%, 85%, 88% {
		opacity: 0.9;
		filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
	}
}

/* ไอคอนลอยเบาๆ */
@keyframes icon-float {
	0%, 100% { transform: translate(0, 0) rotate(var(--r, 0deg)); }
	50%      { transform: translate(0, -14%) rotate(calc(var(--r, 0deg) + 8deg)); }
}

/* ===================================
   ผู้ใช้ที่ตั้งค่าลดการเคลื่อนไหว: ไฟติดค้าง
=================================== */
@media (prefers-reduced-motion: reduce) {
	.bulb-glow,
	.bulb img,
	.idea-icon,
	.idea-icon svg {
		animation: none;
	}
	.idea-icon svg { opacity: 0.8; }
}





/* ===================================
   หัวข้อ (ชั้นบนสุด กลางรูป)
=================================== */
.text-idea {
	position: relative;
	z-index: 50;
	float: left;
	width: 100%;
	text-align: center;
	margin-top: 45%;           /* ระยะห่างจากหลอดไฟ ปรับให้ลงไปอยู่ล่างสุดของรูป */
	margin-bottom: 5%;
	pointer-events: none;
}

.text-idea-inner {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	will-change: transform, translate;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.idea-title {
	display: inline-flex;
	align-items: center;        /* ทุกคำอยู่กึ่งกลางแนวตั้งเท่ากัน */
	justify-content: center;
	gap: 0.3em;                 /* ระยะห่างระหว่างคำ */
	margin: 0;
	font-family: promptregular;
	font-weight: normal;
	font-size: clamp(1.6rem, 4vw, 4.2rem);
	line-height: 1.2;
	letter-spacing: 0.01em;
	color: #ffffff;
	white-space: nowrap;
	text-shadow:
		0 2px 4px rgba(25, 25, 25, 0.95),
		0 0 18px rgba(25, 25, 25, 0.9),
		0 0 40px rgba(25, 25, 25, 0.8);
}
.idea-title > span {
	display: inline-block;
	line-height: 1.2;
}
.idea-title .op {
	color: #8c8c8c;
}
.idea-title .result {
	position: relative;
	overflow: hidden;
	color: #191919;
	background: #ffffff;
	padding: 0.08em 0.4em;      /* บนล่างเท่ากัน */
	border-radius: 0.2em;
	text-shadow: none;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

/* แสงวิ่งผ่านป้าย "ผลงาน" */
.idea-title .result::after {
	content: "";
	position: absolute;
	top: 0;
	left: -60%;
	width: 40%;
	height: 100%;
	background: linear-gradient(100deg, transparent, rgba(25, 25, 25, 0.18), transparent);
	transform: skewX(-20deg);
}

.text-idea .star {
	width: clamp(1rem, 2vw, 2rem);
	height: auto;
}

/* ===================================
   อนิเมชั่น: สถานะเริ่มต้น (เมื่อ JS ทำงาน)
=================================== */
.text-idea.anim-ready .text-idea-inner {
	opacity: 0;
	transform: scale(0.85);
	transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.text-idea.anim-ready .idea-title > span {
	opacity: 0;
	filter: blur(8px);
	transform: translateY(0.7em);
	transition:
		opacity 0.6s ease,
		filter 0.6s ease,
		transform 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.3);
	transition-delay: calc(0.35s + var(--i) * 0.28s);
}
.text-idea.anim-ready .idea-title .result {
	clip-path: inset(0 100% 0 0 round 0.2em);
	transition:
		opacity 0.3s ease,
		filter 0.3s ease,
		transform 0.5s ease,
		clip-path 0.7s cubic-bezier(0.7, 0, 0.2, 1);
	transition-delay: calc(0.35s + var(--i) * 0.28s);
}
.text-idea.anim-ready .star {
	opacity: 0;
	transform: scale(0) rotate(-180deg);
	transition: opacity 0.4s ease, transform 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.5);
	transition-delay: 0.3s;
}

/* ===================================
   อนิเมชั่น: เมื่อเลื่อนมาเห็น
=================================== */
.text-idea.is-in .text-idea-inner {
	opacity: 1;
	transform: scale(1);
	animation: idea-float 5s ease-in-out 2.4s infinite;
}
.text-idea.is-in .idea-title > span {
	opacity: 1;
	filter: none;               /* เดิม blur(0) ทำให้วาดตัวหนังสือใหม่ทุกเฟรม */
	transform: translateY(0);
}
.text-idea.is-in .idea-title .result {
	clip-path: inset(0 0 0 0 round 0.2em);
	animation: result-pop 0.5s ease 2.2s;
}
.text-idea.is-in .idea-title .result::after {
	animation: result-shine 4s ease-in-out 2.8s infinite;
}
.text-idea.is-in .star {
	opacity: 1;
	transform: scale(1) rotate(0);
	animation: roll 3s linear 1.1s infinite;
}
.text-idea.is-in .star:last-child {
	animation-direction: reverse;
}

@keyframes idea-float {
	0%, 100% { translate: 0 0; }
	50%      { translate: 0 -8px; }
}
@keyframes result-pop {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.12); }
	100% { transform: scale(1); }
}
@keyframes result-shine {
	0%   { left: -60%; }
	35%  { left: 130%; }
	100% { left: 130%; }
}
@keyframes roll {
	0%   { transform: rotate(0); }
	100% { transform: rotate(360deg); }
}

/* ===================================
   มือถือ
=================================== */
@media (max-width: 767px) {
	.bg-idea {
		width: 100%;
		margin-left: 0;
	}
	.idea-title {
		flex-wrap: wrap;            /* ขึ้นบรรทัดใหม่ได้ */
		white-space: normal;
		font-size: 1.6rem;
		row-gap: 0.2em;
	}
	.text-idea-inner {
		padding: 0.6em 1em;
	}
}

/* ===================================
   ผู้ใช้ที่ตั้งค่าลดการเคลื่อนไหว
=================================== */
@media (prefers-reduced-motion: reduce) {
	.icon-light {
		animation: none;
	}
	.text-idea .text-idea-inner,
	.text-idea .idea-title > span,
	.text-idea .idea-title .result,
	.text-idea .idea-title .result::after,
	.text-idea .star {
		opacity: 1 !important;
		filter: none !important;
		transform: none !important;
		clip-path: none !important;
		animation: none !important;
		transition: none !important;
	}
}