/**
 * Production Popups Styles: Free Design Consultation & Exit-Intent Callback.
 * Designed to strictly match The Wood Cabinet Factory's editorial aesthetic.
 *
 * @package Room_And_Hearth
 */

:root {
	--rh-popup-cream: #faf9f5;
	--rh-popup-white: #ffffff;
	--rh-popup-ink: #1f1b16;
	--rh-popup-ink-dark: #12100e;
	--rh-popup-muted: #6a6358;
	--rh-popup-terracotta: #b8532f;
	--rh-popup-terracotta-dark: #9f4423;
	--rh-popup-border: #e3ded5;
	--rh-popup-bg-input: #f7f5f0;
	--rh-popup-radius: 18px;
	--rh-popup-serif: 'Playfair Display', Georgia, serif;
	--rh-popup-sans: 'DM Sans', Arial, sans-serif;
}

/* ==========================================================================
   1. Popup Overlay & Backdrop
   ========================================================================== */
.rh-popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 100002; /* Higher than sticky bars and header */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s cubic-bezier(0.16, 1, 0.3, 1);
	box-sizing: border-box;
}

.rh-popup-overlay.is-active {
	visibility: visible;
	opacity: 1;
	pointer-events: auto;
}

.rh-popup-backdrop {
	position: absolute;
	inset: 0;
	background-color: rgba(18, 16, 14, 0.65);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
}

/* ==========================================================================
   2. Dialog Container
   ========================================================================== */
.rh-popup-dialog {
	position: relative;
	background-color: var(--rh-popup-white);
	border-radius: var(--rh-popup-radius);
	box-shadow: 0 28px 70px rgba(0, 0, 0, 0.26), 0 8px 24px rgba(0, 0, 0, 0.12);
	width: 100%;
	max-height: calc(100vh - 48px);
	overflow: hidden;
	z-index: 1;
	transform: scale(0.95) translateY(12px);
	transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
	box-sizing: border-box;
}

.rh-popup-overlay.is-active .rh-popup-dialog {
	transform: scale(1) translateY(0);
}

.rh-popup-dialog--consultation {
	max-width: 860px;
}

.rh-popup-dialog--exit-intent {
	max-width: 700px;
}

/* Accessible Close Button */
.rh-popup-close {
	position: absolute;
	top: 18px;
	right: 18px;
	background: rgba(255, 255, 255, 0.85);
	border: 1px solid rgba(0, 0, 0, 0.06);
	cursor: pointer;
	padding: 7px;
	color: #7d7569;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 10;
	transition: color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.rh-popup-close:hover,
.rh-popup-close:focus-visible {
	color: var(--rh-popup-ink);
	background-color: #f1ede6;
	outline: none;
	transform: scale(1.05);
}

/* ==========================================================================
   3. Typography & Badges
   ========================================================================== */
.rh-popup-eyebrow {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--rh-popup-muted);
	margin-bottom: 8px;
}

.rh-popup-eyebrow__dash {
	color: var(--rh-popup-terracotta);
	font-weight: 800;
}

.rh-popup-title {
	font-family: var(--rh-popup-serif);
	font-size: 28px;
	font-weight: 600;
	color: var(--rh-popup-ink);
	line-height: 1.18;
	letter-spacing: -0.025em;
	margin: 0 0 8px;
}

.rh-popup-title--exit {
	font-size: 27px;
}

.rh-popup-subtitle {
	font-size: 13.5px;
	color: var(--rh-popup-muted);
	line-height: 1.48;
	margin: 0 0 16px;
}

/* ==========================================================================
   4. Consultation Popup Layout (2 Columns)
   ========================================================================== */
.rh-popup-grid {
	display: grid;
	grid-template-columns: 40% 60%;
	align-items: stretch;
	min-height: 520px;
}

.rh-popup-media {
	position: relative;
	background-color: #e8e4db;
	overflow: hidden;
}

.rh-popup-media__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

.rh-popup-body {
	padding: 36px 36px 28px;
	background-color: var(--rh-popup-white);
	display: flex;
	flex-direction: column;
	justify-content: center;
	overflow-y: auto;
	box-sizing: border-box;
}

/* ==========================================================================
   5. Form Controls
   ========================================================================== */
.rh-popup-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 22px;
}

.rh-popup-field {
	position: relative;
	width: 100%;
}

