/* "Scratch to Win" popup (assets/js/scratch-popup.js · template-parts/scratch-popup.php).
   Dark-teal blurred overlay, white floating card, gold foil (canvas), orange CTA — the site's own
   teal and orange (theme.css tokens).
   Uses the theme's fonts and motion tokens; prefers-reduced-motion is handled by theme.css. */

.mp-scratch {
	--sc-teal: var(--mp-teal, #1F4E5F);
	--sc-teal-dark: var(--mp-teal-dark, #163a47);
	--sc-teal-light: #2B6578;
	--sc-orange: var(--mp-orange, #F28C38);
	--sc-orange-hover: var(--mp-orange-hover, #E57D27);
	--sc-gold: #c9973a;
	position: fixed;
	inset: 0;
	z-index: 300;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: var(--mp-body, Inter, system-ui, sans-serif);
	color: #1E1E1E;
}
.mp-scratch__backdrop {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .06) 1px, transparent 1.5px) 0 0 / 22px 22px,
		radial-gradient(120% 90% at 20% 0%, rgba(43, 101, 120, .55), transparent 60%),
		linear-gradient(160deg, rgba(31, 78, 95, .94), rgba(15, 42, 52, .96));
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	opacity: 0;
	transition: opacity var(--mp-dur, 220ms) var(--mp-ease, ease);
}
.mp-scratch.is-open .mp-scratch__backdrop { opacity: 1; }

.mp-scratch__card {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 420px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #FFFFFF;
	border-radius: 24px;
	padding: 28px 28px 24px;
	text-align: center;
	box-shadow: 0 2px 6px rgba(15, 42, 52, .2), 0 40px 90px -30px rgba(0, 0, 0, .7);
	opacity: 0;
	transform: translateY(16px) scale(.98);
	transition: opacity var(--mp-dur-slow, 300ms) var(--mp-ease, ease), transform var(--mp-dur-slow, 300ms) var(--mp-ease, ease);
}
.mp-scratch.is-open .mp-scratch__card { opacity: 1; transform: none; }
.mp-scratch :focus-visible { outline: 3px solid var(--sc-teal); outline-offset: 2px; }
.mp-scratch .mp-scratch__card:focus { outline: none; } /* Focus moved to the dialog on open: no ring round the whole card. */

.mp-scratch__close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border: 0;
	border-radius: 50%;
	background: rgba(31, 78, 95, .08);
	color: var(--sc-teal);
	cursor: pointer;
}
.mp-scratch__close:hover { background: rgba(31, 78, 95, .15); }

/* Brand band across the very top of the card (bleeds into the card padding). */
.mp-scratch__brand {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: -28px -28px 22px;
	padding: 20px 56px 16px; /* 56px: clear of the close button. */
	border-bottom: 1px solid rgba(31, 78, 95, .12);
	font-family: var(--mp-head, Nunito, sans-serif);
	font-weight: 900;
	font-size: 21px;
	letter-spacing: .005em;
	color: var(--sc-teal);
}
.mp-scratch__brand svg { flex: none; width: 34px; height: 34px; }
.mp-scratch__title {
	margin: 0 0 8px;
	font-family: var(--mp-head, Nunito, sans-serif);
	font-weight: 900;
	font-size: 25px;
	line-height: 1.2;
	letter-spacing: -.01em;
	color: var(--sc-teal);
	text-wrap: balance;
}
.mp-scratch__text { margin: 0 0 18px; font-size: 15px; line-height: 1.5; color: var(--mp-muted, #555555); text-wrap: pretty; }
.mp-scratch__win { margin: 0 0 4px; font-weight: 700; font-size: 14px; color: #8a5a00; }

/* Stage 1: the scratch area. */
.mp-scratch__area {
	position: relative;
	height: 156px;
	border-radius: 16px;
	overflow: hidden;
	background: #FFF8F0;
	box-shadow: inset 0 0 0 2px #EADFC4;
}
.mp-scratch__prize {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
}
.mp-scratch__prize-big { font-family: var(--mp-head, Nunito, sans-serif); font-weight: 900; font-size: 44px; line-height: 1; color: var(--sc-teal); }
.mp-scratch__prize-sub { font-weight: 600; font-size: 14px; color: var(--mp-muted, #555555); }
.mp-scratch__foil {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	cursor: grab;
	touch-action: none; /* Scratch with a finger without scrolling the page. */
	transition: opacity .45s var(--mp-ease, ease);
}
.mp-scratch__foil:active { cursor: grabbing; }
.mp-scratch__foil.is-cleared { opacity: 0; pointer-events: none; }
.mp-scratch__reveal {
	margin-top: 12px;
	padding: 8px;
	border: 0;
	background: none;
	color: var(--mp-muted, #555555);
	font: 600 13px var(--mp-body, Inter, sans-serif);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

/* Stage 2: email. */
.mp-scratch__form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.mp-scratch__label { font-weight: 600; font-size: 14px; }
.mp-scratch__input {
	box-sizing: border-box;
	width: 100%;
	height: 52px;
	padding: 0 14px;
	border: 1.5px solid var(--mp-input, #D9CCBB);
	border-radius: 12px;
	background: #FFFFFF;
	font: 400 16px var(--mp-body, Inter, sans-serif); /* 16px: no zoom on iOS. */
	color: #1E1E1E;
}
.mp-scratch__input:focus { border-color: var(--sc-teal); outline: 3px solid rgba(31, 78, 95, .18); outline-offset: 0; }
.mp-scratch__input[aria-invalid="true"] { border-color: #B3261E; }
.mp-scratch__hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.mp-scratch__cta {
	width: 100%;
	height: 54px;
	margin-top: 4px;
	border: 0;
	border-radius: 999px;
	background: var(--sc-orange);
	color: #1E1E1E;
	font: 800 17px/1 var(--mp-body, Inter, sans-serif);
	cursor: pointer;
	transition: transform var(--mp-dur-fast, 150ms) var(--mp-ease, ease);
}
.mp-scratch__cta:hover { background: var(--sc-orange-hover); }
.mp-scratch__cta:active { transform: scale(.97); }
.mp-scratch__cta[aria-busy="true"] { opacity: .7; cursor: progress; }
.mp-scratch__consent { margin: 2px 0 0; font-size: 12px; line-height: 1.5; color: var(--mp-muted, #555555); }
.mp-scratch__consent a { color: var(--sc-teal); }
.mp-scratch__error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #FBE9E7; color: #7A1F16; font-size: 14px; }

/* Stage 3: success. */
.mp-scratch__tick { width: 56px; height: 56px; margin: 4px auto 12px; display: grid; place-items: center; border-radius: 50%; background: rgba(31, 78, 95, .1); color: var(--sc-teal); }
.mp-scratch__text--lead { font-size: 16px; color: var(--mp-charcoal, #1E1E1E); margin-bottom: 20px; }

.mp-scratch__confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }

@media (max-width: 479px) {
	.mp-scratch { padding: 12px; }
	.mp-scratch__card { padding: 24px 20px 20px; border-radius: 20px; max-height: calc(100dvh - 24px); }
	.mp-scratch__brand { margin: -24px -20px 18px; padding: 18px 52px 14px; font-size: 19px; }
	.mp-scratch__brand svg { width: 30px; height: 30px; }
	.mp-scratch__title { font-size: 22px; }
	.mp-scratch__area { height: 140px; }
	.mp-scratch__prize-big { font-size: 38px; }
}
