/* LLT Popup — styl frontendu. Responsywny: telefon / tablet / monitor. */

#lltp-overlay,
#lltp-overlay * {
	box-sizing: border-box;
}

#lltp-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(12px, 4vw, 40px);
	background: rgba(8, 14, 20, var(--lltp-overlay, 0.7));
	opacity: 0;
	visibility: hidden;
	transition: opacity .28s ease, visibility .28s ease;
	-webkit-overflow-scrolling: touch;
}

#lltp-overlay[hidden] {
	display: none;
}

#lltp-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

/* Pozycje narożne */
#lltp-overlay.lltp-pos-bottom-right {
	align-items: flex-end;
	justify-content: flex-end;
	background: transparent;
	pointer-events: none;
}

#lltp-overlay.lltp-pos-bottom-left {
	align-items: flex-end;
	justify-content: flex-start;
	background: transparent;
	pointer-events: none;
}

#lltp-overlay.lltp-pos-bottom-right .lltp-modal,
#lltp-overlay.lltp-pos-bottom-left .lltp-modal {
	pointer-events: auto;
	max-width: min(var(--lltp-max, 640px), 420px);
	box-shadow: 0 18px 50px rgba(8, 14, 20, .28);
}

/* Okno */
.lltp-modal {
	position: relative;
	width: 100%;
	max-width: var(--lltp-max, 640px);
	max-height: calc(100vh - 24px);
	max-height: calc(100dvh - 24px);
	overflow-y: auto;
	overflow-x: hidden;
	background: var(--lltp-bg, #fff);
	color: var(--lltp-text, #16202a);
	border-radius: var(--lltp-radius, 18px);
	box-shadow: 0 24px 70px rgba(8, 14, 20, .35);
	transform: translateY(16px) scale(.98);
	opacity: 0;
	transition: transform .32s cubic-bezier(.22, .68, 0, 1), opacity .32s ease;
	outline: none;
	overscroll-behavior: contain;
}

#lltp-overlay.is-open .lltp-modal {
	transform: translateY(0) scale(1);
	opacity: 1;
}

/* Przycisk zamykania */
.lltp-close {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 5;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	color: #16202a;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(8, 14, 20, .18);
	transition: transform .18s ease, background .18s ease;
}

.lltp-close svg {
	width: 20px;
	height: 20px;
	display: block;
}

.lltp-close:hover,
.lltp-close:focus-visible {
	background: #fff;
	transform: rotate(90deg);
}

/* Grafika i karuzela */
.lltp-media {
	position: relative;
	overflow: hidden;
	background: rgba(8, 14, 20, .05);
	border-radius: var(--lltp-radius, 18px) var(--lltp-radius, 18px) 0 0;
}

.lltp-track {
	display: flex;
	width: 100%;
	transition: transform .4s cubic-bezier(.22, .68, 0, 1);
	touch-action: pan-y;
}

.lltp-slide {
	flex: 0 0 100%;
	min-width: 100%;
}

.lltp-slide a {
	display: block;
	line-height: 0;
}

.lltp-media img {
	display: block;
	width: 100%;
	height: auto;
	max-height: 56vh;
	object-fit: var(--lltp-fit, cover);
	object-position: center;
}

.lltp-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .88);
	color: #16202a;
	cursor: pointer;
	box-shadow: 0 2px 10px rgba(8, 14, 20, .18);
	transition: background .18s ease;
}

.lltp-arrow svg {
	width: 22px;
	height: 22px;
}

.lltp-arrow:hover,
.lltp-arrow:focus-visible {
	background: #fff;
}

.lltp-prev {
	left: 10px;
}

.lltp-next {
	right: 10px;
}

.lltp-dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 10px;
	display: flex;
	gap: 7px;
	align-items: center;
	justify-content: center;
}

.lltp-dot {
	width: 9px;
	height: 9px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .6);
	box-shadow: 0 0 0 1px rgba(8, 14, 20, .18);
	cursor: pointer;
	transition: transform .18s ease, background .18s ease;
}

.lltp-dot.is-active {
	background: #fff;
	transform: scale(1.35);
}

/* Treść */
.lltp-body {
	padding: clamp(18px, 3.4vw, 32px);
}

.lltp-heading {
	margin: 0 0 10px;
	font-size: clamp(20px, 2.4vw, 28px);
	line-height: 1.22;
	font-weight: 700;
	color: inherit;
}

.lltp-text {
	font-size: clamp(15px, 1.5vw, 17px);
	line-height: 1.6;
	color: inherit;
	opacity: .9;
}

