/* 
 * Page Header Component
 * Clean, unified header styles with background imagery
 */

/* ================= BASE PAGE HEADER ================= */
.page-header {
  position: relative;
  height: 50vh;
  min-height: max-content;
  max-height: 600px;
  padding: var(--spacing-3xl) 0 var(--spacing-2xl);
  text-align: center;
  color: var(--text-light);
  background-color: var(--color-primary-dark);
  overflow: hidden;
}

/* Background image container with pseudo-element for opacity control */
.page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 1;
  animation: fadeInBackground 0.8s ease-in forwards;
}
.page-header::after {
  background: linear-gradient(
    rgba(var(--color-primary-rgb), 0.35),
    rgba(var(--color-primary-rgb), 0.65)
  );
}

/* Page-specific background images applied to pseudo-element */
.page-header--services::before {
  background-image: url("/images/us/hero-services.jpg");
}

.page-header--construction::before {
  background-image: url("/images/us/hero-construction.jpg");
  animation-delay: 0.1s;
}

.page-header--interior::before {
  background-image: url("/images/us/hero-interior.jpg");
  animation-delay: 0.2s;
}

.page-header--maintenance::before {
  background-image: url("/images/us/hero-maintenance.jpg");
  animation-delay: 0.3s;
}

.page-header--about::before {
  background-image: url("/images/us/hero-about.jpg");
  animation-delay: 0.1s;
}

.page-header--contact::before {
  background-image: url("/images/us/hero-contact.jpg");
  animation-delay: 0.2s;
}

.page-header--projects::before {
  background-image: url("/images/us/hero-projects.jpg");
  animation-delay: 0.3s;
}

.page-header--privacy::before {
  background-image: url("/images/us/hero-privacy.jpg");
  animation-delay: 0.1s;
}

/* Project category backgrounds */
.page-header[style*="--custom-header-image"]::before {
  background-image: var(--custom-header-image);
  opacity: 0.7;
}
.page-header[style*="--custom-header-image"]::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    rgba(var(--color-primary-rgb), 0.2),
    rgba(var(--color-primary-rgb), 0.8)
  );
  z-index: 1;
}
.project--commercial::before {
  background-image: url("/images/us/pc-commercial.jpg");
  opacity: 0.1;
  animation-delay: 0.2s;
}
.project--residential::before {
  background-image: url("/images/us/pc-residential.jpg");
  animation-delay: 0.3s;
}
.project--interior::before {
  background-image: url("/images/us/pc-interior.jpg");
  animation-delay: 0.1s;
}

/* Header container - positioned above the background */
.page-header .container {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  height: 100%;
}

/* Main title */
.page-header h1 {
  display: inline-block;
  background: rgba(var(--color-gray-100-rgb), 0.9);
  color: var(--text-primary);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-lg);
  margin: 0;
  box-shadow: var(--shadow-lg);
  font-size: clamp(var(--fs-3xl), 4vw, var(--fs-5xl));
  font-weight: var(--fw-light);
  line-height: var(--lh-tight);
  text-align: center;
  opacity: 1;
}

/* Subtitle */
.page-header .subtitle {
  display: inline-block;
  background: rgba(var(--color-gray-100-rgb), 0.92);
  color: var(--text-primary);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  margin: 0;
  max-width: 720px;
  box-shadow: var(--shadow-md);
  font-size: clamp(var(--fs-base), 2vw, var(--fs-xl));
  line-height: var(--lh-relaxed);
  text-align: center;
  opacity: 1;
}

/* ================= BREADCRUMB ================= */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: max-content;
  gap: var(--spacing-xs);
  font-size: var(--fs-sm);
  margin-bottom: var(--spacing-lg);
  position: relative;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-md);
  z-index: 2;
  background: rgba(var(--color-secondary-rgb), 0.4);
  backdrop-filter: blur(4px);
}

.breadcrumb::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(var(--color-secondary-rgb), 0.7);
  border-radius: var(--radius-md);
}

.breadcrumb a {
  color: var(--color-gray-100);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-weight: var(--fw-medium);
}

.breadcrumb a:hover,
.breadcrumb a:focus-visible {
  color: var(--color-secondary-dark);
  text-decoration: underline;
  background: rgba(var(--color-gray-100-rgb), 0.7);
}

/* ================= PROJECT META ================= */
.project-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-md);
  padding: var(--spacing-md);
  background: rgba(var(--color-primary-rgb), 0.7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}
.meta-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--spacing-sm);
}
.meta-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.meta-value {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--text-light);
}

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
  .page-header {
    padding: var(--spacing-3xl) 0 var(--spacing-2xl);
    max-height: 400px;
  }

  .page-header .container {
    gap: var(--spacing-xs);
  }

  .page-header h1 {
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .page-header .subtitle {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  /* Reduce animation on mobile for performance */
  .page-header::before {
    animation-duration: 0.5s;
  }
  .breadcrumb {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--fs-xs);
  }

  .project-meta {
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
  }

  .meta-item {
    flex: 1;
    min-width: 100px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .page-header::before {
    animation: none;
    opacity: 0.7;
  }
}
