/* Smart Post Presenter Collection – arrangements. Card styles live in spc-cards.css */

.spc-collection {
	display: grid;
	gap: var(--spc-gap, 24px);
	grid-template-columns: repeat(var(--spc-cols-d, 3), minmax(0, 1fr));
}

/* Auto grid */
.spc-arr-grid {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--spc-min, 300px)), 1fr));
}

/* Masonry (CSS columns) */
.spc-arr-masonry {
	display: block;
	column-count: var(--spc-cols-d, 3);
	column-gap: var(--spc-gap, 24px);
}
.spc-arr-masonry > .spp-post {
	break-inside: avoid;
	margin-bottom: var(--spc-gap, 24px);
}

/* Mosaic: fixed row height, cards span cells, dense packing */
.spc-arr-mosaic {
	grid-auto-rows: var(--spc-row, 260px);
	grid-auto-flow: dense;
}
.spc-arr-mosaic > .spp-post { height: 100%; }
.spc-arr-mosaic > .spc-span-wide { grid-column: span 2; }
.spc-arr-mosaic > .spc-span-tall { grid-row: span 2; }
.spc-arr-mosaic > .spc-span-big  { grid-column: span 2; grid-row: span 2; }

/* Alternating: 1 wide card, then 2 side by side */
.spc-arr-alternating { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* Single-card rows alternate: 1st gap from the left, 2nd gap from the right, and so on */
.spc-arr-alternating > .spp-post:nth-child(3n+1) { grid-column: 1 / -1; width: var(--spc-single-w, 60%); }
.spc-arr-alternating > .spp-post:nth-child(6n+1) { justify-self: start; margin-left: var(--spc-single-off, 5%); }
.spc-arr-alternating > .spp-post:nth-child(6n+4) { justify-self: end;   margin-right: var(--spc-single-off, 5%); }

/* Two-card rows: one card is shorter (golden ratio by default), centered vertically.
   1st pair: left card shorter. 2nd pair: right card shorter. And so on. */
.spc-arr-alternating > .spp-post:nth-child(6n+2),
.spc-arr-alternating > .spp-post:nth-child(6n+6) {
	height: var(--spc-short-h, 61.8%);
	align-self: center;
	display: flex;
	flex-direction: column;
}
.spc-arr-alternating > .spp-post:nth-child(6n+2) .spp-image,
.spc-arr-alternating > .spp-post:nth-child(6n+6) .spp-image {
	flex: 1 1 auto;
	min-height: 0;
}
.spc-arr-alternating > .spp-post:nth-child(6n+2) .spp-image img.spp-img,
.spc-arr-alternating > .spp-post:nth-child(6n+6) .spp-image img.spp-img,
.spc-arr-alternating > .spp-post:nth-child(6n+2) .spp-image video.spp-video,
.spc-arr-alternating > .spp-post:nth-child(6n+6) .spp-image video.spp-video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Empty message, heading, pagination */
.spc-empty { grid-column: 1 / -1; margin: 0; }
.spc-heading { margin: 0 0 1rem; }
.spc-cat-desc { margin: 0 0 1.5rem; }
.spc-pagination { margin-top: 2rem; text-align: center; }
.spc-pagination .page-numbers { display: inline-block; padding: .4em .8em; margin: 0 2px; text-decoration: none; }

/* Tablet */
@media (max-width: 1024px) {
	.spc-collection { grid-template-columns: repeat(var(--spc-cols-t, 2), minmax(0, 1fr)); }
	.spc-arr-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--spc-min, 300px)), 1fr)); }
	.spc-arr-masonry { display: block; column-count: var(--spc-cols-t, 2); }
	.spc-arr-alternating { grid-template-columns: repeat(var(--spc-cols-t, 2), minmax(0, 1fr)); }
}

/* Mobile */
@media (max-width: 767px) {
	.spc-collection { grid-template-columns: repeat(var(--spc-cols-m, 1), minmax(0, 1fr)); }
	.spc-arr-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--spc-min, 300px)), 1fr)); }
	.spc-arr-masonry { display: block; column-count: var(--spc-cols-m, 1); }
	.spc-arr-alternating { grid-template-columns: repeat(var(--spc-cols-m, 1), minmax(0, 1fr)); }
	.spc-arr-alternating > .spp-post:nth-child(3n+1) { grid-column: auto; width: auto; margin: 0; justify-self: stretch; }
	.spc-arr-alternating > .spp-post:nth-child(6n+2),
	.spc-arr-alternating > .spp-post:nth-child(6n+6) { height: auto; align-self: stretch; display: block; }
	/* mosaic spans only make sense with 2+ columns */
	.spc-arr-mosaic > .spc-span-wide,
	.spc-arr-mosaic > .spc-span-big { grid-column: auto; }
}
@media (max-width: 767px) {
	.spc-arr-mosaic { grid-auto-rows: auto; }
	.spc-arr-mosaic > .spc-span-tall,
	.spc-arr-mosaic > .spc-span-big { grid-row: auto; }
}