.lltp-text p {
	margin: 0 0 .7em;
	color: inherit;
}

.lltp-text p:last-child {
	margin-bottom: 0;
}

.lltp-text a {
	color: var(--lltp-accent, #2f7d32);
}

.lltp-text ul,
.lltp-text ol {
	margin: 0 0 .7em 1.2em;
	padding: 0;
}

.lltp-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 20px;
}

.lltp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 24px;
	border: 2px solid var(--lltp-accent, #2f7d32);
	border-radius: 999px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: transform .18s ease, filter .18s ease, background .18s ease, color .18s ease;
}

.lltp-btn-primary {
	background: var(--lltp-accent, #2f7d32);
	color: var(--lltp-accent-tx, #fff);
}

.lltp-btn-primary:hover,
.lltp-btn-primary:focus-visible {
	color: var(--lltp-accent-tx, #fff);
	filter: brightness(1.08);
	transform: translateY(-1px);
}

.lltp-btn-ghost {
	background: transparent;
	color: var(--lltp-accent, #2f7d32);
}

.lltp-btn-ghost:hover,
.lltp-btn-ghost:focus-visible {
	background: var(--lltp-accent, #2f7d32);
	color: var(--lltp-accent-tx, #fff);
}

.lltp-dismiss {
	display: inline-block;
	margin-top: 14px;
	padding: 6px 0;
	border: 0;
	background: none;
	color: inherit;
	opacity: .6;
	font-size: 14px;
	text-decoration: underline;
	cursor: pointer;
}

.lltp-dismiss:hover {
	opacity: 1;
}

#lltp-overlay :focus-visible {
	outline: 3px solid var(--lltp-accent, #2f7d32);
	outline-offset: 2px;
}

/* Układ „grafika obok tekstu” — od tabletu w poziomie / monitora */
@media (min-width: 900px) {
	#lltp-overlay.lltp-layout-side .lltp-modal {
		display: grid;
		grid-template-columns: 1fr 1fr;
		align-items: stretch;
	}

	#lltp-overlay.lltp-layout-side .lltp-media {
		height: 100%;
		border-radius: var(--lltp-radius, 18px) 0 0 var(--lltp-radius, 18px);
	}

	#lltp-overlay.lltp-layout-side .lltp-track,
	#lltp-overlay.lltp-layout-side .lltp-slide,
	#lltp-overlay.lltp-layout-side .lltp-slide a {
		height: 100%;
	}

	#lltp-overlay.lltp-layout-side .lltp-media img {
		height: 100%;
		max-height: none;
		object-fit: cover;
	}

	#lltp-overlay.lltp-layout-side .lltp-body {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}
}

/* Tryb „tylko grafika” */
#lltp-overlay.lltp-layout-only .lltp-media {
	border-radius: var(--lltp-radius, 18px);
}

#lltp-overlay.lltp-layout-only .lltp-media img {
	max-height: calc(100vh - 80px);
	max-height: calc(100dvh - 80px);
	object-fit: contain;
}

/* Tablet */
@media (min-width: 768px) and (max-width: 1024px) {
	.lltp-modal {
		max-width: min(var(--lltp-max, 640px), 90vw);
	}

	.lltp-media img {
		max-height: 48vh;
	}
}

/* Telefon */
@media (max-width: 767px) {
	#lltp-overlay {
		padding: 10px;
		align-items: flex-end;
	}

	#lltp-overlay.lltp-pos-bottom-right,
	#lltp-overlay.lltp-pos-bottom-left {
		justify-content: center;
	}

	.lltp-modal,
	#lltp-overlay.lltp-pos-bottom-right .lltp-modal,
	#lltp-overlay.lltp-pos-bottom-left .lltp-modal {
		max-width: 100%;
		max-height: 92vh;
		max-height: 92dvh;
	}

	#lltp-overlay.lltp-layout-side .lltp-modal {
		display: block;
	}

	.lltp-media img {
		max-height: 42vh;
	}

	.lltp-body {
		padding: 20px 18px 24px;
	}

	.lltp-actions {
		flex-direction: column;
	}

	.lltp-btn {
		width: 100%;
	}

	.lltp-close {
		top: 8px;
		right: 8px;
		width: 38px;
		height: 38px;
	}

	.lltp-arrow {
		width: 36px;
		height: 36px;
	}
}

