/**
 * IMS Catalog Promo
 *
 * Horizontal card with cover thumbnail, title/subtitle, and three CTA buttons
 * (Browse online · Download · Request print copy).
 *
 * Layout breakpoints:
 *  - >= 768px: cover | copy | actions in a single row
 *  - <  768px: stacks vertically, actions wrap full-width
 */

.ims-catalog-promo {
    width: 100%;
}

.ims-catalog-promo__card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Cover
 *
 * The cover slot keeps a fixed footprint in the flex row (so the title/buttons
 * stay aligned), but the image inside is positioned absolutely, anchored at
 * the bottom of the slot, and rendered taller than the slot itself. This lets
 * the catalog cover "escape" the card and stick out above its top edge —
 * giving it a more product-shot feel without growing the card's height.
 *
 * `position: relative` on the slot, plus `overflow: visible` on both the
 * slot and the card (default), are what allow the overflow to render.
 */
.ims-catalog-promo__cover {
    flex: 0 0 auto;
    width: 110px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    position: relative;
}

.ims-catalog-promo__cover-img {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: auto;
    height: 140px;
    max-width: none;
    max-height: none;
    display: block;
    object-fit: contain;
    filter: drop-shadow( 0 8px 16px rgba( 0, 0, 0, 0.22 ) );
}

.ims-catalog-promo__cover-placeholder {
    width: 72px;
    height: 96px;
    background: #f3f4f6;
    border: 1px dashed #d1d5db;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    letter-spacing: 0.08em;
}

/* Copy
 *
 * `padding-left` adds a little extra indent on top of the card's flex `gap`,
 * so the title doesn't visually butt up against the cover — especially now
 * that the cover image overhangs the top of the card and reads as a
 * "thicker" element on the left.
 */
.ims-catalog-promo__copy {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-left: 12px;
}

.ims-catalog-promo__title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #111111;
    line-height: 1.3;
}

.ims-catalog-promo__subtitle {
    display: block;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.45;
}

/* Actions */
.ims-catalog-promo__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ims-catalog-promo__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
    white-space: nowrap;
}

.ims-catalog-promo__btn:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #FAB000);
    outline-offset: 2px;
}

.ims-catalog-promo__btn-icon {
    display: inline-block;
    flex: 0 0 auto;
}

.ims-catalog-promo__btn-arrow {
    display: inline-block;
    margin-left: 2px;
    transform: translateY(-0.5px);
}

/* Ghost (white / outlined) */
.ims-catalog-promo__btn--ghost {
    background: #ffffff;
    color: #111111;
    border: 1px solid #d1d5db;
}

.ims-catalog-promo__btn--ghost:hover,
.ims-catalog-promo__btn--ghost:focus-visible {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111111;
}

/* Solid (dark filled) */
.ims-catalog-promo__btn--solid {
    background: #111111;
    color: #ffffff;
    border: 1px solid #111111;
}

.ims-catalog-promo__btn--solid:hover,
.ims-catalog-promo__btn--solid:focus-visible {
    background: #000000;
    border-color: #000000;
    color: #ffffff;
}

/* Disabled (no destination configured — visible to admins so they can fix it) */
.ims-catalog-promo__btn--disabled,
.ims-catalog-promo__btn--disabled:hover,
.ims-catalog-promo__btn--disabled:focus-visible {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
    box-shadow: none;
}

/* Admin notice (visible only to logged-in editors) */
.ims-catalog-promo__admin-notice {
    margin: 8px 4px 0;
    padding: 8px 12px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    color: #9a3412;
    font-size: 12.5px;
    line-height: 1.4;
}

.ims-catalog-promo__admin-notice strong {
    margin-right: 4px;
}

/* Editor preview parity */
.ims-catalog-promo--editor .ims-catalog-promo__title,
.ims-catalog-promo--editor .ims-catalog-promo__subtitle {
    cursor: text;
}

.ims-catalog-promo--editor .ims-catalog-promo__btn {
    cursor: default;
}

/* Responsive */
@media ( max-width: 900px ) {
    .ims-catalog-promo__card {
        flex-wrap: wrap;
        gap: 16px;
    }

    .ims-catalog-promo__copy {
        flex: 1 1 calc( 100% - 120px );
    }

    .ims-catalog-promo__actions {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
}

@media ( max-width: 540px ) {
    .ims-catalog-promo__card {
        padding: 14px 16px;
        gap: 14px;
    }

    .ims-catalog-promo__cover {
        width: 84px;
        height: 72px;
    }

    .ims-catalog-promo__cover-img {
        height: 110px;
    }

    .ims-catalog-promo__copy {
        flex: 1 1 calc( 100% - 100px );
    }

    .ims-catalog-promo__title {
        font-size: 15px;
    }

    .ims-catalog-promo__subtitle {
        font-size: 12.5px;
    }

    .ims-catalog-promo__btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}
