: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); }
}

/* --- Card Styles --- */
.card-modern { 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    border-top: 4px solid transparent; 
}

.card-modern:hover {
    border-top: 4px solid var(--cpac-light-blue);
    box-shadow: 0 20px 40px rgba(0,66,137,0.1);
    transform: translateY(-12px);
}

/* --- 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; }

@keyframes slow-zoom {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}
@keyframes line-flow {
    0% { transform: translateX(-100%); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}