/* Diditon Gallery — frontend layouts.
   Theme-neutral: inherits fonts/colours from the active theme. */

.diditon-gallery {
	margin: 0 0 1.5em;
}
.diditon-gallery img {
	display: block;
	max-width: 100%;
}

/* Shared item framing. */
.diditon-gallery__item,
.diditon-gallery__hero,
.diditon-gallery__strip-item {
	display: block;
	cursor: pointer;
	overflow: hidden;
	border-radius: 6px;
}
.diditon-gallery__item img {
	width: 100%;
	height: auto;
	border-radius: 6px;
	transition: transform 0.25s ease;
}
.diditon-gallery__item:hover img {
	transform: scale(1.03);
}

/* ---- Grid: fixed columns, uniform cropped cells, row-major order. -- */
.diditon-gallery__grid {
	display: grid;
	grid-template-columns: repeat(var(--diditon-cols, 3), minmax(0, 1fr));
	gap: 15px;
}
.diditon-gallery__grid .diditon-gallery__item {
	aspect-ratio: 1 / 1;
}
.diditon-gallery__grid .diditon-gallery__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ---- Masonry: justified rows, no gaps, aspect ratios preserved.
        Row heights/widths are set inline by the script. --------------- */
.diditon-gallery__masonry {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	line-height: 0;
}
.diditon-gallery__item--masonry {
	border-radius: 0;
}
.diditon-gallery__item--masonry img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
}
.diditon-gallery__item--masonry:hover img {
	transform: none;
}

/* ---- Showcase: one large featured image + a clickable thumb strip. - */
.diditon-gallery__hero {
	margin: 0 0 12px;
}
.diditon-gallery__hero img {
	width: 100%;
	height: auto;
	max-height: 72vh;
	object-fit: contain;
	border-radius: 6px;
	background: rgba(0, 0, 0, 0.03);
}
.diditon-gallery__strip {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}
.diditon-gallery__strip-item {
	width: 96px;
	height: 72px;
	opacity: 0.6;
	transition: opacity 0.2s ease;
	border-radius: 4px;
}
.diditon-gallery__strip-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.diditon-gallery__strip-item:hover,
.diditon-gallery__strip-item.is-active {
	opacity: 1;
	box-shadow: 0 0 0 2px currentColor;
}

/* ---- Lightbox mode: a single cover thumbnail. --------------------- */
.diditon-gallery__single {
	position: relative;
	max-width: 100%;
}
.diditon-gallery__count {
	position: absolute;
	right: 8px;
	bottom: 8px;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	font-size: 12px;
	line-height: 1;
	padding: 5px 8px;
	border-radius: 999px;
	pointer-events: none;
}

/* ---- PhotoSwipe caption. ------------------------------------------ */
.pswp__diditon-caption {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 14px 20px;
	color: #fff;
	font-size: 14px;
	line-height: 1.4;
	text-align: center;
	background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
	pointer-events: none;
}

/* ---- Phones: keep the grid to two columns. Larger portrait screens
        (tablets, rotated monitors) keep the configured column count. -- */
@media (max-width: 600px) {
	.diditon-gallery__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 10px;
	}
}

/* ---- Lightbox info panel (toggled by the top-left "i" button). ----- */
.pswp__diditon-info {
	position: absolute;
	top: 58px;
	left: 16px;
	max-width: min(360px, 72vw);
	padding: 12px 14px;
	background: rgba(0, 0, 0, 0.62);
	color: #fff;
	border-radius: 6px;
	font-size: 13px;
	line-height: 1.45;
	z-index: 10;
}
.pswp__diditon-info-title {
	font-weight: 600;
	margin-bottom: 4px;
}
.pswp__diditon-info-desc {
	margin-bottom: 6px;
}
.pswp__diditon-info-file {
	margin-bottom: 4px;
	font-family: ui-monospace, Menlo, Consolas, monospace;
	font-size: 12px;
	opacity: 0.75;
	word-break: break-all;
}
.pswp__diditon-info-copy {
	opacity: 0.82;
	font-size: 12px;
}
.pswp__diditon-info-empty {
	opacity: 0.7;
	font-style: italic;
}

/* ---- Grid thumbnail: whole image in each square, chosen background. - */
.diditon-gallery__grid--thumb .diditon-gallery__item {
	background: var(--diditon-cell-bg, #000);
}
.diditon-gallery__grid--thumb .diditon-gallery__item img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.diditon-gallery__grid--thumb .diditon-gallery__item:hover img {
	transform: none;
}

/* ---- Save discouragement (per-gallery toggle). -------------------- */
.diditon-gallery--protected img {
	-webkit-user-drag: none;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
}
