/* Cross-Browser and Mobile Consistency Fixes */

/* ===== BROWSER-SPECIFIC FIXES ===== */

/* Safari/WebKit Fixes */
@supports (-webkit-appearance: none) {
  /* Fix for Safari flexbox issues */
  .nav-container,
  .footer-content,
  .services-grid {
    display: -webkit-flex;
    display: flex;
  }
  
  /* Fix for Safari sticky positioning */
  .main-nav {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
  }
  
  /* Fix for Safari backdrop-filter */
  .menu-overlay {
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
  }
}

/* Firefox Fixes */
@supports (-moz-appearance: none) {
  /* Fix for Firefox button padding */
  button {
    padding: 0;
    border: none;
    background: none;
    font: inherit;
  }
  
  /* Fix for Firefox scrollbar */
  * {
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
  }
  
  /* Fix for Firefox flexbox gap */
  .nav-menu {
    gap: 0;
  }
  
  .nav-menu > li {
    margin-right: 2rem;
  }
}

/* Edge/IE Fixes */
@supports (-ms-ime-align: auto) {
  /* Fix for Edge flexbox issues */
  .nav-container {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -ms-flex-align: center;
    align-items: center;
  }
  
  /* Fix for Edge grid issues */
  .services-grid,
  .footer-content {
    display: -ms-grid;
    display: grid;
    -ms-grid-columns: 1fr 1fr 1fr;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

/* ===== MOBILE-SPECIFIC FIXES ===== */

/* iOS Safari Fixes */
@supports (-webkit-touch-callout: none) {
  /* Fix for iOS viewport height */
  .nav-menu {
    height: 100vh;
    height: -webkit-fill-available;
  }
  
  /* Fix for iOS momentum scrolling */
  .nav-menu {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Fix for iOS tap highlight */
  a, button {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Fix for iOS input zoom */
  input, select, textarea {
    font-size: 16px;
  }
  
  /* Fix for iOS position: fixed */
  .main-nav {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}

/* Android Chrome Fixes */
@supports (-webkit-appearance: none) and (not (-ms-ime-align: auto)) {
  /* Fix for Android Chrome viewport */
  .nav-menu {
    height: 100vh;
    height: 100dvh;
  }
  
  /* Fix for Android Chrome touch */
  a, button {
    touch-action: manipulation;
  }
}

/* ===== RESPONSIVE BREAKPOINT FIXES ===== */

/* Extra Small Devices (phones, 320px and up) */
@media (min-width: 320px) and (max-width: 575px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .nav-container {
    padding: 0.75rem 1rem;
  }
  
  .hero-title {
    font-size: 1.8rem;
    line-height: 1.2;
  }
  
  .hero-description {
    font-size: 1rem;
    line-height: 1.4;
  }
  
  .service-card {
    padding: 1.5rem;
  }
  
  .service-card h2 {
    font-size: 1.4rem;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Small Devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* Medium Devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
  
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
  
  .footer-section:first-child {
    grid-column: 1 / -1;
  }
}

/* Large Devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199px) {
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

/* Extra Large Devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
  }
  
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
  }
}

/* ===== ORIENTATION FIXES ===== */

/* Landscape orientation fixes */
@media (orientation: landscape) and (max-height: 500px) {
  .nav-menu {
    padding-top: 60px;
    overflow-y: auto;
  }
  
  .nav-item > a {
    padding: 8px 0;
    font-size: 1rem;
  }
  
  .hero-section {
    padding: 2rem 0;
  }
  
  .hero-title {
    font-size: 1.8rem;
  }
}

/* Portrait orientation fixes */
@media (orientation: portrait) {
  .banner-image {
    height: 250px;
  }
  
  .hero-section {
    padding: 3rem 0;
  }
}

/* ===== ACCESSIBILITY FIXES ===== */

/* Focus indicators for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #003366;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .cta-button {
    border: 2px solid #003366;
  }
  
  .service-card {
    border: 1px solid #ccc;
  }
}

/* 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;
  }
  
  .nav-menu {
    transition: none;
  }
  
  .service-card:hover {
    transform: none;
  }
}

/* ===== PRINT FIXES ===== */

@media print {
  .main-nav,
  .mobile-menu-toggle,
  .menu-overlay {
    display: none !important;
  }
  
  .banner-section {
    margin-top: 0;
  }
  
  .service-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .footer {
    background: none !important;
    color: #000 !important;
  }
  
  .footer * {
    color: #000 !important;
  }
}

/* ===== PERFORMANCE FIXES ===== */

/* Hardware acceleration for animations */
.service-card,
.nav-menu,
.menu-overlay {
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Optimize paint operations */
.main-nav {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

/* ===== FALLBACK FIXES ===== */

/* Fallback for browsers that don't support CSS Grid */
@supports not (display: grid) {
  .services-grid {
    display: flex;
    flex-wrap: wrap;
    margin: -1rem;
  }
  
  .service-card {
    flex: 1 1 300px;
    margin: 1rem;
  }
  
  .footer-content {
    display: flex;
    flex-wrap: wrap;
    margin: -1rem;
  }
  
  .footer-section {
    flex: 1 1 300px;
    margin: 1rem;
  }
}

/* Fallback for browsers that don't support CSS Variables */
@supports not (--custom-property: value) {
  .cta-button {
    background-color: #003366;
    color: white;
  }
  
  .service-card {
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
  
  .footer {
    background-color: #003366;
    color: white;
  }
} 