/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent zoom on iOS when focusing inputs */
input, select, textarea {
    font-size: 16px;
}

/* Improve touch scrolling on iOS */
body, html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    overflow-x: hidden;
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    /* Prevent horizontal scroll on mobile */
    width: 100%;
    position: relative;
}

/* Main container */
.container {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    /* Safe area padding for mobile devices with notches */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

.content {
    text-align: center;
    max-width: 1200px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Hero Video Container */
.hero-video-container {
    width: 100%;
    max-width: 900px;
    height: 500px;
    margin: 0 auto 40px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    /* Improve aspect ratio on mobile */
    aspect-ratio: 16/9;
}

.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Optimize video rendering on mobile */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* Prevent video from being selected on mobile */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Prevent dragging on mobile */
    -webkit-touch-callout: none;
}

/* Fallback styles if video doesn't load */
.fallback-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 40px;
}

.fallback-hero .company-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fallback-hero .tagline {
    font-size: 1.5rem;
    color: #3b82f6;
    font-weight: 500;
    opacity: 0.9;
}

/* Portfolio grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-top: 20px;
    width: 100%;
    max-width: 600px; /* Prevent grid from being too wide on mobile */
}

.portfolio-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 20px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(59, 130, 246, 0.5);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.4);
    /* Better touch targets for mobile */
    min-height: 44px; /* iOS minimum touch target */
    cursor: pointer;
}

.portfolio-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 60px rgba(59, 130, 246, 0.6);
    background: rgba(255, 255, 255, 1);
}

.portfolio-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

/* Larger logos for BBQ, Mow, and Solutions */
.portfolio-item[data-company="bbq"] .portfolio-logo,
.portfolio-item[data-company="mow"] .portfolio-logo,
.portfolio-item[data-company="solutions"] .portfolio-logo {
    width: 100px;
    height: 100px;
}

.portfolio-item:hover .portfolio-logo {
    transform: scale(1.1);
}

.portfolio-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
}

.portfolio-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
}

.portfolio-text {
    font-size: 14px;
    font-weight: bold;
    fill: white;
    font-family: 'Segoe UI', sans-serif;
}

.portfolio-name {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    transition: color 0.3s ease;
}

/* Company-specific hover colors */
.portfolio-item[data-company="bbq"]:hover .portfolio-name {
    color: #8B4513;
}

.portfolio-item[data-company="mow"]:hover .portfolio-name {
    color: #16A34A;
}

.portfolio-item[data-company="solutions"]:hover .portfolio-name {
    color: #16A34A;
}


/* Footer */
.footer {
    padding: 20px 0;
    text-align: center;
    color: #ffffff;
    font-size: 0.9rem;
    margin-top: auto;
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        /* Adjust for mobile browsers */
        min-height: 100vh;
        min-height: 100dvh;
        justify-content: flex-start;
        padding-top: max(25px, env(safe-area-inset-top) + 15px);
    }
    
    .content {
        padding-top: 20px;
        gap: 20px;
    }
    
    .hero-video-container {
        height: auto;
        min-height: 280px;
        max-height: 350px;
        margin-bottom: 30px;
        border-radius: 15px;
        /* Use aspect ratio for better mobile sizing */
        aspect-ratio: 16/10;
    }
    
    .fallback-hero .company-title {
        font-size: clamp(2rem, 8vw, 2.5rem); /* Responsive font sizing */
        margin-bottom: 8px;
        line-height: 1.2;
    }
    
    .fallback-hero .tagline {
        font-size: clamp(1rem, 4vw, 1.2rem); /* Responsive font sizing */
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        margin-top: 15px;
        width: 100%;
        max-width: 400px; /* Optimize for mobile width */
    }
    
    .portfolio-item {
        padding: 20px 15px;
        min-height: 120px; /* Ensure adequate touch target */
        /* Better mobile interaction feedback */
        -webkit-tap-highlight-color: rgba(59, 130, 246, 0.1);
    }
    
    .portfolio-item:active {
        transform: scale(0.98); /* Touch feedback */
    }
    
    .portfolio-logo {
        width: 70px;
        height: 70px;
        margin-bottom: 12px;
    }
    
    /* Larger logos for BBQ, Mow, and Solutions on mobile */
    .portfolio-item[data-company="bbq"] .portfolio-logo,
    .portfolio-item[data-company="mow"] .portfolio-logo,
    .portfolio-item[data-company="solutions"] .portfolio-logo {
        width: 85px;
        height: 85px;
    }
    
    .portfolio-name {
        font-size: 1.1rem; /* Slightly larger for mobile readability */
        line-height: 1.3;
        text-align: center;
    }
    
    /* Reduce animation intensity on mobile */
    .portfolio-item:hover {
        transform: translateY(-5px); /* Less dramatic hover */
    }
    
    .footer {
        font-size: 0.85rem;
        padding: 15px 0;
        margin-top: 30px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
        padding-top: max(20px, env(safe-area-inset-top) + 12px);
    }
    
    .hero-video-container {
        height: auto;
        min-height: 220px;
        max-height: 280px;
        margin-bottom: 25px;
        border-radius: 12px;
        aspect-ratio: 16/10;
    }
    
    .fallback-hero {
        padding: 25px 15px;
    }
    
    .fallback-hero .company-title {
        font-size: clamp(1.8rem, 9vw, 2.2rem);
        line-height: 1.1;
    }
    
    .fallback-hero .tagline {
        font-size: clamp(0.95rem, 4.5vw, 1.1rem);
    }
    
    .portfolio-grid {
        gap: 20px;
        max-width: 320px; /* Optimize for small screens */
    }
    
    .portfolio-item {
        padding: 18px 12px;
        min-height: 115px;
    }
    
    .portfolio-logo {
        width: 65px;
        height: 65px;
        margin-bottom: 10px;
    }
    
    /* Optimized logos for small mobile */
    .portfolio-item[data-company="bbq"] .portfolio-logo,
    .portfolio-item[data-company="mow"] .portfolio-logo,
    .portfolio-item[data-company="solutions"] .portfolio-logo {
        width: 78px;
        height: 78px;
    }
    
    .portfolio-name {
        font-size: 1rem;
        line-height: 1.2;
    }
    
    .footer {
        font-size: 0.8rem;
        padding: 12px 0;
        margin-top: 25px;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .portfolio-grid {
        gap: 35px;
    }
    
    .company-title {
        font-size: 3rem;
    }
}