.rh-popup-field__icon {
	position: absolute;
	left: 14px;
	top: 50%;
	transform: translateY(-50%);
	color: #8c8579;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.rh-popup-input,
.rh-popup-select {
	width: 100%;
	height: 44px;
	padding: 10px 14px 10px 42px;
	font-size: 13.5px;
	font-family: inherit;
	color: var(--rh-popup-ink);
	background-color: var(--rh-popup-bg-input);
	border: 1px solid var(--rh-popup-border);
	border-radius: 8px;
	outline: none;
	box-sizing: border-box;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.rh-popup-input::placeholder {
	color: #8f887c;
}

.rh-popup-input:focus,
.rh-popup-select:focus {
	background-color: #ffffff;
	border-color: var(--rh-popup-terracotta);
	box-shadow: 0 0 0 3px rgba(184, 83, 47, 0.14);
}

.rh-popup-field--select .rh-popup-select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding-right: 36px;
	cursor: pointer;
}

.rh-popup-select__chevron {
	position: absolute;
	right: 14px;
	top: 50%;
	transform: translateY(-50%);
	pointer-events: none;
	color: #7e786e;
	display: flex;
	align-items: center;
}

/* ==========================================================================
   6. Buttons & Actions
   ========================================================================== */
.rh-popup-btn {
	width: 100%;
	height: 48px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	font-size: 13.5px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 8px;
	cursor: pointer;
	text-decoration: none;
	border: none;
	box-sizing: border-box;
	transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.rh-popup-btn--terracotta {
	background-color: var(--rh-popup-terracotta);
	color: #ffffff !important;
	box-shadow: 0 3px 8px rgba(184, 83, 47, 0.28);
}

.rh-popup-btn--terracotta:hover:not(:disabled),
.rh-popup-btn--terracotta:focus-visible:not(:disabled) {
	background-color: var(--rh-popup-terracotta-dark);
	box-shadow: 0 5px 12px rgba(184, 83, 47, 0.36);
	transform: translateY(-1px);
	outline: none;
}

.rh-popup-btn--outline {
	background-color: #ffffff;
	color: var(--rh-popup-ink) !important;
	border: 1.5px solid #d8d3c9;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.rh-popup-btn--outline:hover,
.rh-popup-btn--outline:focus-visible {
	background-color: #f7f4ed;
	border-color: #beb8ac;
	color: var(--rh-popup-ink-dark) !important;
	outline: none;
}

.rh-popup-btn__arrow {
	font-size: 16px;
	line-height: 1;
	transition: transform 0.15s ease;
}

.rh-popup-btn:hover .rh-popup-btn__arrow {
	transform: translateX(3px);
}

.rh-popup-btn:disabled {
	opacity: 0.72;
	cursor: not-allowed;
}

/* ==========================================================================
   7. Value Proposition Row (Consultation Popup)
   ========================================================================== */
.rh-popup-features {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px;
	padding-top: 14px;
	border-top: 1px solid var(--rh-popup-border);
}

.rh-popup-feature {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 6px;
}

.rh-popup-feature__icon {
	color: #7b7468;
	display: flex;
	align-items: center;
	justify-content: center;
}

.rh-popup-feature__text {
	font-size: 11px;
	font-weight: 600;
	line-height: 1.32;
	color: #3b362f;
}

/* ==========================================================================
   8. Exit-Intent Callback Popup Layout
   ========================================================================== */
.rh-exit-card {
	display: flex;
	flex-direction: column;
	background-color: var(--rh-popup-white);
}

.rh-exit-card__main {
	display: grid;
	grid-template-columns: 58% 42%;
	align-items: stretch;
	min-height: 340px;
}

.rh-exit-card__content {
	padding: 38px 36px 30px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	box-sizing: border-box;
}

.rh-exit-card__visual {
	position: relative;
	background-color: #e5e0d7;
	overflow: hidden;
}

.rh-exit-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: right top;
	display: block;
}

.rh-exit-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-top: 6px;
}

/* Exit Intent Bottom Strip */
.rh-exit-strip {
	display: grid;
	grid-template-columns: 1fr auto 1fr auto 1fr;
	align-items: center;
	background-color: #f7f5ef;
	border-top: 1px solid var(--rh-popup-border);
	padding: 14px 24px;
	gap: 12px;
	box-sizing: border-box;
}

.rh-exit-strip__item {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-size: 11.5px;
	font-weight: 600;
	color: #3f3a33;
	text-align: center;
}

.rh-exit-strip__icon {
	color: #7a7266;
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.rh-exit-strip__divider {
	width: 1px;
	height: 24px;
	background-color: var(--rh-popup-border);
}

/* ==========================================================================
   9. Status Messages & Alerts
   ========================================================================== */
.rh-popup-status {
	padding: 10px 14px;
	border-radius: 6px;
	font-size: 13px;
	line-height: 1.4;
	text-align: center;
	box-sizing: border-box;
}

.rh-popup-status--success {
	background-color: #edf7ee;
	color: #1e6628;
	border: 1px solid #c2e5c6;
}

.rh-popup-status--error {
	background-color: #fdf0ee;
	color: #b22718;
	border: 1px solid #f6cfc9;
}

/* ==========================================================================
   10. Responsive Breakpoints
   ========================================================================== */
@media (max-width: 820px) {
	.rh-popup-grid {
		grid-template-columns: 1fr;
	}

	.rh-popup-media {
		height: 180px;
	}

	.rh-popup-body {
		padding: 26px 24px 22px;
	}

	.rh-popup-title {
		font-size: 24px;
	}

	.rh-exit-card__main {
		grid-template-columns: 1fr;
	}

	.rh-exit-card__visual {
		display: none; /* Keep content focused on mobile */
	}

	.rh-exit-card__content {
		padding: 30px 24px 24px;
	}

	.rh-exit-strip {
		grid-template-columns: 1fr;
		gap: 8px;
		padding: 12px 18px;
	}

	.rh-exit-strip__divider {
		display: none;
	}
}

@media (max-width: 480px) {
	.rh-popup-overlay {
		padding: 12px;
	}

	.rh-popup-dialog {
		max-height: calc(100vh - 24px);
		border-radius: 14px;
	}

	.rh-popup-media {
		height: 140px;
	}

	.rh-popup-body {
		padding: 20px 16px 18px;
	}

	.rh-popup-features {
		grid-template-columns: 1fr;
		gap: 8px;
	}

	.rh-popup-feature {
		flex-direction: row;
		text-align: left;
		justify-content: flex-start;
		gap: 10px;
	}

	.rh-popup-title {
		font-size: 22px;
	}
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
	.rh-popup-overlay,
	.rh-popup-dialog,
	.rh-popup-btn,
	.rh-popup-close {
		transition-duration: 0.01ms !important;
		transform: none !important;
	}
}
