/* ===================================
   MAGPYEHUB LTD - RESPONSIVE STYLES
   Mobile-First Responsive Design
   =================================== */

/* ========== MOBILE FIRST (320px+) ========== */
@media (max-width: 480px) {
    /* Typography */
    html {
        font-size: 14px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    
    p {
        font-size: 1rem;
    }
    
    /* Container */
    .container {
        padding: 0 16px;
    }
    
    /* Section Padding */
    :root {
        --section-padding: 60px 0;
    }
    
    /* Header */
    .navbar {
        padding: 12px 0;
    }
    
    .logo-img {
        height: 40px;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background: white;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 40px;
        transition: var(--transition-smooth);
        z-index: 1002;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-menu .nav-link {
        font-size: 1.2rem;
        font-weight: 600;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    .nav-actions {
        gap: 12px;
    }
    
    .language-selector {
        display: none;
    }
    
    .dropdown-content {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: transparent;
        padding: 0;
    }
    
    .dropdown-content a {
        padding: 16px 0;
        font-size: 1rem;
        text-align: center;
    }
    
    /* Hero Section */
    .hero {
        min-height: 80vh;
        padding-top: 80px;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }
    
    .hero-text {
        order: 2;
    }
    
    .hero-image {
        order: 1;
        height: 300px;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 30px;
    }
    
    .hero-stats {
        justify-content: center;
        gap: 20px;
        margin-bottom: 30px;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: 16px;
        align-items: center;
    }
    
    .btn {
        padding: 14px 28px;
        font-size: 0.9rem;
    }
    
    .palm-oil {
        width: 120px;
        height: 150px;
        left: 20%;
    }
    
    .snack-1 {
        width: 80px;
        height: 80px;
        right: 10%;
    }
    
    .snack-2 {
        width: 100px;
        height: 100px;
        left: 10%;
        bottom: 10%;
    }
    
    /* Sections */
    .section-header {
        margin-bottom: 40px;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* Products */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        margin-bottom: 40px;
    }
    
    .product-card.featured {
        grid-column: span 1;
        display: block;
    }
    
    .product-content {
        padding: 20px;
    }
    
    .product-sizes,
    .product-variants {
        gap: 6px;
        margin-bottom: 16px;
    }
    
    .size,
    .variant {
        font-size: 0.75rem;
        padding: 3px 8px;
    }
    
    .product-features {
        gap: 12px;
    }
    
    .feature {
        font-size: 0.85rem;
    }
    
    /* Heritage Story */
    .story-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .story-text {
        order: 2;
    }
    
    .story-media {
        order: 1;
    }
    
    .story-image-grid {
        height: 300px;
        margin-bottom: 30px;
    }
    
    .story-image.main {
        width: 70%;
        height: 80%;
    }
    
    .story-image.secondary {
        width: 50%;
        height: 60%;
        top: 30%;
    }
    
    .story-image.tertiary {
        width: 40%;
        height: 50%;
        left: 30%;
    }
    
    .heritage-features {
        margin-bottom: 30px;
    }
    
    .heritage-feature {
        gap: 16px;
        margin-bottom: 24px;
    }
    
    .feature-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .story-actions {
        flex-direction: column;
        gap: 16px;
    }
    
    /* Features Grid */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .feature-card {
        padding: 30px 16px;
    }
    
    .feature-card .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    /* Restaurant Preview */
    .restaurant-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .restaurant-info {
        order: 2;
        text-align: center;
    }
    
    .restaurant-visual {
        order: 1;
    }
    
    .restaurant-image img {
        height: 250px;
    }
    
    .restaurant-features {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 30px;
    }
    
    .restaurant-feature {
        justify-content: center;
    }
    
    .restaurant-actions {
        flex-direction: column;
        gap: 16px;
    }
    
    /* Newsletter */
    .newsletter-title {
        font-size: 2rem;
        margin-bottom: 16px;
    }
    
    .newsletter-description {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    
    .form-group {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 16px;
    }
    
    .form-input {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    
    /* Footer */
    .footer {
        padding: 40px 0 0;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        margin-bottom: 30px;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .footer-bottom-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
    
    .certifications {
        justify-content: center;
    }
    
    /* Cart Sidebar */
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    .cart-header {
        padding: 20px;
    }
    
    .cart-content {
        padding: 20px;
    }
    
    .cart-footer {
        padding: 20px;
    }
}

/* ========== SMALL TABLETS (481px - 768px) ========== */
@media (min-width: 481px) and (max-width: 768px) {
    /* Typography */
    html {
        font-size: 15px;
    }
    
    /* Container */
    .container {
        padding: 0 20px;
    }
    
    /* Section Padding */
    :root {
        --section-padding: 80px 0;
    }
    
    /* Header */
    .nav-menu {
        gap: 24px;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background: white;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 40px;
        transition: var(--transition-smooth);
        z-index: 1002;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    /* Hero */
    .hero-content {
        grid-template-columns: 1fr;
        gap: 50px;
        text-align: center;
    }
    
    .hero-text {
        order: 2;
    }
    
    .hero-image {
        order: 1;
        height: 350px;
    }
    
    .hero-stats {
        justify-content: center;
        gap: 30px;
    }
    
    /* Products */
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 28px;
    }
    
    .product-card.featured {
        grid-column: span 2;
    }
    
    /* Heritage Story */
    .story-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }
    
    .story-image-grid {
        height: 350px;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 32px;
    }
    
    /* Restaurant */
    .restaurant-content {
        grid-template-columns: 1fr;
        gap: 50px;
    }
    
    .restaurant-features {
        grid-template-columns: 1fr 1fr;
    }
    
    /* Newsletter */
    .form-group {
        flex-direction: row;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
}

/* ========== TABLETS (769px - 1024px) ========== */
@media (min-width: 769px) and (max-width: 1024px) {
    /* Container */
    .container {
        padding: 0 32px;
    }
    
    /* Hero */
    .hero-content {
        gap: 50px;
    }
    
    .hero-image {
        height: 450px;
    }
    
    /* Products */
    .product-card.featured {
        grid-column: span 1;
        display: block;
    }
    
    /* Heritage Story */
    .story-content {
        gap: 60px;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 32px;
    }
    
    /* Restaurant */
    .restaurant-content {
        gap: 50px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========== SMALL DESKTOPS (1025px - 1200px) ========== */
@media (min-width: 1025px) and (max-width: 1200px) {
    /* Container */
    .container {
        max-width: 1000px;
    }
    
    /* Products */
    .product-card.featured {
        grid-column: span 2;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== LARGE DESKTOPS (1201px+) ========== */
@media (min-width: 1201px) {
    /* Container */
    .container {
        max-width: 1200px;
    }
    
    /* Hero */
    .hero-image {
        height: 500px;
    }
    
    /* Products */
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .product-card.featured {
        grid-column: span 2;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

/* ========== LANDSCAPE ORIENTATION ========== */
@media (max-height: 480px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding-top: 60px;
    }
    
    .hero-content {
        grid-template-columns: 1fr 1fr;
        gap: 40px;
        align-items: center;
    }
    
    .hero-text {
        order: 1;
    }
    
    .hero-image {
        order: 2;
        height: 300px;
    }
    
    .hero-stats {
        gap: 20px;
        margin-bottom: 20px;
    }
    
    .hero-actions {
        flex-direction: row;
        gap: 16px;
    }
}

/* ========== HIGH DPI DISPLAYS ========== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure crisp images on retina displays */
    .logo-img,
    .cert-logo {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .floating-element {
        animation: none;
    }
    
    .scroll-indicator {
        animation: none;
    }
    
    .ghana-spinner {
        animation: none;
        border: 4px solid var(--ghana-gold);
    }
}

/* ========== DARK MODE SUPPORT ========== */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed */
    /* Currently maintaining light theme for brand consistency */
}

/* ========== PRINT STYLES ========== */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    .header,
    .cart-sidebar,
    .overlay,
    .loading-screen,
    .newsletter,
    .footer {
        display: none !important;
    }
    
    .hero {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .section-padding {
        padding: 20px 0;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    a {
        text-decoration: underline;
    }
    
    .btn {
        border: 1px solid black;
        background: white;
        color: black;
    }
}

/* ========== ACCESSIBILITY ENHANCEMENTS ========== */
@media (prefers-contrast: high) {
    :root {
        --charcoal: #000000;
        --medium-gray: #666666;
        --border-gray: #999999;
    }
    
    .btn {
        border: 2px solid;
    }
    
    .nav-link::after {
        height: 3px;
    }
}

/* ========== FOCUS STATES FOR KEYBOARD NAVIGATION ========== */
@media (any-hover: none) {
    .product-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.3);
    }
    
    .image-overlay {
        opacity: 1;
        background: rgba(0, 0, 0, 0.3);
    }
}

/* ========== HOVER DEVICE DETECTION ========== */
@media (hover: hover) and (pointer: fine) {
    /* Enhanced hover effects for devices with precise pointing */
    .product-card:hover {
        transform: translateY(-12px);
    }
    
    .feature-card:hover {
        transform: translateY(-10px);
    }
    
    .btn:hover {
        transform: translateY(-3px);
    }
}

@media (hover: none) and (pointer: coarse) {
    /* Simplified interactions for touch devices */
    .product-card:hover,
    .feature-card:hover,
    .btn:hover {
        transform: none;
    }
    
    .product-overlay {
        opacity: 0.8;
    }
}

/* ========== SAFE AREA INSETS FOR MOBILE DEVICES ========== */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
    
    .footer {
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

/* ========== CONTAINER QUERIES (FUTURE-PROOFING) ========== */
@supports (container-type: inline-size) {
    .product-card {
        container-type: inline-size;
    }
    
    @container (max-width: 300px) {
        .product-content {
            padding: 16px;
        }
        
        .product-title {
            font-size: 1.2rem;
        }
    }
}