/* ==========================================================================
   Race Terra - Responsive Stylesheet
   Mobile-first responsive design for all devices
   ========================================================================== */

/* Mobile First - Base styles are for mobile */

/* Small devices (landscape phones, 576px and up) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 0.75rem;
    }
    
    /* Typography adjustments for mobile */
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Header mobile */
    .nav-wrapper {
        padding: 0.75rem 0;
    }
    
    .logo {
        height: 40px;
    }
    
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--white);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 1rem;
    }
    
    .main-nav.active {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-link {
        display: block;
        padding: 1rem 0;
        border-bottom: 1px solid var(--earth-gray);
    }
    
    .nav-link:last-child {
        border-bottom: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }
    
    /* Hero section mobile */
    .hero {
        padding: 6rem 0 3rem;
        text-align: center;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-buttons {
        justify-content: center;
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
    
    /* About section mobile */
    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .stats {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .about-features {
        gap: 1rem;
    }
    
    .feature {
        padding: 1.5rem;
    }
    
    /* Services mobile */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .service-card {
        padding: 1.5rem;
    }
    
    /* Products mobile */
    .product-categories {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .category {
        padding: 1.5rem;
    }
    
    /* Testimonials mobile */
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Newsletter mobile */
    .newsletter {
        padding: 3rem 0;
    }
    
    .newsletter-form .form-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .newsletter-form input[type="email"] {
        max-width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Contact mobile */
    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .contact-form {
        padding: 1.5rem;
    }
    
    /* Footer mobile */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    /* Cookie banner mobile */
    .cookie-banner {
        padding: 1rem;
    }
    
    .cookie-buttons {
        flex-direction: column;
    }
    
    .cookie-buttons .btn {
        width: 100%;
    }
    
    /* Legal pages mobile */
    .legal-content {
        padding: 0 0.5rem;
    }
    
    .cookie-table {
        font-size: 0.875rem;
    }
    
    .cookie-table th,
    .cookie-table td {
        padding: 0.5rem;
    }
    
    /* Thank you page mobile */
    .thank-you-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .thank-you-actions .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .next-steps {
        gap: 1rem;
    }
    
    .step {
        padding: 1rem;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    /* Header adjustments for tablets */
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--white);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        padding: 1rem;
    }
    
    .main-nav.active {
        display: block;
    }
    
    .nav-list {
        flex-direction: column;
        gap: 0;
    }
    
    .nav-link {
        display: block;
        padding: 1rem 0;
        border-bottom: 1px solid var(--earth-gray);
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Hero adjustments */
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .hero-text h1 {
        font-size: 2.5rem;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    /* About section tablet */
    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .stats {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Services tablet */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Products tablet */
    .product-categories {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Testimonials tablet */
    .testimonials-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Newsletter tablet */
    .newsletter-form .form-group {
        flex-direction: row;
        justify-content: center;
    }
    
    /* Contact tablet */
    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .form-row {
        grid-template-columns: 1fr 1fr;
    }
    
    /* Footer tablet */
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Header for large tablets/small desktops */
    .mobile-menu-toggle {
        display: none;
    }
    
    .main-nav {
        display: flex;
    }
    
    .nav-list {
        flex-direction: row;
        gap: 1.5rem;
    }
    
    /* Hero adjustments */
    .hero-content {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    
    /* About section */
    .about-content {
        grid-template-columns: 1.5fr 1fr;
        gap: 3rem;
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Products */
    .product-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    /* Contact */
    .contact-content {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 2rem;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 992px) {
    /* All styles in main.css apply */
    
    /* Enhanced hero for large screens */
    .hero-text h1 {
        font-size: 3.5rem;
    }
    
    /* Enhanced stats display */
    .stat-number {
        font-size: 3rem;
    }
    
    /* Enhanced testimonials layout */
    .testimonials-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Enhanced products layout */
    .product-categories {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Enhanced services layout */
    .services-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* XXL devices (extra large desktops, 1400px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    /* Hero enhancements for very large screens */
    .hero-text h1 {
        font-size: 4rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 1.375rem;
    }
    
    /* Section padding adjustments */
    .hero {
        padding: 10rem 0 5rem;
    }
    
    .about,
    .services,
    .products,
    .testimonials,
    .contact {
        padding: 6rem 0;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        padding: 4rem 0 2rem;
    }
    
    .hero-text h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .cookie-modal .modal-content {
        max-height: 90vh;
        margin: 0.5rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure SVG icons remain crisp */
    .feature-icon,
    .logo,
    .hero-img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero-img,
    .feature,
    .service-card,
    .testimonial {
        transform: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed */
    .cookie-banner,
    .cookie-modal .modal-content {
        background-color: #1a202c;
        color: #e2e8f0;
    }
    
    .cookie-banner {
        border-top-color: #2d3748;
    }
}

/* Print optimizations */
@media print {
    /* Hide navigation and interactive elements */
    .header,
    .footer,
    .cookie-banner,
    .cookie-modal,
    .mobile-menu-toggle,
    .btn,
    .newsletter,
    .contact-form {
        display: none !important;
    }
    
    /* Optimize layout for print */
    .hero,
    .about,
    .services,
    .products,
    .testimonials,
    .contact {
        padding: 1rem 0;
        page-break-inside: avoid;
    }
    
    /* Ensure content fits on page */
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    /* Typography for print */
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
    }
    
    h1, h2, h3, h4, h5, h6 {
        color: #000;
        page-break-after: avoid;
    }
    
    /* Ensure links are visible */
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
    
    /* Grid adjustments for print */
    .hero-content,
    .about-content,
    .contact-content,
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .services-grid,
    .product-categories,
    .testimonials-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Remove backgrounds for print */
    .hero,
    .services,
    .testimonials,
    .newsletter {
        background: none !important;
    }
}

/* Accessibility improvements */
@media (min-width: 768px) {
    /* Ensure focus indicators are visible */
    .nav-link:focus,
    .btn:focus,
    .form-group input:focus,
    .form-group textarea:focus {
        outline: 2px solid var(--primary-green);
        outline-offset: 2px;
    }
    
    /* Improve button sizing for touch */
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .social-links a {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Internet Explorer 11 compatibility */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    /* Grid fallbacks for IE11 */
    .hero-content {
        display: block;
    }
    
    .hero-text,
    .hero-image {
        width: 48%;
        display: inline-block;
        vertical-align: top;
    }
    
    .services-grid,
    .product-categories,
    .testimonials-grid {
        display: block;
    }
    
    .service-card,
    .category,
    .testimonial {
        display: inline-block;
        width: 48%;
        vertical-align: top;
        margin-bottom: 2rem;
    }
}

/* Performance optimizations */
@media (max-width: 767.98px) {
    /* Optimize animations for mobile */
    .feature:hover,
    .service-card:hover,
    .testimonial:hover {
        transform: none;
    }
    
    /* Reduce box shadows for better performance */
    .service-card,
    .testimonial,
    .contact-form {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
}
