/* Xcitium Thailand — Interactions Layer (เพิ่ม 2026-10-13)
   ลูกเล่น interactive ทั้งหมดอยู่ไฟล์นี้ — ลบ/ปิดไฟล์นี้ก็กลับไปดีไซน์เดิมได้ทันที
   ใช้ตัวแปรธีมเดิมจาก main.css (violet #7C5CFF / orange #FF7A1A) */

/* ── 1. Scroll progress bar — แถบความคืบหน้าด้านบนสุด ── */
#xci-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    z-index: 999;
    background: linear-gradient(90deg, var(--violet), var(--orange));
    box-shadow: 0 0 12px rgba(124, 92, 255, 0.55);
    transition: width 0.08s linear;
    pointer-events: none;
}

/* ── 2. Header เมื่อสกรอลล์ — เข้มขึ้น + ย่อเล็กน้อย ── */
.header {
    transition: padding 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.header.is-scrolled {
    padding: 10px 0;
    background: rgba(10, 6, 18, 0.95);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.nav-link {
    position: relative;
}
/* เส้นใต้เรืองแสง — active section */
.nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--violet), var(--orange));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}
.nav-link.is-active::after,
.nav-link:hover::after {
    transform: scaleX(1);
}
.nav-link.is-active {
    color: var(--violet-tint);
}

/* ── 3. Hero: แสงตามเมาส์ + orb parallax ── */
.hero {
    position: relative;
    overflow: hidden;
}
#xci-hero-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 92, 255, 0.16) 0%, rgba(255, 122, 26, 0.06) 45%, transparent 70%);
    pointer-events: none;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s ease;
    will-change: transform;
}
.hero-orb {
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}
.hero-eyebrow {
    animation: xci-eyebrow-glow 2.6s ease-in-out infinite;
}
@keyframes xci-eyebrow-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(124, 92, 255, 0.35); }
    50% { box-shadow: 0 0 18px 3px rgba(124, 92, 255, 0.25); }
}

/* ── 4. Card 3D tilt + เงาเรืองแสงตามเมาส์ ── */
.zt-card, .sol-card, .price-card, .feat-item, .testi-card, .how-col {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease !important;
    transform-style: preserve-3d;
    position: relative;
}
.zt-card:hover, .sol-card:hover, .feat-item:hover, .testi-card:hover {
    box-shadow: 0 14px 40px rgba(124, 92, 255, 0.22), 0 0 0 1px var(--violet-border);
    border-color: var(--violet-border) !important;
}
.price-card.popular:hover {
    box-shadow: 0 14px 44px rgba(255, 122, 26, 0.25), 0 0 0 1px rgba(255, 122, 26, 0.35);
}
/* ไฮไลต์จุดที่เมาส์ชี้ (รับตำแหน่งจาก JS ผ่าน CSS custom property) */
.zt-card::before, .sol-card::before, .feat-item::before, .testi-card::before, .price-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(420px circle at var(--xci-mx, 50%) var(--xci-my, 50%), rgba(124, 92, 255, 0.10), transparent 55%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.zt-card:hover::before, .sol-card:hover::before, .feat-item:hover::before,
.testi-card:hover::before, .price-card:hover::before {
    opacity: 1;
}
.price-card.popular::before {
    background: radial-gradient(420px circle at var(--xci-mx, 50%) var(--xci-my, 50%), rgba(255, 122, 26, 0.12), transparent 55%);
}

/* ── 5. ปุ่ม: ยกขึ้น + แสงวาบกวาดผ่าน ── */
.btn {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}
.btn:hover {
    transform: translateY(-2px);
}
.btn-primary {
    background-image: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.22) 50%, transparent 70%);
    background-size: 220% 100%;
    background-position: 120% 0;
    background-repeat: no-repeat;
    transition: transform 0.2s ease, background-position 0.6s ease, box-shadow 0.2s ease !important;
}
.btn-primary:hover {
    background-position: -40% 0;
    box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35);
}

/* ── 6. Reveal on scroll — section header / stats / เนื้อหาใหญ่ ── */
.xci-reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.xci-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}
/* สถิติเด้งเบา ๆ เมื่อเห็น (จับคู่ counter ใน JS) */
.stat-item .stat-value {
    display: inline-block;
}
.stat-item.counted .stat-value {
    animation: xci-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes xci-pop {
    0% { transform: scale(0.85); }
    100% { transform: scale(1); }
}

/* ── 7. Back-to-top ── */
#xci-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--violet-border);
    background: rgba(12, 8, 24, 0.9);
    backdrop-filter: blur(8px);
    color: var(--violet-tint);
    font-size: 18px;
    cursor: pointer;
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
#xci-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#xci-top:hover {
    background: var(--violet-deep);
    color: #fff;
    transform: translateY(-3px);
}

/* ── 8. โมบายล์: hamburger + เมนูดรอปดาวน์ ── */
#xci-navtoggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0 9px;
    border-radius: 10px;
    border: 1px solid var(--hairline);
    background: var(--surface);
    cursor: pointer;
    z-index: 120;
}
#xci-navtoggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
    transition: transform 0.3s ease, opacity 0.3s ease;
}
#xci-navtoggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#xci-navtoggle.is-open span:nth-child(2) { opacity: 0; }
#xci-navtoggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
    #xci-navtoggle { display: flex; }
    .nav-links {
        display: block !important;
        position: fixed;
        top: 0;
        right: 0;
        width: min(78vw, 320px);
        height: 100vh;
        padding: 96px 28px 28px;
        background: rgba(10, 6, 18, 0.98);
        backdrop-filter: blur(16px);
        border-left: 1px solid var(--hairline);
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
        z-index: 110;
        overflow-y: auto;
    }
    .nav-links.is-open {
        transform: translateX(0);
        box-shadow: -20px 0 60px rgba(0, 0, 0, 0.5);
    }
    .nav-links .nav-link {
        display: block;
        padding: 14px 4px;
        font-size: 18px;
        border-bottom: 1px solid var(--hairline);
    }
    .nav-links .nav-link::after { display: none; }
    #xci-overlay {
        position: fixed;
        inset: 0;
        background: rgba(6, 4, 9, 0.6);
        z-index: 105;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s;
    }
    #xci-overlay.is-visible {
        opacity: 1;
        visibility: visible;
    }
}

/* ── 9. เคารพผู้ใช้ที่เปิด reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    #xci-progress, .hero-orb, #xci-hero-glow { display: none; }
    .xci-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .zt-card, .sol-card, .price-card, .feat-item, .testi-card, .how-col {
        transform: none !important;
        transition: none !important;
    }
}

/* ── 10. Chat: จุดกำลังพิมพ์ + ข้อความสตรีม ── */
.xci-typing span {
    display: inline-block;
    font-size: 18px;
    line-height: 1;
    transition: opacity 0.2s ease;
}
#chatPanel .chat-message.bot .chat-text {
    white-space: pre-wrap;
    word-break: break-word;
}
