/*
	NG Hoorig – Galerie + Lightbox
	Webkultur GmbH, 2026
*/

.hoorig-gallery .eyebrow {
	display: inline-block;
	font-size: .8em;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--h-red);
	margin-bottom: .5em;
}

.gal-head { margin-bottom: 1.75em; }
.gal-head h2 { margin-bottom: .3em; }
.gal-lead { margin: 0; font-size: 1.05em; max-width: 46em; }
.gal-notice {
	margin: 1em 0 0 0;
	padding: .8em 1em;
	border-radius: 10px;
	background: #fff4f2;
	border: 1px solid #f3cfc9;
	color: var(--h-red-dark);
}

.gal-back {
	display: flex;
	width: max-content;
	align-items: center;
	gap: .4em;
	margin-bottom: 1em;
	font-weight: 600;
	text-decoration: none;
	border-bottom: 0;
}
.gal-back .fa { font-size: 1.3em; line-height: 1; }

.gal-meta { display: flex; flex-wrap: wrap; gap: .4em 1.4em; margin: 0; color: var(--h-muted); }
.gal-meta .fa { color: var(--h-red); margin-right: .25em; }

/* ---------- Werkzeugleiste: Suche + Jahre ---------- */

.gal-toolbar {
	position: sticky;
	top: var(--h-header-h);
	z-index: 20;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75em 1em;
	margin: 0 -2.75em 1.5em;
	padding: .85em 2.75em;
	background: rgba(255, 255, 255, .97);
	border-top: 1px solid var(--h-line);
	border-bottom: 1px solid var(--h-line);
}

.gal-search {
	position: relative;
	flex: 0 1 18em;
	margin: 0;
}
.gal-search .fa {
	position: absolute;
	left: .95em;
	top: 50%;
	transform: translateY(-50%);
	color: var(--h-muted);
	pointer-events: none;
}
.gal-search input[type="search"] {
	width: 100%;
	height: 2.6em;
	padding: 0 1em 0 2.5em;
	border: 1px solid var(--h-line);
	border-radius: 999px;
	background: #fbf8f4;
	font-size: .95em;
	line-height: 2.6em;
	-webkit-appearance: none;
	appearance: none;
}
.gal-search input[type="search"]:focus { outline: 0; border-color: var(--h-red); background: #fff; box-shadow: 0 0 0 3px rgba(200, 22, 29, .12); }

.gal-years {
	flex: 1 1 0;
	display: flex;
	gap: .35em;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	min-width: 0;
}
.gal-years::-webkit-scrollbar { display: none; }
.gal-years a {
	flex: 0 0 auto;
	padding: .35em .8em;
	border-radius: 999px;
	border: 1px solid var(--h-line);
	color: var(--h-ink);
	font-size: .88em;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.4;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.gal-years a:hover, .gal-years a.is-active { border-color: var(--h-red); background: var(--h-red); color: #fff; }
.gal-years a[hidden] { display: none; }

/* ---------- Jahresabschnitte + Karten ---------- */

.gal-year { scroll-margin-top: calc(var(--h-header-h) + 5em); }
.gal-year + .gal-year { margin-top: 2.25em; }
.gal-year h3 {
	display: flex;
	align-items: center;
	gap: .75em;
	margin: 0 0 .9em 0;
	font-size: 1.35em;
}
.gal-year h3:after { content: ""; flex: 1; height: 1px; background: var(--h-line); }

.gal-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
	gap: 1.1em;
}

.gal-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 12px;
	background: #fff;
	border: 1px solid var(--h-line);
	color: var(--h-ink);
	text-decoration: none;
	transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.gal-card:hover, .gal-card:focus-visible {
	transform: translateY(-3px);
	border-color: transparent;
	box-shadow: 0 12px 28px rgba(43, 37, 34, .16);
	color: var(--h-ink);
}

.gal-cover {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #efe8df;
	color: #c9bcae;
	font-size: 2em;
}
#content .gal-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
	transition: transform .5s ease;
}
.gal-card:hover .gal-cover img { transform: scale(1.06); }

.gal-card-body { display: flex; flex-direction: column; gap: .15em; padding: .8em .95em .9em; line-height: 1.3; }
.gal-card-body strong { font-size: 1em; }
.gal-card-body small { color: var(--h-muted); font-size: .82em; }

.gal-empty { margin: 1em 0; color: var(--h-muted); }

/* ---------- Bildraster einer Galerie ---------- */

.gal-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
	gap: 6px;
}
.gal-grid a {
	position: relative;
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 6px;
	background: #efe8df;
	border: 0;
	cursor: zoom-in;
}
#content .gal-grid img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 0;
	transition: transform .4s ease, opacity .3s ease;
}
.gal-grid a:after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0);
	transition: background-color .25s ease;
}
.gal-grid a:hover img { transform: scale(1.05); }
.gal-grid a:hover:after { background: rgba(0, 0, 0, .12); }
.gal-grid a:focus-visible { outline: 3px solid var(--h-red); outline-offset: 2px; }

