/*
 * Impact theme styling for the ImpactLinq Subscribe popup (.bpe-popup).
 * Loaded only when that plugin's stylesheet is on the page. Desktop: two panels (story on the left,
 * form on the right). Phones: a compact bottom sheet. The plugin's markup and behaviour are unchanged.
 */

html .bpe-popup {
	--sub-dark: var(--c-dark, #1f2340);
	--sub-accent: var(--c-accent, #39bfbe);
	--sub-primary: var(--c-primary, #0c2ad1);
	--sub-line: var(--c-line, #e5e8f3);
	--sub-soft: var(--c-soft, #f4f6fd);
	--sub-text: var(--c-text, #2b3045);
	--sub-muted: var(--c-muted, #5d6378);
	--sub-r: 14px;
	--sub-field-r: 10px;
	font-family: var(--font, system-ui, sans-serif);
}
html .style-editorial .bpe-popup, html body.style-editorial .bpe-popup { --sub-r: 8px; --sub-field-r: 6px; }

/* ---------- Dialog: two panels ---------- */
html .bpe-popup .bpe-popup__backdrop { background: rgba(15, 18, 38, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
html .bpe-popup .bpe-popup__dialog {
	display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
	width: min(880px, 100%); max-height: calc(100vh - 32px); overflow: hidden auto;
	border-radius: calc(var(--sub-r) + 4px); background: #fff;
	box-shadow: 0 40px 80px -30px rgba(10, 14, 40, .6), 0 0 0 1px rgba(255, 255, 255, .06);
}

/* Left panel: the pitch. */
html .bpe-popup .bpe-popup__head {
	position: relative; display: flex; flex-direction: column; justify-content: center;
	padding: 44px 38px; min-height: 100%; overflow: hidden; isolation: isolate;
	background: var(--sub-dark); color: #fff;
}
html .bpe-popup .bpe-popup__head::before {
	content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
	background:
		radial-gradient(circle at 110% -10%, color-mix(in srgb, var(--sub-accent) 55%, transparent) 0, transparent 45%),
		radial-gradient(circle at -20% 120%, color-mix(in srgb, var(--sub-primary) 60%, transparent) 0, transparent 50%),
		radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1.3px) 0 0 / 18px 18px;
}
/* Decorative envelope card in the corner. */
html .bpe-popup .bpe-popup__head::after {
	content: ""; position: absolute; z-index: -1; right: -46px; bottom: -40px; width: 190px; height: 140px;
	border-radius: 18px; transform: rotate(-12deg); opacity: .16;
	background:
		linear-gradient(150deg, transparent 49%, #fff 50%, #fff 52%, transparent 53%) top left / 50% 60% no-repeat,
		linear-gradient(210deg, transparent 49%, #fff 50%, #fff 52%, transparent 53%) top right / 50% 60% no-repeat;
	border: 3px solid #fff;
}
html .bpe-popup .bpe-popup__badge {
	display: grid; width: 56px; height: 56px; margin: 0 0 22px; border-radius: 16px;
	background: var(--sub-accent); color: var(--sub-dark); border: 0;
	box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--sub-accent) 80%, transparent);
}
html .bpe-popup .bpe-popup__kicker {
	align-self: flex-start; gap: 8px; margin: 0 0 14px; padding: 6px 12px; border-radius: 999px;
	background: rgba(255, 255, 255, .1); color: #fff; font-size: .7rem; letter-spacing: .12em;
}
html .bpe-popup .bpe-popup__kicker::before { width: 7px; height: 7px; background: var(--sub-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sub-accent) 35%, transparent); }
html .bpe-popup .bpe-popup__head .bpe-popup__title {
	margin: 0 0 14px; color: #fff; -webkit-text-fill-color: #fff; background: none;
	font-size: clamp(1.55rem, 1.1rem + 1.6vw, 2.1rem); font-weight: 800; line-height: 1.12; letter-spacing: -.02em;
}
html .bpe-popup .bpe-popup__head .bpe-popup__text { margin: 0; color: rgba(255, 255, 255, .78); font-size: 1rem; line-height: 1.6; max-width: 34ch; }

/* Right panel: benefits + form. */
html .bpe-popup .bpe-popup__body { padding: 40px 36px 32px; align-self: center; }
html .bpe-popup .bpe-points { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; padding-right: 40px; }
html .bpe-popup .bpe-points li {
	display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 7px; border-radius: 999px;
	background: var(--sub-soft); border: 1px solid var(--sub-line); color: var(--sub-text); font-size: .78rem; font-weight: 600; line-height: 1.3;
}
html .bpe-popup .bpe-points svg { flex: none; width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: var(--sub-accent); color: var(--sub-dark); }

html .bpe-popup .bpe-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
html .bpe-popup .bpe-form > .bpe-field:nth-of-type(3), html .bpe-popup .bpe-form > .bpe-consent, html .bpe-popup .bpe-form > .bpe-error, html .bpe-popup .bpe-form > .bpe-submit, html .bpe-popup .bpe-form > .bpe-status { grid-column: 1 / -1; }
html .bpe-popup .bpe-field { gap: 6px; }
html .bpe-popup .bpe-field label { margin: 0; color: var(--sub-muted); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
html .bpe-popup .bpe-field input,
html .bpe-popup .bpe-field input[type="text"],
html .bpe-popup .bpe-field input[type="email"],
html .bpe-popup .bpe-field input[type="tel"] {
	width: 100%; min-height: 50px; margin: 0; padding: 12px 14px 12px 44px;
	background: #fff no-repeat 14px center / 18px 18px; color: var(--sub-text);
	border: 1.5px solid var(--sub-line); border-radius: var(--sub-field-r); box-shadow: none;
	font: 500 .98rem/1.3 inherit; transition: border-color .15s, box-shadow .15s;
}
html .bpe-popup #bpe-name { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a90a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"); }
html .bpe-popup #bpe-email { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a90a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='4' width='20' height='16' rx='2'/%3E%3Cpath d='m22 7-10 6L2 7'/%3E%3C/svg%3E"); }
html .bpe-popup #bpe-phone { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a90a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='6' y='2' width='12' height='20' rx='2'/%3E%3Cpath d='M11 18h2'/%3E%3C/svg%3E"); }
html .bpe-popup .bpe-field input::placeholder { color: #9aa0b6; opacity: 1; }
html .bpe-popup .bpe-field input:hover { border-color: #c9cede; }
html .bpe-popup .bpe-field input:focus { outline: 0; border-color: var(--sub-dark); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sub-accent) 28%, transparent); }
html .bpe-popup .bpe-field.has-error input { border-color: #d0384b; box-shadow: 0 0 0 4px rgba(208, 56, 75, .12); }
html .bpe-popup .bpe-error { font-size: .76rem; font-weight: 600; color: #c62839; }

html .bpe-popup .bpe-consent { grid-template-columns: 20px 1fr; gap: 10px; margin-top: 2px; font-size: .8rem; color: var(--sub-muted); }
html .bpe-popup .bpe-check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #c9cede; background: #fff; }
html .bpe-popup .bpe-consent input:checked + .bpe-check { background: var(--sub-dark); border-color: var(--sub-dark); }
html .bpe-popup .bpe-consent a { color: var(--sub-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

html body .bpe-popup .bpe-form .bpe-submit {
	position: relative; width: 100%; min-height: 54px; margin: 4px 0 0; padding: 0 22px;
	border: 0; border-radius: var(--sub-field-r); background: var(--sub-accent); color: var(--sub-dark);
	font: 800 1rem/1 inherit; letter-spacing: .01em; box-shadow: 0 14px 28px -14px color-mix(in srgb, var(--sub-accent) 90%, #000);
	transition: transform .15s, box-shadow .15s, filter .15s;
}
html body .bpe-popup .bpe-form .bpe-submit::after { content: "→"; margin-left: 10px; font-size: 1.15em; transition: transform .2s; }
html body .bpe-popup .bpe-form .bpe-submit:hover { filter: brightness(.96); transform: translateY(-1px); box-shadow: 0 18px 30px -14px color-mix(in srgb, var(--sub-accent) 90%, #000); }
html body .bpe-popup .bpe-form .bpe-submit:hover::after { transform: translateX(4px); }
html body .bpe-popup .bpe-form .bpe-submit[disabled]::after { content: ""; width: 16px; height: 16px; margin-left: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sub-spin .7s linear infinite; }
@keyframes sub-spin { to { transform: rotate(360deg); } }
html .bpe-popup .bpe-status { font-size: .82rem; }

/* Close button sits on the white panel. */
html .bpe-popup .bpe-popup__close { top: 14px; right: 14px; background: var(--sub-soft); color: var(--sub-dark); }
html .bpe-popup .bpe-popup__close:hover { background: var(--sub-line); }

/* Success state. */
html .bpe-popup .bpe-success { padding: 24px 0 8px; }
html .bpe-popup .bpe-success__icon { width: 72px; height: 72px; background: var(--sub-accent); color: var(--sub-dark); box-shadow: 0 0 0 10px color-mix(in srgb, var(--sub-accent) 20%, transparent); }
html .bpe-popup .bpe-success__text { color: var(--sub-dark); font-size: 1.15rem; font-weight: 800; }
html .bpe-popup .bpe-success .bpe-btn--ghost { border-radius: var(--sub-field-r); border: 1.5px solid var(--sub-dark); color: var(--sub-dark); }

/* Entrance. */
html .bpe-popup .bpe-popup__dialog { transform: translateY(24px) scale(.97); }
html .bpe-popup.is-open .bpe-popup__dialog { transform: none; }

/* Short desktop screens: tighter. */
@media (max-height: 760px) and (min-width: 721px) {
	html .bpe-popup .bpe-popup__head { padding: 30px 30px; }
	html .bpe-popup .bpe-popup__badge { display: none; }
	html .bpe-popup .bpe-popup__body { padding: 28px 30px 24px; }
	html .bpe-popup .bpe-points { margin-bottom: 16px; }
}

/* Tablets and phones: one column. */
@media (max-width: 720px) {
	html .bpe-popup .bpe-popup__dialog { grid-template-columns: 1fr; width: min(520px, 100%); }
	html .bpe-popup .bpe-popup__head { padding: 26px 24px 22px; min-height: 0; }
	html .bpe-popup .bpe-popup__head::after { display: none; }
	html .bpe-popup .bpe-popup__badge { display: none; }
	html .bpe-popup .bpe-popup__head .bpe-popup__title { font-size: 1.45rem; margin-bottom: 8px; padding-right: 36px; }
	html .bpe-popup .bpe-popup__head .bpe-popup__text { font-size: .92rem; }
	html .bpe-popup .bpe-popup__body { padding: 20px 24px 24px; }
	html .bpe-popup .bpe-popup__close { background: rgba(255, 255, 255, .14); color: #fff; }
	html .bpe-popup .bpe-popup__close:hover { background: rgba(255, 255, 255, .26); }
}
@media (max-width: 600px) {
	html .bpe-popup .bpe-popup__dialog { width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; }
	html .bpe-popup .bpe-popup__dialog::before { content: ""; position: absolute; z-index: 3; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: rgba(255, 255, 255, .35); }
	html .bpe-popup .bpe-popup__head { padding: 26px 20px 18px; }
	html .bpe-popup .bpe-popup__kicker { margin-bottom: 10px; }
	html .bpe-popup .bpe-popup__body { padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); }
	html .bpe-popup .bpe-points { display: grid; gap: 6px; margin-bottom: 16px; padding-right: 0; }
	html .bpe-popup .bpe-points li { padding: 0; border: 0; background: none; font-size: .82rem; font-weight: 500; }
	html .bpe-popup .bpe-form { gap: 10px; }
	html .bpe-popup .bpe-field input, html .bpe-popup .bpe-field input[type="text"], html .bpe-popup .bpe-field input[type="email"], html .bpe-popup .bpe-field input[type="tel"] { min-height: 46px; }
	html .bpe-popup .bpe-form { grid-template-columns: 1fr; gap: 12px; }
	html .bpe-popup .bpe-form > .bpe-field { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
	html body .bpe-popup .bpe-form .bpe-submit, html body .bpe-popup .bpe-form .bpe-submit::after { transition: none; }
}
