/* MMF strip in place of the long footer. */
.mmf-gp-brand {
	flex: none;
	padding: 0.3rem 1rem max(0.3rem, env(safe-area-inset-bottom));
	border-top: 1px solid transparent;
	border-image: var(--gp-gradient) 1;
	background: rgba(255, 255, 255, 0.92);
}

.mmf-gp-brand__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0 1.1rem;
	width: min(76rem, 100%);
	margin: 0 auto;
}

.mmf-gp-brand__home {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 30px;
	color: var(--gp-navy);
	font-size: 0.78rem;
	line-height: 1.2;
	text-decoration: none;
}

.mmf-gp-brand__home img {
	width: 28px;
	height: 28px;
	object-fit: contain;
}

.mmf-gp-brand__home strong {
	font-weight: 900;
	letter-spacing: -0.01em;
}

.mmf-gp-brand__tag {
	color: var(--gp-magenta);
	font-weight: 700;
}

.mmf-gp-brand__tag::before {
	content: "· ";
	color: var(--gp-muted);
}

.mmf-gp-brand__links {
	display: flex;
	gap: 1rem;
}

.mmf-gp-brand__links a,
.mmf-gp-brand .mmf-consent-manage {
	display: inline-flex;
	align-items: center;
	min-height: 26px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--gp-muted);
	font-size: 0.74rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

/* One screen without scrolling (where the native popover sheet exists), story sheet, wide layout.
   Older browsers keep a normal scrolling page with the story under the buttons. */
.mmf-gpx .mmf-gp__sheet-head,
.mmf-gpx .mmf-gp__sheet-close {
	display: none;
}

#portraits .mmf-gp__story h2:first-child {
	margin-top: 0.25rem;
}

@supports selector(:popover-open) {
	.mmf-gpx {
		height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
		height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
		min-height: 20rem;
	}

	body.mmf-gp-immersive #primary,
	.mmf-gpx .mmf-gp--page,
	.mmf-gpx .mmf-gp__portrait.mmf-gp__screen {
		flex: 1 1 0;
		min-height: 0;
	}

	.mmf-gpx .mmf-gp__hero {
		flex: 1 1 0;
		height: auto;
		min-height: 7.5rem;
	}

	.mmf-gpx .mmf-gp__content {
		flex: 0 1 auto;
		min-height: 0;
	}

	.mmf-gpx .mmf-gp__words {
		flex: 0 1 auto;
		min-height: 4.75rem;
	}

	.mmf-gpx .mmf-gp__more {
		display: grid;
		place-items: center;
	}

	.mmf-gpx .mmf-gp__sheet {
		position: fixed;
		inset: auto 0 0;
		width: 100%;
		max-width: 40rem;
		height: auto;
		max-height: min(88dvh, 56rem);
		margin: 0 auto;
		padding: 0;
		border: 0;
		border-radius: 26px 26px 0 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		background: #fff;
		box-shadow: 0 -24px 60px rgba(30, 34, 68, 0.28);
		color: var(--gp-navy);
		text-align: left;
	}

	.mmf-gpx .mmf-gp__sheet::backdrop {
		background: rgba(30, 34, 68, 0.45);
	}

	.mmf-gpx .mmf-gp__sheet-head {
		position: sticky;
		top: 0;
		z-index: 1;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1rem;
		padding: 0.95rem 0.8rem 0.45rem 1.35rem;
		background: rgba(255, 255, 255, 0.94);
		-webkit-backdrop-filter: blur(12px);
		backdrop-filter: blur(12px);
	}

	.mmf-gpx .mmf-gp__sheet-head::before {
		content: "";
		position: absolute;
		top: 0.4rem;
		left: calc(50% - 1.25rem);
		width: 2.5rem;
		height: 5px;
		border-radius: 999px;
		background: rgba(30, 34, 68, 0.16);
	}

	.mmf-gpx #portraits .mmf-gp__sheet-name {
		margin: 0;
		font-size: 1.1rem;
		font-weight: 900;
		line-height: 1.2;
	}

	.mmf-gpx .mmf-gp__sheet-close {
		display: grid;
		flex: none;
		place-items: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: var(--gp-soft);
		color: var(--gp-navy);
		font-size: 1.7rem;
		line-height: 1;
		cursor: pointer;
	}

	.mmf-gpx .mmf-gp__sheet .mmf-gp__story {
		margin: 0;
		padding: 0 1.35rem max(1.5rem, env(safe-area-inset-bottom));
	}

	@media (prefers-reduced-motion: no-preference) {
		.mmf-gpx .mmf-gp__sheet {
			transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), overlay 0.32s allow-discrete, display 0.32s allow-discrete;
		}

		.mmf-gpx .mmf-gp__sheet:not(:popover-open) {
			transform: translateY(100%);
		}

		@starting-style {
			.mmf-gpx .mmf-gp__sheet:popover-open {
				transform: translateY(100%);
			}
		}
	}
}

