:root {
	--eg-accent: #1a1a1a;
	--eg-accent-soft: #f4f4f2;
	--eg-radius: 6px;
	--eg-speed: 280ms;
	--eg-ease: cubic-bezier(.4, 0, .2, 1);
}

/* ---- Filter menu ---- */
.eg-filter-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 32px;
}

.eg-filter-menu.eg-align-left { justify-content: flex-start; }
.eg-filter-menu.eg-align-center { justify-content: center; }
.eg-filter-menu.eg-align-right { justify-content: flex-end; }

.eg-filter-pill {
	appearance: none;
	border: 1px solid #e2e2e0;
	background: #fff;
	color: #444;
	font-size: 14px;
	padding: 8px 18px;
	border-radius: 999px;
	cursor: pointer;
	transition: background var(--eg-speed) var(--eg-ease),
		color var(--eg-speed) var(--eg-ease),
		border-color var(--eg-speed) var(--eg-ease);
}

.eg-filter-pill:hover {
	border-color: var(--eg-accent);
}

.eg-filter-pill.is-active {
	background: var(--eg-accent);
	color: #fff;
	border-color: var(--eg-accent);
}

.eg-count {
	opacity: .6;
	font-size: 12px;
}

/* ---- Grid ----
 * --eg-grid-columns and --eg-image-ratio are set inline per-instance
 * from Customizer settings (Appearance -> Customize -> Elegant
 * Gallery), read in EG_Shortcodes::render_gallery()/render_projects().
 * Falls back to 3 columns / 4:3 ratio if not set. */
.eg-grid {
	display: grid;
	grid-template-columns: repeat(var(--eg-grid-columns, 3), 1fr);
	gap: 20px;
}

@media (max-width: 900px) {
	.eg-grid {
		grid-template-columns: repeat(min(var(--eg-grid-columns, 3), 2), 1fr);
	}
}

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

.eg-grid-item {
	position: relative;
	overflow: hidden;
	border-radius: var(--eg-radius);
	aspect-ratio: var(--eg-image-ratio, 4 / 3);
	transition: opacity var(--eg-speed) var(--eg-ease),
		transform var(--eg-speed) var(--eg-ease);
}

.eg-grid-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 500ms var(--eg-ease);
}

/* When "Original / Auto" ratio is selected, let the image define its
   own height instead of being forced to fill a fixed-ratio box. */
.eg-grid.eg-ratio-auto .eg-grid-item {
	aspect-ratio: auto;
}
.eg-grid.eg-ratio-auto .eg-grid-item img {
	height: auto;
	object-fit: initial;
}

.eg-grid-item:hover img {
	transform: scale(1.04);
}

.eg-grid-item.eg-fading {
	opacity: 0;
	transform: scale(.96);
}

.eg-grid-item.eg-hidden {
	display: none;
}

/* ---- Project cards ---- */
.eg-project-card {
	display: block;
	text-decoration: none;
	color: inherit;
}

.eg-project-caption {
	position: absolute;
	inset: auto 0 0 0;
	padding: 14px 16px;
	background: linear-gradient(to top, rgba(0,0,0,.55), transparent);
	color: #fff;
}

.eg-project-title {
	font-size: 15px;
	font-weight: 500;
}

/* ---- Lightbox ---- */
.eg-lightbox-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 10, 10, .92);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 9999;
}

.eg-lightbox-overlay.is-open {
	display: flex;
}

.eg-lightbox-img {
	max-width: 90vw;
	max-height: 86vh;
	border-radius: 4px;
}

.eg-lightbox-close,
.eg-lightbox-prev,
.eg-lightbox-next {
	position: absolute;
	background: transparent;
	border: none;
	color: #fff;
	font-size: 32px;
	cursor: pointer;
	line-height: 1;
	padding: 12px;
}

