/* ──────────────────────────────────────────────────────────
   HERO SECTION (v1 base)
   ────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 84vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 96px 20px 72px;
  color: #fff;

  background: linear-gradient(135deg, #0056b3, #007bff);
  background-size: 300% 300%;
  background-position: 0% 50%;
  animation: gradientShift 12s ease infinite;
  overflow: hidden;

  /* ที่ว่างเพื่อ floating badges */
  padding-bottom: clamp(160px, 12vh, 220px);
}

/* Animated multi-layered background */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 30%, #004ba0, transparent 70%),
    radial-gradient(circle at 70% 60%, #007bff, transparent 80%),
    radial-gradient(circle at 50% 50%, #1e88e5, #1565c0 80%);
  background-size: 200% 200%;
  animation: backgroundFloat 20s ease-in-out infinite alternate;
  z-index: -1;
  opacity: .9;
  filter: blur(10px);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, .06) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: particlesMove 40s linear infinite;
  z-index: -2;
}

/* Canvas globe (ถ้าใช้งาน) */
#globeCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: .4;
  pointer-events: none;
}

/* Content block */
.hero-content {
  max-width: 900px;
  animation: none;
  z-index: 1;
  text-align: center;
  margin-top: 60px;
}

/* ──────────────────────────────────────────────────────────
   TITLE (Brand + Tagline + AI Pill)
   ────────────────────────────────────────────────────────── */
.hero-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px 0;
}

.hero-title .brand {
  font-weight: 800;
  letter-spacing: .2px;
  font-size: clamp(1.6rem, 2.8vw, 2.3rem);
  line-height: 1.2;
}

.hero-title .tag {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: clamp(1.6rem, 4vw, 3rem);
  line-height: 1.35;
}

/* ไฮไลต์ข้อความ tagline แบบ gradient (รองรับของเดิมด้วย) */
.hero h1 .highlight,
.hero-title .tag .tag-text {
  background: linear-gradient(90deg, #ffc107, #ff9800, #ffc107);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

/* AI pill */
.ai-pill {
  display: inline-block;
  padding: .15em .6em;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: .4px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15), inset 0 0 20px rgba(255, 255, 255, .15);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}

/* ──────────────────────────────────────────────────────────
   TYPOGRAPHY
   ────────────────────────────────────────────────────────── */
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.35;
  margin: 0;
}

.hero p {
  font-size: clamp(1rem, 1.6vw, 1.1rem);
  opacity: .95;
  margin: 16px auto 30px;
}

/* ปุ่ม CTA (สไตล์เฉพาะเมื่อวางใน hero) */
.hero .cta-btn {
  padding: 12px 28px;
  background: var(--blue);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .15);
  transition: background .25s ease, transform .15s ease, box-shadow .25s ease;
}

.hero .cta-btn:hover {
  background: var(--dark-blue);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}

/* ภาษาไทย – กันสระล่าง/บน */
html[lang="th"] .hero h1,
html[data-lang="th"] .hero h1 {
  line-height: 1.55;
}

html[lang="th"] .hero-title .tag,
html[data-lang="th"] .hero-title .tag {
  line-height: 1.55;
}

html[lang="th"] .hero h1 .highlight,
html[lang="th"] .hero-title .tag .tag-text,
html[data-lang="th"] .hero h1 .highlight,
html[data-lang="th"] .hero-title .tag .tag-text {
  display: inline-block;
  padding-bottom: .15em;
  line-height: 1.25;
}

/* ──────────────────────────────────────────────────────────
   FLOATING FEATURES
   ────────────────────────────────────────────────────────── */
