/* Global mobile & touch-friendly overrides */

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

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

/* Prevent horizontal overflow from wide content */
.container {
    max-width: 100%;
}

/* Touch devices: show hover-only product overlays & labels */
@media (max-width: 767px), (hover: none) {
    .opacity-0.group-hover\:opacity-100 {
        opacity: 1 !important;
    }

    .translate-y-3.group-hover\:translate-y-0,
    .translate-y-4.group-hover\:translate-y-0 {
        transform: translateY(0) !important;
    }
}

/* Hero slider controls */
@media (max-width: 767px) {
    .slider-arrow-hero {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
    }

    .slider-prev-hero {
        left: 8px !important;
    }

    .slider-next-hero {
        right: 8px !important;
    }

    .slider-dots {
        bottom: 12px !important;
        gap: 8px !important;
    }

    .text,
    .numbertext {
        white-space: normal !important;
        max-width: calc(100vw - 2rem);
        font-size: 12px !important;
        padding: 6px 10px !important;
    }

    /* Hero section height on small phones */
    section.relative.h-screen {
        min-height: 100svh;
        height: auto;
        min-height: 100dvh;
    }
}

/* Navigation logo scaling */
@media (max-width: 767px) {
    nav img.h-12 {
        height: 2.5rem;
    }

    nav .flex.justify-between.items-center {
        min-height: 3.5rem;
    }
}

/* Mobile menu styling */
#mobileMenu {
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#mobileMenu a {
    padding: 0.625rem 0;
    font-size: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

#mobileMenu a:last-child {
    border-bottom: none;
}

#mobileMenuBtn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Breadcrumb scroll on narrow screens */
@media (max-width: 639px) {
    nav.flex.items-center.space-x-2,
    .flex.items-center.space-x-2.text-sm {
        flex-wrap: wrap;
        gap: 0.25rem;
        row-gap: 0.5rem;
    }
}

/* Product page headings */
@media (max-width: 767px) {
    h1.font-playfair.text-5xl,
    h1.font-playfair.text-6xl {
        font-size: clamp(1.875rem, 7vw, 2.75rem) !important;
        line-height: 1.15 !important;
    }

    .product-thumb-gallery--cols-4,
    .product-thumb-gallery--cols-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* Filter buttons on produkter page */
@media (max-width: 639px) {
    .filter-btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.8125rem !important;
    }
}

/* Fixed floating buttons (WhatsApp, chat) */
@media (max-width: 639px) {
    .fixed.bottom-6.right-6,
    .fixed.bottom-6.left-6 {
        bottom: 1rem !important;
    }

    .fixed.bottom-6.right-6 {
        right: 1rem !important;
    }

    .fixed.bottom-6.left-6 {
        left: 1rem !important;
    }

    .fixed.bottom-6.right-6 a,
    .fixed.bottom-6.left-6 a {
        padding: 0.75rem !important;
    }

    #chatPopup {
        left: 1rem !important;
        right: 1rem !important;
        width: auto !important;
        max-width: none !important;
        bottom: 5.5rem !important;
        height: min(24rem, calc(100vh - 7rem)) !important;
    }
}

/* Section padding reduction on mobile */
@media (max-width: 767px) {
    section.py-20 {
        padding-top: 3rem;
        padding-bottom: 3rem;
    }
}

/* Product grid card heights */
@media (max-width: 767px) {
    .h-96 {
        height: 14rem;
    }

    .h-80 {
        height: 12rem;
    }
}

/* Epoxy calculator */
@media (max-width: 480px) {
    .epoxy-m2-calculator {
        padding: 1rem;
    }

    .epoxy-calc-inputs {
        grid-template-columns: 1fr;
    }
}

/* Improve tap targets */
@media (max-width: 767px) {
    button,
    a.block {
        -webkit-tap-highlight-color: transparent;
    }
}
