.gpi-gallery { --gpi-gap: 10px; margin: 1.5em 0; }
.gpi-gallery [hidden] { display: none !important; }

/* Description box */
.gpi-desc { border: 1px solid rgba(127, 127, 127, .3); background: rgba(127, 127, 127, .08); border-radius: 8px; padding: 1em 1.25em; margin: 0 0 1.25em; }
.gpi-desc > :first-child { margin-top: 0; }
.gpi-desc > :last-child { margin-bottom: 0; }

.gpi-html { margin: 1.25em 0; }
.gpi-html img { max-width: 100%; height: auto; }

/* Thumbnail grid */
.gpi-grid { display: grid; grid-template-columns: repeat(var(--gpi-cols, 4), minmax(0, 1fr)); gap: var(--gpi-gap); margin: 0 0 var(--gpi-gap); }
.gpi-item { margin: 0; padding: 0; }
.gpi-item a { display: block; overflow: hidden; border-radius: 4px; background: rgba(127, 127, 127, .12); }
.gpi-item img { display: block; width: 100%; height: auto; aspect-ratio: var(--gpi-ratio, 3 / 4); object-fit: cover; transition: transform .25s ease; margin: 0; }
.gpi-ratio-auto .gpi-item img { aspect-ratio: auto; }
.gpi-item a:hover img, .gpi-item a:focus-visible img { transform: scale(1.04); }
@media (max-width: 900px) {
	.gpi-cols-5 .gpi-grid, .gpi-cols-6 .gpi-grid, .gpi-cols-7 .gpi-grid, .gpi-cols-8 .gpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.gpi-gallery:not(.gpi-cols-1) .gpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Full-size images, always inside the post width */
.gpi-full { margin: 0 0 var(--gpi-gap); }
.gpi-full-item { margin: 0 0 var(--gpi-gap); padding: 0; text-align: center; }
.gpi-full-item a { display: inline-block; max-width: 100%; }
.gpi-full-item img { display: block; max-width: 100%; height: auto; margin: 0 auto; }

/* Buttons */
.gpi-sponsor-wrap, .gpi-toggle-wrap { text-align: center; margin: 1.25em 0; }
.gpi-sponsor { display: inline-block; background: var(--gpi-accent, #d6336c); color: #fff !important; text-decoration: none !important; padding: .85em 1.75em; border-radius: 6px; font-weight: 700; line-height: 1.2; transition: filter .15s, transform .15s; }
.gpi-sponsor:hover, .gpi-sponsor:focus-visible { filter: brightness(1.1); transform: translateY(-1px); }
.gpi-toggle-full { background: transparent; border: 1px solid currentColor; color: inherit; padding: .6em 1.3em; border-radius: 6px; cursor: pointer; font: inherit; opacity: .85; }
.gpi-toggle-full:hover { opacity: 1; }

/* Lightbox */
html.gpi-lb-open { overflow: hidden; }
.gpi-lb { position: fixed; inset: 0; z-index: 999999; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; color: #fff; }
.gpi-lb[hidden] { display: none; }
.gpi-lb-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 56px 64px 8px; min-height: 0; }
.gpi-lb-img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; box-shadow: 0 4px 30px rgba(0, 0, 0, .5); }
.gpi-lb-bar { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 12px 16px 18px; flex-wrap: wrap; }
.gpi-lb-count { font-size: 14px; opacity: .8; font-variant-numeric: tabular-nums; }
.gpi-lb-sponsor[hidden] { display: none; }
.gpi-lb button { position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; cursor: pointer; border-radius: 50%; width: 48px; height: 48px; font-size: 22px; line-height: 48px; padding: 0; text-align: center; transition: background .15s; }
.gpi-lb button:hover, .gpi-lb button:focus-visible { background: rgba(255, 255, 255, .28); }
.gpi-lb-close { top: 10px; right: 10px; font-size: 30px !important; }
.gpi-lb-prev, .gpi-lb-next { top: 50%; transform: translateY(-50%); }
.gpi-lb-prev { left: 10px; }
.gpi-lb-next { right: 10px; }
.gpi-lb-single .gpi-lb-prev, .gpi-lb-single .gpi-lb-next, .gpi-lb-single .gpi-lb-count { display: none; }
@media (max-width: 600px) {
	.gpi-lb-stage { padding: 56px 8px 8px; }
	.gpi-lb-prev, .gpi-lb-next { top: auto; bottom: 12px; transform: none; }
}