.floating-features {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(64px, 6vh, 96px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 0 12px;
  z-index: 2;
  pointer-events: none;
}

.feature-badge {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #00d8ff;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: .85rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  animation: floatBadge 6s ease-in-out infinite alternate;
}

/* ──────────────────────────────────────────────────────────
   RESPONSIVE (สำหรับ .hero base)
   ────────────────────────────────────────────────────────── */
@media (max-width:720px) {
  .hero {
    padding: 96px 18px 120px;
    min-height: 82vh;
  }

  .hero-title {
    gap: 6px;
    margin-bottom: 14px;
  }

  .feature-badge {
    font-size: .8rem;
    padding: 5px 12px;
  }

  .floating-features {
    bottom: 16px;
    gap: 8px;
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width:600px) {
  .floating-features {
    bottom: clamp(28px, 5vh, 48px);
  }
}

/* ──────────────────────────────────────────────────────────
   ENTRANCE ANIMATION — แบบไม่พึ่ง JS
   ────────────────────────────────────────────────────────── */
/* เล่นทันทีเมื่อโหลดเพจ + ไล่ดีเลย์อัตโนมัติ */
.hero-v2 .hero-content>* {
  opacity: 0;
  transform: translateY(26px);
  animation: heroUp .70s cubic-bezier(.22, 1, .36, 1) forwards;
  animation-delay: var(--d, 0ms);
}

/* ไล่ลำดับ delay ให้ 5 ชิ้นหลัก: eyebrow, h1, subhead, cta, chips */
.hero-v2 .hero-content>*:nth-child(1) {
  --d: 0ms;
}

.hero-v2 .hero-content>*:nth-child(2) {
  --d: 120ms;
}

.hero-v2 .hero-content>*:nth-child(3) {
  --d: 240ms;
}

.hero-v2 .hero-content>*:nth-child(4) {
  --d: 360ms;
}

.hero-v2 .hero-content>*:nth-child(5) {
  --d: 480ms;
}

/* ชิป 5 อัน ลอยขึ้นลงตลอดเวลา + ไล่ดีเลย์ */
.hero-v2 .feature-chips .chip {
  --fy: 6px;
  animation: chipFloat 3.6s ease-in-out infinite !important;
  /* บังคับถ้าถูก override ที่อื่น */
  animation-delay: var(--bd, 0ms);
}

.hero-v2 .feature-chips .chip:nth-child(1) {
  --bd: 0ms;
}

.hero-v2 .feature-chips .chip:nth-child(2) {
  --bd: 120ms;
}

.hero-v2 .feature-chips .chip:nth-child(3) {
  --bd: 240ms;
}

.hero-v2 .feature-chips .chip:nth-child(4) {
  --bd: 360ms;
}

.hero-v2 .feature-chips .chip:nth-child(5) {
  --bd: 480ms;
}

/* ──────────────────────────────────────────────────────────
   ANIMATIONS (base)
   ────────────────────────────────────────────────────────── */
@keyframes heroUp {
  0% {
    opacity: 0;
    transform: translateY(26px)
  }

  60% {
    opacity: 1;
    transform: translateY(-4px)
  }

  100% {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes badgeUp {
  from {
    opacity: 0;
    transform: translateY(14px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes shimmer {
  0% {
    background-position: 0%
  }

  100% {
    background-position: 100%
  }
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%
  }

  50% {
    background-position: 100% 50%
  }

  100% {
    background-position: 0% 50%
  }
}

@keyframes particlesMove {
  0% {
    background-position: 0 0
  }

  100% {
    background-position: 100px 100px
  }
}

@keyframes backgroundFloat {
  0% {
    background-position: 30% 30%, 70% 60%, 50% 50%
  }

  100% {
    background-position: 50% 60%, 30% 40%, 60% 50%
  }
}

@keyframes floatBadge {
  0% {
    transform: translateY(0)
  }

  100% {
    transform: translateY(-8px)
  }
}

/* Reduce motion (ยังคงเคารพ แต่เฉพาะพื้นหลัง/กริด) */
@media (prefers-reduced-motion:reduce) {

  .hero::before,
  .hero::after {
    animation: none !important;
  }

  .hero-v2 .feature-chips .chip {
    animation: chipFloat 3.6s ease-in-out infinite !important;
  }

  /* ชิปยังลอย */
  .hero-v2 .hero-content>* {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* iOS safe-area */
@supports (padding: max(0px)) {
  .floating-features {
    bottom: calc(clamp(64px, 6vh, 96px) + env(safe-area-inset-bottom));
  }
}

/* ──────────────────────────────────────────────────────────
   HERO SECTION (v2 cinematic & parallax) — พื้นหลังขยับเสมอ
   ────────────────────────────────────────────────────────── */
.hero-v2 {
  position: relative;
  background:
    radial-gradient(1200px 800px at 70% 20%, rgba(0, 194, 255, .25), transparent 60%),
    linear-gradient(135deg, #0b74e3, #0056b3 45%, #004095 100%);
  overflow: hidden;
  color: #fff;
  padding-bottom: clamp(110px, 14vh, 160px);
}

/* Layering */
.hero-v2 .hero-content {
  position: relative;
  z-index: 2;
}

.hero-v2 .hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

/* Eyebrow / Headline */
.hero-v2 .eyebrow {
  letter-spacing: .18em;
  font-weight: 700;
  opacity: .9;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .9);
  margin-bottom: 12px;
}

.hero-v2 .display {
  font-size: clamp(2.2rem, 5.2vw, 4rem);
  line-height: 1.1;
  font-weight: 800;
}

.hero-v2 .display .accent {
  color: #ffc53d;
  text-shadow: 0 0 22px rgba(255, 197, 61, .25);
}

.hero-v2 .subhead {
  max-width: 820px;
  color: rgba(255, 255, 255, .92);
  margin: 14px auto 22px;
  font-size: clamp(1rem, 1.2vw, 1.15rem);
}

/* CTA group */
.hero-v2 .cta-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
}

.hero-v2 .cta-btn.primary {
  background: linear-gradient(90deg, var(--accent-color), #4cc9ff);
  color: #052a41;
  font-weight: 800;
  box-shadow: var(--shadow-md);
}

.hero-v2 .cta-btn.ghost {
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  background: transparent;
}

.hero-v2 .cta-btn.ghost:hover {
  background: rgba(255, 255, 255, .08);
}

/* Feature chips container */
.hero-v2 .feature-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 28px;
}

/* Background layers (animate even without JS) */
.hero-v2 .layer {
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.hero-v2 .bg-gradient {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(60% 60% at 20% 20%, rgba(0, 195, 255, .22), transparent 55%),
    radial-gradient(60% 60% at 85% 35%, rgba(0, 255, 170, .18), transparent 55%);
  filter: blur(10px);
  animation: bgDrift 28s ease-in-out infinite alternate;
}

.hero-v2 .bg-radial {
  position: absolute;
  inset: 0;
  background: radial-gradient(800px 480px at 30% 75%, rgba(255, 255, 255, .08), transparent 70%);
}

.hero-v2 .bg-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px;
  opacity: .18;
  mask-image: radial-gradient(60% 60% at 50% 50%, #000, transparent 70%);
  animation: gridPan 40s linear infinite;
}

.hero-v2 .bg-orbit {
  position: absolute;
  inset: 0;
  animation: orbitRotate 24s linear infinite;
}

.hero-v2 .bg-orbit::before,
.hero-v2 .bg-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, .18);
  inset: 15% 22% 35% 22%;
  transform: rotate(12deg);
}

.hero-v2 .bg-orbit::after {
  inset: 28% 10% 20% 10%;
  transform: rotate(-6deg);
  opacity: .6;
}

.hero-v2 .bg-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(40% 40% at 70% 30%, rgba(255, 197, 61, .14), transparent 60%);
}

/* Mobile tune (v2) */
@media (max-width:768px) {
  .hero-v2 .feature-chips {
    gap: 8px;
  }

  .hero-v2 .chip {
    font-size: .9rem;
    padding: 7px 12px;
  }
}

/* Keyframes used by v2 layers */
@keyframes bgDrift {
  0% {
    transform: translate3d(-2%, -2%, 0) scale(1.02)
  }

  100% {
    transform: translate3d(2%, 1%, 0) scale(1.03)
  }
}

@keyframes gridPan {
  0% {
    background-position: 0 0, 0 0
  }

  100% {
    background-position: 120px 120px, 120px 120px
  }
}

@keyframes orbitRotate {
  from {
    transform: rotate(0deg)
  }

  to {
    transform: rotate(360deg)
  }
}

@keyframes chipFloat {

  0%,
  100% {
    transform: translateY(0)
  }

  50% {
    transform: translateY(calc(-1 * var(--fy)))
  }
}