/**
 * AGS Project Gallery — styles
 * Used by: ags-project-gallery.php, ags-project-detail.php
 * All class names are prefixed with "ags" to avoid conflicts with existing site CSS.
 */

/* ── Page body when gallery is active ─────────────────────────────────────── */

/* body.agsGalleryPage {
	background: #000;
} */

/* ── Options / filter bar ──────────────────────────────────────────────────── */

#agsGalleryOptions {
	position: fixed;
	top: 100px; /* clear the fixed stickyHeader */
	left: 0;
	right: 0;
	width: 100%;
	text-align: center;
	background: #333;
	padding: 8px 10px;
	font-size: 1.05em;
	opacity: 0.95;
	z-index: 9999;
}

.agsProjectGalleryOptions { margin: 0; }

.agsFlexOptions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-around;
	gap: 12px;
}

.agsGalleryOption {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #fff;
}

.agsProjectGalleryOptions select,
.agsProjectGalleryOptions input {
	padding: 6px 8px;
	border: 1px solid #666;
	border-radius: 5px;
	background: #000;
	color: #fff;
	font-size: 0.95em;
}

.agsProjectGalleryOptions select:focus,
.agsProjectGalleryOptions input:focus {
	outline: 2px solid #0b56ff;
}

.agsProjectGalleryOptions input::placeholder { color: #aaa; }

#agsNumResults {
	font-weight: bold;
	color: #fff;
	min-width: 120px;
}

/* ── Pagination ────────────────────────────────────────────────────────────── */

.agsGalleryPagination {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	justify-content: center;
	margin: 10px 0 4px;
}

.agsPaginationBtn {
	cursor: pointer;
	user-select: none;
	padding: 6px 10px;
	border-radius: 4px;
	background: #f3f3f3;
	color: #063357;
	font-size: 0.9em;
}

.agsPaginationBtn:hover {
	border: inherit !important;
	background: #e0e0e0;
}

.agsPaginationBtn.is-active {
	background: #0b56ff;
	color: #fff;
}

/* ── Gallery container ─────────────────────────────────────────────────────── */

#agsGalleryContainer {
	/* background: #ddd; */
	text-align: center;
	padding-top: 90px; /* space for fixed #agsGalleryOptions */
	min-height: 300px;
}

/* ── Card grid ─────────────────────────────────────────────────────────────── */

#agsElementHeight {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 18px;
	padding: 25px 12px 250px;
}

.agsGalleryRow {
	float: none;
	width: 320px;
	display: block;
	margin: 0;
	padding: 0;
}

.agsGalleryCard {
	position: relative;
	width: 100%;
}

.agsGalleryCardPhoto {
	width: 100%;
}

/* Card link — uses CSS custom property for the cover image so hover effects work */
a.agsGalleryCardLink {
	display: block;
	position: relative;
	height: 210px;
	border-radius: 6px;
	border: 2px solid #eee;
	box-shadow: 0 0 0 2px #777;
	overflow: hidden;
	text-decoration: none;
}

/* Color background layer — scales on hover */
a.agsGalleryCardLink::before {
	content: "";
	position: absolute;
	inset: 0;
	background-image: var(--ags-cover);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transition: transform 400ms ease;
	transform: scale(1);
	pointer-events: none;
	z-index: 0;
}

/* Greyscale overlay — fades in on hover */
a.agsGalleryCardLink::after {
	content: "";
	position: absolute;
	inset: 0;
	background-image: var(--ags-cover);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	filter: grayscale(1);
	opacity: 0;
	transition: opacity 300ms ease, transform 400ms ease;
	transform: scale(1);
	pointer-events: none;
	z-index: 1;
}

a.agsGalleryCardLink:hover::before,
a.agsGalleryCardLink:hover::after { transform: scale(1.07); }
a.agsGalleryCardLink:hover::after { opacity: 1; }

/* Prevent a:hover { border: 0 } from causing a jump */
body.agsGalleryPage #agsGalleryContainer a.agsGalleryCardLink:hover {
	border: 2px solid #eee !important;
}

/* Card title overlay */
.agsGalleryCardName {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	padding: 10px 12px;
	background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0));
	text-align: left;
	pointer-events: none;
	z-index: 2;
}

.agsGalleryCardName h2 {
	margin: 0;
	color: #fff;
	font-size: 18px;
	line-height: 1.2;
	text-shadow: 0 1px 2px rgba(0,0,0,0.9);
	max-height: 2.6em;
	overflow: hidden;
}

