/* Phil's Popup — front-end styles.
   Brand values follow phils.se: deep teal leads, cream paper, sparing gold.
   Everything reads the custom properties below, so a theme can retint the
   popup by overriding --phils-popup-* on :root. */

#phils-popup {
	--phils-popup-teal: #00594e;
	--phils-popup-night: #00463d;
	--phils-popup-paper: #f5f5e9;
	--phils-popup-ink: #14211d;
	--phils-popup-gold: #c9a23f;
	--phils-popup-radius: 12px;
	--phils-popup-max-w: 34rem;

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25rem;
	opacity: 0;
	transition: opacity 0.3s ease;
}

#phils-popup.is-open {
	opacity: 1;
}

#phils-popup[hidden] {
	display: none;
}

.phils-popup__backdrop {
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--phils-popup-night) 72%, black);
	opacity: 0.82;
	cursor: pointer;
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.phils-popup__backdrop {
		background: var(--phils-popup-night);
	}
}

.phils-popup__dialog {
	position: relative;
	width: 100%;
	max-width: var(--phils-popup-max-w);
	max-height: min(86vh, 46rem);
	overflow: hidden;
	border-radius: var(--phils-popup-radius);
	background: var(--phils-popup-paper);
	color: var(--phils-popup-ink);
	box-shadow: 0 24px 60px rgba(0, 20, 17, 0.35);
	display: flex;
	flex-direction: column;
	transform: translateY(12px) scale(0.98);
	transition: transform 0.3s ease;
}

#phils-popup.is-open .phils-popup__dialog {
	transform: translateY(0) scale(1);
}

/* ---- Media background variant: media fills the card, copy overlays it ---- */

.phils-popup--has-media .phils-popup__dialog {
	min-height: min(70vh, 34rem);
	background: var(--phils-popup-night);
	color: #fff;
	justify-content: flex-end;
}

.phils-popup__media {
	position: absolute;
	inset: 0;
}

.phils-popup__media img,
.phils-popup__media video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Readability overlay, deepest where the copy sits — like the site's
   wordmark-over-food treatment. Only when there is copy to protect. */
.phils-popup--has-media .phils-popup__media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(
		to top,
		rgba(0, 40, 35, 0.88) 0%,
		rgba(0, 40, 35, 0.45) 45%,
		rgba(0, 40, 35, 0.12) 100%
	);
}

.phils-popup--no-copy .phils-popup__media::after {
	background: none;
}

/* ---- Content ---- */

.phils-popup__content {
	position: relative;
	padding: 1.75rem 1.75rem 2rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	align-items: flex-start;
}

.phils-popup--plain .phils-popup__content {
	padding-top: 2.25rem;
}

.phils-popup__title {
	margin: 0;
	font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
	font-weight: 800;
	font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem);
	line-height: 1.15;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	text-wrap: balance;
	color: var(--phils-popup-teal);
}

.phils-popup--has-media .phils-popup__title {
	color: #fff;
}

.phils-popup__desc {
	font-family: "Courier Prime", "Courier New", monospace;
	font-size: 0.95rem;
	line-height: 1.6;
	max-width: 52ch;
}

.phils-popup__desc p {
	margin: 0 0 0.6em;
}

.phils-popup__desc p:last-child {
	margin-bottom: 0;
}

.phils-popup__desc a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.phils-popup--has-media .phils-popup__desc {
	color: rgba(255, 255, 255, 0.92);
}

.phils-popup__cta {
	display: inline-block;
	margin-top: 0.5rem;
	padding: 0.7rem 1.5rem;
	font-family: "Courier Prime", "Courier New", monospace;
	font-weight: 700;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	text-decoration: none;
	border-radius: 999px;
	background: var(--phils-popup-teal);
	color: #fff;
	border: 1px solid var(--phils-popup-teal);
	transition: background 0.2s ease, color 0.2s ease;
}

.phils-popup__cta:hover,
.phils-popup__cta:focus-visible {
	background: var(--phils-popup-night);
	color: #fff;
}

.phils-popup--has-media .phils-popup__cta {
	background: #fff;
	border-color: #fff;
	color: var(--phils-popup-night);
}

.phils-popup--has-media .phils-popup__cta:hover,
.phils-popup--has-media .phils-popup__cta:focus-visible {
	background: var(--phils-popup-gold);
	border-color: var(--phils-popup-gold);
	color: var(--phils-popup-night);
}

/* ---- Close button ---- */

.phils-popup__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	z-index: 2;
	width: 2.25rem;
	height: 2.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	background: rgba(0, 40, 35, 0.35);
	color: #fff;
	transition: background 0.2s ease;
}

.phils-popup--plain .phils-popup__close {
	background: rgba(20, 33, 29, 0.08);
	color: var(--phils-popup-ink);
}

.phils-popup__close:hover,
.phils-popup__close:focus-visible {
	background: var(--phils-popup-teal);
	color: #fff;
}

/* ---- Small screens & motion ---- */

@media (max-width: 480px) {
	#phils-popup {
		padding: 0.75rem;
	}

	.phils-popup__content {
		padding: 1.25rem 1.25rem 1.5rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	#phils-popup,
	.phils-popup__dialog {
		transition: none;
	}
}

body.phils-popup-open {
	overflow: hidden;
}
