/* Hero section optimization for img element approach */
#hero {
  min-height: 320px; /* min-h-80 equivalent */
}

@media (min-width: 768px) {
  #hero {
    min-height: 80vh; /* Reduced from 100vh for more compact hero section */
  }
}

/* Ensure hero images cover properly on all orientations */
#hero picture {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

#hero img {
  object-fit: cover;
  object-position: center;
  width: 100%;
  height: 100%;
}

/* Ensure proper sizing on mobile portrait */
@media (orientation: portrait) and (max-width: 768px) {
  #hero {
    min-height: 100vh; /* Full height on mobile portrait */
  }
}

/* Fix hero content overflow on medium screens (768px-1200px) */
@media (min-width: 768px) and (max-width: 1200px) {
  .hero-content {
    max-width: 90vw;
    padding: 1.5rem !important;
  }

  .hero-content h1 {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .hero-content h2 {
    font-size: 1.5rem; /* text-xl instead of text-2xl */
  }
}

.hero-content h1 {
  display: inline-block;
  border-right: 0.15em solid transparent;
}

/* Ensure hero content text wraps properly on small screens and make hero larger */
@media (max-width: 640px) {
  .hero-content {
    padding-top: 2rem !important;
    padding-bottom: 3rem !important;
  }

  .hero-content h1 {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
  }
}

.hero-content p {
  animation: slideIn 0.5s ease-in-out forwards;
  animation-delay: 0.8s;
}

.hero-content a {
  opacity: 0; /* Ensure CTA buttons start completely hidden */
  animation: slideIn 0.5s ease-in-out forwards, pulseCTA 2s infinite;
  animation-delay: 1.1s;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseCTA {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(45, 115, 16, 0.4);
  }

  50% {
    box-shadow: 0 0 10px 5px rgba(45, 115, 16, 0.6);
  }
}

.scroll-down {
  animation: pulse 2s infinite;
  z-index: 1;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.scroll-down:hover {
  transform: scale(1.2);
  background-color: rgba(0, 0, 0, 0.7);
}

@keyframes pulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }

  50% {
    transform: translateY(10px);
    opacity: 1;
  }
}

.services-bg {
  background: linear-gradient(to bottom, #f3f4f6, #e5e7eb);
}

/* Inaktivera animationer vid prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .hero-content h1 {
    animation: none;
    width: 100%;
    border-right: none;
  }

  .hero-content p,
  .hero-content a {
    animation: none;
    opacity: 1;
    transform: translateY(0);
  }

  .scroll-down {
    animation: none;
  }
}

/* Ensure CTA buttons wrap properly on small screens with better spacing */
@media (max-width: 640px) {
  .hero-content .btn1 {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    flex-shrink: 1;
    margin-bottom: 1rem;
  }

  .hero-content .flex.gap-4 {
    margin-bottom: 2rem;
  }
}
