/* hero.css — sticky hero section (scroll effect) */

/* ── ตัวห่อที่ทำให้ scroll ผ่านขณะ hero ติดอยู่ ── */
#hero-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(160deg, var(--hero-bg) 0%, var(--hero-bg2) 55%, var(--hero-bg) 100%);
}

/* Animated gradient overlay */
#hero-sticky::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 70% 50%, var(--hero-glow1, rgba(37,99,235,0.25)) 0%, transparent 65%),
              radial-gradient(ellipse 50% 70% at 15% 80%, var(--hero-glow2, rgba(251,191,36,0.12)) 0%, transparent 60%);
  animation: heroGlow 8s ease-in-out infinite alternate;
}
@keyframes heroGlow {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}

/* Floating particles (CSS only) */
.hero-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.hero-particles span {
  position: absolute;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0;
  animation: floatUp linear infinite;
}
.hero-particles span:nth-child(1)  { width:4px;  height:4px;  left:8%;   animation-duration:12s; animation-delay:0s;   opacity-end:0.25; }
.hero-particles span:nth-child(2)  { width:3px;  height:3px;  left:18%;  animation-duration:15s; animation-delay:2s;   }
.hero-particles span:nth-child(3)  { width:5px;  height:5px;  left:30%;  animation-duration:10s; animation-delay:4s;   background:var(--accent); }
.hero-particles span:nth-child(4)  { width:2px;  height:2px;  left:42%;  animation-duration:18s; animation-delay:1s;   }
.hero-particles span:nth-child(5)  { width:4px;  height:4px;  left:55%;  animation-duration:13s; animation-delay:6s;   background:var(--accent); }
.hero-particles span:nth-child(6)  { width:3px;  height:3px;  left:68%;  animation-duration:11s; animation-delay:3s;   }
.hero-particles span:nth-child(7)  { width:6px;  height:6px;  left:78%;  animation-duration:16s; animation-delay:5s;   }
.hero-particles span:nth-child(8)  { width:2px;  height:2px;  left:88%;  animation-duration:14s; animation-delay:0.5s; background:var(--accent); }
.hero-particles span:nth-child(9)  { width:3px;  height:3px;  left:92%;  animation-duration:9s;  animation-delay:7s;   }
.hero-particles span:nth-child(10) { width:4px;  height:4px;  left:48%;  animation-duration:17s; animation-delay:2.5s; }
@keyframes floatUp {
  0%   { transform: translateY(110vh); opacity: 0;    }
  10%  { opacity: 0.3; }
  90%  { opacity: 0.2; }
  100% { transform: translateY(-10vh); opacity: 0; }
}

/* Hero content */
.hero-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  padding-top: var(--nav-h);
}

.hero-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 20px;
  text-shadow: 0 0 14px rgba(251,191,36,0.55);
}

.hero-title {
  font-size: clamp(1.9rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--hero-text);
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
/* คำไฮไลท์ — ทองไล่เฉด มีแสงวิ่งผ่านช้าๆ */
.hero-title .hl {
  background: linear-gradient(100deg,
    var(--yellow-l) 0%, var(--yellow) 30%, var(--yellow-d) 50%,
    var(--yellow) 70%, var(--yellow-l) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shineText 5s linear infinite;
}
@keyframes shineText {
  to { background-position: 200% center; }
}

.hero-desc {
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--hero-muted);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: 36px;
}

.hero-stats {
  display: flex;
  gap: 36px;
  margin-bottom: 40px;
}
.hero-stat { text-align: center; }
.hero-stat-n {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--hero-text);
  line-height: 1;
  font-family: var(--mono);
}
.hero-stat-l {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hero-muted);
  margin-top: 4px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  transition: background 0.15s, transform 0.15s;
  border: none;
}
.hero-cta:hover { background: var(--primary-d); transform: translateY(-1px); }

/* scroll hint */
.hero-scroll-hint {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--hero-muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.hero-scroll-hint .arrow {
  width: 20px;
  height: 20px;
  border-right: 2px solid var(--hero-muted);
  border-bottom: 2px solid var(--hero-muted);
  transform: rotate(45deg);
  animation: scrollBounce 1.5s ease-in-out infinite;
}
@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translateY(0); }
  50%       { transform: rotate(45deg) translateY(5px); }
}

/* ── Content block ที่ scroll มาทับ hero ── */
#main-content {
  position: relative;
  z-index: 10;
  background: transparent;
  margin-top: 0;
}

