/* =====================================================================
   Gated Downloads — Public UI
   Neutral, theme-agnostic. Restyle via the CSS custom properties below —
   no !important needed.
   ===================================================================== */

.tslgd-btn-wrap,
.tslgd-overlay,
.tslgd-lock,
.tslgd-link {
	--tslgd-accent: #2563eb;
	--tslgd-accent-hover: #1d4ed8;
	--tslgd-accent-soft: rgba(37, 99, 235, 0.12);
	--tslgd-header-from: #111827;
	--tslgd-header-to: #1f2937;
	--tslgd-radius: 8px;
}

/* ---------- Trigger button ---------- */
.tslgd-btn-wrap {
	display: inline-block;
}

.tslgd-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--tslgd-accent, #2563eb);
	color: #fff;
	border: none;
	border-radius: var(--tslgd-radius, 8px);
	padding: 10px 18px;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
	font-family: inherit;
	line-height: 1.2;
	transition: background 0.2s, transform 0.15s;
	text-decoration: none;
}

.tslgd-btn:hover {
	background: var(--tslgd-accent-hover, #1d4ed8);
	transform: translateY(-1px);
}

.tslgd-btn:focus-visible {
	outline: 3px solid var(--tslgd-accent-soft, rgba(37, 99, 235, 0.12));
	outline-offset: 2px;
}

.tslgd-btn svg {
	flex-shrink: 0;
}

/* ---------- Overlay ---------- */
.tslgd-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(10, 12, 20, 0.65);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	align-items: center;
	justify-content: center;
	padding: 16px;
	animation: tslgd-fadein 0.2s ease;
}

.tslgd-overlay.is-open {
	display: flex;
}

