/* 📱 MOBILE-FIRST RESPONSIVE ENHANCEMENTS */
/* Enhanced mobile experience for Africa Chefs Connect */

/* ===== MOBILE-FIRST BASE STYLES ===== */

/* Touch-friendly interactions */
* {
    -webkit-tap-highlight-color: rgba(212, 175, 55, 0.3);
    -webkit-touch-callout: none;
}

/* Improved touch targets */
button, .btn, .nav-link, .portfolio-item {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* Mobile button optimizations */
@media (max-width: 768px) {
    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 280px;
        padding: 0.9rem 1.5rem;
        font-size: 1rem;
        border-radius: 25px;
        justify-content: center;
        text-align: center;
    }
    
    .hero-actions .btn-primary,
    .hero-actions .btn-secondary {
        min-height: 50px;
        font-weight: 600;
    }
    
    .nav-cta {
        display: none; /* Hide nav CTA on mobile to save space */
    }
}

@media (max-width: 480px) {
    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 250px;
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
        min-height: 48px;
    }
    
    .hero-actions {
        width: 100%;
    }
    
    .hero-actions .btn-primary,
    .hero-actions .btn-secondary {
        width: 100%;
        max-width: 220px;
    }
}

/* ===== ENHANCED NAVIGATION ===== */

/* Mobile hamburger menu improvements */
.mobile-toggle {
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.mobile-toggle:hover {
    background-color: rgba(212, 175, 55, 0.1);
}

.mobile-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-dark);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Animated hamburger */
.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Enhanced mobile menu */
.nav-menu {
    border-radius: 0 0 15px 15px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border-top: 3px solid var(--primary-gold);
}

