.tdp-has-popup { cursor: pointer; }

html.tdp-lock, html.tdp-lock body { overflow: hidden; }

.tdp-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	visibility: hidden;
	pointer-events: none;
}
.tdp-modal.is-open { visibility: visible; pointer-events: auto; }

.tdp-overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 12, 16, 0.72);
	opacity: 0;
	transition: opacity 0.22s ease;
}
.tdp-modal.is-open .tdp-overlay { opacity: 1; }

.tdp-dialog {
	--tdp-width: 760px;
	--tdp-accent: #1a1a1a;
	position: relative;
	width: 100%;
	max-width: var(--tdp-width);
	max-height: calc(100vh - 48px);
	max-height: calc(100dvh - 48px);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: #fff;
	color: #1f2328;
	border-radius: 6px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
	opacity: 0;
	transform: translateY(14px) scale(0.985);
	transition: opacity 0.22s ease, transform 0.22s ease;
	outline: none;
}
.tdp-modal.is-open .tdp-dialog { opacity: 1; transform: none; }

.tdp-close {
	position: sticky;
	top: 12px;
	float: right;
	margin: 12px 12px 0 0;
	z-index: 2;
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--tdp-accent);
	cursor: pointer;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
	padding: 0;
}
.tdp-close:hover { background: #fff; }
.tdp-close:focus-visible { outline: 2px solid var(--tdp-accent); outline-offset: 2px; }

.tdp-body { padding: 8px 32px 32px; line-height: 1.6; font-size: 16px; }
.tdp-body::after { content: ""; display: block; clear: both; }

.tdp-title { margin: 20px 56px 16px 0; font-size: 1.6em; line-height: 1.25; color: inherit; }

.tdp-cover { margin: 0 -32px 20px; }
.tdp-title + .tdp-cover { margin-top: 0; }
.tdp-cover img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: cover; }
.tdp-title:first-child + .tdp-cover, .tdp-body > .tdp-cover:first-child { clear: none; }

.tdp-body img { max-width: 100%; height: auto; }
.tdp-body a { color: var(--tdp-accent); }
.tdp-content > *:first-child { margin-top: 0; }
.tdp-content > *:last-child { margin-bottom: 0; }

.tdp-video { position: relative; margin: 20px 0 0; aspect-ratio: 16 / 9; background: #000; border-radius: 4px; overflow: hidden; }
.tdp-video iframe, .tdp-video video, .tdp-video .wp-video { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0; }
.tdp-video--file { aspect-ratio: auto; background: none; }
.tdp-video--file .wp-video, .tdp-video--file video { position: static; height: auto !important; }

.tdp-html { margin-top: 20px; }
.tdp-html iframe { max-width: 100%; }

@media (max-width: 600px) {
	.tdp-modal { padding: 0; align-items: flex-end; }
	.tdp-dialog {
		max-height: 92vh;
		max-height: 92dvh;
		border-radius: 14px 14px 0 0;
		transform: translateY(40px);
	}
	.tdp-body { padding: 4px 20px 28px; padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }
	.tdp-cover { margin: 0 -20px 16px; }
	.tdp-title { font-size: 1.35em; }
}

@media (prefers-reduced-motion: reduce) {
	.tdp-overlay, .tdp-dialog { transition: none; }
}

/* ---------- Кнопка и форма заявки ---------- */
.tdp-lead { margin-top: 28px; padding-top: 24px; border-top: 1px solid #e3e6ea; }

.tdp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 28px;
	border: 0;
	border-radius: 4px;
	background: var(--tdp-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	font-size: 1em;
	cursor: pointer;
	transition: filter 0.15s ease;
}
.tdp-btn:hover { filter: brightness(1.12); }
.tdp-btn:focus-visible { outline: 2px solid var(--tdp-accent); outline-offset: 3px; }
.tdp-btn:disabled { opacity: 0.6; cursor: wait; }
.tdp-lead-toggle { width: 100%; }
.tdp-lead-toggle[hidden] { display: none; }

.tdp-form[hidden] { display: none; }
.tdp-form { display: grid; gap: 14px; scroll-margin-top: 60px; }
.tdp-form-title { margin: 0; font-size: 1.2em; font-weight: 600; }
.tdp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tdp-field { display: grid; gap: 6px; font-size: 0.92em; margin: 0; }
.tdp-field span { color: #555c66; }
.tdp-field input, .tdp-field textarea {
	width: 100%;
	box-sizing: border-box;
	padding: 11px 12px;
	border: 1px solid #c9ced5;
	border-radius: 4px;
	background: #fff;
	color: #1f2328;
	font: inherit;
	font-size: 16px; /* без автозума на iPhone */
}
.tdp-field input:focus, .tdp-field textarea:focus { outline: none; border-color: var(--tdp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tdp-accent) 22%, transparent); }
.tdp-field textarea { resize: vertical; min-height: 80px; }

.tdp-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 0.85em; line-height: 1.45; color: #555c66; }
.tdp-consent input { margin-top: 3px; flex: none; width: 18px; height: 18px; accent-color: var(--tdp-accent); }

.tdp-form .tdp-btn { justify-self: start; }
.tdp-form-msg { margin: 0; font-size: 0.92em; min-height: 1em; }
.tdp-form-msg.is-error { color: #b32d2e; }
.tdp-form-done { padding: 18px 20px; border-radius: 4px; background: #eaf6ee; color: #1e5e33; font-weight: 500; }

.tdp-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 600px) {
	.tdp-row { grid-template-columns: 1fr; }
	.tdp-form .tdp-btn { justify-self: stretch; }
}
