/**
 * Smart Image Studio — Overlay CSS
 * This file provides base styles; dynamic values injected via wp_head.
 */

/* Force wrapper to respect its image's dimensions */
.sis-wm-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    overflow: hidden;
    /* Inherit block/flex behaviour from parent */
    max-width: 100%;
}

/* Make the image fill the wrapper (works with themes that set width:100%) */
.sis-wm-wrap > img,
.sis-wm-wrap > a > img,
.sis-wm-wrap > figure > img,
.sis-wm-wrap > picture > img,
.sis-wm-wrap img {
    display: block;
    width: 100%;
    height: auto;
}

/* The watermark badge — all positioning & content set via wp_head inline CSS */
.sis-wm-badge {
    position: absolute;
    pointer-events: none;
    z-index: 10;
    display: block;
    line-height: 1.2;
}

/* Ensure the badge renders on top of lazy-loaded images */
.sis-wm-badge::before {
    display: block;
}

/* ── Theme compatibility fixes ────────────────────────────── */

/* Twenty Twenty-One, Twenty Twenty-Two: featured image is a figure */
.wp-post-image ~ .sis-wm-badge,
.attachment-post-thumbnail ~ .sis-wm-badge {
    /* already handled by parent .sis-wm-wrap */
}

/* Elementor, Beaver Builder, Divi — images in absolute wrappers */
.elementor-image .sis-wm-wrap,
.fl-photo-content .sis-wm-wrap,
.et_pb_image .sis-wm-wrap {
    display: block;
}

/* Gutenberg cover block & group blocks */
.wp-block-image .sis-wm-wrap {
    display: block;
    width: 100%;
}
.wp-block-image .sis-wm-wrap img {
    width: 100%;
}

/* Genesis, Astra, OceanWP featured image wrappers */
.post-image .sis-wm-wrap,
.featured-image .sis-wm-wrap,
.wp-post-image.sis-wm-wrap {
    display: block;
}

/* ── Print: hide watermark ────────────────────────────────── */
@media print {
    .sis-wm-badge { display: none !important; }
}