.nav-menu.active {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== MOBILE TYPOGRAPHY ===== */

/* Improved readability on mobile */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 0.8rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        line-height: 1.4;
        margin-bottom: 1.5rem;
        /* Limit text length on mobile */
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .hero-badge {
        font-size: 0.85rem;
        padding: 0.4rem 1rem;
        margin-bottom: 1rem;
    }
    
    .section-title {
        font-size: 1.8rem;
        line-height: 1.3;
        margin-bottom: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
        line-height: 1.5;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.6rem;
        line-height: 1.1;
        margin-bottom: 0.6rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        line-height: 1.3;
        margin-bottom: 1rem;
        /* Show only 2 lines on very small screens */
        -webkit-line-clamp: 2;
    }
    
    .hero-badge {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    .section-title {
        font-size: 1.4rem;
    }
}

/* ===== MOBILE LAYOUT IMPROVEMENTS ===== */

/* Better spacing on mobile */
@media (max-width: 768px) {
    .section {
        padding: 2.5rem 0;
    }
    
    .hero {
        min-height: 85vh; /* Reduce hero height on mobile */
        padding: 1rem 0;
    }
    
    .hero-container {
        padding: 0 1.5rem;
        gap: 2rem;
        min-height: auto;
    }
    
    .hero-content {
        text-align: center;
        max-width: 100%;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        margin-top: 1.5rem;
    }
    
    .about-container,
    .portfolio-container,
    .contact-container,
    .features-container,
    .events-container {
        padding: 0 1.5rem;
    }
    
    /* Improved grid layouts */
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .about-grid {
        gap: 2rem;
    }
    
    .contact-grid {
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 1.5rem 0;
    }
    
    .hero {
        min-height: 80vh; /* Further reduce on small screens */
        padding: 0.5rem 0;
    }
    
    .hero-container,
    .about-container,
    .portfolio-container,
    .contact-container,
    .features-container,
    .events-container {
        padding: 0 1rem;
    }
    
    .hero-content {
        padding: 1rem 0;
    }
    
    .hero-actions {
        gap: 0.8rem;
        margin-top: 1rem;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Single column layout for very small screens */
    .features-grid,
    .events-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ===== MOBILE PORTFOLIO ENHANCEMENTS ===== */

/* Better portfolio experience on mobile */
@media (max-width: 768px) {
    .portfolio-item {
        border-radius: 12px;
        overflow: hidden;
        aspect-ratio: 1;
    }
    
    .portfolio-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .portfolio-overlay {
        background: linear-gradient(45deg, rgba(212, 175, 55, 0.9) 0%, rgba(184, 115, 51, 0.9) 100%);
    }
    
    .portfolio-icon {
        font-size: 2rem;
    }
    
    /* Touch-friendly load more button */
    .load-more-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
        border-radius: 25px;
        min-height: 50px;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
        display: block;
    }
}

/* ===== MOBILE MODAL IMPROVEMENTS ===== */

/* Better modal experience on mobile */
@media (max-width: 768px) {
    .modal {
        padding: 1rem;
    }
    
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 2rem auto;
        border-radius: 15px;
    }
    
    .modal-image {
        max-width: 100%;
        max-height: 70vh;
        border-radius: 10px;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===== MOBILE FORM IMPROVEMENTS ===== */

/* Better form experience on mobile */
@media (max-width: 768px) {
    .contact-form {
        padding: 2rem 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-input,
    .form-textarea {
        padding: 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 10px;
        border: 2px solid #e5e7eb;
        transition: border-color 0.3s ease;
    }
    
    .form-input:focus,
    .form-textarea:focus {
        border-color: var(--primary-gold);
        outline: none;
        box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    }
    
    .btn-primary {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        border-radius: 10px;
        min-height: 50px;
    }
}

/* ===== MOBILE PERFORMANCE OPTIMIZATIONS ===== */

/* Reduce animations on mobile for better performance */
@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    .portfolio-item {
        transition: transform 0.2s ease;
    }
    
    .portfolio-item:hover {
        transform: translateY(-5px);
    }
    
    .portfolio-image:hover {
        transform: scale(1.02);
    }
}

/* Disable hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    .portfolio-item:hover {
        transform: none;
    }
    
    .portfolio-image:hover {
        transform: none;
    }
    
    .btn:hover {
        transform: none;
    }
}

/* ===== MOBILE ACCESSIBILITY IMPROVEMENTS ===== */

/* Better focus indicators for mobile */
@media (max-width: 768px) {
    button:focus,
    .btn:focus,
    .nav-link:focus {
        outline: 3px solid var(--primary-gold);
        outline-offset: 2px;
    }
    
    /* Skip to content link for screen readers */
    .skip-link {
        position: absolute;
        top: -40px;
        left: 6px;
        background: var(--primary-gold);
        color: white;
        padding: 8px;
        text-decoration: none;
        border-radius: 4px;
        z-index: 1000;
    }
    
    .skip-link:focus {
        top: 6px;
    }
}

/* ===== MOBILE LOADING STATES ===== */

/* Better loading indicators on mobile */
@media (max-width: 768px) {
    .image-loading {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
    
    .loading-spinner {
        width: 30px;
        height: 30px;
        border: 3px solid rgba(212, 175, 55, 0.3);
        border-top: 3px solid var(--primary-gold);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
}

/* ===== MOBILE FOOTER IMPROVEMENTS ===== */

@media (max-width: 768px) {
    .footer {
        padding: 3rem 0 2rem;
    }
    
    .footer-container {
        padding: 0 1.5rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-logo {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    .footer-logo img {
        width: 40px;
        height: 40px;
    }
}

/* ===== MOBILE DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .nav-menu {
        background: rgba(44, 24, 16, 0.95);
        color: var(--light-cream);
    }
    
    .modal-content {
        background: var(--dark-brown);
        color: var(--light-cream);
    }
}

/* ===== MOBILE LANDSCAPE OPTIMIZATIONS ===== */

@media (max-width: 768px) and (orientation: landscape) {
    .hero-container {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        align-items: center;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .section {
        padding: 2rem 0;
    }
}

/* ===== MOBILE VIEWPORT OPTIMIZATIONS ===== */

/* Prevent content from taking full screen height */
@media (max-width: 768px) {
    .hero {
        /* Use viewport units but with fallbacks */
        min-height: 75vh;
        max-height: 85vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .hero-container {
        height: auto;
        min-height: auto;
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    /* Ensure content doesn't overflow viewport */
    .hero-content {
        max-height: 70vh;
        overflow-y: auto;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .hero {
        min-height: 70vh;
        max-height: 80vh;
        padding: 1rem 0;
    }
    
    .hero-content {
        max-height: 65vh;
        padding: 0.5rem;
    }
    
    /* Compact spacing for small screens */
    .hero-badge {
        margin-bottom: 0.5rem;
    }
    
    .hero-title {
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        margin-bottom: 0.8rem;
    }
    
    .hero-actions {
        margin-top: 0.8rem;
    }
}

/* ===== MOBILE SAFE AREAS (iPhone X+) ===== */

@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
        padding-top: env(safe-area-inset-top);
    }
    
    .hero {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
    
    .footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

/* ===== MOBILE PRINT STYLES ===== */

@media print and (max-width: 768px) {
    .mobile-toggle,
    .nav-menu,
    .portfolio-overlay {
        display: none !important;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}