/* =========================================================================
   Media Gallery — styles
   Matches the site's existing brand tokens (navy / blue / teal gradient)
   used across the rest of the theme (see :root in style.css).
   ========================================================================= */

.media-gallery-page {
	--mg-navy:   #0c2340;
	--mg-blue:   #1b5ca8;
	--mg-teal1:  #23C3DD;
	--mg-teal2:  #124F9F;
	--mg-ink:    #1a2e4a;
	--mg-muted:  #637587;
	--mg-bg:     #f8fbff;
	--mg-card-bg:#ffffff;
	--mg-border: #dce8f4;
	--mg-radius: 14px;
	--mg-shadow: 0 4px 18px rgba(12, 35, 64, 0.08);
	--mg-shadow-hover: 0 12px 30px rgba(12, 35, 64, 0.14);
	box-sizing: border-box;
}

.media-gallery-page *,
.media-gallery-page *::before,
.media-gallery-page *::after {
	box-sizing: border-box;
}

/* The site header (#hdr) is position:fixed at 94px tall, so push the page
   content down to clear it. WordPress also shifts #hdr down further when
   the admin toolbar is showing (32px desktop / 46px mobile), so match that
   here too — otherwise the hero title gets clipped for logged-in editors. */
.media-gallery-page {
	padding-top: 94px;
}

.admin-bar .media-gallery-page {
	padding-top: 126px; /* 94px header + 32px admin bar */
}

@media screen and (max-width: 782px) {
	.admin-bar .media-gallery-page {
		padding-top: 140px; /* 94px header + 46px mobile admin bar */
	}
}

@media (max-width: 640px) {
	.media-gallery-page {
		padding-top: 80px;
	}
}

.mg-container {
	max-width: 1300px;
	margin: 0 auto;
	padding: 0 60px;
}

@media (max-width: 900px) {
	.mg-container { padding: 0 24px; }
}

/* ---- Hero ------------------------------------------------------------- */

.mg-hero {
	background: linear-gradient(135deg, var(--mg-navy) 0%, var(--mg-blue) 100%);
	padding: 64px 24px 56px;
	text-align: center;
}

.mg-hero__inner {
	max-width: 720px;
	margin: 0 auto;
}

.mg-hero__title {
	color: #fff;
	font-size: clamp(2rem, 4vw, 2.75rem);
	font-weight: 800;
	letter-spacing: -0.01em;
	margin: 0 0 12px;
}

.mg-hero__subtitle {
	color: rgba(255, 255, 255, 0.82);
	font-size: 1.05rem;
	line-height: 1.6;
	margin: 0;
}

/* ---- Gallery section ---------------------------------------------------*/

.mg-gallery-section {
	background: var(--mg-bg);
	padding: 56px 0 72px;
}

.mg-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 28px;
}

@media (max-width: 980px) {
	.mg-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
	.mg-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* ---- Card ---------------------------------------------------------------*/

.mg-card {
	display: flex;
	flex-direction: column;
	background: var(--mg-card-bg);
	border: 1px solid var(--mg-border);
	border-radius: var(--mg-radius);
	overflow: hidden;
	box-shadow: var(--mg-shadow);
	transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.mg-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--mg-shadow-hover);
}

.mg-card__thumb {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	background: #eef2f8;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mg-card__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	transition: transform 0.35s ease;
}

.mg-card:hover .mg-card__thumb img {
	transform: scale(1.03);
}

.mg-card__body {
	padding: 20px 20px 22px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.mg-card__title {
	color: var(--mg-ink);
	font-size: 1.1rem;
	font-weight: 700;
	line-height: 1.4;
	margin: 0;
}

.mg-card__desc {
	color: var(--mg-muted);
	font-size: 0.92rem;
	line-height: 1.6;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---- Lightbox ------------------------------------------------------------*/

.mg-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
}

.mg-modal.is-open {
	display: flex;
}

.mg-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(10, 16, 22, 0.88);
}

.mg-modal__content {
	position: relative;
	width: 100%;
	max-width: 900px;
	max-height: 88vh;
	z-index: 1;
	background: #fff;
	border-radius: var(--mg-radius);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.mg-modal__img-wrap {
	width: 100%;
	max-height: 60vh;
	background: #0c1820;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.mg-modal__img-wrap img {
	width: 100%;
	height: 100%;
	max-height: 60vh;
	object-fit: contain;
	display: block;
}

.mg-modal__body {
	padding: 20px 26px 26px;
	overflow-y: auto;
}

.mg-modal__title {
	color: var(--mg-ink);
	font-size: 1.3rem;
	font-weight: 800;
	margin: 0 0 10px;
}

.mg-modal__desc {
	color: var(--mg-muted);
	font-size: 0.98rem;
	line-height: 1.7;
	margin: 0;
	white-space: pre-line;
}

.mg-modal__close {
	position: absolute;
	top: -44px;
	right: 0;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 2.2rem;
	line-height: 1;
	cursor: pointer;
	padding: 4px 10px;
}

.mg-modal__close:hover {
	color: var(--mg-teal1);
}

@media (max-width: 600px) {
	.mg-modal__close { top: -40px; right: 0; font-size: 1.9rem; }
}

/* ---- Empty state ---------------------------------------------------------*/

.mg-empty {
	text-align: center;
	padding: 48px 20px;
	color: var(--mg-muted);
	font-size: 1.05rem;
}

/* ---- Page content (Gutenberg content below gallery, if any) ------------ */

.mg-page-content {
	padding: 32px 0 0;
}

/* ---- Reduced motion ------------------------------------------------------*/

@media (prefers-reduced-motion: reduce) {
	.mg-card,
	.mg-card__thumb img {
		transition: none !important;
	}
	.mg-card:hover {
		transform: none;
	}
}
