/* Posts Grid Plugin v1.2 */
:root {
	--pgp-hf: 'Playfair Display', Georgia, serif;
	--pgp-hs: 18px;
	--pgp-bf: 'Inter', system-ui, sans-serif;
	--pgp-bs: 14px;
	--pgp-border: #e8e8e8;
	--pgp-meta:   #999;
	--pgp-gap:    26px;
	--pgp-ease:   0.28s ease;
}

/* Grid wrapper */
.pgp-wrap { font-family: var(--pgp-bf); color: #1a1a1a; width: 100%; }
.pgp-grid  { display: grid !important; gap: var(--pgp-gap); }

.pgp-c1 .pgp-grid { grid-template-columns: 1fr; }
.pgp-c2 .pgp-grid { grid-template-columns: repeat(2,1fr); }
.pgp-c3 .pgp-grid { grid-template-columns: repeat(3,1fr); }
.pgp-c4 .pgp-grid { grid-template-columns: repeat(4,1fr); }
.pgp-c5 .pgp-grid { grid-template-columns: repeat(5,1fr); }
.pgp-c6 .pgp-grid { grid-template-columns: repeat(6,1fr); }

/* Card */
.pgp-card {
	border: 1px solid var(--pgp-border);
	border-radius: 2px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	background: #fff;
	transition: box-shadow var(--pgp-ease);
}
.pgp-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.08); }

/* ============================================================
   IMAGE – PERFECT SQUARE
   !important everywhere to override Astra's global:
     img { max-width:100%; height:auto; }
   which breaks the square technique.
============================================================ */
.pgp-card__img {
	position: relative !important;
	display: block !important;
	width: 100% !important;
	padding-top: 100% !important;   /* 1:1 ratio */
	overflow: hidden !important;
	background: #f0f0f0;
	cursor: pointer;
	flex-shrink: 0;
	box-sizing: border-box !important;
}

/* Target every possible state of the img to win specificity war */
.pgp-card__img img,
.pgp-card__img img.pgp-lazy,
.pgp-card__img img.pgp-loaded,
.pgp-wrap .pgp-card__img img {
	position: absolute !important;
	top:    0 !important;
	left:   0 !important;
	right:  0 !important;
	bottom: 0 !important;
	width:  100% !important;
	height: 100% !important;
	max-width:  none !important;   /* <-- this is what Astra breaks */
	max-height: none !important;
	min-width:  0 !important;
	min-height: 0 !important;
	object-fit:      cover !important;
	object-position: center center !important;
	display: block !important;
	margin:  0 !important;
	padding: 0 !important;
	border:  none !important;
	box-sizing: border-box !important;
	transition: opacity .4s ease !important;
}
.pgp-wrap .pgp-card__img img:not(.pgp-loaded) { opacity: 0 !important; }
.pgp-wrap .pgp-card__img img.pgp-loaded       { opacity: 1 !important; }

/* Card body */
.pgp-card__body {
	padding: 18px 20px 22px;
	display: flex;
	flex-direction: column;
	gap: 7px;
	flex: 1;
}
.pgp-card__title {
	font-family: var(--pgp-hf);
	font-size: var(--pgp-hs);
	font-weight: 600;
	line-height: 1.35;
	margin: 0;
	cursor: pointer;
	color: #1a1a1a;
}
.pgp-card__date {
	font-size: 11px;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--pgp-meta);
	display: block;
}
.pgp-card__ex {
	font-size: var(--pgp-bs);
	line-height: 1.65;
	color: #555;
	margin: 0;
}
.pgp-empty { grid-column: 1/-1; text-align: center; color: var(--pgp-meta); padding: 48px 0; }

/* Load more */
.pgp-more-wrap { margin-top: 44px; text-align: center; }
.pgp-more {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 11px 34px;
	border: 1px solid #1a1a1a;
	background: transparent;
	color: #1a1a1a;
	font-size: 12px;
	letter-spacing: .08em;
	text-transform: uppercase;
	cursor: pointer;
	border-radius: 2px;
	font-family: var(--pgp-bf);
	transition: background var(--pgp-ease), color var(--pgp-ease);
}
.pgp-more:hover  { background: #1a1a1a; color: #fff; }
.pgp-more:disabled { opacity: .4; cursor: not-allowed; }
.pgp-spinner {
	width: 13px; height: 13px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: pgp-spin .7s linear infinite;
	display: none;
}
.pgp-loading .pgp-spinner { display: block; }
@keyframes pgp-spin { to { transform: rotate(360deg); } }

/* ============================================================
   POPUP – reset ALL motyw styles inside
============================================================ */
.pgp-popup {
	position: fixed !important;
	inset: 0 !important;
	z-index: 99999 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	margin: 0 !important;
	padding: 0 !important;
}
.pgp-popup[hidden] { display: none !important; }

.pgp-popup__bg {
	position: absolute !important;
	inset: 0 !important;
	background: rgba(8,8,8,.58) !important;
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	cursor: pointer;
	animation: pgp-fade .22s ease;
}
@keyframes pgp-fade { from { opacity:0; } to { opacity:1; } }

.pgp-popup__box {
	position: relative !important;
	z-index: 1 !important;
	background: #fff !important;
	width: min(680px, 94vw) !important;
	max-height: 88vh !important;
	border-radius: 3px !important;
	overflow: hidden !important;
	display: flex !important;
	flex-direction: column !important;
	margin: 0 auto !important;
	animation: pgp-up .3s cubic-bezier(.22,.61,.36,1);
	box-shadow: 0 20px 60px rgba(0,0,0,.25) !important;
}
@keyframes pgp-up { from { opacity:0; transform:translateY(22px); } to { opacity:1; transform:translateY(0); } }

/* Close button – perfect circle, force equal width/height */
#pgp-close {
	position: absolute !important;
	top: 12px !important;
	right: 12px !important;
	z-index: 2 !important;
	width:  34px !important;
	height: 34px !important;
	min-width:  34px !important;
	min-height: 34px !important;
	max-width:  34px !important;
	max-height: 34px !important;
	padding: 0 !important;
	margin: 0 !important;
	border-radius: 50% !important;
	border: 1px solid rgba(0,0,0,.16) !important;
	background: rgba(255,255,255,.96) !important;
	color: #333 !important;
	font-size: 14px !important;
	line-height: 1 !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-sizing: border-box !important;
	flex-shrink: 0 !important;
	transition: transform .25s ease, background .2s ease !important;
	text-decoration: none !important;
	font-family: sans-serif !important;
}
#pgp-close:hover { background: #fff !important; transform: rotate(90deg) !important; }

