/* by whyr, contact: pangestu@whyr.my.id */
/* Home Page Specific Styles */

.hero-section {
    margin-top: -76px;
    position: relative;
    overflow: hidden;
}

/* Optimize carousel slide untuk mencegah flash */
.carousel-slide {
    padding: 100px 0;
    position: relative;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background-attachment: scroll;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    image-rendering: auto;
}

/* Hero Carousel Sliding Animation - Improved untuk mencegah flash */
#heroCarousel {
    position: relative;
    overflow: hidden;
}

#heroCarousel .carousel-item {
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

#heroCarousel .carousel-item-next:not(.carousel-item-start),
#heroCarousel .active.carousel-item-end {
    transform: translateX(100%) translateZ(0);
}

#heroCarousel .carousel-item-prev:not(.carousel-item-end),
#heroCarousel .active.carousel-item-start {
    transform: translateX(-100%) translateZ(0);
}

#heroCarousel .carousel-item-next,
#heroCarousel .carousel-item-prev {
    position: absolute;
    top: 0;
    width: 100%;
}

#heroCarousel .carousel-item-next.carousel-item-start,
#heroCarousel .active.carousel-item-end {
    transform: translateX(0) translateZ(0);
}

#heroCarousel .carousel-item-prev.carousel-item-end,
#heroCarousel .active.carousel-item-start {
    transform: translateX(0) translateZ(0);
}

/* Smooth transition untuk konten di dalam carousel - hanya sekali saat pertama kali muncul */
#heroCarousel .carousel-slide {
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
}

/* Efek fade-in untuk konten - hanya sekali saat carousel pertama kali dimuat */
#heroCarousel .carousel-item.active .carousel-slide {
    animation: fadeInContent 1s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Hanya animasi sekali, tidak retrigger saat scroll */
@keyframes fadeInContent {
    from {
        opacity: 0;
        transform: translateY(20px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

/* Pastikan gambar background tidak reload dan tidak flash */
.carousel-item {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: scroll !important;
}

/* Prevent flash saat carousel transition - gunakan hardware acceleration */
.carousel-item.active .carousel-slide {
    opacity: 1;
    visibility: visible;
}

/* Optimize carousel inner untuk smooth transitions */
.carousel-inner {
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Pastikan konten carousel tidak flash */
.carousel-slide > * {
    will-change: auto;
    transform: translateZ(0);
}

/* Animation complete state - tidak retrigger animasi saat scroll */
#heroCarousel.animation-complete .carousel-item.active .carousel-slide {
    animation: none !important;
    opacity: 1;
}

/* Force GPU acceleration untuk smooth transitions tanpa flash */
#heroCarousel .carousel-item,
#heroCarousel .carousel-slide {
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

/* Ensure background images are stable dan tidak reload */
.carousel-item .carousel-slide {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    image-rendering: auto;
}

.product-card {
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.product-card-bg {
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.product-link:hover .product-card-bg {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* Innovation Cards Styling */
.inovasi-card {
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.inovasi-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

/* Innovation Modal Styling */
.modal-content {
    border-radius: 15px;
    overflow: hidden;
}

/* Modal Image Container */
.modal-image-container {
    width: 100%;
    text-align: center;
    margin: 0 auto;
}

/* Modal Popup Image - Responsive untuk Desktop dan Mobile */
.modal-popup-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: block;
    margin: 0 auto;
}

/* Pastikan gambar tidak terpotong di berbagai ukuran layar */
@media (min-width: 992px) {
    .modal-popup-image {
        max-height: 500px;
        width: auto;
        max-width: 100%;
    }
}

@media (max-width: 991px) {
    .modal-popup-image {
        max-height: 300px;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .modal-popup-image {
        max-height: 250px;
        width: 100%;
    }
}

.modal-body h6 {
    font-size: 1.1rem;
}

.modal-body ul li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.modal-body .list-unstyled li {
    padding-left: 0;
}

/* Auto-scrolling reviews animation */
@keyframes scrollReviews {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.reviews-container {
    position: relative;
}

.reviews-track {
    display: flex;
    width: fit-content;
}

.reviews-track:hover {
    animation-play-state: paused;
}

.testimonial-avatar {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Profil Image Styling - Limit size untuk desktop */
.profil-image {
    width: 100%;
    height: auto;
    max-width: 100%;
}

@media (min-width: 992px) {
    .profil-image {
        max-width: 450px;
        max-height: 500px;
        width: auto;
        object-fit: contain;
    }
}

@media (min-width: 1200px) {
    .profil-image {
        max-width: 500px;
        max-height: 550px;
    }
}

@media (max-width: 768px) {
    .carousel-slide {
        padding: 60px 0;
        min-height: 400px !important;
        background-attachment: scroll !important;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    /* Adjust animation speed untuk mobile */
    #heroCarousel .carousel-item {
        transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Disable complex animations pada mobile untuk performa lebih baik */
    #heroCarousel .carousel-item.active .carousel-slide {
        animation: none;
        opacity: 1;
    }
}
