/* Gallery page */

/* ---------- Layout: category menu beside the grid ---------- */

.gallery-layout {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 36px;
	align-items: start;
	margin-top: 28px;
}

.gallery-nav {
	position: sticky;
	top: 24px;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
}

.gallery-nav-head,
.gallery-nav-toggle {
	display: none;
}

.nav-group {
	margin: 22px 0 6px 12px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--gold);
}

.gallery-nav .cat {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-left: 2px solid transparent;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.95rem;
	text-align: left;
	cursor: pointer;
}

.gallery-nav .cat:hover {
	background: var(--panel);
}

.gallery-nav .cat[aria-current="true"] {
	border-left-color: var(--gold);
	background: var(--panel);
	color: var(--gold);
}

.cat .count {
	color: var(--secondary);
	font-size: 0.85rem;
}

/* ---------- Category menu slides in on phones and tablets ---------- */

@media (max-width: 899px) {
	.gallery-layout {
		grid-template-columns: 1fr;
		gap: 16px;
	}
	.gallery-nav-toggle {
		display: inline-flex;
		justify-self: start;
		gap: 8px;
		padding: 11px 16px;
		border: 1px solid var(--gold);
		background: var(--panel);
		color: inherit;
		font: inherit;
		font-size: 0.95rem;
		cursor: pointer;
	}
	.gallery-nav-toggle span {
		color: var(--gold);
	}
	.gallery-nav {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		z-index: 60;
		width: min(300px, 82vw);
		max-height: none;
		padding: 14px 14px 30px;
		background: var(--bg);
		border-right: 1px solid var(--panel-border);
		transform: translateX(-100%);
		visibility: hidden;
		transition: transform 0.25s ease, visibility 0.25s;
	}
	.gallery-nav.open {
		transform: none;
		visibility: visible;
	}
	.gallery-nav-head {
		display: flex;
		justify-content: space-between;
		align-items: center;
		font-weight: 700;
		letter-spacing: 0.14em;
		text-transform: uppercase;
	}
	.gallery-nav-head button {
		width: 44px;
		height: 44px;
		border: 1px solid var(--panel-border);
		background: var(--panel);
		color: inherit;
		font-size: 1.1rem;
		cursor: pointer;
	}
	.gallery-nav-shade {
		position: fixed;
		inset: 0;
		z-index: 59;
		background: rgba(0, 0, 0, 0.6);
	}
}

@media (prefers-reduced-motion: reduce) {
	.gallery-nav {
		transition: none;
	}
}

/* ---------- Thumbnail grid ---------- */

.gallery-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.gallery-item button {
	display: block;
	width: 100%;
	padding: 0;
	border: 1px solid var(--panel-border);
	border-top: 3px solid var(--gold);
	background: var(--panel);
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.gallery-item button:hover,
.gallery-item button:focus-visible {
	border-color: var(--gold);
}

.gallery-thumb {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--bg);
}

@media (min-width: 600px) {
	.gallery-item.wide {
		grid-column: span 2;
	}
	.gallery-item.wide .gallery-thumb {
		aspect-ratio: 8 / 3;
	}
}

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

.gallery-play {
	position: absolute;
	inset: 0;
	margin: auto;
	width: 58px;
	height: 58px;
	border-radius: 50%;
	background: rgba(11, 11, 12, 0.72);
	border: 2px solid var(--gold);
}

.gallery-play::after {
	content: "";
	position: absolute;
	left: 22px;
	top: 17px;
	border-style: solid;
	border-width: 11px 0 11px 18px;
	border-color: transparent transparent transparent var(--gold);
}

.gallery-caption {
	padding: 12px 14px 14px;
}

.gallery-caption strong {
	display: block;
	font-size: 1rem;
}

.gallery-caption span {
	display: block;
	margin-top: 4px;
	color: var(--secondary);
	font-size: 0.85rem;
}

.gallery-empty {
	color: var(--secondary);
}

/* ---------- Photo / video viewer ---------- */

.gallery-viewer {
	width: min(1100px, 100vw - 32px);
	max-height: calc(100vh - 32px);
	padding: 0;
	border: 1px solid var(--panel-border);
	border-top: 3px solid var(--gold);
	background: var(--bg);
	color: var(--offwhite);
}

.gallery-viewer::backdrop {
	background: rgba(0, 0, 0, 0.85);
}

.viewer-media {
	display: flex;
	align-items: center;
	justify-content: center;
	background: #000;
}

.viewer-media img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 170px);
}

.viewer-media iframe {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	max-height: calc(100vh - 170px);
	border: 0;
}

.viewer-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 14px;
}

.viewer-text {
	flex: 1;
	min-width: 0;
}

.viewer-text span {
	display: block;
	color: var(--secondary);
	font-size: 0.85rem;
	margin-top: 3px;
}

.viewer-bar button {
	min-width: 44px;
	height: 44px;
	border: 1px solid var(--panel-border);
	background: var(--panel);
	color: inherit;
	font-size: 1.2rem;
	cursor: pointer;
}

.viewer-bar button:hover {
	border-color: var(--gold);
}

body.light-mode .gallery-item button,
body.light-mode .viewer-bar button {
	background: #fff;
	border-color: var(--light-border-alt);
}

body.light-mode .gallery-viewer {
	background: var(--light-bg);
	color: var(--light-text);
}

@media (max-width: 599px) {
	.gallery-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 4px;
	}
	.gallery-caption {
		display: none;
	}
	.gallery-item button {
		border: 0;
	}
	.gallery-thumb {
		aspect-ratio: 1 / 1;
	}
	.gallery-play {
		width: 34px;
		height: 34px;
	}
	.gallery-play::after {
		left: 12px;
		top: 8px;
		border-width: 8px 0 8px 13px;
	}
}

body.light-mode .gallery-nav .cat:hover,
body.light-mode .gallery-nav .cat[aria-current="true"],
body.light-mode .gallery-nav-toggle,
body.light-mode .gallery-nav-head button {
	background: #fff;
}

body.light-mode .gallery-nav {
	background: var(--light-bg);
}