/* Telefon w poziomie — mało wysokości */
@media (max-height: 520px) and (orientation: landscape) {
	#lltp-overlay {
		align-items: center;
	}

	.lltp-media img {
		max-height: 38vh;
	}

	.lltp-body {
		padding: 16px 18px;
	}
}

/* Blokada przewijania tła */
html.lltp-locked,
body.lltp-locked {
	overflow: hidden !important;
}

/* Pasek trybu podglądu */
.lltp-preview-bar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	z-index: 1000000;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: center;
	padding: 10px 16px;
	background: #16202a;
	color: #fff;
	font: 500 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	text-align: center;
	box-shadow: 0 -4px 20px rgba(8, 14, 20, .3);
}

.lltp-preview-dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #f0b429;
	box-shadow: 0 0 0 4px rgba(240, 180, 41, .25);
}

.lltp-preview-reopen {
	padding: 7px 14px;
	border: 1px solid rgba(255, 255, 255, .45);
	border-radius: 999px;
	background: transparent;
	color: #fff;
	font: inherit;
	cursor: pointer;
}

.lltp-preview-reopen:hover {
	background: rgba(255, 255, 255, .12);
}

@media (max-width: 600px) {
	.lltp-preview-bar {
		font-size: 13px;
		padding: 9px 12px;
	}
}

/* Mniej animacji dla osób, które tego potrzebują */
@media (prefers-reduced-motion: reduce) {
	#lltp-overlay,
	.lltp-modal,
	.lltp-track,
	.lltp-close,
	.lltp-btn {
		transition: none !important;
	}
}

/* ============================================================
   Tryb „tylko grafika” — okno w proporcjach zdjęcia, X nad nim
   ============================================================ */

#lltp-overlay.lltp-layout-only .lltp-modal {
	width: auto;
	max-width: min(96vw, 1600px);
	max-height: none;
	overflow: visible;
	background: transparent;
	box-shadow: none;
	/* szerokość wyliczana ze zdjęcia przez skrypt */
	transition: transform .32s cubic-bezier(.22, .68, 0, 1), opacity .32s ease, width .25s ease;
}

#lltp-overlay.lltp-layout-only .lltp-media {
	border-radius: var(--lltp-radius, 18px);
	background: transparent;
	box-shadow: 0 24px 70px rgba(8, 14, 20, .45);
	line-height: 0;
}

#lltp-overlay.lltp-layout-only .lltp-media img {
	width: 100%;
	height: auto;
	max-width: 96vw;
	max-height: calc(100vh - 56px);
	max-height: calc(100dvh - 56px);
	object-fit: contain;
}

/* Zamknięcie przypięte do rogu ekranu — zawsze nad grafiką, nigdy jej nie zasłania */
#lltp-overlay .lltp-close-screen {
	position: fixed;
	top: 14px;
	right: 14px;
	width: 46px;
	height: 46px;
	z-index: 10;
	background: rgba(22, 32, 42, .82);
	color: #fff;
	box-shadow: 0 2px 14px rgba(0, 0, 0, .35);
}

#lltp-overlay .lltp-close-screen:hover,
#lltp-overlay .lltp-close-screen:focus-visible {
	background: #16202a;
	color: #fff;
}

#lltp-overlay .lltp-close-screen svg {
	width: 24px;
	height: 24px;
}

/* Pasek administratora nie może zasłaniać przycisku */
body.admin-bar #lltp-overlay .lltp-close-screen {
	top: 46px;
}

@media screen and (max-width: 782px) {
	body.admin-bar #lltp-overlay .lltp-close-screen {
		top: 60px;
	}
}

/* Karuzela w trybie „tylko grafika” */
#lltp-overlay.lltp-layout-only .lltp-dots {
	bottom: 14px;
}

#lltp-overlay.lltp-layout-only .lltp-arrow {
	background: rgba(22, 32, 42, .72);
	color: #fff;
}

#lltp-overlay.lltp-layout-only .lltp-arrow:hover,
#lltp-overlay.lltp-layout-only .lltp-arrow:focus-visible {
	background: #16202a;
}

@media (max-width: 767px) {
	#lltp-overlay.lltp-layout-only {
		align-items: center;
		padding: 8px;
	}

	#lltp-overlay.lltp-layout-only .lltp-modal {
		max-width: 96vw;
	}

	#lltp-overlay.lltp-layout-only .lltp-media img {
		max-height: calc(100dvh - 24px);
	}

	#lltp-overlay .lltp-close-screen {
		top: 10px;
		right: 10px;
		width: 42px;
		height: 42px;
	}
}
