/* ========================================
   CRITICAL CSS - Above the fold styles
   ======================================== */
body {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
}

/* Skip link accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #d4af37;
  color: #0f172a;
  padding: 8px 16px;
  font-weight: 600;
  z-index: 1000;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  overflow: hidden;
  white-space: nowrap;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}
.skip-link:focus {
  top: 8px;
  left: 8px;
  clip: auto;
  clip-path: none;
  height: auto;
  width: auto;
  overflow: visible;
  white-space: normal;
}

/* Hero background - optimized progressive loading */
.hero-bg {
  background-color:#1e293b;
  background-image:linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.65)),url("../images/hero-image/elevate615-hero-image2-320w.webp");
  background-size:cover;
  background-position:center;
  will-change: background-image;
}
.hero-bg.hero-loaded{
  background-image:linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.65)),url("../images/hero-image/elevate615-hero-image2-extra-1600w.webp");
  transition: background-image .6s ease;
}

/* ========================================
   ANIMATION & INTERACTION
   ======================================== */
/* Fade-in on scroll animation */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  will-change: opacity, transform;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* CTA button hover effects */
.cta-button {
  transition: all 0.3s ease;
  will-change: transform, box-shadow;
}
.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.icon { height: 1em; width: auto; display: inline-block; vertical-align: middle; fill: currentColor; line-height: 1; }
/* Scale via explicit height so width auto-resizes proportionally */
.icon-2x { height: 2rem; }
.icon-3x { height: 3rem; }

/* Form success swap fade transitions */
.fade-transition { position: relative; }
.fade-transition.is-fading-out { opacity: 0; transition: opacity .28s ease; }
.fade-transition.is-fading-in { opacity: 0; }
.fade-transition.is-fading-in.fade-ready { transition: opacity .38s ease .05s; opacity: 1; }

/* Slide/scale swap animation (new variant) */
.swap-anim-wrapper { position: relative; }
.swap-exit { opacity:1; transform: translateY(0) scale(1); }
.swap-exit-active { transition: opacity .28s ease, transform .32s cubic-bezier(.4,.0,.2,1); opacity:0; transform: translateY(12px) scale(.96); }
.swap-enter { opacity:0; transform: translateY(-12px) scale(.96); }
.swap-enter-active { transition: opacity .45s ease .05s, transform .5s cubic-bezier(.35,.7,.25,1) .05s; opacity:1; transform: translateY(0) scale(1); }

/* ========================================
   RESPONSIVE ENHANCEMENTS FOR MOBILE, TABLET & DESKTOP
   ======================================== */

/* Mobile-first: Base styles (320px+) */
@media screen and (max-width: 639px) {
  /* Improve touch targets */
  a, button {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Better spacing on small screens */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  /* Stack cards vertically */
  .grid {
    grid-template-columns: 1fr;
  }
  
  /* Improve text readability */
  body {
    font-size: 16px;
    line-height: 1.6;
  }
  
  h1 {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  h2 {
    font-size: 1.75rem;
    line-height: 1.3;
  }
  
  h3 {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  
  /* Optimize form fields for mobile */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
  }
}

/* Small tablets (640px - 767px) */
@media screen and (min-width: 640px) and (max-width: 767px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
  
  /* 2-column layout for medium cards */
  .grid-sm-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablets (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
  .container {
    max-width: 720px;
    padding-left: 2rem;
    padding-right: 2rem;
  }
  
  /* Optimize hero section */
  .hero-bg {
    background-position: center center;
  }
  
  /* Better grid layouts */
  .grid-md-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-md-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Desktop (1024px+) */
@media screen and (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
  
  /* Optimize navigation spacing */
  nav a {
    padding: 0.5rem 1rem;
  }
  
  /* Better hover effects on desktop */
  .cta-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  }
}

/* Large desktop (1280px+) */
@media screen and (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
  
  /* Larger hero text on big screens */
  .hero-bg h1 {
    font-size: 4.5rem;
  }
}

/* Extra large desktop (1536px+) */
@media screen and (min-width: 1536px) {
  .container {
    max-width: 1536px;
  }
}

/* Landscape mobile optimization */
@media screen and (max-height: 500px) and (orientation: landscape) {
  /* Reduce vertical padding in landscape */
  section {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  .hero-bg {
    min-height: 400px;
  }
}

/* Print optimization */
@media print {
  .no-print,
  nav,
  footer,
  .cta-button,
  .mobile-menu-button {
    display: none !important;
  }
  
  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }
}

/* Focus visible styles for keyboard navigation */
*:focus-visible {
  outline: 3px solid #14b8a6;
  outline-offset: 2px;
  border-radius: 4px;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 3px;
}

.cta-button:focus-visible {
  outline: 4px solid #fbbf24;
  outline-offset: 4px;
  box-shadow: 0 0 0 8px rgba(251, 191, 36, 0.2);
}

/* Form field validation states */
input:focus:invalid,
textarea:focus:invalid,
select:focus:invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown),
select:valid:not([value=""]) {
  border-color: #10b981;
}

input:valid:not(:placeholder-shown)::after,
textarea:valid:not(:placeholder-shown)::after {
  content: '✓';
  color: #10b981;
}

/* Loading state for forms */
button.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

button.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .fade-transition.is-fading-out, .fade-transition.is-fading-in.fade-ready { transition: none !important; }
  .fade-transition.is-fading-in { opacity: 1 !important; }
  .swap-exit-active, .swap-enter-active { transition: none !important; }
  .swap-enter { opacity:1 !important; transform:none !important; }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  button.loading::after {
    animation: none;
  }
}
