/*
 * System F skin for Metorik's "Save your cart?" popup (GROWTH-T13).
 * Markup: metorik/add-cart-email-form.php. Behaviour: assets/js/sf-cart-save.js.
 *
 * Every rule is prefixed `body` (or scoped to .sf-acp) so it outranks metorik.css and
 * tippy's injected core CSS on specificity alone, whatever order they load in. No
 * !important. Tokens are System F literals (DESIGN-REFERENCE.md section 1).
 */

/* Tippy box: a warm polaroid-paper card lifted off the cream page by the tile shadow. */
body .tippy-box[data-theme~='light']:has(.sf-acp) {
	background-color: #FAF6EC;
	color: #1A1714;
	border-radius: 8px;
	font-family: var(--font-body, "Manrope"), system-ui, sans-serif;
	font-size: 14px;
	line-height: 1.45;
	box-shadow:
		0 0 0 1px rgb(26 23 20 / 0.10),
		0 1px 2px rgba(26, 23, 20, 0.07),
		0 18px 34px -14px rgba(26, 23, 20, 0.32);
}
body .tippy-box[data-theme~='light']:has(.sf-acp) > .tippy-arrow {
	color: #FAF6EC;
}
body .tippy-box[data-theme~='light']:has(.sf-acp) > .tippy-content {
	padding: 0;
}

/* Root. Metorik's base sets max-width 300 + padding; we size for a 390px phone. */
body .metorik-add-cart-email-form.sf-acp {
	position: relative;
	width: min(320px, calc(100vw - 32px));
	max-width: none;
	box-sizing: border-box;
	padding: 26px 20px 18px;
	text-align: left;
}

/* Distinctive move: a pink post-it tab tucked over the top edge, in the hero's
   hand-written voice. Decorative (aria-hidden); ink on pink is 4.9:1. */
.sf-acp .sf-acp__tab {
	position: absolute;
	top: -13px;
	left: 16px;
	padding: 3px 12px 4px;
	background: #E8356B;
	color: #1A1714;
	font-family: var(--font-hand, "Caveat"), cursive;
	font-weight: 700;
	font-size: 19px;
	line-height: 1;
	border-radius: 2px;
	transform: rotate(-4deg);
	box-shadow: 0 2px 3px rgba(26, 23, 20, 0.12), 0 8px 14px -8px rgba(232, 53, 107, 0.55);
	pointer-events: none;
}

.sf-acp .sf-acp__title {
	margin: 0 36px 6px 0;
	font-family: var(--font-headline, "Epilogue"), system-ui, sans-serif;
	font-style: italic;
	font-weight: 900;
	font-size: 24px;
	line-height: 1.02;
	letter-spacing: -0.03em;
	color: #1A1714;
}

.sf-acp .sf-acp__why {
	margin: 0 0 14px;
	font-size: 13px;
	line-height: 1.5;
	color: #3A342E;
}

/* Close: a real <button>, 44px hit area, quiet until hovered. */
body .metorik-add-cart-email-form.sf-acp .close-button {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 9999px;
	background: transparent;
	color: #6B625A;
	font-size: 0;
	line-height: 0;
	cursor: pointer;
	transition: background-color 150ms ease, color 150ms ease;
}
body .metorik-add-cart-email-form.sf-acp .close-button:hover {
	background: rgb(26 23 20 / 0.06);
	color: #1A1714;
}

/* Input + Save pill on one row. */
.sf-acp .sf-acp__row {
	display: flex;
	align-items: stretch;
	gap: 8px;
}
body .metorik-add-cart-email-form.sf-acp .email-input-wrapper {
	position: relative;
	display: block;
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}
body .metorik-add-cart-email-form.sf-acp .email-input {
	display: block;
	width: 100%;
	height: 44px;
	box-sizing: border-box;
	margin: 0;
	padding: 0 40px 0 16px;
	border: 1px solid rgb(26 23 20 / 0.16);
	border-radius: 9999px;
	background: #EDE6D8;
	color: #1A1714;
	font-family: inherit;
	font-size: 16px; /* 16px stops iOS zooming the page on focus. */
	line-height: 1;
	box-shadow: none;
	transition: border-color 150ms ease, background-color 150ms ease;
}
body .metorik-add-cart-email-form.sf-acp .email-input::placeholder {
	color: #6B625A;
	opacity: 1;
}
body .metorik-add-cart-email-form.sf-acp .email-input:hover {
	border-color: rgb(26 23 20 / 0.35);
}
body .metorik-add-cart-email-form.sf-acp .email-input:focus {
	background: #F4EFE6;
	border-color: #1A1714;
}
body .metorik-add-cart-email-form.sf-acp.is-invalid .email-input {
	border-color: #C72248;
}

.sf-acp .sf-acp__save {
	flex: 0 0 auto;
	height: 44px;
	margin: 0;
	padding: 0 20px;
	border: 0;
	border-radius: 9999px;
	background: #E8356B;
	color: #1A1714;
	font-family: var(--font-body, "Manrope"), system-ui, sans-serif;
	font-weight: 700;
	font-size: 12px;
	line-height: 1;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	cursor: pointer;
	box-shadow: 0 6px 18px rgba(232, 53, 107, 0.32);
	transition: background-color 150ms ease;
}
.sf-acp .sf-acp__save:hover {
	background: #D42659;
}
.sf-acp .sf-acp__save:active {
	background: #E31754;
}
.sf-acp.is-saved .sf-acp__save {
	background: #1A1714;
	color: #F4EFE6;
	box-shadow: none;
}

/* Pink focus ring on every control (the theme zeroes outlines on :focus). */
.sf-acp .close-button:focus-visible,
.sf-acp .sf-acp__save:focus-visible,
.sf-acp .email-input:focus-visible,
.sf-acp .email-usage-notice a:focus-visible {
	outline: 2px solid #E8356B;
	outline-offset: 2px;
}

/* Success: Metorik adds .success to the wrapper once it has captured the email.
   Replace its green text tick with an ink tick in a pink disc inside the field. */
body .metorik-add-cart-email-form.sf-acp .email-input-wrapper.success::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 10px;
	width: 22px;
	height: 22px;
	margin-top: -11px;
	border-radius: 9999px;
	background: #E8356B url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M6.5 11.5l3 3 6-6.5' fill='none' stroke='%231A1714' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 22px 22px no-repeat;
	color: transparent;
	font-size: 0;
	animation: sf-acp-pop 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
body .metorik-add-cart-email-form.sf-acp .email-input-wrapper.success .email-input {
	border-color: #1A1714;
}
@keyframes sf-acp-pop {
	from { transform: scale(0.6); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

/* Status line: empty (collapsed) until there's something to say. */
.sf-acp .sf-acp__status {
	margin: 0;
	font-size: 12px;
	line-height: 1.4;
	color: #3A342E;
}
.sf-acp .sf-acp__status:not(:empty) {
	margin-top: 8px;
}
.sf-acp.is-invalid .sf-acp__status {
	color: #C72248;
}

body .metorik-add-cart-email-form.sf-acp .email-usage-notice {
	margin: 10px 0 0;
	padding: 0;
	font-size: 11px;
	line-height: 1.45;
	color: #6B625A;
}
.sf-acp .email-usage-notice a {
	color: #1A1714;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.sf-acp .sf-acp__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (prefers-reduced-motion: reduce) {
	.sf-acp .sf-acp__tab { transform: none; }
	body .metorik-add-cart-email-form.sf-acp .email-input-wrapper.success::after { animation: none; }
	.sf-acp .close-button,
	.sf-acp .sf-acp__save,
	.sf-acp .email-input { transition: none; }
}