.pgp-popup__scroll {
	overflow-y: auto !important;
	-webkit-overflow-scrolling: touch;
	flex: 1 !important;
}
.pgp-popup__scroll::-webkit-scrollbar { width: 3px; }
.pgp-popup__scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* Loader dots */
.pgp-popup__loader {
	display: flex; align-items: center; justify-content: center; gap: 6px;
	padding: 60px 0;
}
.pgp-popup__loader span {
	width: 7px; height: 7px; border-radius: 50%; background: #ccc;
	animation: pgp-dot 1.2s ease-in-out infinite;
}
.pgp-popup__loader span:nth-child(2) { animation-delay:.2s; }
.pgp-popup__loader span:nth-child(3) { animation-delay:.4s; }
@keyframes pgp-dot { 0%,80%,100%{transform:scale(.8);opacity:.4;} 40%{transform:scale(1.2);opacity:1;} }
.pgp-popup__loader.pgp-hide { display: none !important; }

/* Popup hero image */
.pgp-popup__hero {
	width: 100% !important;
	max-height: 280px !important;
	overflow: hidden !important;
	display: block !important;
	flex-shrink: 0 !important;
}
.pgp-popup__hero img {
	width: 100% !important;
	height: 280px !important;
	max-width: none !important;
	max-height: none !important;
	object-fit: cover !important;
	object-position: center !important;
	display: block !important;
	margin: 0 !important;
}

/* Popup header – reset motyw styles */
.pgp-popup__hdr {
	padding: 22px 30px 16px !important;
	border-bottom: 1px solid var(--pgp-border) !important;
	background: #fff !important;
	margin: 0 !important;
}
.pgp-popup__hdr h2 {
	font-weight: 700 !important;
	line-height: 1.3 !important;
	margin: 0 0 6px !important;
	padding: 0 !important;
	color: #1a1a1a !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	border: none !important;
}
.pgp-popup__hdr time {
	font-size: 11px !important;
	text-transform: uppercase !important;
	letter-spacing: .05em !important;
	color: var(--pgp-meta) !important;
	font-family: sans-serif !important;
	display: block !important;
}

/* Popup body – typography scoped only to popup content */
.pgp-popup__body {
	padding: 22px 30px 34px !important;
	background: #fff !important;
	margin: 0 !important;
	font-family: 'Inter', 'DM Sans', system-ui, -apple-system, sans-serif !important;
	font-size: 15px !important;
	line-height: 1.75 !important;
	color: #2d2d2d !important;
	font-weight: 400 !important;
	font-style: normal !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}
.pgp-popup__body > p,
.pgp-popup__body > div > p { margin: 0 0 1em !important; font-size: 15px !important; line-height: 1.75 !important; font-family: inherit !important; color: inherit !important; }
.pgp-popup__body > p:last-child,
.pgp-popup__body > div > p:last-child { margin-bottom: 0 !important; }
.pgp-popup__body > h1, .pgp-popup__body > h2,
.pgp-popup__body > h3, .pgp-popup__body > h4 { font-family: 'Playfair Display', Georgia, serif !important; color: #1a1a1a !important; margin: 1.2em 0 .5em !important; font-size: revert !important; }
.pgp-popup__body > figure img,
.pgp-popup__body > p img,
.pgp-popup__body > img { max-width: 100% !important; height: auto !important; display: block !important; margin: 1em 0 !important; border: none !important; }
.pgp-popup__body > ul,
.pgp-popup__body > ol  { padding-left: 1.5em !important; margin: 0 0 1em !important; font-family: inherit !important; font-size: 15px !important; }
.pgp-popup__body > li  { margin-bottom: .3em !important; }
.pgp-popup__body > figure { margin: 1em 0 !important; }
.pgp-popup__body figcaption { font-size: 12px !important; color: var(--pgp-meta) !important; margin-top: 4px !important; }

body.pgp-open { overflow: hidden !important; }

/* Responsive */
@media (max-width:1100px) { .pgp-c6 .pgp-grid,.pgp-c5 .pgp-grid { grid-template-columns:repeat(4,1fr); } }
@media (max-width:900px)  { .pgp-c6 .pgp-grid,.pgp-c5 .pgp-grid,.pgp-c4 .pgp-grid { grid-template-columns:repeat(3,1fr); } }
@media (max-width:680px)  { .pgp-c6 .pgp-grid,.pgp-c5 .pgp-grid,.pgp-c4 .pgp-grid,.pgp-c3 .pgp-grid { grid-template-columns:repeat(2,1fr); } }
@media (max-width:420px)  { .pgp-c6 .pgp-grid,.pgp-c5 .pgp-grid,.pgp-c4 .pgp-grid,.pgp-c3 .pgp-grid,.pgp-c2 .pgp-grid { grid-template-columns:1fr; } }
