/* Override some WordPress CSS to fix browser breakage */

/* IE 10 and 11 only */
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
    /* Fix for IE11 image not being constrained by parent block when using display:table
       This happens for aligned images in gutenberg and results in large images exceeding
       the block boundaries. Changing display:table to display:block on the parent element
       works OK, but prevents centring from working. Setting width seems to work (max-width
       does not) but it overrides any custom scaling, so exclude resized images. */
    .wp-block-image .alignleft,
    .wp-block-image .alignright {
        display:block;
    }
    .wp-block-image .aligncenter:not(.is-resized) img {
        width:100%;
    }
}

/* Older versions of Safari make a right mess of galleries */
.wp-block-gallery .blocks-gallery-image,
.wp-block-gallery .blocks-gallery-item,
.wp-block-gallery .blocks-gallery-image figure,
.wp-block-gallery .blocks-gallery-grid .blocks-gallery-item figure {
	display:block;
}

/* Additional CSS class to prevent gallery items expanding to fit width */
.wp-block-gallery.no-flex-grow figure.wp-block-image,
.wp-block-gallery.no-flex-grow figure.wp-block-image img,
.wp-block-gallery.no-flex-grow .blocks-gallery-image,
.wp-block-gallery.no-flex-grow .blocks-gallery-item,
.wp-block-gallery.no-flex-grow .blocks-gallery-image figure,
.wp-block-gallery.no-flex-grow .blocks-gallery-item figure {
	flex-grow:0;
    margin: auto;
}

/* Galleries with captions below */
.wp-block-gallery.caption-below {
	margin-bottom: 10px;
}

.wp-block-gallery.caption-below li.blocks-gallery-item {
	margin-bottom: 3.5em;
}

.wp-block-gallery.caption-below.caption-long li.blocks-gallery-item {
	margin-bottom: 6em;
}

.wp-block-gallery.caption-below.caption-longer li.blocks-gallery-item {
	margin-bottom: 8em;
}

.wp-block-gallery.caption-below .blocks-gallery-item figcaption,
.wp-block-gallery.caption-below figure.wp-block-image figcaption.wp-element-caption {
    position: inherit;
    color: inherit;
    background: inherit;
    padding: 0;
	margin-top: 0.25em;
}

/* Leave caption links in contrasting colour when on top of gallery image */
.wp-block-gallery:not(.caption-below) figcaption a,
.wp-block-gallery:not(.caption-below) figcaption a:hover {
    color: inherit;
}

/* Centre small gallery images. */
.wp-block-gallery figure.wp-block-image img,
.wp-block-gallery .blocks-gallery-grid .blocks-gallery-item img {
    margin: auto;
}

/* Captions using baguette box lightbox */
#baguetteBox-overlay .full-image figcaption {
    bottom: initial;
    background-color: inherit;
    color: #eee;
}
