/*
 * Affiliate Hub — in-article ad (no price). Compact horizontal card:
 * cover | name + short line | button. When the card is narrow (phones, narrow
 * content columns) the button goes full width below: a container query, so it
 * follows the space the card really has, not the screen size.
 * The cover box has a fixed size, so the lazy image never shifts the text (no CLS).
 */

:is(.afh, #afh#afh).afh--ad {
    margin-top: 2em;
    margin-bottom: 2em;
    container-type: inline-size;
}

:is(.afh, #afh#afh) .afh-ad {
    position: relative;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px 18px;
    padding: 22px 20px 16px;
    background: var(--afh-bg);
    border: 1px solid var(--afh-border);
    border-radius: var(--afh-radius);
    box-shadow: var(--afh-shadow);
}

:is(.afh, #afh#afh) .afh-ad__label {
    position: absolute;
    top: 7px;
    left: 20px;
    color: var(--afh-muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1;
    text-transform: uppercase;
}

:is(.afh, #afh#afh) .afh-ad__media {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 100px;
    padding: 6px;
    background: var(--afh-soft);
    border-radius: 8px;
    text-decoration: none;
}

:is(.afh, #afh#afh) .afh-ad__media .afh-cover {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.35);
}

:is(.afh, #afh#afh) .afh-ad__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

:is(.afh, #afh#afh) .afh-ad__title {
    display: -webkit-box;
    overflow: hidden;
    color: var(--afh-title);
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

:is(.afh, #afh#afh) .afh-ad__title:hover {
    text-decoration: underline;
}

:is(.afh, #afh#afh) .afh-ad__text {
    display: -webkit-box;
    overflow: hidden;
    color: var(--afh-muted);
    font-size: 0.9rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

:is(.afh, #afh#afh) .afh-ad__btn {
    white-space: nowrap;
}

:is(.afh, #afh#afh) .afh-ad__btn:hover,
:is(.afh, #afh#afh) .afh-ad__btn:focus-visible {
    background: var(--afh-button-bg-hover);
}

@container (max-width: 520px) {
    :is(.afh, #afh#afh) .afh-ad {
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 12px 14px;
        padding: 22px 14px 14px;
    }

    :is(.afh, #afh#afh) .afh-ad__label {
        left: 14px;
    }

    :is(.afh, #afh#afh) .afh-ad__media {
        width: 64px;
        height: 86px;
    }

    :is(.afh, #afh#afh) .afh-ad__btn {
        grid-column: 1 / -1;
        width: 100%;
    }
}