@keyframes tslgd-fadein {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* ---------- Modal shell (flex column so body scrolls, header/footer stay) ---------- */
.tslgd-modal {
	background: #fff;
	border-radius: 14px;
	width: 100%;
	max-width: 440px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 4px 16px rgba(0, 0, 0, 0.1);
	animation: tslgd-slide-up 0.25s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.tslgd-modal .tslgd-form {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
}

@keyframes tslgd-slide-up {
	from { opacity: 0; transform: translateY(24px) scale(0.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Header band (separated, dark, colored icon) ---------- */
.tslgd-modal__header {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 13px;
	padding: 18px 20px;
	background: linear-gradient(135deg, var(--tslgd-header-from, #111827), var(--tslgd-header-to, #1f2937));
	color: #fff;
}

.tslgd-modal__icon {
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	border-radius: 10px;
	background: var(--tslgd-accent, #2563eb);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
}

.tslgd-modal__heading {
	flex: 1;
	min-width: 0;
}

.tslgd-modal__eyebrow {
	margin: 0 0 3px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.55);
}

.tslgd-modal__title {
	font-size: 16px;
	font-weight: 700;
	color: #fff;
	margin: 0;
	line-height: 1.25;
	word-break: break-word;
}

.tslgd-modal__subtitle {
	font-size: 11.5px;
	color: rgba(255, 255, 255, 0.7);
	margin: 3px 0 0;
}

.tslgd-modal__close {
	flex-shrink: 0;
	align-self: flex-start;
	background: transparent;
	border: none;
	width: 28px;
	height: 28px;
	border-radius: 7px;
	cursor: pointer;
	color: rgba(255, 255, 255, 0.7);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s, color 0.15s;
}

.tslgd-modal__close:hover {
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
}

.tslgd-modal__close:focus-visible {
	outline: 2px solid rgba(255, 255, 255, 0.6);
	outline-offset: 1px;
}

/* ---------- Body (scrollable) ---------- */
.tslgd-modal__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 18px 20px 6px;
}

/* ---------- Fields (compact) ---------- */
.tslgd-field {
	margin-bottom: 8px;
}

.tslgd-field label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: #374151;
	margin-bottom: 4px;
}

.tslgd-req {
	color: var(--tslgd-accent, #2563eb);
}

.tslgd-field input[type="text"],
.tslgd-field input[type="email"],
.tslgd-field input[type="tel"] {
	display: block;
	width: 100%;
	padding: 7px 11px;
	font-size: 13px;
	font-family: inherit;
	border: 1.5px solid #e2e5ea;
	border-radius: var(--tslgd-radius, 8px);
	color: #111;
	background: #fafbfc;
	box-sizing: border-box;
	transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
	outline: none;
}

.tslgd-field input:focus {
	border-color: var(--tslgd-accent, #2563eb);
	background: #fff;
	box-shadow: 0 0 0 3px var(--tslgd-accent-soft, rgba(37, 99, 235, 0.12));
}

.tslgd-field input.is-invalid {
	border-color: #d93025;
	box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.1);
}

.tslgd-field-error {
	display: block;
	font-size: 11px;
	color: #d93025;
	margin-top: 3px;
	min-height: 0;
}

.tslgd-field-error:empty {
	margin-top: 0;
}

.tslgd-field--consent label {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	font-weight: 400;
	font-size: 12px;
	color: #555;
	cursor: pointer;
}

.tslgd-field--consent input {
	margin-top: 2px;
}

/* ---------- Messages ---------- */
.tslgd-form__message {
	font-size: 13px;
	border-radius: var(--tslgd-radius, 8px);
	padding: 0;
	overflow: hidden;
}

.tslgd-form__message.is-success {
	padding: 10px 14px;
	margin-bottom: 6px;
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	color: #166534;
}

.tslgd-form__message.is-error {
	padding: 10px 14px;
	margin-bottom: 6px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: #991b1b;
}

/* ---------- Footer bar (separated) ---------- */
.tslgd-modal__footer {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 13px 20px;
	background: #f8fafc;
	border-top: 1px solid #eceff3;
}

.tslgd-privacy-note {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 11px;
	color: #6b7280;
	margin: 0;
	line-height: 1.35;
}

.tslgd-privacy-note svg {
	flex-shrink: 0;
	color: #9aa3af;
}

.tslgd-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-shrink: 0;
	padding: 10px 20px;
	background: var(--tslgd-accent, #2563eb);
	color: #fff;
	border: none;
	border-radius: var(--tslgd-radius, 8px);
	font-size: 13.5px;
	font-weight: 700;
	font-family: inherit;
	cursor: pointer;
	transition: background 0.2s, transform 0.15s;
}

.tslgd-submit:hover {
	background: var(--tslgd-accent-hover, #1d4ed8);
	transform: translateY(-1px);
}

.tslgd-submit:disabled {
	opacity: 0.65;
	cursor: not-allowed;
	transform: none;
}

.tslgd-submit:focus-visible {
	outline: 3px solid var(--tslgd-accent-soft, rgba(37, 99, 235, 0.12));
	outline-offset: 2px;
}

.tslgd-submit__loader {
	display: none;
	width: 15px;
	height: 15px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: tslgd-spin 0.7s linear infinite;
	flex-shrink: 0;
}

.tslgd-submit.is-loading .tslgd-submit__loader { display: block; }
.tslgd-submit.is-loading .tslgd-submit__text   { opacity: 0.85; }

@keyframes tslgd-spin {
	to { transform: rotate(360deg); }
}

/* ---------- Success state ---------- */
.tslgd-success {
	text-align: center;
	padding: 14px 0 10px;
}

.tslgd-success__icon {
	width: 52px;
	height: 52px;
	background: #f0fdf4;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0 auto 14px;
	color: #16a34a;
	font-size: 26px;
}

.tslgd-success h3 {
	font-size: 16px;
	font-weight: 700;
	color: #111;
	margin: 0 0 6px;
}

.tslgd-success p {
	font-size: 13px;
	color: #555;
	margin: 0;
}

/* ---------- Inline link trigger ---------- */
.tslgd-link {
	cursor: pointer;
	text-decoration: underline;
	color: var(--tslgd-accent, #2563eb);
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
}

.tslgd-link:hover,
.tslgd-link:focus-visible {
	color: var(--tslgd-accent-hover, #1d4ed8);
}

/* Inherit the theme's link color when placed inside body copy. */
.entry-content .tslgd-link,
.wp-block-post-content .tslgd-link {
	color: inherit;
}

/* ---------- Download count ---------- */
.tslgd-dl-count {
	display: block;
	margin-top: 6px;
	font-size: 11.5px;
	color: #6b7280;
	line-height: 1.4;
}

/* ---------- Auto-inserted button ---------- */
.tslgd-auto-insert {
	margin: 1.6em 0;
	padding: 18px 20px;
	border: 1.5px solid #e2e5ea;
	border-radius: 12px;
	background: #fafbfc;
	text-align: center;
}

.tslgd-auto-insert__heading {
	margin: 0 0 10px;
	font-size: 15px;
	font-weight: 700;
	color: #111827;
	line-height: 1.35;
}

/* ---------- Content Locker ---------- */
.tslgd-lock {
	position: relative;
	border: 1.5px solid #e2e5ea;
	border-radius: 12px;
	overflow: hidden;
	margin: 1.2em 0;
	background: #fff;
}

.tslgd-lock__preview {
	padding: 22px 24px 90px;
	filter: blur(5px);
	user-select: none;
	pointer-events: none;
}

.tslgd-lock__teaser {
	margin: 0;
	color: #4b5563;
	font-size: 14px;
	line-height: 1.6;
}

.tslgd-lock__bar {
	display: block;
	height: 12px;
	border-radius: 6px;
	background: linear-gradient(90deg, #e5e7eb, #d1d5db);
	margin-bottom: 10px;
}

.tslgd-lock__bar--short {
	width: 55%;
	margin-bottom: 0;
}

.tslgd-lock__panel {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 4px;
	padding: 20px;
	background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.92) 60%);
}

.tslgd-lock__icon {
	width: 40px;
	height: 40px;
	border-radius: 10px;
	background: var(--tslgd-accent-soft, rgba(37, 99, 235, 0.12));
	color: var(--tslgd-accent, #2563eb);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 4px;
}

.tslgd-lock__title {
	font-size: 16px;
	font-weight: 700;
	color: #111827;
	margin: 0;
	line-height: 1.3;
}

.tslgd-lock__hint {
	font-size: 12.5px;
	color: #6b7280;
	margin: 0 0 10px;
	line-height: 1.4;
}

/* Unlocked: drop the frame so the revealed content flows like normal copy. */
.tslgd-lock.is-unlocked {
	border: none;
	border-radius: 0;
	overflow: visible;
	background: transparent;
	margin: 0;
	animation: tslgd-fadein 0.35s ease;
}

/* Locker icon: same theme-hardening as the other inline icons. */
.tslgd-lock__icon svg,
.tslgd-lock .tslgd-btn svg {
	flex: 0 0 auto !important;
	max-width: none !important;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
	.tslgd-modal {
		max-width: 100%;
		border-radius: 12px;
	}
	.tslgd-modal__footer {
		flex-direction: column-reverse;
		align-items: stretch;
	}
	.tslgd-submit {
		width: 100%;
		padding: 12px;
	}
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.tslgd-overlay,
	.tslgd-modal,
	.tslgd-btn,
	.tslgd-submit,
	.tslgd-submit__loader {
		animation: none !important;
		transition: none !important;
	}
}

/* =====================================================================
   Theme-compatibility hardening
   Some themes and page builders (Twenty Twenty-Five, Elementor, etc.)
   apply aggressive global rules to `button` and `svg`. Two of them break
   the modal chrome: (1) forcing native `appearance` on <button>, so a
   transparent button reveals the browser's accent-colored native widget
   (e.g. a solid pink square where the close ✕ should be); (2) an
   `svg { width: auto | max-width: 100% }` rule that collapses inline
   flex-child icons to 0px wide, hiding the ✕ and download glyphs.
   These scoped !important resets keep the modal intact under ANY theme
   without touching the surrounding page. Only the plugin's own controls
   are targeted, so nothing outside .tslgd-* is affected.
   ===================================================================== */

/* Neutralize native / accent-colored button rendering on our controls. */
.tslgd-btn-wrap .tslgd-btn,
.tslgd-lock .tslgd-btn,
.tslgd-overlay .tslgd-modal__close,
.tslgd-overlay .tslgd-submit {
	-webkit-appearance: none !important;
	-moz-appearance: none !important;
	appearance: none !important;
	background-image: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	text-shadow: none !important;
	min-width: 0 !important;
	min-height: 0 !important;
	font-family: inherit !important;
}

/* Close button: force our transparent chrome no matter the theme's button styles. */
.tslgd-overlay .tslgd-modal__close {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	color: rgba(255, 255, 255, 0.7) !important;
	width: 28px !important;
	height: 28px !important;
	padding: 0 !important;
	border-radius: 7px !important;
}
.tslgd-overlay .tslgd-modal__close:hover {
	background: rgba(255, 255, 255, 0.14) !important;
	color: #fff !important;
}

/* Inline icons: keep intrinsic size. Themes commonly set `svg{width:auto}` or
   `img,svg{max-width:100%}`, which lets a flex-child icon shrink to 0px wide. */
.tslgd-overlay .tslgd-modal__icon svg {
	width: 22px !important;
	height: 22px !important;
	flex: 0 0 auto !important;
	max-width: none !important;
}
.tslgd-overlay .tslgd-modal__close svg {
	width: 18px !important;
	height: 18px !important;
	flex: 0 0 auto !important;
	max-width: none !important;
	stroke: currentColor !important;
	fill: none !important;
	vertical-align: middle;
}
.tslgd-btn svg,
.tslgd-overlay .tslgd-submit svg {
	flex: 0 0 auto !important;
	max-width: none !important;
}

/* Honeypot: parked far off-screen; never hide with display:none (bots skip those) */
.tslgd-hp {
	position: absolute !important;
	left: -9999px !important;
	top: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}
