/* Custom styles for animations and additional effects */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Header background transition */
.header-scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.header-transparent {
  background: transparent;
}

/* Navigation link colors */
.nav-link-scrolled {
  color: rgb(31, 41, 55);
}

.nav-link-transparent {
  color: white;
}

/* Mobile menu animation */
.mobile-menu-open {
  display: block;
  animation: slideDown 0.3s ease-out;
}

.mobile-menu-closed {
  display: none;
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  z-index: 40;
}

.mobile-menu-overlay.is-visible {
  display: block;
}

body.mobile-menu-active {
  overflow: hidden;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* FAQ animations */
.faq-answer-open {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.faq-answer-closed {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Form success animation */
.form-success-show {
  display: block;
  animation: fadeInScale 0.5s ease-out;
}

.form-success-hide {
  display: none;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Hover effects for cards */
.card-hover:hover {
  transform: translateY(-8px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Fade-in animation for scroll-triggered elements */
.fade-in-initial {
  opacity: 0;
  transform: translateY(20px);
}

.animate-fade-in {
  animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in-initial,
  .animate-fade-in {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #8b5cf6, #3b82f6);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, #7c3aed, #2563eb);
}

/* Focus styles for accessibility */
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

/* Loading animation for form submission */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive text sizing */
@media (max-width: 640px) {
  .text-5xl {
    font-size: 2.5rem;
    line-height: 1.2;
  }
  
  .text-7xl {
    font-size: 3rem;
    line-height: 1.1;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* Performance optimizations */
.lazy-load {
  transition: opacity 0.3s;
}

.lazy-load[data-loaded="false"] {
  opacity: 0;
}

.lazy-load[data-loaded="true"] {
  opacity: 1;
}

/* Improved focus states for better accessibility */
.focus-visible:focus {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

/* Better button states */
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Smooth transitions for better UX */
* {
  transition-duration: 0.2s;
  transition-timing-function: ease-out;
}

/* Optimize gradients for performance */
.bg-gradient-to-br {
  background-attachment: fixed;
  will-change: transform;
}

@media (max-width: 768px) {
  .bg-gradient-to-br {
    background-attachment: scroll; /* Better performance on mobile */
  }
}

/* Enhanced hover effects */
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Loading spinner styles */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Better form field styling */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.5);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Improved visibility for placeholder text */
::placeholder {
  color: rgba(156, 163, 175, 0.7);
  opacity: 1;
}

/* Better mobile touch targets */
@media (max-width: 768px) {
  button,
  a,
  input,
  textarea,
  select {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Optimized image loading */
img {
  max-width: 100%;
  height: auto;
}

img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Critical CSS inline optimization hint */
.critical-section {
  contain: layout style;
}

/* ---------------------------------------------
   Logo sizing: ensure site logos are readable
   across devices. These selectors target the
   two logo files and provide responsive heights
   while preserving aspect ratio (width:auto).
   Placed at the end so they override utility
   classes (Tailwind) loaded earlier.
   --------------------------------------------- */
img.site-logo,
img[src*="SeoXpert_logo7_RGB_main_invert.svg"],
img[src*="logo-light.svg"] {
  height: 2.25rem; /* 36px default */
  width: auto;
  display: block;
  object-fit: contain;
}

/* Small screens (phones) - slightly larger than default h-8 */
@media (max-width: 639px) {
  img.site-logo,
  img[src*="SeoXpert_logo7_RGB_main_invert.svg"],
  img[src*="logo-light.svg"] {
    height: 2.25rem; /* 36px */
  }
}

/* Medium screens (tablets) */
@media (min-width: 640px) {
  img.site-logo,
  img[src*="SeoXpert_logo7_RGB_main_invert.svg"],
  img[src*="logo-light.svg"] {
    height: 2.75rem; /* 44px */
  }
}

/* Large screens (desktops) */
@media (min-width: 1024px) {
  img.site-logo,
  img[src*="SeoXpert_logo7_RGB_main_invert.svg"],
  img[src*="logo-light.svg"] {
    height: 3.5rem; /* 56px */
  }
}

/* Prevent flexbox containers from compressing the logo */
.header-logo-wrapper img,
.logo-container img {
  max-height: 100%;
  height: auto;
}

/* Optional utility class you can add to <img> tags: <img class="logo-large" /> */
.logo-large {
  height: 3rem;
  width: auto;
  object-fit: contain;
}
