/* Mobile Optimization Stylesheet - Essentials Creative */
/* Comprehensive mobile-first responsive improvements */
/* Created: February 2024 */

/* ======================== */
/* Base Mobile Reset & Setup */
/* ======================== */

/* Prevent iOS zoom on form inputs */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select:focus,
    textarea:focus,
    input:focus {
        font-size: 16px !important;
    }
}

/* Smooth scrolling for mobile */
@media (max-width: 1024px) {
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* ======================== */
/* Mobile Navigation Improvements */
/* ======================== */

/* Enhanced hamburger menu */
@media (max-width: 768px) {
    .hamburger-nav,
    .hamburger-toggle,
    .mobile-menu-toggle {
        display: flex !important;
        position: relative;
        z-index: 9999;
    }
    
    .hamburger-toggle,
    .mobile-menu-toggle {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
        padding: 12px;
        margin: 0;
        border: none;
        background: transparent;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.3s ease;
    }
    
    .hamburger-toggle .hamburger-line,
    .hamburger-toggle span,
    .mobile-menu-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: #333;
        margin: 4px 0;
        transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        border-radius: 2px;
    }
    
    /* Animated hamburger transformation */
    .hamburger-toggle.active .hamburger-line:nth-child(1),
    .hamburger-toggle.active span:nth-child(1),
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    
    .hamburger-toggle.active .hamburger-line:nth-child(2),
    .hamburger-toggle.active span:nth-child(2),
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(-20px);
    }
    
    .hamburger-toggle.active .hamburger-line:nth-child(3),
    .hamburger-toggle.active span:nth-child(3),
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }
    
    /* Mobile navigation panel */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: #ffffff;
        box-shadow: -5px 0 20px rgba(0,0,0,0.1);
        transition: right 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        z-index: 9998;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 80px 20px 40px;
        display: flex;
        flex-direction: column;
    }
    
    .nav-links.mobile-active {
        right: 0;
    }
    
    /* Mobile menu overlay */
    .nav-links::before {
        content: '';
        position: fixed;
        top: 0;
        left: -100vw;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }
    
    .nav-links.mobile-active::before {
        opacity: 1;
        pointer-events: all;
    }
    
    /* Mobile nav links styling */
    .nav-links a {
        display: block;
        padding: 16px 20px;
        font-size: 18px;
        color: #333;
        text-decoration: none;
        border-bottom: 1px solid #f0f0f0;
        transition: all 0.2s ease;
        position: relative;
        margin: 0;
    }
    
    .nav-links a:active,
    .nav-links a:hover {
        background: #f8f8f8;
        padding-left: 28px;
    }
    
    .nav-links a.active {
        font-weight: 700;
        color: #000;
    }
}

/* ======================== */
/* Touch Target Optimization */
/* ======================== */

