/* Enhanced Responsive Styles for Arsala Builder Website - Mobile First Approach */

/* ===========================
   Mobile First Base Styles
   =========================== */
@media (max-width: 767px) {
    /* Base responsive styles for mobile devices */
    .container {
        padding: 0 1.5rem;
    }
    
    .section-header {
        text-align: center;
        margin-bottom: 3rem;
    }
    
    .section-title {
        font-size: 2.4rem;
        line-height: 1.2;
    }
    
    .section-description {
        font-size: 1.6rem;
        line-height: 1.5;
    }
    
    /* Mobile Navigation */
    .navbar {
        gap: 0.5rem;
    }

    /* Place hamburger on the right */
    .navbar-toggle {
        display: flex;
        order: 2;
        margin-left: auto;
        margin-right: 0;
        position: relative;
        right: -1.5rem; /* pull to viewport edge (container has 1.5rem padding) */
    }

    .navbar-brand { order: 0; }
    .navbar-menu { order: 1; }
    .navbar-menu {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: flex-start;
        padding: 2rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
        z-index: 999;
    }
    
    .navbar-menu.active {
        transform: translateX(0);
    }
    
    .navbar-nav {
        flex-direction: column;
        gap: 1.5rem;
        margin-bottom: 2rem;
        width: 100%;
    }
    
    .nav-link {
        font-size: 1.8rem;
        padding: 1.5rem 0;
        border-bottom: 1px solid rgba(212, 165, 116, 0.1);
        width: 100%;
        text-align: center;
    }
    
    .navbar-actions {
        width: 100%;
        justify-content: center;
    }
    
    .navbar-toggle {
        display: flex;
    }
    
    /* Hero Section Mobile */
    .hero {
        min-height: 70vh;
        text-align: center;
        margin-top: 70px;
    }
    
    .hero-title {
        font-size: 2.8rem;
        line-height: 1.1;
        margin-bottom: 1.5rem;
    }
    
    .hero-description {
        font-size: 1.6rem;
        margin-bottom: 2rem;
        line-height: 1.6;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }
    
    .hero-badge {
        font-size: 1.4rem;
        padding: 0.8rem 1.5rem;
        margin-bottom: 2rem;
    }
    
    /* About Section Mobile */
    .about,
    .services,
    .projects,
    .team,
    .contact {
        padding: 2.5rem 0;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-stats {
        position: static;
        margin-top: 2rem;
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    /* Services Mobile */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .service-card {
        padding: 2rem;
    }
    
    /* Projects Mobile */
    .projects-showcase {
        grid-template-columns: 1fr;
        height: auto;
        gap: 2rem;
    }
    
    .project-item {
        height: 300px;
    }
    
    /* Team Mobile */
    .team-members {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .member-card {
        padding: 2rem;
    }
    
    /* Contact Mobile */
    .contact-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .contact-form-section {
        padding: 2rem;
    }
    
    /* Footer Mobile */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .footer-social {
        justify-content: center;
    }

    /* Tighter heading/description spacing on mobile */
    .section-header { margin-bottom: 2rem; }
    .section-title { margin-bottom: 0.8rem; }
    .section-description { margin-bottom: 2rem; }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .section-description {
        font-size: 1.4rem;
    }
    
    .hero-title {
        font-size: 2.4rem;
    }
    
    .hero-description {
        font-size: 1.4rem;
    }
    
    .service-card {
        padding: 1.5rem;
    }
    
    .member-card {
        padding: 1.5rem;
    }
    
    .contact-form-section {
        padding: 1.5rem;
    }
    
    .btn {
        padding: 1.2rem 2rem;
        font-size: 1.4rem;
    }
    
    .btn-large {
        padding: 1.4rem 2.5rem;
        font-size: 1.6rem;
    }
    /* Align hamburger to the very edge for extra small screens (1rem padding) */
    .navbar-toggle {
        right: -27rem;
    }
}

/* ===========================
   Tablet Styles
   =========================== */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 0 2rem;
    }
    
    .hero-title {
        font-size: 3.6rem;
    }
    
    .hero-description {
        font-size: 1.8rem;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    /* Two column layouts */
    .about-content {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
    
    .team-members {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
    
    .projects-showcase {
        grid-template-columns: repeat(2, 1fr);
        height: auto;
        gap: 2rem;
    }
    
    .contact-wrapper {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
    
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.5rem;
    }
}

/* Large Desktop Styles */
@media (min-width: 1200px) {
    .container {
        padding: 0 3rem;
    }
    
    .hero-title {
        font-size: 5.2rem;
    }
    
    .section-title {
        font-size: 3.8rem;
    }
    
    /* Enhanced hover effects for desktop */
    .service-card:hover {
        transform: translateY(-10px);
    }
    
    .project-item:hover {
        transform: translateY(-8px);
    }
    
    .member-card:hover {
        transform: translateY(-8px);
    }
}

/* Ultra Wide Screens */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-title {
        font-size: 5.2rem;
    }
    
    .section-title {
        font-size: 4.2rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .service-card:hover,
    .project-item:hover,
    .member-card:hover,
    .btn:hover {
        transform: none;
    }
    
    /* Increase touch targets */
    .nav-link,
    .btn,
    .service-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Optimize for touch scrolling */
    .navbar-menu {
        -webkit-overflow-scrolling: touch;
    }
}

/* High DPI / Retina Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Ensure sharp graphics */
    .brand-logo,
    .footer-logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===========================
   Cross-device Animation Utilities
   =========================== */

/* Base initial states for scroll animations */
.animate-on-scroll,
.section-animate,
.card-animate,
.stagger-item,
.team-members .team-member,
.projects-showcase .project-item,
.about-content .about-text,
.about-content .about-visual {
    opacity: 0;
    transform: translateY(20px);
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;
    backface-visibility: hidden;
}

/* Activated state when in view */
.animate-on-scroll.animate,
.section-animate.animate,
.card-animate.animate {
    opacity: 1;
    transform: none;
}

/* Services grid items default state (slight scale for pop effect) */
.services-grid .stagger-item {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
}

/* Team members rotate in slightly */
.team-members .team-member {
    transform: translateY(20px) rotate(2deg);
}

/* Project items subtle scale */
.projects-showcase .project-item {
    transform: translateY(20px) scale(0.98);
}

/* About split animation (slide from sides) */
.about-content .about-text {
    transform: translateX(-24px);
}

.about-content .about-visual {
    transform: translateX(24px);
}

/* Delay helpers for tasteful staggering */
.animate-delay-1 { transition-delay: 0.1s; }
.animate-delay-2 { transition-delay: 0.2s; }
.animate-delay-3 { transition-delay: 0.3s; }
.animate-delay-4 { transition-delay: 0.4s; }
.animate-delay-5 { transition-delay: 0.5s; }
.animate-delay-6 { transition-delay: 0.6s; }
.animate-delay-7 { transition-delay: 0.7s; }

/* Button + hover animation safety across devices */
.btn-animate {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
    .hover-lift:hover { transform: translateY(-6px); }
    .hover-glow:hover { box-shadow: 0 10px 30px rgba(0,0,0,0.12); }
}

/* Respect reduced motion (overrides base transitions) */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll,
    .section-animate,
    .card-animate,
    .stagger-item,
    .team-members .team-member,
    .projects-showcase .project-item,
    .about-content .about-text,
    .about-content .about-visual {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-on-scroll,
    .section-animate,
    .card-animate {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Print Styles */
@media print {
    .header,
    .navbar-toggle,
    .navbar-menu,
    .back-to-top,
    .scroll-indicator {
        display: none !important;
    }
    
    .hero {
        min-height: auto;
        page-break-inside: avoid;
    }
    
    .service-card,
    .project-item,
    .member-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
}

/* Legacy Browser Support */
.no-cssgrid .services-grid,
.no-cssgrid .projects-showcase,
.no-cssgrid .team-members,
.no-cssgrid .footer-content {
    display: flex;
    flex-wrap: wrap;
}

.no-cssgrid .service-card,
.no-cssgrid .project-item,
.no-cssgrid .team-member,
.no-cssgrid .footer-section {
    flex: 1 1 300px;
    margin: 1rem;
}