/* No results */
.agsGallery .noResults,
p.noResults {
	color: #ccc;
	padding: 40px 20px;
	text-align: center;
	font-size: 1.1em;
}

/* ── Detail page ───────────────────────────────────────────────────────────── */

.agsProjectDetail {
	color: #000;
	padding: 15px 1% 250px;
}

.agsProjectDetailHeader {
	margin-bottom: 20px;
}

/* Back button */
.agsProjectDetailBackButton {
	margin-bottom: 15px;
}

.agsBackButton {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 20px;
	background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
	color: #fff;
	text-decoration: none;
	border-radius: 6px;
	font-weight: 600;
	font-size: 14px;
	box-shadow: 0 2px 4px rgba(74,144,226,0.3);
	transition: all 0.2s ease;
}

.agsBackButton:hover {
	background: linear-gradient(135deg, #357abd 0%, #2c5282 100%);
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(74,144,226,0.4);
	text-decoration: none;
	color: #fff;
	border: inherit !important;
}

.agsBackButton:active {
	transform: translateY(0);
	box-shadow: 0 2px 4px rgba(74,144,226,0.3);
}

.agsBackButton i { font-size: 12px; }

/* Cover hero image */
.agsProjectDetailCover {
	height: 320px;
	border: 10px solid #bfbfbf;
	box-shadow: 0 0 5px 1px #000;
	background-size: cover;
	background-position: center;
	margin: 10px auto 20px;
}

/* Title & description */
.agsProjectDetail h1 {
	margin: 10px 0 6px;
	padding: 0 1%;
}

.agsProjectDetailDesc {
	color: #333;
	margin: 6px 0;
	padding: 0 1%;
}

/* Meta list */
.agsProjectDetailMeta {
	margin: 10px 0;
	padding: 0 1%;
}

.agsProjectDetailMeta ul {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.6;
}

.agsProjectDetailMeta li { margin: 2px 0; }

.agsFieldLabel {
	font-weight: 700;
	margin-right: 6px;
	color: #222;
}

/* Photo grid */
.agsProjectDetailGrid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 10px;
	padding: 10px 1%;
}

a.agsProjectPhoto {
	display: block;
	border: 2px solid #eee;
	box-shadow: 0 0 0 2px #777;
	border-radius: 5px;
	overflow: hidden;
	background: #000;
}

a.agsProjectPhoto img {
	width: 100%;
	height: 180px;
	object-fit: cover;
	display: block;
}

/* ── Lightbox ──────────────────────────────────────────────────────────────── */

.agsLb[hidden] { display: none !important; }

.agsLb {
	position: fixed;
	inset: 0;
	z-index: 1000000;
}

.agsLbBackdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.88);
}

.agsLbDialog {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: min(1200px, 96vw);
	height: min(86vh, 900px);
	display: grid;
	grid-template-columns: 52px 1fr 52px;
	grid-template-rows: 1fr auto;
	gap: 8px;
	align-items: center;
	justify-items: center;
	box-sizing: border-box;
	padding: 10px;
}

.agsLbImg {
	grid-column: 2;
	grid-row: 1;
	max-width: 100%;
	max-height: 100%;
	box-shadow: 0 0 14px rgba(0,0,0,0.65);
	background: #000;
}

.agsLbCaption {
	grid-column: 1 / 4;
	grid-row: 2;
	color: #fff;
	font-size: 14px;
	text-align: center;
	padding: 6px 10px;
	background: rgba(0,0,0,0.35);
	border-radius: 6px;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.agsLbNav,
.agsLbClose {
	appearance: none;
	border: 0;
	border-radius: 10px;
	background: rgba(255,255,255,0.15);
	color: #fff;
	cursor: pointer;
	user-select: none;
	line-height: 1;
	width: 46px;
	height: 46px;
	font-size: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.agsLbNav:hover,
.agsLbClose:hover {
	background: rgba(255,255,255,0.28);
}

.agsLbPrev  { grid-column: 1; grid-row: 1; }
.agsLbNext  { grid-column: 3; grid-row: 1; }

.agsLbClose {
	position: absolute;
	right: 14px;
	top: 14px;
	font-size: 28px;
	width: 44px;
	height: 44px;
}

body.agsLbOpen { overflow: hidden; }

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
	.agsGalleryRow           { width: 92vw; }
	a.agsGalleryCardLink     { height: 240px; }
	.agsProjectDetailCover   { height: 200px; border-width: 4px; }
	.agsProjectDetailGrid    { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
	a.agsProjectPhoto img    { height: 140px; }
}
