/* Header Basis-Styling */
body > header {
    /* Layout */
    position: relative;
    height: 128px;
    max-width: 480px;
    width: 100%;
    width: 480px;
    margin: 0 auto;
    background-color: whitesmoke;
    
    /* Site Icon - initial rechts */
    background-repeat: no-repeat;
    background-position: bottom right;
    background-size: 128px 128px;
    
    /* Smooth Übergänge für alle Eigenschaften */
    transition: 
        position 0.3s ease,
        height 0.3s ease,
        background-color 0.3s ease,
        background-position 0.3s ease,
        background-size 0.3s ease,
        opacity 0.3s ease,
        box-shadow 0.3s ease;
    
    /* Sicherstellen dass Header über anderen Elementen liegt */
    z-index: 1000;
}

/* Scrolled State - fixiert am oberen Rand */
body > header.scrolled {
    /* Fixed Position */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    max-width: none; /* Volle Breite bei fixed */
    width: 100%;
    width: 480px;
    /* Kompakte Höhe */
    height: 128px;
    
    /* Leicht durchsichtig */
    background-color: rgba(245, 245, 245, 0.95);
    opacity: 0.9;
    
    /* Site Icon - in die Mitte */
    background-position: center bottom;
    background-size: 128px 128px; /* Kleinere Größe für kompakten Header */
    
    /* Dezenter Schatten */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    
    /* Rahmen für Abgrenzung */
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Back-to-Top Button - erscheint beim Scrollen */
body > header::after {
    content: "↑";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    
    /* Styling */
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    
    /* Text zentrieren */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    
    /* Initial versteckt */
    opacity: 0;
    visibility: hidden;
    
    /* Smooth Übergänge */
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    
    /* Cursor */
    cursor: pointer;
    
    /* Accessibility */
    user-select: none;
}

/* Back-to-Top Button sichtbar bei scrolled */
body > header.scrolled::after {
    opacity: 1;
    visibility: visible;
}

/* Hover-Effekt für Back-to-Top Button */
body > header.scrolled::after:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

/* Body Anpassung für fixed header */
body.header-scrolled {
    padding-top: 80px; /* Platz für fixed header schaffen */
}

/* Alternative: Moderneres Pfeil-Icon statt Text */
body > header.modern::after {
    content: "";
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M7 14l5-5 5 5z'/%3E%3C/svg%3E");
    background-size: 24px 24px;
    background-repeat: no-repeat;
    background-position: center;
}

/* Responsive Anpassungen */
@media (max-width: 480px) {
    body > header {
        max-width: 100%;
    }
    
    body > header.scrolled {
        height: 60px;
        background-size: 48px 48px;
    }
    
    body > header::after {
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
    
    body.header-scrolled {
        padding-top: 60px;
    }
}