.hpg-gallery {
	--hpg-gallery-cols: 3;
}

.hpg-gallery-none {
	color: #6b7280;
	font-style: italic;
}

.hpg-gallery-title {
	margin: 0 0 30px !important;
}

.hpg-gallery-search-wrap {
	margin-bottom: 30px;
}

.hpg-gallery-search {
	appearance: none;
	width: 100%;
	max-width: 320px;
	box-sizing: border-box;
	border: 1px solid #d1d5db;
	background: #fff;
	color: #111827;
	padding: 0.5rem 1rem;
	border-radius: 3px;
	font-size: 14px;
	transition: border-color 0.15s ease;
}

.hpg-gallery-search:focus {
	outline: none;
	border-color: #9ca3af;
}

.hpg-gallery-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-bottom: 20px;
}

.hpg-gallery-filters button {
	appearance: none;
	border: 1px solid #d1d5db;
	background: #fff;
	color: #374151;
	padding: 0.4rem 1rem;
	border-radius: 999px;
	font-size: 12px;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.hpg-gallery-filters button:hover {
	border-color: #9ca3af;
	transform: translateY(-1px);
}

.hpg-gallery-filters button.is-active {
	background: #111827;
	border-color: #111827;
	color: #fff;
}

.hpg-gallery-grid {
	display: grid;
	grid-template-columns: repeat(var(--hpg-gallery-cols, 3), minmax(0, 1fr));
	gap: 29px;
	align-items: stretch;
}

@media (max-width: 900px) {
	.hpg-gallery-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 560px) {
	.hpg-gallery-grid {
		grid-template-columns: 1fr;
	}
}

.hpg-tile {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: none;
	border-radius: 2px;
	padding: 15px 5px 5px;
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: box-shadow 0.2s ease, transform 0.22s ease;
}

.hpg-tile:hover {
	box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
	transform: translateY(-2px);
}

.hpg-tile[hidden] {
	display: none !important;
}

/* Toggled by hpg-gallery.js while a tile is filtered in/out (search box or
   category buttons) — slides the tile down/away, rather than snapping
   straight to display:none. */
.hpg-tile.hpg-tile-hiding {
	transform: translateY(16px);
	pointer-events: none;
}

.hpg-tile-media {
	aspect-ratio: 16 / 9;
	background: #f4f4f5;
	overflow: hidden;
}

.hpg-tile-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.hpg-tile-media-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 0 1rem;
	color: #9ca3af;
	font-weight: 700;
	letter-spacing: 0.03em;
}

.hpg-tile-body {
	padding: 20px 1.1rem 25px;
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

/* Fixed-height description: clamped to 5 lines regardless of length, so
   every tile in a row ends up the same height and the button always lines
   up. Server-side word trimming (see HPG_Gallery::render()) backs this up
   for browsers that don't support line-clamp. */
.hpg-tile-teaser {
	margin: 0 0 15px;
	color: #6b7280;
	font-size: 14px;
	line-height: 1.55;
	display: -webkit-box;
	-webkit-line-clamp: 5;
	-webkit-box-orient: vertical;
	line-clamp: 5;
	overflow: hidden;
	height: calc(14px * 1.55 * 5);
}

.hpg-tile-btn {
	margin-top: auto;
	display: inline-block;
	background: #111827;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	padding: 0.65rem 1.4rem;
	border-radius: 999px;
	border: 1px solid transparent;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hpg-tile:hover .hpg-tile-btn {
	background: #fff;
	color: #111827;
	border-color: #111827;
	transform: translateX(2px);
}

.hpg-gallery-empty {
	color: #6b7280;
	font-style: italic;
	margin-top: 1.5rem;
}

.hpg-gallery-empty[hidden] {
	display: none;
}
