:root { 
    --cpac-blue: #004289; 
    --cpac-light-blue: #0076c0;
    --slate-gray: #f8fafc;
}

body { 
    font-family: 'Sarabun', sans-serif; 
    color: #1e293b; 
    line-height: 1.8; 
    background-color: #ffffff; 
    overflow-x: hidden; 
    max-width: 100%;
    position: relative;
}

h1, h2, h3, h4, .font-kanit { 
    font-family: 'Kanit', sans-serif; 
    letter-spacing: -0.01em; 
}

/* --- Preloader Styles --- */
#preloader {
    position: fixed;
    inset: 0;
    background-color: var(--cpac-blue);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.text-pulse-glow {
    animation: pulseGlow 1.2s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% { transform: scale(0.98); opacity: 0.5; text-shadow: 0 0 0px rgba(255, 255, 255, 0); }
    100% { transform: scale(1.05); opacity: 1; text-shadow: 0 0 20px rgba(255, 255, 255, 0.5); }
}

.header-shadow { 
    box-shadow: 0 2px 15px rgba(0,0,0,0.05); 
    transition: all 0.3s ease; 
}

/* --- Hero Section & Zoom Effect --- */
.hero-cpac {
    position: relative;
    overflow: hidden;
    z-index: 1;
    min-height: calc(100svh - 80px) !important; 
    background: none !important; 
}

.hero-cpac::before {
    content: "";
    position: absolute;
    top: -10%; left: -10%; width: 120%; height: 120%;
    background: linear-gradient(90deg, rgba(0, 66, 137, 0.9) 0%, rgba(0, 66, 137, 0.4) 100%), 
                url('https://images.unsplash.com/photo-1541888946425-d81bb19240f5?q=80&w=1600');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-animation: heroZoomV2 15s linear infinite alternate;
    animation: heroZoomV2 15s linear infinite alternate;
}

@-webkit-keyframes heroZoomV2 {
    0% { -webkit-transform: scale(1); }
    100% { -webkit-transform: scale(1.15); }
}

@keyframes heroZoomV2 {
    0% { transform: scale(1); }
    100% { transform: scale(1.15); }
}

/* เอฟเฟกต์ Shine สำหรับการ์ด */
.card-modern {
    position: relative;
    overflow: hidden;
}

.card-modern::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(30deg);
    transition: all 0.7s;
    pointer-events: none;
    z-index: 1;
}

.card-modern:hover::after {
    left: 120%;
}

/* ปรับปรุง Smooth Scale */
.card-modern:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 0 25px 50px -12px rgba(0, 66, 137, 0.2);
}

/* --- Navigation & Menus --- */
#mobile-menu {
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    transform: translateX(100%);
}

#mobile-menu.active { transform: translateX(0); }

.desktop-dropdown { position: relative; }

.desktop-dropdown-content {
    display: block;
    visibility: hidden;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.3s ease;
    pointer-events: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 240px;
    z-index: 50;
}

.desktop-dropdown:hover .desktop-dropdown-content {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.mobile-sub-content {
    max-height: 0;
    overflow: hidden;
    /* ใช้ Ease-out เพื่อให้ความรู้สึกที่ลื่นไหลกว่าตอนกางออก */
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1); 
}

.mobile-sub-content.open {
    /* ใช้ 1000px เพื่อกันเนื้อหาขาด แต่ animation จะเร็วตามเนื้อหาจริง */
    max-height: 1000px; 
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ย้าย Padding และ Background มาไว้ที่ตัวลูก (inner div) */
.mobile-sub-inner {
    padding-left: 1rem;
    padding-bottom: 1rem; /* เพิ่ม padding ล่างเพื่อให้ปุ่มไม่จมติดขอบ */
    background: #f8fafc;
}

.rotate-icon { transition: transform 0.4s; }

.rotate-icon.active { transform: rotate(180deg); }

/* --- Swiper & Components --- */
.swiper-button-next, .swiper-button-prev { 
    color: var(--cpac-blue) !important; 
    scale: 0.7; 
    transition: 0.3s; 
}

.swiper-button-next:hover, .swiper-button-prev:hover { scale: 0.9; }

.swiper-pagination-bullet-active { 
    background: var(--cpac-blue) !important; 
    width: 24px !important; 
    border-radius: 4px !important; 
    transition: 0.3s; 
}

.float-contact-sync { 
    animation: fluidBounce 3s ease-in-out infinite; 
}

#floating-status {
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fluidBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.project-img-wrap { overflow: hidden; border-radius: 8px; }

.project-img-wrap img { transition: transform 0.8s ease; }

.swiper-slide:hover img { transform: scale(1.1); }

/* --- Service Card Image Slider --- */
@keyframes cardSlider {
    0%, 28%   { transform: translateX(0); } 
    33%, 61%  { transform: translateX(-25%); } 
    66%, 94%  { transform: translateX(-50%); } 
    100%      { transform: translateX(-75%); } 
}

.animate-card-slider {
    animation: cardSlider 15s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.delay-1 { animation-delay: 0s; }
.delay-2 { animation-delay: -5s; }
.delay-3 { animation-delay: -10s; }

/* --- Utilities --- */
[data-aos] { pointer-events: none; }
.aos-animate { pointer-events: auto; }

/* การ์ดที่มีมิติมากขึ้น */
.service-card-hover {
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.service-card-hover:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 66, 137, 0.15);
}

/* เอฟเฟกต์แสงเงาวิ่งผ่านการ์ด (Shine Effect) */
.shine-effect {
    position: relative;
    overflow: hidden;
}

.shine-effect::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(30deg);
    transition: all 0.7s;
    pointer-events: none;
}

.shine-effect:hover::after {
    left: 120%;
}

/* --- New Premium Effects --- */

/* เอฟเฟกต์แสงเงาวิ่งผ่านการ์ด (Shine Effect) */
.card-modern {
    position: relative;
    overflow: hidden;
}

.card-modern::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(30deg);
    transition: all 0.7s;
    pointer-events: none;
    z-index: 1;
}

.card-modern:hover::after {
    left: 120%;
}

/* ปรับปรุงการ Hover ให้สมูทขึ้น */
.card-modern:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 66, 137, 0.2) !important;
}

/* FAQ Animation Support */
.rotate-180 {
    transform: rotate(180deg);
}

.faq-content {
    transition: max-height 0.5s cubic-bezier(0, 1, 0, 1);
}

/* --- Premium Animation Fix --- */

/* 1. เอฟเฟกต์ Shine และ Hover สำหรับ Card */
.card-premium {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-premium:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 66, 137, 0.15) !important;
}

.card-premium::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.4), transparent);
    transform: skewX(-25deg);
    transition: 0.7s;
}

.card-premium:hover::before {
    left: 125%;
}

/* 2. FAQ Accordion State */
/* FAQ Animation Support */
.accordion-content {
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-header i {
    transition: transform 0.3s ease;
}

.accordion-item.active .accordion-header i {
    transform: rotate(180deg);
}

@keyframes bounceSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
.animate-bounce-slow {
    animation: bounceSlow 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-150%) skewX(-20deg); }
    100% { transform: translateX(150%) skewX(-20deg); }
}

@keyframes shimmer {
    0% { transform: translateX(-150%) skewX(-25deg); }
    100% { transform: translateX(150%) skewX(-25deg); }
}
@keyframes next {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}