/* Elementor editor: layout picker tiles */
.spc-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.spc-pick-option {
	position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
	padding: 10px 8px 9px; border: 2px solid #ddd; border-radius: 7px; cursor: pointer;
	background: #fafafa; text-align: center; transition: border-color .15s, background .15s;
}
.spc-pick-option:hover { border-color: #2271b1; background: #f0f6fc; }
.spc-pick-option.spc-selected { border-color: #00a32a; background: #f0fdf4; box-shadow: 0 0 0 1px #00a32a; }
.spc-pick-svg { width: 100%; display: block; border-radius: 3px; }
.spc-pick-svg svg { width: 100%; height: auto; display: block; }
.spc-pick-name { font-size: 10px; line-height: 1.3; color: #555; font-weight: 500; }
.spc-pick-option.spc-selected .spc-pick-name { color: #00a32a; font-weight: 700; }

/* Lightbox */
.spc-collection[data-spc-lightbox] .spp-image,
.spc-collection[data-spc-lightbox] .spp-layout-overlay,
.spc-collection[data-spc-lightbox] .spp-layout-banner { cursor: zoom-in; }
.spc-lb { position: fixed; inset: 0; z-index: 999999; background: rgba(0,0,0,.93); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; touch-action: pan-y; }
.spc-lb.is-open { opacity: 1; }
.spc-lb-fig { margin: 0; max-width: 94vw; max-height: 94vh; display: flex; flex-direction: column; align-items: center; }
.spc-lb-img { max-width: 94vw; max-height: 86vh; object-fit: contain; display: block; transition: opacity .2s; }
.spc-lb-img.is-loading { opacity: 0; }
.spc-lb-cap { color: #ddd; font-size: 15px; margin-top: 10px; text-align: center; }
.spc-lb button { position: absolute; background: none; border: 0; color: #fff; cursor: pointer; font-size: 38px; line-height: 1; padding: 12px 16px; opacity: .75; }
.spc-lb button:hover, .spc-lb button:focus-visible { opacity: 1; }
.spc-lb-close { top: 6px; right: 10px; }
.spc-lb-prev { left: 6px; top: 50%; transform: translateY(-50%); }
.spc-lb-next { right: 6px; top: 50%; transform: translateY(-50%); }
.spc-lb-spin { position: absolute; width: 36px; height: 36px; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; animation: spc-spin .8s linear infinite; }
@keyframes spc-spin { to { transform: rotate(360deg); } }

/* Lightbox hardening: themes (Hello Elementor etc.) style all buttons/images globally */
.spc-lb .spc-lb-close,
.spc-lb .spc-lb-prev,
.spc-lb .spc-lb-next,
.spc-lb .spc-lb-close:hover, .spc-lb .spc-lb-prev:hover, .spc-lb .spc-lb-next:hover,
.spc-lb .spc-lb-close:focus, .spc-lb .spc-lb-prev:focus, .spc-lb .spc-lb-next:focus,
.spc-lb .spc-lb-close:active, .spc-lb .spc-lb-prev:active, .spc-lb .spc-lb-next:active {
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	border-radius: 0 !important;
	text-decoration: none !important;
	text-shadow: none !important;
	min-width: 0 !important;
	width: auto !important;
	height: auto !important;
	margin: 0 !important;
	font-family: Arial, sans-serif !important;
	font-weight: 400 !important;
	outline: none;
}
.spc-lb .spc-lb-close:focus-visible, .spc-lb .spc-lb-prev:focus-visible, .spc-lb .spc-lb-next:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -4px;
}
.spc-lb .spc-lb-img {
	width: auto !important;
	height: auto !important;
	max-width: 94vw !important;
	max-height: 86vh !important;
	margin: 0 auto !important;
	position: static !important;
	transform: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
}
.spc-lb .spc-lb-fig { position: relative; width: auto; max-width: 94vw; margin: 0 !important; padding: 0; }
