/**
 * HeroSplit — Frontend-CSS
 * Prefix: hsp-   |   kein JS   |   SALEPIX-unabhaengig
 * Vorbild: offeco.nl/de/
 *
 * Breakpoints (analog NOVA):
 *   xs < 514px | sm >= 514px | md >= 768px | lg >= 1024px | xl >= 1300px
 */

/* ===== Custom Properties (per Inline-Style ueberschrieben) ===== */
.hsp-block {
    --hsp-bg:             #f2f2f0;
    --hsp-text:           #1f1f1f;
    --hsp-btn-bg:         #1f1f1f;
    --hsp-btn-text:       #ffffff;
    --hsp-radius:         36px;
    --hsp-gap:            16px;
    --hsp-img-h-mobile:   343px;
    --hsp-img-h:          538px;
    --hsp-cols:           1fr 2fr;
    --hsp-transition:     .3s ease;
}

.hsp-block {
    width: 100%;
    margin-bottom: 2rem;
}

/* ===== Grid ===== */
.hsp-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--hsp-gap);
}

@media (min-width: 1024px) {
    .hsp-grid {
        grid-template-columns: var(--hsp-cols);
        align-items: stretch;
    }

    /* Bild links: Medienspalte vorziehen, Textspalte nachziehen */
    .hsp-grid--img-left .hsp-media {
        order: 1;
    }

    .hsp-grid--img-left .hsp-text {
        order: 2;
    }
}

/* ===== Textkachel ===== */
.hsp-text {
    background-color: var(--hsp-bg);
    color: var(--hsp-text);
    border-radius: calc(var(--hsp-radius) * 0.78);
    padding: 1.5rem;
    display: flex;
    align-items: flex-end;      /* Text unten buendig — Offeco-Merkmal */
    overflow: hidden;
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    .hsp-text {
        border-radius: var(--hsp-radius);
        padding: 2rem;
    }
}

.hsp-text__inner {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    overflow-wrap: break-word;
    word-break: break-word;
    width: 100%;
}

.hsp-eyebrow {
    margin: 0;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .7;
}

.hsp-headline {
    margin: 0 0 .5rem;
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.01em;
    color: inherit;
}

@media (min-width: 1024px) {
    .hsp-headline {
        font-size: 2.75rem;
        line-height: 1.14;
    }
}

@media (min-width: 1300px) {
    .hsp-headline {
        font-size: 3rem;
    }
}

.hsp-desc {
    margin: 0 0 .5rem;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.6;
    opacity: .85;
}

.hsp-desc p:last-child {
    margin-bottom: 0;
}

/* ===== Button ===== */
.hsp-btn-wrap {
    margin-top: .25rem;
}

.hsp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .625rem 1rem;
    border-radius: .75rem;
    background-color: var(--hsp-btn-bg);
    color: var(--hsp-btn-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
    transition: opacity var(--hsp-transition), transform var(--hsp-transition);
}

@media (min-width: 768px) {
    .hsp-btn {
        display: inline-flex;
        width: auto;
    }
}

.hsp-btn:hover,
.hsp-btn:focus {
    color: var(--hsp-btn-text);
    text-decoration: none;
    opacity: .88;
}

.hsp-btn:focus-visible {
    outline: 2px solid var(--hsp-btn-bg);
    outline-offset: 2px;
}

.hsp-btn__arrow {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    transition: transform var(--hsp-transition);
}

.hsp-btn:hover .hsp-btn__arrow {
    transform: translateX(3px);
}

/* ===== Bild ===== */
.hsp-media {
    border-radius: calc(var(--hsp-radius) * 0.78);
    overflow: hidden;
}

@media (min-width: 1024px) {
    .hsp-media {
        border-radius: var(--hsp-radius);
    }
}

.hsp-media__img {
    display: block;
    width: 100%;
    height: var(--hsp-img-h-mobile);
    object-fit: cover;
}

@media (min-width: 1024px) {
    .hsp-media__img {
        height: 100%;
        min-height: var(--hsp-img-h);
        max-height: var(--hsp-img-h);
    }
}

/* Platzhalter, solange kein Bild gewaehlt ist */
.hsp-media__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--hsp-img-h-mobile);
    background: repeating-linear-gradient(
        45deg,
        #ececec,
        #ececec 12px,
        #f6f6f6 12px,
        #f6f6f6 24px
    );
    color: #7a7a7a;
    font-size: .875rem;
    text-align: center;
    padding: 1rem;
}

@media (min-width: 1024px) {
    .hsp-media__placeholder {
        height: var(--hsp-img-h);
    }
}

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
    .hsp-btn,
    .hsp-btn__arrow {
        transition: none;
    }

    .hsp-btn:hover .hsp-btn__arrow {
        transform: none;
    }
}
