/**
 * Page Header Styles – Blueprint Theme v2.0.0
 *
 * All visual properties are driven by CSS Custom Properties set inline
 * by page-header.php via ACF field values (with global options fallback).
 *
 * Properties used:
 *   --header-height                (px)
 *   --header-padding-top           (px)
 *   --header-padding-bottom        (px)
 *   --header-title-size            (rem)
 *   --header-title-weight          (number)
 *   --header-title-transform       (none|uppercase|capitalize)
 *   --header-title-letter-spacing  (em)
 *   --header-subtitle-size         (rem)
 *   --page-header-text-color       (color)
 *   --header-content-max-width     (px) – only when set
 *   --header-image-blur            (px) – only when > 0
 *   --header-overlay-color         (rgba)
 *   --header-overlay-color-top     (rgba, slightly less opaque)
 */

/* ==========================================================================
   Base
   ========================================================================== */

.page-header {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    min-height: var(--header-height, 400px);
    height: var(--header-height, 400px);
    display: flex;
    align-items: stretch;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* Contained variant */
.page-header--contained {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    max-width: 1200px;
}

/* ==========================================================================
   Overlay  (Farbe, Alpha, Gradient – alle via CSS vars)
   ========================================================================== */

.page-header__overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* Solid overlay (flat, one alpha) */
.page-header--solid-overlay .page-header__overlay {
    background: var(--header-overlay-color, rgba(0,0,0,0.4));
}

/* Gradient overlay (top = lighter, bottom = darker) */
.page-header--gradient-overlay .page-header__overlay {
    background: linear-gradient(
        to bottom,
        var(--header-overlay-color-top,  rgba(0,0,0,0.25)),
        var(--header-overlay-color,      rgba(0,0,0,0.55))
    );
}

/* No overlay on solid-color headers */
.page-header--solid .page-header__overlay {
    display: none;
}

/* ==========================================================================
   Blur effect on background image
   ========================================================================== */

/* ==========================================================================
   Blur – via echtem <img> Tag (zuverlässigste Methode)
   ========================================================================== */

.page-header--blur {
    /* Kein background-image wenn blur aktiv — <img> übernimmt */
    background-image: none !important;
}

/* Das Blur-Bild liegt absolut hinter allem */
.page-header__blur-img {
    position: absolute;
    top: -40px;
    left: -40px;
    right: -40px;
    bottom: -40px;
    width: calc(100% + 80px);
    height: calc(100% + 80px);
    object-fit: cover;
    object-position: center;
    z-index: 0;
    display: block;
    /* filter wird inline per style-Attribut gesetzt (aus PHP) */
}

/* overflow:hidden nötig damit der -40px Überschuss nicht sichtbar ist */
.page-header--blur {
    overflow: hidden;
}

/* Overlay + Content darüber stapeln */
.page-header--blur .page-header__overlay {
    z-index: 2;
}
.page-header--blur .page-header__content {
    z-index: 3;
}

/* ==========================================================================
   Content
   ========================================================================== */

.page-header__content {
    position: relative;
    z-index: 2;
    width: 100%;
    min-height: 100%;
    padding: var(--header-padding-top, 60px) 0 var(--header-padding-bottom, 60px);
    display: flex;
    flex-direction: column;
}

.page-header__content-inner {
    width: 100%;
    max-width: var(--header-content-max-width, 1400px);
    margin: 0 auto;
    padding: 0 20px;
}

/* Narrow content variant */
.page-header--narrow-content .page-header__content-inner {
    max-width: var(--header-content-max-width, 800px);
}

/* ==========================================================================
   Parallax
   ========================================================================== */

.page-header--parallax {
    background-attachment: fixed;
    background-position: center;
}

@supports not (background-attachment: fixed) {
    .page-header--parallax { background-attachment: scroll; }
}

@media (max-width: 768px) {
    .page-header--parallax { background-attachment: scroll; }
}

/* ==========================================================================
   Solid Color variant
   ========================================================================== */

.page-header--solid {
    /* background-color set inline via PHP (with alpha support) */
    background-image: none !important;
}

/* ==========================================================================
   Responsive Height
   ========================================================================== */

@media (max-width: 768px) {
    .page-header {
        min-height: max(calc(var(--header-height, 400px) * 0.75), 200px);
        height: max(calc(var(--header-height, 400px) * 0.75), 200px);
    }
}

@media (max-width: 480px) {
    .page-header {
        min-height: max(calc(var(--header-height, 400px) * 0.6), 180px);
        height: max(calc(var(--header-height, 400px) * 0.6), 180px);
    }
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.page-header__breadcrumbs {
    margin-bottom: 16px;
}

.page-header__breadcrumbs--below {
    margin-bottom: 0;
    margin-top: 16px;
}

.breadcrumbs {
    font-size: 0.875rem;
    color: var(--page-header-text-color, rgba(255,255,255,0.8));
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item a {
    color: var(--page-header-text-color, rgba(255,255,255,0.9));
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb-item a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.breadcrumb-item a:focus {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: 2px;
}

.breadcrumb-item.active {
    color: var(--page-header-text-color, rgba(255,255,255,0.6));
    opacity: 0.7;
}

.breadcrumb-separator {
    color: var(--page-header-text-color, rgba(255,255,255,0.5));
    opacity: 0.6;
    margin: 0 4px;
}

/* ==========================================================================
   Title  – driven entirely by CSS custom properties
   ========================================================================== */

.page-header__title {
    font-size: clamp(1.5rem, 5vw, var(--header-title-size, 3.5rem));
    font-weight: var(--header-title-weight, 700);
    text-transform: var(--header-title-transform, none);
    letter-spacing: var(--header-title-letter-spacing, 0em);
    line-height: 1.2;
    color: var(--page-header-text-color, #ffffff);
    margin: 0 0 16px;
    text-shadow: 0 3px 8px rgba(0,0,0,0.5), 0 1px 3px rgba(0,0,0,0.3);
}

.page-header--solid .page-header__title {
    text-shadow: none;
}

/* ==========================================================================
   Subtitle
   ========================================================================== */

.page-header__subtitle {
    font-size: clamp(0.9rem, 2vw, var(--header-subtitle-size, 1.2rem));
    font-weight: 400;
    line-height: 1.6;
    color: var(--page-header-text-color, rgba(255,255,255,0.9));
    margin: 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.page-header:not(.page-header--solid) .page-header__subtitle {
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* ==========================================================================
   Horizontal alignment
   ========================================================================== */

.page-header--align-left  .page-header__content-inner,
.page-header--align-left  .grid-container { text-align: left; }

.page-header--align-center .page-header__content-inner,
.page-header--align-center .grid-container { text-align: center; }

.page-header--align-right .page-header__content-inner,
.page-header--align-right .grid-container { text-align: right; }

/* Subtitle alignment */
.page-header--align-left  .page-header__subtitle { margin-left: 0; margin-right: auto; }
.page-header--align-right .page-header__subtitle { margin-left: auto; margin-right: 0; }

/* Breadcrumb list alignment */
.page-header--align-left   .breadcrumb-list { justify-content: flex-start; }
.page-header--align-center .breadcrumb-list { justify-content: center; }
.page-header--align-right  .breadcrumb-list { justify-content: flex-end; }

/* ==========================================================================
   Vertical alignment
   ========================================================================== */

.page-header--valign-top    .page-header__content { justify-content: flex-start; }
.page-header--valign-center .page-header__content { justify-content: center; }
.page-header--valign-bottom .page-header__content { justify-content: flex-end; }

/* ==========================================================================
   Responsive adjustments
   ========================================================================== */

@media (max-width: 768px) {
    .page-header__breadcrumbs { margin-bottom: 12px; }
    .page-header__title { margin-bottom: 12px; }
    .breadcrumbs { font-size: 0.8125rem; }
}

@media (max-width: 480px) {
    .page-header__breadcrumbs { margin-bottom: 10px; }
    .breadcrumb-list { gap: 6px; }
    .breadcrumbs { font-size: 0.75rem; }
}

/* ==========================================================================
   Dark mode
   ========================================================================== */

[data-theme="dark"] .page-header--solid {
    background: var(--color-dark-bg, #0a0a0a);
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .page-header {
        min-height: auto;
        background-image: none !important;
        background: #fff;
        padding: 20px 0;
    }
    .page-header__overlay { display: none; }
    .page-header__title,
    .page-header__subtitle,
    .breadcrumbs,
    .breadcrumb-item a {
        color: #000 !important;
        text-shadow: none !important;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .page-header--parallax {
        background-attachment: scroll;
        transform: none !important;
    }
}

@media (prefers-contrast: high) {
    .page-header__title,
    .page-header__subtitle,
    .breadcrumb-item a { color: #ffffff; }
    .breadcrumb-item.active { color: rgba(255,255,255,0.8); opacity: 1; }
}

/* ==========================================================================
   Pixel-Effekt (AudioPixel Signature)
   ========================================================================== */

.page-header--pixelate {
    background-image: none !important;
}

.page-header__pixel-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.page-header--pixelate .page-header__overlay {
    z-index: 2;
}
.page-header--pixelate .page-header__content {
    z-index: 3;
}