/* ── Stacking panels — ตัวห่อล่องหน เห็นแค่การ์ดข้างใน ── */
/* หยุดชนใต้เมนู ไม่มุดเข้าไปหลังเมนู */
.stack-panel {
  position: sticky;
  top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
  background: transparent;
}

#panel-pricing  { z-index: 1; }
#panel-products { z-index: 2; }
/* panel สุดท้ายไม่ sticky — ไม่มีอะไรมาทับ ปล่อยให้ footer ต่อท้ายปกติ */
#panel-articles { z-index: 3; position: relative; top: 0; }

/* ── Dark overrides: card/list inside stack panels ── */

/* Pricing cards — glassmorphism */
.stack-panel .price-card {
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--hero-border);
  color: var(--hero-muted);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.stack-panel .price-card:hover {
  transform: translateY(-6px);
  border-color: var(--primary);
  box-shadow: 0 18px 48px rgba(0,0,0,0.5), 0 0 0 1px var(--hero-border);
}
.stack-panel .price-card .price-name,
.stack-panel .price-card .price-tag-label { color: var(--hero-text); }
.stack-panel .price-card .price-sub,
.stack-panel .price-card .price-period,
.stack-panel .price-card .price-original { color: var(--hero-muted); }
.stack-panel .price-card .price-recommend {
  background: rgba(255,255,255,0.06);
  color: var(--hero-muted);
}
.stack-panel .price-card .price-features li { color: var(--hero-muted); }
.stack-panel .price-card .price-cta {
  border-color: var(--hero-border);
  color: var(--hero-text);
  background: transparent;
}
.stack-panel .price-card .price-cta:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Product cards — glassmorphism */
.stack-panel .product-card {
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--hero-border);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.stack-panel .product-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 48px rgba(0,0,0,0.5);
}
.stack-panel .product-img {
  background: rgba(255,255,255,0.06);
  border-color: var(--hero-border);
  color: var(--hero-muted);
}
.stack-panel .product-name { color: var(--hero-text); }
.stack-panel .products-see-all { color: var(--hero-muted); border-color: var(--hero-border); }
.stack-panel .section-label { color: var(--hero-muted); }

/* Post list — glassmorphism */
.stack-panel .post-list {
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--hero-border);
}
.stack-panel .post-list-head {
  background: rgba(255,255,255,0.04);
  border-color: var(--hero-border);
}
.stack-panel .post-list-head span { color: var(--hero-muted); }
.stack-panel .post-row {
  background: transparent;
  border-color: rgba(110,193,228,0.1);
}
.stack-panel .post-row:hover { background: rgba(255,255,255,0.04); }
.stack-panel .post-title { color: var(--hero-muted); }
.stack-panel .post-row:hover .post-title { color: var(--hero-text); }
.stack-panel .post-num { color: rgba(110,193,228,0.4); }
.stack-panel .post-date { color: rgba(110,193,228,0.35); }
.stack-panel .posts-header-label { color: var(--hero-muted); }

/* Category filter */
.stack-panel .cat-btn {
  background: transparent;
  border-color: var(--hero-border);
  color: var(--hero-muted);
}
.stack-panel .cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.stack-panel .cat-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Reveal on scroll — เลื่อนถึงแล้วค่อยลอยขึ้นมา ── */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
/* ไล่จังหวะการ์ดทีละใบ */
.reveal.in:nth-child(2) { transition-delay: 0.1s; }
.reveal.in:nth-child(3) { transition-delay: 0.2s; }
.reveal.in:nth-child(4) { transition-delay: 0.3s; }

@media (max-width: 600px) {
  .hero-stats { gap: 24px; }
  .hero-stat-n { font-size: 1.4rem; }
}

/* ── มือถือ: ปิด sticky-stacking ──
   บน mobile การ์ด/สินค้า/บทความซ้อนกันแนวตั้ง (1 คอลัมน์) ทำให้ section สูงกว่าจอมาก
   sticky จะแช่ภาพบนสุดไว้ตลอดแล้วกระโดดข้าม section ทันที ทำให้เห็นแค่การ์ดใบแรก
   → ปิด sticky ให้เลื่อนแบบปกติแทน เอฟเฟกต์ทับซ้อนเก็บไว้เฉพาะจอกว้าง */
@media (max-width: 820px) {
  .stack-panel {
    position: relative;
    top: auto;
    min-height: auto;
  }
  .panel-content {
    opacity: 1 !important;
    transform: none !important;
  }
}
