.editor-media-modal-gallery__preview {
	position: relative;
	display: flex;
	flex-direction: column;
	flex: 2 0 0%;
	margin: 80px 0 0;
	background-color: var(--color-neutral-0);
	border: 1px solid var(--color-neutral-10);

	@include breakpoint-deprecated( ">660px" ) {
		display: block;
		margin: 16px 0 16px 24px;
	}
}

.editor-media-modal-gallery__preview .calypso-notice {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	margin: 0;
	overflow: hidden;
}

.editor-media-modal-gallery__preview .ellipsis-menu {
	display: flex;
	flex-direction: row-reverse;
	margin-top: -12px;
}

.editor-media-modal-gallery__preview-toggle {
	position: absolute;
	top: -28px;
	right: 15px;
	z-index: z-index(".dialog__backdrop", ".editor-media-modal-gallery__preview-toggle");
	width: 200px;

	@include breakpoint-deprecated( ">660px" ) {
		right: -1px;
	}

	.segmented-control__item .segmented-control__link {
		border-color: var(--color-neutral-10);
	}

	.segmented-control__item:first-of-type .segmented-control__link {
		border-bottom-left-radius: 0;
	}

	.segmented-control__item:last-of-type .segmented-control__link {
		border-bottom-right-radius: 0;
		border-left-color: var(--color-neutral-10);
	}

	.segmented-control__item.is-selected .segmented-control__link {
		border-bottom-color: var(--color-neutral-0);
	}
}

.editor-media-modal-gallery__preview-toggle .segmented-control__item {
	flex-basis: 0%;
}

.editor-media-modal-gallery .sortable-list__item {
	width: 44%;
	margin: 3%;

	@include breakpoint-deprecated( ">660px" ) {
		width: 160px;
		margin: 16px 0 0 16px;
	}
}

.editor-media-modal-gallery__edit-item {
	position: relative;
}

.editor-media-modal-gallery__remove {
	position: absolute;
	top: 0;
	/*!rtl:ignore*/
	right: 0;
	width: 28px;
	height: 28px;
	/*!rtl:ignore*/
	transform: translate(25%, -25%);
	border: 1px solid var(--color-neutral-20);
	border-radius: 50%;
	background-color: var(--color-neutral-0);
	color: var(--color-neutral-20);
	cursor: pointer;
}

.editor-media-modal-gallery__remove .gridicon {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
}

.editor-media-modal-gallery .media-library__list-item {
	display: block;
}

.editor-media-modal-gallery .media-library__list-item-edit {
	display: none;
}

.editor-media-modal-gallery .sortable-list__navigation {
	position: absolute;
	top: 16px;
	left: 16px;
	margin: 0;
}

.editor-media-modal-gallery .sortable-list__navigation-button {
	background-color: var(--color-surface);

	&:disabled {
		opacity: 0.9;
		background-color: var(--color-neutral-0);
	}
}

input.editor-media-modal-gallery__caption.form-text-input[type="text"] {
	font-size: $font-body-extra-small;

	&:focus {
		box-shadow: none;
	}
}

.popover.gallery__order-popover {
	z-index: z-index("root", ".popover.gallery__order-popover");
}

.editor-media-modal-gallery__sidebar {
	flex: 1 0 0%;
	padding: 16px;

	@include breakpoint-deprecated( ">660px" ) {
		padding-top: 0;
		padding-right: 24px;
		overflow-y: auto;
	}
}

.editor-media-modal-gallery__preview-wrapper {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	box-sizing: border-box;
	overflow-y: auto;
	padding: 16px;
}

.editor-media-modal-gallery__preview-shortcode {
	&,
	& .shortcode-frame {
		width: 100%;
	}
	&.is-loading {
		animation: loading-fade 0.8s ease-in-out infinite;
	}

	&::before,
	&::after {
		content: "";
		position: absolute;
		left: 50%;
		display: block;
		width: 90%;
		margin-left: -45%;
		transition: 0.2s opacity cubic-bezier(0.25, 0.5, 0.5, 0.9);
		opacity: 0;

		@include breakpoint-deprecated( ">660px" ) {
			width: 75%;
			margin-left: -37.5%;
		}
	}

	&::before {
		top: 16px;
		height: 130px;
		background: linear-gradient(to right, var(--color-neutral-5), var(--color-neutral-5) 40%, transparent 40%, transparent 42%, var(--color-neutral-10) 42%);
	}

	&::after {
		top: calc(146px + 2%);
		height: 240px;
		background: var(--color-neutral-20);
	}

	&.is-loading::before,
	&.is-loading::after {
		opacity: 1;
	}
}

.editor-media-modal-gallery__fields .for-setting-type {
	position: absolute;
	top: 0;
	left: 16px;
	right: 16px;

	@include breakpoint-deprecated( ">660px" ) {
		position: static;
	}
}

.editor-media-modal-gallery__fields .for-setting-type .editor-media-modal__fieldset-legend {
	display: none;

	@include breakpoint-deprecated( ">660px" ) {
		display: block;
	}
}

.editor-media-modal-gallery__fields .for-setting-type .select-dropdown__container {
	width: 100%;

	@include breakpoint-deprecated( ">660px" ) {
		width: auto;
	}
}

input[type].editor-media-modal-gallery__input-width-auto {
	width: auto;
}

.editor-media-modal-gallery__preview-individual-content {
	padding-top: 8px;

	@include breakpoint-deprecated( ">660px" ) {
		max-width: 75%;
		margin: 0 auto;
	}

	@include breakpoint-deprecated( ">960px" ) {
		max-width: 50%;
	}
}

.editor-media-modal-gallery__preview-individual .wp-caption {
	@extend %content-font;
	margin: 0 auto;
	text-align: center;
	font-family: $serif;
	background: none;
	box-sizing: border-box;
	border: none;
	margin-bottom: 16px;
	max-width: 100%;
	padding-top: 0;

	&.alignleft {
		margin-right: 16px;
	}

	&.alignright {
		margin-left: 16px;
	}
}

.editor-media-modal-gallery__preview-individual .wp-caption-dt {
	overflow: hidden;
}

.editor-media-modal-gallery__preview-individual .wp-caption img[class*="wp-image-"] {
	display: block;
	margin: 0;
}

.editor-media-modal-gallery__preview-individual .wp-caption-dd {
	background: var(--color-neutral-0);
	color: var(--color-neutral-50);
	font-size: $font-body-small;
	line-height: 1.7;
	padding: 16px;
}

.editor-media-modal-gallery__content {
	margin-top: 16px;

	@include breakpoint-deprecated( ">660px" ) {
		margin-top: 0;
	}
}
