/* ========================================
   EcoSpace - Responsive CSS
   Mobile-First Responsive Design
======================================== */

/* ========================================
   Mobile-First Base Styles
======================================== */

/* Extra Small Devices (Portrait Phones, <576px) */
@media (max-width: 575.98px) {
  
  /* Typography Adjustments */
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
  
  h3 {
    font-size: 1.25rem;
  }
  
  h4 {
    font-size: 1.125rem;
  }
  
  h5, h6 {
    font-size: 1rem;
  }
  
  /* Navigation */
  .navbar-brand {
    font-size: 1.25rem !important;
  }
  
  .navbar-nav {
    text-align: center;
  }
  
  .navbar-nav .nav-link {
    padding: 0.75rem 1rem;
  }
  
  /* Hero Section */
  .hero-section {
    padding-top: 60px;
    min-height: 80vh;
  }
  
  .hero-section h1 {
    margin-bottom: 1rem;
    padding-top: 225px;
}
  
  .hero-section .col-lg-6:first-child {
    margin-bottom: 2rem;
  }
  
  /* Cards */
  .card {
    margin-bottom: 1.5rem;
  }
  
  .card-body {
    padding: 1rem;
    overflow-x: hidden;
}
  
  /* Buttons */
  .btn {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .btn:last-child {
    margin-bottom: 0;
  }
  
  /* Forms */
  .form-control {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Spacing */
  section {
    padding: 2rem 0;
  }
  
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Team Grid */
  .team .col-lg-2 {
    margin-bottom: 1rem;
  }
  
  .team .card img {
    height: 150px;
  }
  
  /* Services Grid */
  .services .card img {
    height: 200px;
  }
  
  /* Gallery */
  .gallery .col-lg-3,
  .gallery .col-md-4 {
    margin-bottom: 1rem;
  }
  
  /* Blog Grid */
  .blog .card img {
    height: 180px;
  }
  
  /* Process Steps */
  .process .col-lg-2 {
    margin-bottom: 1.5rem;
  }
  
  .process-step .badge {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  /* Timeline */
  .timeline .col-lg-2 {
    margin-bottom: 1.5rem;
  }
  
  /* Footer */
  footer .col-lg-4 {
    margin-bottom: 2rem;
    text-align: center;
  }
  
  /* Contact Section */
  .contact .col-lg-8,
  .contact .col-lg-4 {
    margin-bottom: 2rem;
  }
  
  /* NO SCROLL ANIMATIONS ON MOBILE */
  [data-sal] {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
  
  /* Disable hover effects on mobile */
  .card:hover {
    transform: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }
  
  .btn:hover {
    transform: none;
  }
  
  .gallery img:hover {
    transform: none;
  }
}

/* ========================================
   Small Devices (Landscape Phones, ≥576px)
======================================== */
@media (min-width: 576px) and (max-width: 767.98px) {
  
  /* Typography */
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  /* Hero Section */
  .hero-section {
    min-height: 85vh;
  }
  
  /* Cards */
  .card-body {
    padding: 1.25rem;
  }
  
  /* Buttons */
  .btn {
    width: auto;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
  }
  
  /* Team Grid */
  .team .card img {
    height: 180px;
  }
  
  /* Services Grid */
  .services .card img {
    height: 220px;
  }
  
  /* Blog Grid */
  .blog .card img {
    height: 190px;
  }
  
  /* Process Steps */
  .process-step .badge {
    width: 45px;
    height: 45px;
    font-size: 1.125rem;
  }
  
  /* NO SCROLL ANIMATIONS ON MOBILE */
  [data-sal] {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
}

/* ========================================
   Medium Devices (Tablets, ≥768px)
======================================== */
@media (min-width: 768px) and (max-width: 991.98px) {
  
  /* Hero Section */
  .hero-section {
    min-height: 90vh;
  }
  
  /* Cards */
  .card-body {
    padding: 1.5rem;
  }
  
  /* Team Grid */
  .team .card img {
    height: 190px;
  }
  
  /* Services Grid */
  .services .card img {
    height: 230px;
  }
  
  /* Blog Grid */
  .blog .card img {
    height: 200px;
  }
  
  /* Enable subtle animations on tablets */
  [data-sal] {
    transition-duration: 0.3s;
  }
}

/* ========================================
   Large Devices (Desktops, ≥992px)
======================================== */
@media (min-width: 992px) {
  
  /* Hero Section */
  .hero-section {
    min-height: 100vh;
  }
  
  /* Enable full animations on desktop */
  [data-sal] {
    transition-duration: 0.5s;
  }
  
  /* Enhanced hover effects for desktop */
  .card:hover {
    transform: translateY(-3px);
  }
  
  .btn:hover {
    transform: translateY(-1px);
  }
}

/* ========================================
   Extra Large Devices (Large Desktops, ≥1200px)
======================================== */
@media (min-width: 1200px) {
  
  /* Container max-width adjustment */
  .container {
    max-width: 1140px;
  }
  
  /* Enhanced spacing for large screens */
  section {
    padding: 4rem 0;
  }
  
  /* Typography scaling for large screens */
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 2rem;
  }
  
  /* Team Grid */
  .team .card img {
    height: 220px;
  }
  
  /* Services Grid */
  .services .card img {
    height: 280px;
  }
  
  /* Blog Grid */
  .blog .card img {
    height: 220px;
  }
}

/* ========================================
   Extra Extra Large Devices (≥1400px)
======================================== */
@media (min-width: 1400px) {
  
  .container {
    max-width: 1320px;
  }
  
  /* Enhanced spacing for very large screens */
  section {
    padding: 5rem 0;
  }
  
  /* Team Grid */
  .team .card img {
    height: 240px;
  }
  
  /* Services Grid */
  .services .card img {
    height: 300px;
  }
  
  /* Blog Grid */
  .blog .card img {
    height: 240px;
  }
}

/* ========================================
   Landscape Orientation Adjustments
======================================== */
@media (max-height: 600px) and (orientation: landscape) {
  
  .hero-section {
    min-height: 100vh;
    padding-top: 80px;
  }
  
  section {
    padding: 1.5rem 0;
  }
  
  /* Disable animations in landscape mobile */
  [data-sal] {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
}

/* ========================================
   Print Media Queries
======================================== */
@media print {
  
  * {
    background: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  .container {
    max-width: none !important;
    padding: 0 !important;
  }
  
  .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
  .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12,
  .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
  .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
    width: 100% !important;
    float: none !important;
  }
  
  .card {
    border: 1px solid #dee2e6 !important;
    page-break-inside: avoid;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
}

/* ========================================
   Touch Device Optimizations
======================================== */
@media (hover: none) and (pointer: coarse) {
  
  /* Larger touch targets */
  .btn {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
  }
  
  .nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .form-control {
    min-height: 44px;
  }
  
  /* Disable hover effects on touch devices */
  .card:hover,
  .btn:hover,
  .gallery img:hover {
    transform: none;
  }
  
  /* Remove hover states that don't work on touch */
  .navbar-light .navbar-nav .nav-link:hover {
    color: inherit;
  }
}

/* ========================================
   High DPI Display Adjustments
======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  
  /* Crisper borders on high DPI displays */
  .card {
    border-width: 0.5px;
  }
  
  .form-control {
    border-width: 1px;
  }
}

/* ========================================
   Accessibility - Focus Improvements
======================================== */
@media (max-width: 991.98px) {
  
  /* Enhanced focus states for mobile */
  .btn:focus,
  .form-control:focus,
  .nav-link:focus {
    outline: 3px solid var(--eco-green-primary);
    outline-offset: 2px;
  }
  
  /* Skip link for mobile navigation */
  .skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--eco-green-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
  }
  
  .skip-link:focus {
    top: 6px;
  }
}

/* ========================================
   Dark Mode Support (if system prefers)
======================================== */

/* ========================================
   Reduced Motion Preferences
======================================== */
@media (prefers-reduced-motion: reduce) {
  
  /* Disable all animations and transitions */
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  /* Remove all transform effects */
  .card:hover,
  .btn:hover,
  .gallery img:hover {
    transform: none !important;
  }
  
  /* Disable Sal.js animations completely */
  [data-sal] {
    transform: none !important;
    opacity: 1 !important;
    transition: none !important;
  }
}

/* ========================================
   Container Query Support (Future-proofing)
======================================== */
@supports (container-type: inline-size) {
  
  .card-container {
    container-type: inline-size;
  }
  
  @container (max-width: 300px) {
    .card-body {
      padding: 0.75rem;
    }
    
    .card-body h5 {
      font-size: 0.9rem;
    }
  }
}

/* ========================================
   iOS Safari Specific Fixes
======================================== */
@supports (-webkit-appearance: none) {
  
  /* Fix viewport height on iOS Safari */
  .hero-section {
    min-height: -webkit-fill-available;
  }
  
  /* Fix input zoom on iOS */
  .form-control {
    font-size: 16px;
  }
}

/* ========================================
   Chrome/Edge Specific Optimizations
======================================== */
@supports (-webkit-backdrop-filter: blur(10px)) {
  
  .navbar {
    backdrop-filter: blur(10px);
    background-color: rgba(248, 249, 250, 0.9);
  }
}

/* ========================================
   Firefox Specific Fixes
======================================== */
@-moz-document url-prefix() {
  
  /* Firefox-specific fixes if needed */
  .form-control {
    background-image: none;
  }
}
