/* ===========================================
   R4P – Bild-Ladezustände
   .img-load + img.r4p-img / [data-img-src]
   =========================================== */

@keyframes r4p-img-pulse {
    0%, 100% { background-color: #ececec; }
    50% { background-color: #e0e0e0; }
}

@keyframes r4p-img-spin {
    to { transform: rotate(360deg); }
}

.img-load {
    position: relative;
    overflow: hidden;
    background: #e8e8e8;
}

.img-load.is-loading {
    animation: r4p-img-pulse 2.2s ease-in-out infinite;
}


.img-load > img {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.img-load.is-loaded > img {
    opacity: 1;
}

.img-load.is-loaded .img-load__status::before,
.img-load.is-error .img-load__status::before {
    display: none;
    animation: none;
}

.img-load__status {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    text-align: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(11, 15, 11, 0.5);
    pointer-events: none;
}

.img-load.is-loading .img-load__status {
    flex-direction: column;
    gap: 12px;
    color: rgba(11, 15, 11, 0.45);
}

.img-load.is-loading .img-load__status::before {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    border: 2px solid rgba(11, 15, 11, 0.1);
    border-top-color: rgba(11, 15, 11, 0.42);
    border-radius: 50%;
    animation: r4p-img-spin 0.9s linear infinite;
    flex-shrink: 0;
}

.img-load.is-loaded .img-load__status {
    display: none;
}

.img-load.is-error {
    background: #d8d8d8;
}

.img-load.is-error .img-load__status {
    display: flex;
}

.img-load.is-error > img {
    display: none;
}

/* Inline-Bilder (Logo etc.) */
.img-load--inline {
    display: inline-block;
    vertical-align: middle;
    line-height: 0;
    background: transparent;
}

.img-load--inline.is-loading {
    min-width: 2rem;
    min-height: 1.5rem;
    background: #ececec;
    border-radius: 6px;
}

.img-load--inline > img {
    position: relative;
    inset: auto;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
}

.img-load--inline .img-load__status {
    font-size: 0.58rem;
    min-height: 1.5rem;
}

/* Platzhalter (.ph) mit echtem Bild */
.ph.img-load {
    color: transparent;
    min-height: 100%;
}

.hero-m__media.img-load.is-loading .img-load__status::before {
    border-color: rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.75);
}

.hero-m__media.img-load.is-loading .img-load__status {
    color: rgba(255, 255, 255, 0.65);
}

.hero-m__media.img-load.is-error .img-load__status {
    color: rgba(255, 255, 255, 0.75);
}

html[data-hero-tone="light"] .hero-m__media.img-load.is-loading .img-load__status::before {
    border-color: rgba(11, 15, 11, 0.1);
    border-top-color: rgba(11, 15, 11, 0.4);
}

html[data-hero-tone="light"] .hero-m__media.img-load.is-loading .img-load__status,
html[data-hero-tone="light"] .hero-m__media.img-load.is-error .img-load__status {
    color: rgba(11, 15, 11, 0.55);
}

.ph.img-load.is-loading,
.ph.img-load.is-error {
    color: transparent;
}

.ph.img-load.is-error .img-load__status {
    color: rgba(11, 15, 11, 0.5);
}

.ph--dark.img-load.is-loading {
    animation-name: r4p-img-pulse-dark;
}

@keyframes r4p-img-pulse-dark {
    0%, 100% { background-color: #5a5a5a; }
    50% { background-color: #4e4e4e; }
}

.ph--dark.img-load.is-loading .img-load__status::before {
    border-color: rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.55);
}

.ph--dark.img-load.is-error {
    background: #4a4a4a;
}

.ph--dark.img-load.is-error .img-load__status,
.ph--dark.img-load.is-loading .img-load__status {
    color: rgba(255, 255, 255, 0.55);
}

@media (prefers-reduced-motion: reduce) {
    .img-load.is-loading {
        animation: none;
        background: #e8e8e8;
    }

    .img-load.is-loading .img-load__status::before {
        animation: none;
        border-top-color: rgba(11, 15, 11, 0.35);
    }

    .img-load > img {
        transition: none;
    }
}
