/* =========================================================================
   CALORIE PLAN MODAL  -  [calorie_plan_template popup="yes"]
   ========================================================================= */

.pf-modal {
	--pfm-radius: 16px;
	--pfm-max: 640px;

	position: fixed;
	inset: 0;
	z-index: 99000;   /* above the PF sidebar (9000) and the tab bar (8500) */
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: clamp(12px, 4vh, 48px) clamp(12px, 4vw, 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
}

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

.pf-modal *,
.pf-modal *::before,
.pf-modal *::after {
	box-sizing: border-box;
}

.pf-modal__scrim {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.pf-modal__dialog {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: var(--pfm-max);
	margin: auto;
	border-radius: var(--pfm-radius);
	background: #fff;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
	animation: pf-modal-in .22s cubic-bezier(.16, 1, .3, 1);
}

@keyframes pf-modal-in {
	from { opacity: 0; transform: translateY(12px) scale(.985); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.pf-modal__dialog { animation: none; }
}

.pf-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 18px 20px;
	border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.pf-modal__title {
	margin: 0;
	font-family: Teko, 'Arial Narrow', sans-serif;
	font-size: clamp(22px, 3vw, 30px);
	font-weight: 600;
	line-height: 1.15;
	color: #14213D;
}

.pf-modal__close {
	flex: none;
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, .06);
	color: #1d1d1f;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background .18s ease;
}

.pf-modal__close:hover {
	background: rgba(0, 0, 0, .12);
}

.pf-modal__close:focus-visible {
	outline: 3px solid #FFCD04;
	outline-offset: 2px;
}

.pf-modal__body {
	padding: 20px;
}

/* The partial ships its own wrapper margins for the inline layout; inside the
   dialog they would double up on the padding above. */
.pf-modal__body .calorie-form-wrapper,
.pf-modal__body .calorie-form-inner {
	margin: 0;
	padding: 0;
}

/* Lock the page behind the dialog. `position: fixed` is deliberately avoided -
   it would reset the scroll position when the modal closes. */
body.pf-modal-open {
	overflow: hidden;
}

@media (max-width: 600px) {
	.pf-modal {
		padding: 0;
	}

	.pf-modal__dialog {
		min-height: 100%;
		border-radius: 0;
	}

	.pf-modal__head {
		position: sticky;
		top: 0;
		z-index: 2;
		background: #fff;
		border-top-left-radius: 0;
		border-top-right-radius: 0;
	}
}