.eg-lightbox-close { top: 16px; right: 16px; }
.eg-lightbox-prev  { left: 16px; top: 50%; transform: translateY(-50%); }
.eg-lightbox-next  { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---- Archive wrapper ---- */
.eg-archive-wrap {
	/* Fallback container for themes without their own content-width
	   class. Blocksy sites get "ct-container eg-archive-content"
	   instead (see templates/archive-*.php), so this max-width never
	   stacks with the theme's own container width. */
	max-width: 1200px;
	margin: 0 auto;
	padding: 48px 24px;
}

.eg-archive-content {
	/* Used on Blocksy (or any theme exposing its own container
	   class) — only vertical spacing, no width override, since the
	   theme's container already controls width. */
	padding: 48px 0;
}

.eg-archive-title {
	/* Intentionally no font-family/color set here — inherits
	   whatever the active theme's global heading styles are. */
	font-size: 32px;
	margin-bottom: 24px;
}

.eg-archive-title.eg-align-left { text-align: left; }
.eg-archive-title.eg-align-center { text-align: center; }
.eg-archive-title.eg-align-right { text-align: right; }

/* ---- Single project template ---- */

/* Hero: the one intentionally full-bleed element (edge-to-edge of
   the viewport, breaking out of whatever container/theme wrapper
   this sits inside), with title + client/year/role overlaid directly
   on the image — same idea as the archive card caption, scaled up. */
.eg-project-hero {
	position: relative;
	width: 100vw;
	margin-left: calc(50% - 50vw);
	max-height: 78vh;
	min-height: 320px;
	overflow: hidden;
}

.eg-project-hero img,
.eg-project-hero video {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.eg-project-hero-overlay {
	position: absolute;
	inset: auto 0 0 0;
	padding: 48px clamp(20px, 6vw, 80px) 40px;
	background: linear-gradient(to top, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0) 65%);
	color: #fff;
}

.eg-project-hero-title {
	/* No font-family override — inherits the theme's heading font. */
	font-size: clamp(28px, 4vw, 48px);
	line-height: 1.15;
	margin: 0 0 10px;
	color: #fff;
}

.eg-project-hero-meta {
	text-transform: uppercase;
	letter-spacing: .08em;
	font-size: 13px;
	opacity: .9;
	margin: 0;
}

/* Content: everything below the hero is contained, not full-bleed.
   Two width tiers — narrow for reading, wide for media — so the page
   has visual rhythm instead of every block being the same width. */
.eg-project-container {
	max-width: 760px;
	margin: 0 auto;
	padding: 56px 24px 0;
}

.eg-project-container--wide {
	max-width: 1100px;
}

.eg-project-intro {
	font-size: 17px;
	line-height: 1.75;
}

.eg-project-media-block {
	margin: 0;
}

.eg-project-media-block model-viewer {
	width: 100%;
	height: 480px;
	background: var(--eg-accent-soft);
	border-radius: var(--eg-radius);
}

/* Prev/next navigation — used on non-Blocksy themes (Blocksy gets
   WordPress core's own post-navigation markup instead, styled by
   Blocksy's own site-wide CSS). Real thumbnail + label + title +
   SVG chevron, not arrow characters. */
.eg-project-nav {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	border-top: 1px solid #eee;
	margin-top: 64px;
	padding: 32px 0 64px;
}

.eg-project-nav-link {
	display: flex;
	align-items: center;
	gap: 14px;
	max-width: 46%;
	text-decoration: none;
	color: inherit;
	transition: opacity var(--eg-speed) var(--eg-ease);
}

.eg-project-nav-link:hover {
	opacity: .6;
}

.eg-project-nav-next {
	margin-left: auto;
	flex-direction: row-reverse;
	text-align: right;
}

.eg-project-nav-icon {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	color: #999;
}

.eg-project-nav-icon svg {
	width: 100%;
	height: 100%;
}

.eg-project-nav-thumb {
	flex-shrink: 0;
	width: 56px;
	height: 56px;
	border-radius: 4px;
	overflow: hidden;
}

.eg-project-nav-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.eg-project-nav-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.eg-project-nav-label {
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: #999;
}

.eg-project-nav-title {
	font-size: 15px;
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media (max-width: 600px) {
	.eg-project-nav {
		flex-direction: column;
		gap: 24px;
	}
	.eg-project-nav-link {
		max-width: 100%;
	}
	.eg-project-nav-next {
		flex-direction: row;
		text-align: left;
	}
}

.eg-fade-in {
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 600ms var(--eg-ease), transform 600ms var(--eg-ease);
}

.eg-fade-in.is-visible {
	opacity: 1;
	transform: translateY(0);
}
