@media (max-width: 1200px) {
    .grid-asymmetric {
        grid-template-columns: 1fr;
        gap: 4rem;
    }
    .col-5, .col-6, .col-7 {
        grid-column: span 1;
    }
    .hero-text {
        order: 2;
        text-align: center;
    }
    .hero-image {
        order: 1;
    }
    .product-card-horizontal {
        grid-template-columns: 1fr;
    }
    .product-card-horizontal .product-image-wrapper {
        min-height: 300px;
    }
}

@media (max-width: 1024px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
    .section {
        padding: 5rem 0;
    }
    .gallery-masonry {
        grid-template-columns: repeat(2, 1fr);
    }
    .gallery-item.wide {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background-color: var(--white);
        flex-direction: column;
        align-items: flex-start;
        padding: 8rem 2.5rem 3rem;
        box-shadow: var(--shadow-lg);
        transition: right var(--transition-normal);
        gap: 1.5rem;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-menu::before {
        content: 'Menu Utama';
        position: absolute;
        top: 2rem;
        left: 2.5rem;
        font-weight: 800;
        font-size: 1.5rem;
        color: var(--dark);
    }

    .nav-link {
        font-size: 1.25rem;
        width: 100%;
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--gray-light);
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .cart-drawer {
        max-width: 100%;
        right: -100%;
    }
    
    .floating-wa {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 56px;
        height: 56px;
    }
    
    .floating-wa svg {
        width: 28px;
        height: 28px;
    }

    .modal-prev, .modal-next {
        width: 40px;
        height: 40px;
        top: auto;
        bottom: 2rem;
        transform: none;
    }
    .modal-prev { left: 2rem; }
    .modal-next { right: 2rem; left: auto; }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .section {
        padding: 4rem 0;
    }
    
    .product-content {
        padding: 1.5rem;
    }
    
    .trust-card {
        padding: 1.5rem;
    }
    
    .gallery-masonry {
        grid-template-columns: 1fr;
        grid-auto-rows: 200px;
    }
    .gallery-item.large {
        grid-row: span 1;
    }
}

@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-brand-column,
    .footer-contact {
        grid-column: span 2;
    }

    .footer-column {
        min-width: 0;
    }

    .footer-column > a {
        overflow-wrap: anywhere;
    }

    .testimonials-header {
        display: block;
    }

    .testimonials-controls {
        margin-top: 18px;
    }

    .testimonials-track {
        grid-auto-columns: minmax(260px, 88vw);
    }

    .profile-video-frame,
    .catalog-flipbook {
        border-radius: var(--radius-md);
    }

    .catalog-flipbook iframe {
        height: 520px;
    }
}

/* Cross-device layout safeguards */
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

img,
svg,
video,
iframe {
    max-width: 100%;
}

@media (max-width: 640px) {
    .navbar .container {
        gap: 0.75rem;
    }

    .navbar-brand {
        flex-shrink: 1;
        min-width: 0;
        font-size: clamp(1.25rem, 6vw, 1.75rem);
        white-space: nowrap;
    }

    .navbar-actions {
        flex-shrink: 0;
        gap: 0.5rem;
    }

    #allProductsContainer {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 1.5rem !important;
    }

    .product-card,
    .product-content,
    .trust-card,
    .modal-content {
        min-width: 0;
    }

    .process-timeline-item {
        flex-direction: column !important;
        gap: 1.25rem !important;
        margin-bottom: 3rem !important;
    }

    .process-timeline-item > :first-child {
        width: auto !important;
        min-width: 3.5rem;
        padding: 0.5rem 0.75rem;
        font-size: 2rem !important;
    }

    .process-timeline-item > :last-child {
        width: 100%;
        min-width: 0;
    }

    .process-timeline-item h3 {
        font-size: clamp(1.5rem, 7vw, 2rem) !important;
    }
}

@media (max-width: 380px) {
    .container {
        padding-right: 14px;
        padding-left: 14px;
    }

    .nav-menu {
        width: min(88vw, 320px);
        padding-right: 1.5rem;
        padding-left: 1.5rem;
    }

    .nav-menu::before {
        left: 1.5rem;
    }

    .btn {
        max-width: 100%;
        white-space: normal;
    }

    .product-featured-content,
    .product-secondary-content {
        padding: 18px;
    }
}