/* Wide screens and phones held sideways: photo on the left, words and donation on the right. */
@media (min-width: 900px), (orientation: landscape) and (min-width: 600px) {
	.mmf-gpx .mmf-gp__portrait.mmf-gp__screen {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		grid-template-rows: auto minmax(0, 1fr);
		column-gap: clamp(1.5rem, 4vw, 4.5rem);
		max-width: 78rem;
		padding: 0 clamp(1rem, 3vw, 2.5rem) clamp(0.75rem, 2.5vh, 1.75rem);
	}

	.mmf-gpx .mmf-gp__bar {
		grid-column: 1 / -1;
		padding: max(0.9rem, env(safe-area-inset-top)) 0 0.7rem;
	}

	.mmf-gpx .mmf-gp__hero {
		grid-column: 1;
		grid-row: 2;
		height: min(72vh, 36rem);
		border-radius: 32px;
		background:
			radial-gradient(55% 45% at 30% 22%, rgba(255, 255, 255, 0.9), transparent 70%),
			linear-gradient(150deg, #fff4f0 0%, #fde2ec 55%, #f1dcef 100%);
		box-shadow: inset 0 0 0 1px rgba(180, 40, 126, 0.08);
	}

	.mmf-gpx .mmf-gp__ring {
		--ring: min(calc(100cqh - 4.5rem), calc(100cqw - 4rem), 36rem);
		padding: 6px;
	}

	.mmf-gpx .mmf-gp__content {
		grid-column: 2;
		grid-row: 2;
		justify-content: center;
		gap: 1.2rem;
		padding: 0;
		text-align: left;
	}

	.mmf-gpx .mmf-gp__portrait-name {
		font-size: clamp(2.1rem, 4.4vw, 3.8rem);
	}

	.mmf-gpx #portraits .mmf-gp__kicker {
		font-size: 0.82rem;
	}

	.mmf-gpx #portraits .mmf-gp__meta {
		margin-top: 0.6rem;
		font-size: 1.05rem;
		-webkit-line-clamp: 3;
	}

	.mmf-gpx .mmf-gp__words {
		padding: 2.1rem 1.75rem 1.4rem;
		border-radius: 28px;
	}

	.mmf-gpx .mmf-gp__words--quote {
		padding-top: 3.2rem;
	}

	.mmf-gpx .mmf-gp__langpick {
		top: 0.8rem;
		right: 0.8rem;
	}

	.mmf-gpx .mmf-gp__words::before {
		top: 0.2rem;
		left: 1.4rem;
		font-size: 3.6rem;
	}

	.mmf-gpx .mmf-gp__text {
		font-size: clamp(1.2rem, 1.75vw, 1.6rem);
		line-height: 1.4;
	}

	.mmf-gpx .is-long .mmf-gp__text {
		font-size: clamp(1.08rem, 1.45vw, 1.35rem);
	}

	.mmf-gpx .is-xlong .mmf-gp__text {
		font-size: clamp(1rem, 1.2vw, 1.18rem);
	}

	.mmf-gpx .mmf-gp__actions {
		justify-content: flex-start;
	}

	.mmf-gpx .mmf-gp__more,
	.mmf-gpx .mmf-gp__donate {
		flex: 0 1 auto;
		min-width: 12rem;
		padding: 0 1.8rem;
	}

	.mmf-gp-brand {
		padding-inline: clamp(1rem, 3vw, 2.5rem);
	}

	.mmf-gp-brand__inner {
		justify-content: space-between;
	}

	@supports selector(:popover-open) {
		.mmf-gpx .mmf-gp__hero {
			height: auto;
			min-height: 0;
		}

		.mmf-gpx .mmf-gp__sheet {
			inset: 0 0 0 auto;
			width: min(34rem, 92vw);
			max-width: none;
			height: 100dvh;
			max-height: none;
			border-radius: 28px 0 0 28px;
		}

		.mmf-gpx .mmf-gp__sheet-head {
			padding: 1.1rem 1.1rem 0.6rem 1.75rem;
		}

		.mmf-gpx .mmf-gp__sheet-head::before {
			content: none;
		}

		.mmf-gpx .mmf-gp__sheet .mmf-gp__story {
			padding-inline: 1.75rem;
		}

		.mmf-gpx .mmf-gp__sheet:not(:popover-open) {
			transform: translateX(100%);
		}

		@starting-style {
			.mmf-gpx .mmf-gp__sheet:popover-open {
				transform: translateX(100%);
			}
		}
	}
}

/* Short screens (phones sideways, small laptops). */
@media (max-height: 560px) {
	.mmf-gpx .mmf-gp__portrait-name {
		font-size: clamp(1.5rem, 3.6vw, 2rem);
	}

	.mmf-gpx .mmf-gp__content {
		gap: 0.6rem;
	}

	.mmf-gpx #portraits .mmf-gp__meta {
		-webkit-line-clamp: 2;
	}
}

/* Phones held sideways: everything on the right column must stay above the MMF strip. */
@media (max-height: 560px) and (orientation: landscape) {
	.mmf-gpx .mmf-gp__bar {
		padding-block: max(0.4rem, env(safe-area-inset-top)) 0.4rem;
	}

	.mmf-gpx .mmf-gp__portrait-name {
		font-size: clamp(1.3rem, 3vw, 1.8rem);
	}

	.mmf-gpx #portraits .mmf-gp__meta {
		margin-top: 0.2rem;
		-webkit-line-clamp: 1;
	}

	.mmf-gpx .mmf-gp__content {
		gap: 0.5rem;
	}

	.mmf-gpx .mmf-gp__words,
	.mmf-gpx .mmf-gp__words--quote {
		min-height: 3.5rem;
		padding: 2.4rem 1.1rem 0.7rem;
	}

	.mmf-gpx .mmf-gp__words--cause {
		padding-top: 0.7rem;
	}

	.mmf-gpx .mmf-gp__langpick {
		top: 0.35rem;
		right: 0.4rem;
	}

	.mmf-gpx .mmf-gp__more,
	.mmf-gpx .mmf-gp__donate {
		flex: 1 1 auto;
		min-width: 0;
		min-height: 44px;
		padding: 0 0.9rem;
	}
}
