/**
 * Free gift popup — matches client mockup (dark teal, sharp corners, cream image tiles).
 * Three-column gift layout is preserved on all screen sizes; only type scales down on mobile.
 */

:root {
	--stfg-teal: #3d5a5a;
	--stfg-cream: #f5f1ea;
	--stfg-btn-bg: rgba(255, 255, 255, 0.14);
	--stfg-btn-border: rgba(255, 255, 255, 0.28);
}

.stfg-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, 0.65);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.stfg-overlay.is-visible {
	opacity: 1;
	visibility: visible;
}

.stfg-overlay[hidden] {
	display: none !important;
}

.stfg-overlay.is-visible[hidden] {
	display: flex !important;
}

.stfg-modal {
	position: relative;
	width: 100%;
	max-width: 960px;
	max-height: calc(100vh - 48px);
	overflow-x: hidden;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--stfg-teal);
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: 0;
	color: #fff;
	text-align: center;
	padding: 64px 56px 52px;
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.stfg-modal__inner {
	width: 100%;
	box-sizing: border-box;
}

.stfg-close {
	position: absolute;
	top: 18px;
	right: 22px;
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 24px;
	font-weight: 300;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	opacity: 0.9;
}

.stfg-close:hover,
.stfg-close:focus {
	opacity: 1;
}

.stfg-badge {
	margin: 0 0 18px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.95);
}

.stfg-title {
	margin: 0 0 22px;
	font-size: clamp(28px, 5vw, 42px);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1.15;
	color: #fff;
}

.stfg-description {
	margin: 0 0 44px;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.95);
}

.stfg-gifts {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 36px;
	width: 100%;
	box-sizing: border-box;
}

.stfg-gift {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	min-width: 0;
	width: 100%;
	box-sizing: border-box;
}

.stfg-gift__image-wrap {
	width: 100%;
	aspect-ratio: 1;
	background: var(--stfg-cream);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	margin-bottom: 20px;
	box-sizing: border-box;
	border-radius: 0;
}

.stfg-gift__image {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.stfg-gift__name {
	margin: 0 0 18px;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #fff;
	line-height: 1.25;
	word-break: break-word;
}

.stfg-gift__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	max-width: 180px;
	margin: 0 auto;
	padding: 14px 18px;
	background: var(--stfg-btn-bg);
	border: 1px solid var(--stfg-btn-border);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
	border-radius: 999px;
	box-sizing: border-box;
	white-space: nowrap;
	text-align: center;
	line-height: 1.2;
	transition: background 0.2s ease, border-color 0.2s ease;
}

.stfg-gift__btn:hover:not(:disabled),
.stfg-gift__btn:focus:not(:disabled) {
	background: rgba(255, 255, 255, 0.22);
	border-color: rgba(255, 255, 255, 0.4);
}

.stfg-gift__btn:disabled {
	opacity: 0.6;
	cursor: wait;
}

.stfg-free-label {
	font-weight: 600;
	color: var(--stfg-teal);
}

/* Tablet — same 3-column layout, slightly tighter spacing */
@media (max-width: 900px) {
	.stfg-modal {
		padding: 48px 24px 36px;
	}

	.stfg-gifts {
		gap: 16px;
	}

	.stfg-description {
		margin-bottom: 32px;
		font-size: 14px;
	}

	.stfg-gift__image-wrap {
		padding: 14px;
		margin-bottom: 14px;
	}

	.stfg-gift__name {
		font-size: 13px;
		margin-bottom: 12px;
	}

	.stfg-gift__btn {
		max-width: 100%;
		padding: 12px 10px;
		font-size: 9px;
		letter-spacing: 0.06em;
	}
}

/* Mobile — keep 3 products side by side; single-line pill buttons */
@media (max-width: 600px) {
	.stfg-overlay {
		padding: 4px;
		align-items: center;
	}

	.stfg-modal {
		max-height: calc(100vh - 8px);
		padding: 32px 6px 20px;
	}

	.stfg-close {
		top: 8px;
		right: 8px;
		font-size: 20px;
	}

	.stfg-badge {
		margin-bottom: 10px;
		font-size: 8px;
		letter-spacing: 0.14em;
	}

	.stfg-title {
		margin-bottom: 12px;
		font-size: 15px;
		letter-spacing: 0.05em;
	}

	.stfg-description {
		margin-bottom: 18px;
		font-size: 10px;
		line-height: 1.45;
		padding: 0 4px;
	}

	.stfg-gifts {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: 4px;
		padding: 0 2px;
	}

	.stfg-gift__image-wrap {
		padding: 6px;
		margin-bottom: 6px;
	}

	.stfg-gift__name {
		font-size: 7px;
		letter-spacing: 0.02em;
		margin-bottom: 6px;
		padding: 0 1px;
	}

	.stfg-gift__btn {
		width: 100%;
		max-width: 100%;
		margin: 0;
		padding: 7px 2px;
		font-size: 5px;
		letter-spacing: 0;
		line-height: 1;
		border-radius: 999px;
	}
}

/* iPhone SE and similar (375px) */
@media (max-width: 390px) {
	.stfg-modal {
		padding: 28px 4px 16px;
	}

	.stfg-title {
		font-size: 13px;
	}

	.stfg-description {
		font-size: 9px;
	}

	.stfg-gifts {
		gap: 3px;
	}

	.stfg-gift__name {
		font-size: 6px;
	}

	.stfg-gift__btn {
		padding: 6px 1px;
		font-size: 4.5px;
	}
}
