/* Gallery page styles. Scoped under .gallery-root, which also carries
   .civedit-root so base font/button/input styling is inherited. */

.gallery-root.civedit-root {
	/* The gallery scrolls as one page rather than the editor's fixed panes. */
	display: block;
	overflow-y: auto;
	background: #ececed;
}

/* ── Header ─────────────────────────────────────────────── */
#galleryHeader {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	padding: 8px 14px;
	background: #f4f4f6;
	border-bottom: 1px solid #d0d0d8;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}
.g-brand {
	font-size: 16px;
	font-weight: 700;
	color: #2d8a5e;
	text-decoration: none;
}
.g-brand-sub {
	font-size: 14px;
	color: #666;
	margin-left: -4px;
}
#gSearch {
	flex: 1;
	min-width: 160px;
	max-width: 360px;
	font-family: monospace;
	font-size: 12px;
	border: 1px solid #c4c4cc;
	border-radius: 3px;
	padding: 4px 8px;
	background: #fff;
}
#gSearch:focus {
	outline: none;
	border-color: #88aacc;
	box-shadow: 0 0 0 2px rgba(100, 140, 200, 0.15);
}
.g-sort {
	font-size: 12px;
	color: #555;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}
.g-sort select {
	font-family: monospace;
	font-size: 12px;
	border: 1px solid #c4c4cc;
	border-radius: 3px;
	padding: 2px 4px;
	background: #fff;
}
.g-editor-link {
	margin-left: auto;
	font-size: 12px;
	color: #2766b8;
	text-decoration: none;
}
.g-editor-link:hover {
	text-decoration: underline;
}

/* ── Tag filter bar ─────────────────────────────────────── */
#gTagBar {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	padding: 8px 14px 0;
}
.g-tag-chip {
	padding: 2px 9px;
	font-size: 11px;
	border-radius: 11px;
}
.g-tag-chip.active {
	background: #3a9a6a;
	color: #fff;
	border-color: #2d8a5e;
}

/* ── Wrap filter bar (derived metadata; distinct from user tags) ── */
#gWrapBar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 5px;
	padding: 6px 14px 0;
}
.g-wrap-label {
	font-size: 11px;
	color: #777;
	margin-right: 2px;
}
#gWrapBar .g-wrap-chip {
	background: #efeafa;
	border-color: #cfc2ec;
	color: #54407a;
}
#gWrapBar .g-wrap-chip:hover:not(:disabled) {
	background: #e6def5;
	border-color: #b8a6e0;
	color: #3f2e63;
}
#gWrapBar .g-wrap-chip.active {
	background: #6a4ca8;
	border-color: #553d8a;
	color: #fff;
}

/* ── Status line ────────────────────────────────────────── */
#gStatus {
	padding: 8px 14px 2px;
	font-size: 12px;
	color: #666;
}

/* ── Card grid ──────────────────────────────────────────── */
#gGrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 16px;
	padding: 10px 14px 20px;
}
.g-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid #d2d2da;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
	transition: box-shadow 0.12s, border-color 0.12s;
}
.g-card:hover {
	box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
	border-color: #b4c2d4;
}
.g-card.highlight {
	border-color: #3a9a6a;
	box-shadow: 0 0 0 2px rgba(58, 154, 106, 0.4);
}
.g-thumb-link {
	display: block;
	height: 210px;
	background:
		linear-gradient(45deg, #d8d8dc 25%, transparent 25%, transparent 75%, #d8d8dc 75%) 0 0 / 16px 16px,
		linear-gradient(45deg, #d8d8dc 25%, #e8e8ec 25%, #e8e8ec 75%, #d8d8dc 75%) 8px 8px / 16px 16px;
}
.g-thumb {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	image-rendering: pixelated;
}

/* Floating enlarged thumbnail shown while hovering a card image. */
.g-thumb-preview {
	position: fixed;
	z-index: 100;
	max-width: 60vw;
	max-height: 80vh;
	border: 1px solid #c8c8d0;
	border-radius: 6px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
	background: #fff;
	padding: 4px;
	image-rendering: pixelated;
	pointer-events: none;
}
.g-card-body {
	flex: 1;
	padding: 8px 10px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.g-card-name {
	font-size: 13px;
	font-weight: 600;
	color: #222;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.g-card-meta {
	font-size: 11px;
	color: #777;
}
.g-card-desc {
	font-size: 11px;
	color: #555;
	display: -webkit-box;
	-webkit-line-clamp: 5;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.g-card-desc[title] {
	cursor: help;
}
.g-card-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 2px;
}
.g-card-tag {
	padding: 1px 7px;
	font-size: 10px;
	border-radius: 9px;
	background: #eef3fa;
	border: 1px solid #c4d2e4;
	color: #345;
}
.g-card-tag:hover {
	background: #e0e8f4;
}
/* Derived wrap chip on a card — distinct from user tags (higher specificity
   than the base .civedit-root button rule). */
.g-card-tags .g-card-wrap {
	background: #efeafa;
	border-color: #cfc2ec;
	color: #54407a;
}
.g-card-tags .g-card-wrap:hover {
	background: #e6def5;
	border-color: #b8a6e0;
}
.g-card-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 10px;
	border-top: 1px solid #eee;
}
.g-action {
	font-size: 11px;
	color: #2766b8;
	text-decoration: none;
}
.g-action:hover {
	text-decoration: underline;
}
.g-dl-count {
	margin-left: auto;
	font-size: 11px;
	color: #999;
}

/* ── Owner controls ─────────────────────────────────────── */
.g-card.owned {
	border-color: #bfe0cd;
}
.g-card-owner {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 10px;
	background: #f1f8f4;
	border-top: 1px solid #e0efe6;
}
.g-owner-badge {
	font-size: 9px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #2d8a5e;
	background: #dcefe3;
	border: 1px solid #bfe0cd;
	border-radius: 8px;
	padding: 1px 7px;
}
.g-card-owner .g-owner-action {
	font-size: 11px;
	color: #2766b8;
	text-decoration: none;
	background: none;
	border: none;
	border-radius: 0;
	box-shadow: none;
	padding: 0;
	cursor: pointer;
	font-family: monospace;
}
.g-card-owner .g-owner-action:hover:not(:disabled) {
	text-decoration: underline;
	background: none;
	border: none;
	box-shadow: none;
	color: #1a4e94;
}
.g-card-owner .g-owner-delete {
	margin-left: auto;
	color: #c0392b;
}
.g-card-owner .g-owner-delete:hover:not(:disabled) {
	color: #a02a1e;
}
