/* ==========================================================================
   WP Gallery — styled to match the WEBFIXUS neo-brutalist design system.
   Mirrors the theme tokens (assets/css/webfixus.css): cream canvas, ink-black
   3px borders, hard offset shadows, squared corners, Space Grotesk / Archivo /
   Space Mono type, and rotating accent colors per tile.

   The --wfx-* variables below fall back to the theme's literal values, so this
   looks correct even if the plugin's CSS happens to load before the theme's.
   ========================================================================== */

.wg-grid {
	/* Local copies of the WEBFIXUS palette (fallbacks = theme values). */
	--wg-ink:   var(--wfx-ink, #14110c);
	--wg-cream: var(--wfx-cream, #f3ede1);
	--wg-blue:  var(--wfx-blue, #2b4cff);
	--wg-red:   var(--wfx-red, #ff5a36);
	--wg-green: var(--wfx-green, #16a06a);
	--wg-amber: var(--wfx-amber, #ffb300);
	--wg-body:  var(--wfx-body, #3a352c);

	display: grid;
	grid-template-columns: repeat(var(--wg-cols, 3), 1fr);
	gap: 24px;
	margin: 28px 0;
	max-width: 100%;
}

/* Make every element predictable inside any theme/Elementor container. */
.wg-grid,
.wg-grid * { box-sizing: border-box; }

/* Grid/flex children won't shrink below their content unless min-width:0.
   Without this, a long unbroken word forces the tile wider than the screen. */
.wg-tile { min-width: 0; }
.wg-caption,
.wg-note {
	overflow-wrap: break-word;
	word-break: break-word;
}

@media (max-width: 900px) {
	.wg-grid { grid-template-columns: repeat(2, 1fr); gap: 18px; }
}
@media (max-width: 600px) {
	.wg-grid { grid-template-columns: 1fr; gap: 16px; }
	/* Tame the hard shadow on small screens so it never adds scroll. */
	.wg-tile { box-shadow: 5px 5px 0 var(--wg-ink); }
	.wg-tile:hover { transform: none; box-shadow: 5px 5px 0 var(--wg-ink); }
}

/* ---- the brutalist tile: square corners, thick border, hard shadow ---- */
.wg-tile {
	display: block;
	background: var(--wg-cream);
	border: 3px solid var(--wg-ink);
	box-shadow: 6px 6px 0 var(--wg-ink);
	border-radius: 0;                 /* brutalism = no rounding */
	margin: 0;
	padding: 0;
	text-decoration: none;
	color: inherit;
	transition: transform .12s ease, box-shadow .12s ease;
}

/* Lift-on-hover: the classic hard-shadow "pop". */
.wg-tile:hover {
	transform: translate(-3px, -3px);
	box-shadow: 9px 9px 0 var(--wg-ink);
}
.wg-grid--lightbox .wg-lb { cursor: zoom-in; }

/* ---- photo: square, framed, separated by a thick rule when captioned ---- */
.wg-photo {
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--wg-cream);
}

.wg-photo .wg-img,
.wg-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .25s ease;
}
.wg-tile:hover .wg-img { transform: scale(1.04); }

/* ---- caption / note block ---- */
.wg-meta {
	display: block;
	padding: 14px 16px 16px;
	border-top: 3px solid var(--wg-ink);
}

.wg-caption {
	display: block;
	font-family: 'Archivo', 'Space Grotesk', sans-serif;
	font-weight: 900;
	letter-spacing: -.02em;
	font-size: 18px;
	line-height: 1.15;
	color: var(--wg-ink);
}

.wg-note {
	display: block;
	margin-top: 6px;
	font-family: 'Space Mono', monospace;
	font-size: 12px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--wg-blue);
}

/* ---- rotate accent colors across tiles (very neo-brutalist) ---- */
.wg-tile:nth-child(4n+1) .wg-note { color: var(--wg-blue); }
.wg-tile:nth-child(4n+2) .wg-note { color: var(--wg-red); }
.wg-tile:nth-child(4n+3) .wg-note { color: var(--wg-green); }
.wg-tile:nth-child(4n+4) .wg-note { color: var(--wg-amber); }

/* ==========================================================================
   CATEGORY FILTER BAR (shown when the shortcode uses filter="yes").
   Mono "chip" buttons in the brutalist style; the active one is inverted.
   ========================================================================== */
.wg-filter {
	--wg-ink:   var(--wfx-ink, #14110c);
	--wg-cream: var(--wfx-cream, #f3ede1);
	--wg-blue:  var(--wfx-blue, #2b4cff);
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 8px 0 4px;
}

.wg-filter-btn {
	font-family: 'Space Mono', monospace;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	cursor: pointer;
	color: var(--wg-ink);
	background: var(--wg-cream);
	padding: 8px 14px;
	border: 3px solid var(--wg-ink);
	box-shadow: 3px 3px 0 var(--wg-ink);
	border-radius: 0;
	transition: transform .1s ease, box-shadow .1s ease;
}
.wg-filter-btn:hover {
	transform: translate(-2px, -2px);
	box-shadow: 5px 5px 0 var(--wg-ink);
}
.wg-filter-btn.is-active {
	color: var(--wg-cream);
	background: var(--wg-ink);
}

/* ---- empty-state message in the brutalist frame ---- */
.wg-empty {
	font-family: 'Space Mono', monospace;
	font-size: 14px;
	padding: 16px;
	background: var(--wfx-cream, #f3ede1);
	border: 3px solid var(--wfx-ink, #14110c);
	box-shadow: 4px 4px 0 var(--wfx-ink, #14110c);
	color: var(--wfx-ink, #14110c);
}

/* ==========================================================================
   LIGHTBOX overlay (Subsystem J). Full-screen dim + a framed image.
   ========================================================================== */
.wg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(20, 17, 12, .82);
}
.wg-lightbox[hidden] { display: none; }

.wg-lb-figure {
	margin: 0;
	max-width: min(92vw, 1100px);
	max-height: 92vh;
	background: var(--wfx-cream, #f3ede1);
	border: 3px solid var(--wfx-ink, #14110c);
	box-shadow: 10px 10px 0 var(--wfx-ink, #14110c);
	display: flex;
	flex-direction: column;
}

.wg-lb-img {
	display: block;
	max-width: 100%;
	max-height: calc(92vh - 54px);
	object-fit: contain;
	background: #fff;
}

.wg-lb-caption {
	font-family: 'Archivo', 'Space Grotesk', sans-serif;
	font-weight: 900;
	letter-spacing: -.01em;
	font-size: 15px;
	padding: 12px 16px;
	border-top: 3px solid var(--wfx-ink, #14110c);
	color: var(--wfx-ink, #14110c);
}
.wg-lb-caption:empty { display: none; }

.wg-lb-close {
	position: fixed;
	top: 18px;
	right: 20px;
	width: 46px;
	height: 46px;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: var(--wfx-ink, #14110c);
	background: var(--wfx-amber, #ffb300);
	border: 3px solid var(--wfx-ink, #14110c);
	box-shadow: 4px 4px 0 var(--wfx-ink, #14110c);
	border-radius: 0;
}
.wg-lb-close:hover { background: var(--wfx-red, #ff5a36); color: #fff; }