@media (max-width: 768px) {
    /* Ensure all interactive elements meet minimum touch target size */
    button,
    a,
    input[type="submit"],
    input[type="button"],
    input[type="reset"],
    .btn,
    .button,
    .portfolio-item,
    .gallery-item {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Increase form element touch targets */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="password"],
    textarea,
    select {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 16px;
        border-radius: 8px;
    }
    
    /* Enhance button styling for mobile */
    button,
    .btn,
    .button,
    input[type="submit"] {
        padding: 14px 24px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 8px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* ======================== */
/* Typography Optimization */
/* ======================== */

/* Mobile typography scaling */
@media (max-width: 480px) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    h1 {
        font-size: clamp(1.75rem, 8vw, 2.5rem);
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    h2 {
        font-size: clamp(1.5rem, 6vw, 2rem);
        line-height: 1.3;
        margin-bottom: 0.875rem;
    }
    
    h3 {
        font-size: clamp(1.25rem, 5vw, 1.5rem);
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }
    
    h4 {
        font-size: clamp(1.125rem, 4vw, 1.25rem);
        line-height: 1.4;
    }
    
    p {
        font-size: 16px;
        line-height: 1.6;
        margin-bottom: 1rem;
    }
    
    /* Prevent text overflow */
    h1, h2, h3, h4, h5, h6, p, li {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

/* ======================== */
/* Gallery & Image Optimization */
/* ======================== */

@media (max-width: 768px) {
    /* Portfolio grid mobile layout */
    .portfolio-grid,
    .gallery-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 16px !important;
    }
    
    /* Single column on very small screens */
    @media (max-width: 480px) {
        .portfolio-grid,
        .gallery-grid {
            grid-template-columns: 1fr !important;
            gap: 16px !important;
        }
    }
    
    /* Image containers mobile optimization */
    .portfolio-item,
    .gallery-item {
        aspect-ratio: 1/1;
        overflow: hidden;
        border-radius: 8px;
        position: relative;
    }
    
    .portfolio-item img,
    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }
    
    /* Simplify hover effects for touch devices */
    @media (hover: none) {
        .portfolio-item:hover img,
        .gallery-item:hover img {
            transform: none;
        }
    }
    
    /* Lightbox mobile optimization */
    .lightbox {
        padding: 20px;
    }
    
    .lightbox img {
        max-width: 95vw;
        max-height: 80vh;
        border-radius: 8px;
    }
    
    .lightbox-close {
        width: 48px;
        height: 48px;
        top: 10px;
        right: 10px;
        font-size: 28px;
        background: rgba(0,0,0,0.7);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ======================== */
/* Hero Section Mobile */
/* ======================== */

@media (max-width: 768px) {
    .hero {
        min-height: 50vh !important;
        height: auto !important;
        padding: 80px 20px 60px;
    }
    
    .hero-content {
        padding: 0 20px !important;
        max-width: 100% !important;
    }
    
    .hero h1 {
        font-size: clamp(2rem, 8vw, 3rem) !important;
        margin-bottom: 1rem !important;
    }
    
    .hero p {
        font-size: clamp(1rem, 4vw, 1.25rem) !important;
        line-height: 1.5 !important;
    }
}

/* ======================== */
/* Container & Spacing */
/* ======================== */

@media (max-width: 768px) {
    /* Consistent mobile padding */
    .container,
    .container-standard,
    .content-block,
    section {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    /* Section spacing */
    .section {
        padding: 40px 16px !important;
    }
    
    .section-spacious {
        padding: 60px 16px !important;
    }
    
    /* Card and content block spacing */
    .card,
    .card-standard {
        padding: 20px !important;
        margin-bottom: 20px;
        border-radius: 12px;
    }
}

/* ======================== */
/* Form Mobile Optimization */
/* ======================== */

@media (max-width: 768px) {
    .contact-form,
    .newsletter-form {
        max-width: 100%;
        padding: 0;
    }
    
    .contact-form input,
    .contact-form textarea,
    .contact-form select {
        width: 100%;
        margin-bottom: 16px;
        font-size: 16px;
        padding: 14px 16px;
        border-radius: 8px;
        border: 1px solid #ddd;
        -webkit-appearance: none;
        appearance: none;
    }
    
    .contact-form button,
    .newsletter-form button {
        width: 100%;
        padding: 16px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 8px;
        margin-top: 8px;
    }
    
    /* Stack form elements vertically */
    .newsletter-form {
        flex-direction: column !important;
    }
    
    .newsletter-form input {
        margin-bottom: 12px;
        width: 100% !important;
    }
}

/* ======================== */
/* Footer Mobile */
/* ======================== */

@media (max-width: 768px) {
    .footer {
        padding: 40px 16px 20px;
    }
    
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center;
    }
    
    .footer-section {
        margin-bottom: 1.5rem;
    }
    
    .footer-social {
        justify-content: center;
        flex-direction: row !important;
        gap: 1.5rem !important;
    }
}

/* ======================== */
/* Logo Mobile Scaling */
/* ======================== */

@media (max-width: 768px) {
    .logo img {
        height: 50px !important;
        max-width: 180px !important;
    }
}

@media (max-width: 480px) {
    .logo img {
        height: 45px !important;
        max-width: 160px !important;
    }
}

@media (max-width: 375px) {
    .logo img {
        height: 40px !important;
        max-width: 140px !important;
    }
}

/* ======================== */
/* Performance Optimizations */
/* ======================== */

@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    * {
        animation-duration: 0.3s !important;
    }
    
    /* Disable parallax on mobile */
    .parallax {
        background-attachment: scroll !important;
    }
    
    /* Optimize image loading */
    img {
        content-visibility: auto;
    }
}

/* ======================== */
/* Accessibility Improvements */
/* ======================== */

@media (max-width: 768px) {
    /* Focus states for mobile */
    a:focus,
    button:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid #4A90E2;
        outline-offset: 2px;
    }
    
    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -40px;
        left: 0;
        background: #000;
        color: #fff;
        padding: 8px;
        text-decoration: none;
        z-index: 100000;
    }
    
    .skip-to-content:focus {
        top: 0;
    }
}

/* ======================== */
/* Landscape Mobile Optimization */
/* ======================== */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 70vh !important;
    }
    
    .nav-links {
        padding-top: 60px;
    }
    
    .hamburger-toggle,
    .mobile-menu-toggle {
        position: fixed;
        top: 10px;
        right: 10px;
    }
}

/* ======================== */
/* Print Styles for Mobile */
/* ======================== */

@media print {
    .mobile-menu-toggle,
    .hamburger-nav,
    .nav-links {
        display: none !important;
    }
}

/* ======================== */
/* Utility Classes for Mobile */
/* ======================== */

@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .text-center-mobile {
        text-align: center !important;
    }
    
    .stack-mobile {
        flex-direction: column !important;
    }
    
    .full-width-mobile {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .no-margin-mobile {
        margin: 0 !important;
    }
    
    .padding-mobile {
        padding: 16px !important;
    }
}