/* Blaettern zwischen Galerien */
.gal-pager {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1em;
	margin-top: 2.5em;
	padding-top: 1.75em;
	border-top: 1px solid var(--h-line);
}
.gal-pager a {
	display: flex;
	flex-direction: column;
	gap: .15em;
	padding: .9em 1.1em;
	border: 1px solid var(--h-line);
	border-radius: 12px;
	color: var(--h-ink);
	text-decoration: none;
	line-height: 1.3;
	transition: border-color .2s ease, background-color .2s ease;
}
.gal-pager a:hover { border-color: var(--h-red); background: #fff7f5; }
.gal-pager small { color: var(--h-red); font-weight: 600; font-size: .82em; }
.gal-pager .next { grid-column: 2; text-align: right; }

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

html.lb-open, html.lb-open body { overflow: hidden; }

.lb {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	background: #0e0a09;
	color: #fff;
	opacity: 0;
	transition: opacity .2s ease;
	-webkit-user-select: none;
	user-select: none;
	touch-action: pan-y pinch-zoom;
}
.lb.is-visible { opacity: 1; }

.lb-bar {
	display: flex;
	align-items: center;
	gap: .5em;
	padding: .6em .75em .6em 1.25em;
	font-size: .95em;
	line-height: 1.3;
}
.lb-count { font-weight: 700; white-space: nowrap; }
.lb-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255, 255, 255, .7); }

.lb button, .lb .lb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	text-decoration: none;
	transition: background-color .2s ease;
}
.lb button:hover, .lb .lb-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.lb button:focus-visible, .lb .lb-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.lb-stage {
	position: relative;
	flex: 1;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0 4.5em 1em;
}
.lb-stage img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, .5);
	opacity: 0;
	transition: opacity .25s ease, transform .25s ease;
}
.lb-stage img.is-loaded { opacity: 1; }

.lb-spinner {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 38px;
	height: 38px;
	margin: -19px 0 0 -19px;
	border: 3px solid rgba(255, 255, 255, .2);
	border-top-color: #fff;
	border-radius: 50%;
	animation: lb-spin .8s linear infinite;
}
.lb-stage.is-ready .lb-spinner { display: none; }
@keyframes lb-spin { to { transform: rotate(360deg); } }

.lb .lb-prev, .lb .lb-next {
	position: absolute;
	top: 50%;
	width: 54px;
	height: 54px;
	margin-top: -27px;
	background: rgba(255, 255, 255, .1);
	font-size: 30px;
}
.lb .lb-prev { left: .9em; }
.lb .lb-next { right: .9em; }
.lb .lb-prev[disabled], .lb .lb-next[disabled] { opacity: .25; cursor: default; background: rgba(255, 255, 255, .1); }

.lb-credit { padding: 0 1.25em .9em; text-align: center; font-size: .8em; color: rgba(255, 255, 255, .55); min-height: 1.2em; }

@media screen and (max-width: 1280px) {
	.gal-toolbar { margin: 0 -2.25em 1.5em; padding: .85em 2.25em; }
}

@media screen and (max-width: 980px) {
	.gal-toolbar { margin: 0 -1.75em 1.5em; padding: .75em 1.75em; }
}

@media screen and (max-width: 736px) {
	.gal-toolbar { margin: 0 -1.25em 1.25em; padding: .7em 1.25em; }
	.gal-search { flex: 1 1 100%; }
	.gal-years { flex: 1 1 100%; }

	.gal-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7em; }
	.gal-card-body { padding: .6em .7em .7em; }
	.gal-card-body strong { font-size: .92em; }
	.gal-card-body small { font-size: .76em; }

	.gal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
	.gal-grid a { border-radius: 3px; }

	.gal-pager { grid-template-columns: 1fr; }
	.gal-pager .next { grid-column: 1; }

	.lb-stage { padding: 0 0 .5em; }
	.lb .lb-prev, .lb .lb-next { display: none; }   /* auf dem Handy wischen */
	.lb-stage img { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.gal-card, .gal-cover img, .gal-grid img, .lb, .lb-stage img { transition: none !important; }
}
