/* custom.css - Reusable hero section component for Rajala Services / Fixnero */

:root {
  --hero-gap-top: 12px;
  /* Negative overlap that pulls the hero flush against the top of .container
     (compensates for .container's 28px top padding at the hero position) */
  --hero-container-overlap: -28px;
}

/* ===== HERO SECTION =====
 * Reusable hero component for service subpages.
 * HTML pattern: .hero-image-section > img + .hero-overlay > .hero-top-buttons + h1
 * Breakpoints: ≤480px mobile · ≤768px tablet · 769px+ desktop.
 * ========================= */

.hero-image-section {
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* Hero image: fills container, cropped with cover.
   38vw keeps the hero at ~40% of viewport width on desktop (≈480px at 1280px)
   while the clamp bounds prevent it from getting too short (<220px) or too tall (>480px). */
.hero-image-section img {
  display: block;
  width: 100%;
  height: clamp(220px, 38vw, 480px);
  object-fit: cover;
  object-position: center;
}

/* Gradient overlay: top-dark for button legibility, clear middle, bottom-dark for H1 */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0.05) 35%,
    rgba(0, 0, 0, 0.50) 65%,
    rgba(0, 0, 0, 0.82) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: clamp(14px, 3vw, 40px);
  box-sizing: border-box;
}

/* H1 inside hero: always white with shadow for contrast on any image.
   Centered bottom-of-hero with constrained width to avoid edge-to-edge text.
   width: 100% + max-width: 900px together ensure the heading fills narrow
   containers (small screens) while capping the width on wide viewports. */
.hero-overlay h1 {
  color: #fff;
  font-size: clamp(1.2rem, 2.8vw, 2.2rem);
  font-family: 'Bebas Neue', 'Yanone Kaffeesatz', 'Impact', sans-serif;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.70);
  margin: 0;
  max-width: 900px;
  width: 100%;
  text-align: center;
  hyphens: auto;
}

.hero-overlay p {
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.60);
  margin-bottom: 0;
}

.hero-overlay button {
  background-color: #007bff;
  color: #fff;
  padding: 10px 20px;
  margin: 5px;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.hero-overlay button:hover {
  background-color: #0056b3;
}

.hero-overlay button:focus,
.hero-overlay button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Navigation button row at the top of the overlay */
.hero-top-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: center;
}

/* Hero inside .container: bleed to full viewport width */
.container .hero-image-section {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  margin-top: var(--hero-container-overlap);
  margin-bottom: 24px;
  border-radius: 0;
}

/* Responsive image heights */
@media (max-width: 768px) {
  .hero-image-section img {
    height: clamp(200px, 55vw, 310px);
  }
}

@media (max-width: 480px) {
  .hero-image-section img {
    height: clamp(230px, 70vw, 340px);
  }
  .hero-overlay h1 {
    font-size: clamp(1.1rem, 5.5vw, 1.6rem);
  }
  .hero-overlay {
    padding: clamp(10px, 3vw, 20px);
  }
}
