/*
* Adapted from: https://github.com/chanzuckerberg/czi-prosemirror/blob/master/src/ui/czi-image-view.css
*
* MIT License
*
* Copyright (c) 2019 Chan Zuckerberg Initiative
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

.editor-image-view {
	clear: both;
	display: inline-block;
	line-height: 0;
	margin: 0 2px; /* This should be synced to the constant IMAGE_MARGIN in JS. */
	max-width: 100%;
	text-align: center;
	vertical-align: baseline;
}

.editor-image-view.ProseMirror-selectednode {
	outline: none;
}

.editor-image-view.align-left {
	float: left;
	margin: 0 40px 20px 0;
}

.editor-image-view.align-right {
	float: right;
	margin: 0 0 20px 40px;
}

.editor-image-view.align-center {
	clear: both;
	display: block;
	float: none;
	margin: 20px 0;
}

.editor-image-view-body-img-clip {
	display: inline-block;
	max-width: 100%;
	overflow: hidden;
	position: relative;
}

.editor-image-view-body {
	clear: both;
	display: inline-block;
	max-width: 100%;
	position: relative;
}

.editor-image-view-error {
	font-size: 20px;
	z-index: 10;
	position: absolute;
}

.editor-image-view-body.loading::before {
	animation: editor_animation_blink normal 800ms infinite ease-in-out;
	background-color: #cdcdcd;
	bottom: 0;
	content: "";
	cursor: wait;
	left: 0;
	position: absolute;
	right: 0;
	top: 0;
	z-index: 3;
}

.editor-image-view-body.error::before {
	background-color: #fff;
	outline: solid 1px #cdcdcd;
	bottom: 0;
	content: "";
	left: 0;
	position: absolute;
	right: 0;
	top: 0;
	z-index: 3;
}

.editor-image-view-body .editor-icon.error {
	color: red;
	left: 50%;
	position: absolute;
	top: 50%;
	z-index: 4;
	margin: -11px 0 0 -11px;
	font-size: 22px;
}

.editor-image-view-body.selected::after {

	/* simulated selection highlight */
	background-color: rgba(152, 204, 253, 0.8);
	bottom: 0;
	content: "";
	left: 0;
	position: absolute;
	right: 0;
	top: 0;
	z-index: 2;
}

.editor-image-view-body.active.selected::after {

	/* hide the highlight so user can resize the image easily. */
	display: none;
}

.editor-image-view-body.active {
	background-color: transparent;
	box-shadow: 0 0 0 2px rgba(152, 204, 253, 0.8);
}

@keyframes editor_animation_blink {
	0% {
		opacity: 1;
	}

	50% {
		opacity: 0.5;
	}

	100% {
		opacity: 1;
	}
}
