/*
 * Newsletter PDF viewer modal.
 *
 * Its own stylesheet rather than part of pages/newsletters.css, because the
 * modal is used in two places — the archive and a single issue — and that
 * file only loads on the archive. Living there left the modal unstyled on an
 * issue page.
 *
 * Markup is template-parts/newsletters/viewer-modal.php; behaviour is
 * assets/js/newsletters.js.
 */

/*
 * Same fixed-overlay + fade/scale-in pattern as the sponsorship
 * checkout modal, sized wide for reading a document instead of a form.
 */

.newsletter-modal-open {
	overflow: hidden;
}

.newsletter-modal[hidden] {
	display: none;
}

.newsletter-modal {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0.75rem;
}

.newsletter-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgb(11 20 32 / 55%);
	opacity: 0;
	transition: opacity 0.22s ease;
}

.newsletter-modal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 900px;
	height: 98vh;
	overflow: hidden;
	border-radius: var(--radius);
	background: var(--bg);
	box-shadow: 0 24px 60px rgb(11 20 32 / 25%);
	opacity: 0;
	transform: translateY(12px) scale(0.98);
	transition: opacity 0.22s ease, transform 0.22s ease;
}

.newsletter-modal--visible .newsletter-modal__backdrop {
	opacity: 1;
}

.newsletter-modal--visible .newsletter-modal__dialog {
	opacity: 1;
	transform: none;
}

/* Close floats over the frame instead of sitting in a bar, so the full dialog
   height goes to the PDF. */
.newsletter-modal__close {
	position: absolute;
	top: 0.85rem;
	right: 1rem;
	z-index: 2;
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 50%;
	background: rgb(11 20 32 / 62%);
	color: #fff;
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	transition: background 0.15s ease;
}

.newsletter-modal__close:hover {
	background: rgb(11 20 32 / 85%);
}

.newsletter-modal__frame {
	flex: 1;
	background: var(--sand);
}

.newsletter-modal__frame iframe {
	width: 100%;
	height: 100%;
	border: none;
}

@media (max-width: 640px) {
	.newsletter-modal__dialog {
		height: 100vh;
	}
}
