/* Mobile-optimized styles for invoicer.lt */

/* Base mobile optimizations */
body {
  font-size: 16px; /* Ensure readable text size on mobile */
  -webkit-text-size-adjust: 100%; /* Prevent iOS text size adjust after orientation change */
  font-display: swap; /* Improve font loading performance */
}

/* Prevent layout shifts by reserving space */
.site-header {
  min-height: 150px; /* Reserve space for header to prevent layout shifts */
  contain: layout style paint;
}

.site-logo {
  width: 150px;
  height: 50px;
  aspect-ratio: 3/1;
  contain: strict;
  content-visibility: auto;
}

/* Optimize images for mobile */
img {
  max-width: 100%;
  height: auto;
  aspect-ratio: attr(width) / attr(height);
  contain: strict;
}

/* Reduce animation complexity on mobile */
@media (max-width: 768px) {
  .animated, .animation, [class*="animate-"] {
    animation: none !important;
    transition: none !important;
  }
  
  /* Simplify shadows and effects */
  [class*="shadow"], [class*="hover"] {
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  /* Optimize font rendering */
  * {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
  }
  
  /* Reduce padding/margins for mobile but maintain consistent spacing */
  .container, .section, .row, [class*="padding"], [class*="margin"] {
    padding: 10px !important;
    margin: 0 !important; /* Eliminate variable margins that cause layout shifts */
    box-sizing: border-box;
    width: 100% !important;
  }
  
  /* Ensure text doesn't cause layout shifts */
  h1, h2, h3, h4, h5, h6, p {
    max-height: none;
    overflow: visible;
    line-height: 1.5;
  }
  
  /* Fix button sizes to prevent shifts */
  .button, button, .nav-link {
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  
  /* Ensure navigation doesn't cause shifts */
  .nav-list {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  /* Prevent footer from causing layout shifts */
  .site-footer {
    margin-top: auto;
  }
  
  /* Prevent testimonials from causing layout shifts */
  .testimonial {
    height: auto;
    min-height: 150px;
  }
}

/* Optimize for touch interactions */
button, a, [role="button"], input[type="submit"], input[type="button"] {
  min-height: 44px; /* Apple's recommended minimum touch target size */
  min-width: 44px;
  touch-action: manipulation; /* Improve touch response */
}

/* Reduce layout shifts */
* {
  contain: layout style paint;
}

/* Critical above-the-fold content */
.hero, header, .main-banner, .top-section {
  content-visibility: auto;
  contain-intrinsic-size: 1px 500px;
}

/* Prevent font-based layout shifts */
html {
  font-display: optional;
}

/* Prevent image-based layout shifts */
img[src] {
  height: auto !important;
}

/* Force hardware acceleration for smoother rendering */
.site-header, .main-nav, .button-primary, .site-logo {
  transform: translateZ(0);
  will-change: transform;
}

/* Ensure all images have explicit dimensions */
img:not([width]):not([height]) {
  aspect-ratio: 16/9;
}
