/* --- Core Plugin Styles --- */
.liz-wrapper {
    display: inline-block;
    overflow: hidden !important; 
    position: relative;
    vertical-align: middle;
    line-height: 0;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
}

.liz-target-img {
    transition: transform var(--liz-speed, 0.5s) ease-in-out !important;
    transform: scale(1);
    backface-visibility: hidden;
    /* Removed 'display: block !important' to let gallery layouts handle image display */
    height: auto;
}

/* --- Universal Hover Logic --- */
.liz-wrapper:hover .liz-target-img,
a:hover > .liz-target-img,
a:focus > .liz-target-img,
/* Specific hook for Meow Gallery deep nested anchors */
.mgl-img-container a:hover .liz-target-img {
    transform: scale(var(--liz-dynamic-scale, 1.1)) !important;
}

/* --- Block Level Structural Fixes --- */
.mpa-featured-image .liz-wrapper,
.wp-block-post-featured-image .liz-wrapper,
.wp-block-image .liz-wrapper {
    display: block;
    width: 100%;
}

/* --- Meow Gallery Compatibility --- */
.mgl-root .mgl-img-container a {
    /* We must ensure the anchor is a block to contain the overflow */
    display: block !important;
    overflow: hidden !important;
    position: relative;
    /* Ensure it fills the Meow container but doesn't override the JS-calculated height */
    width: 100%;
    height: 100%;
}

/* IMPORTANT: Remove 'object-fit: cover' and 'width: 100% !important' 
   if they were breaking the tile aspect ratios. We only want to ensure 
   the image is capable of being scaled.
*/
.mgl-root .liz-target-img {
    max-width: none !important; /* Meow Gallery sometimes needs this for tile fitting */
    width: 100%;
    height: 100%;
    object-fit: inherit; /* Inherit from Meow Gallery's settings */
}

/* --- WP Native Gallery Compatibility --- */
.wp-block-gallery .wp-block-image a {
    overflow: hidden !important;
    display: block !important;
}