/**
 * TEAB Projektgalleri – bildgalleri för enskild projektsida.
 *
 * Visar projektets galleribilder (meta _teab_projekt_galleri) i FÄRG, med en
 * enkel lightbox. Self-contained och scoped under .teab-projektgalleri.
 *
 * @package Teab_Moduler
 */

.teab-projektgalleri {
	--_ink:    var(--teab-projektgalleri-ink, var(--teab-text, #14201A));
	--_muted:  var(--teab-projektgalleri-muted, var(--teab-muted, #5C6B61));
	--_accent: var(--teab-projektgalleri-accent, var(--teab-accent, #008A2B));
	--_line:   var(--teab-projektgalleri-line, color-mix(in srgb, var(--_ink) 16%, transparent));

	--_font-ui:      var(--teab-projektgalleri-font-ui, var(--font-ui, inherit));
	--_font-display: var(--teab-projektgalleri-font-display, var(--font-display, var(--_font-ui)));

	--_cols:   var(--teab-projektgalleri-cols, 3);
	--_gap:    var(--teab-projektgalleri-gap, 14px);
	--_ratio:  var(--teab-projektgalleri-ratio, 4 / 3);
	--_easing: cubic-bezier(.2, .6, .2, 1);

	font-family: var(--_font-ui);
	color: var(--_ink);
}

.teab-projektgalleri *,
.teab-projektgalleri *::before,
.teab-projektgalleri *::after { box-sizing: border-box; }

.teab-projektgalleri--dark {
	--teab-projektgalleri-ink: #EDF4EF;
	--teab-projektgalleri-muted: rgba(237, 244, 239, 0.62);
	--teab-projektgalleri-accent: var(--teab-accent-bright, #34AC5C);
}

.teab-projektgalleri__eyebrow {
	font-family: var(--_font-ui);
	font-weight: 600; font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
	color: var(--_muted); display: inline-flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.teab-projektgalleri__eyebrow::before { content: ''; display: block; width: 40px; height: 1px; background: var(--_accent); }

.teab-projektgalleri__heading {
	margin: 0 0 32px;
	font-family: var(--_font-display);
	font-weight: var(--teab-projektgalleri-title-weight, 700);
	font-size: clamp(26px, 3vw, 42px); line-height: 1.1; letter-spacing: -0.02em;
}

/* ============ RUTNÄT ============ */
.teab-projektgalleri__grid {
	display: grid;
	grid-template-columns: repeat(var(--_cols), 1fr);
	gap: var(--_gap);
}
.teab-projektgalleri__item {
	overflow: hidden;
}
.teab-projektgalleri__btn {
	display: block; width: 100%;
	margin: 0; padding: 0; border: none; background: none; cursor: zoom-in;
	line-height: 0;
}
/* Bilden bär själv bildformatet (aspect-ratio) + cover, med height:auto. Då fyller
   den alltid rutan oavsett om temat tvingar img{height:auto} – ingen grå botten. */
.teab-projektgalleri__btn img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--_ratio);
	object-fit: cover;
	transition: transform .6s var(--_easing);
}
.teab-projektgalleri__btn:hover img,
.teab-projektgalleri__btn:focus-visible img { transform: scale(1.045); }
.teab-projektgalleri__btn:focus-visible { outline: 2px solid var(--_accent); outline-offset: -2px; }

/* ============ LIGHTBOX ============ */
.teab-projektgalleri__lightbox {
	position: fixed; inset: 0; z-index: 99990;
	display: none; align-items: center; justify-content: center;
	background: rgba(8, 11, 9, 0.94);
	padding: 4vw;
}
.teab-projektgalleri__lightbox.is-open { display: flex; }
.teab-projektgalleri__lightbox img {
	max-width: 92vw; max-height: 86vh; object-fit: contain; display: block;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.teab-projektgalleri__lb-btn {
	position: absolute; background: transparent; border: none; color: #EDF4EF;
	cursor: pointer; line-height: 1; padding: 12px; transition: color .2s ease;
}
.teab-projektgalleri__lb-btn:hover { color: var(--teab-accent-bright, #34AC5C); }
.teab-projektgalleri__lb-btn:focus-visible { outline: 2px solid var(--teab-accent-bright, #34AC5C); outline-offset: 2px; }
.teab-projektgalleri__lb-close { top: 20px; right: 24px; font-size: 34px; }
.teab-projektgalleri__lb-prev { left: 16px; top: 50%; transform: translateY(-50%); font-size: 48px; }
.teab-projektgalleri__lb-next { right: 16px; top: 50%; transform: translateY(-50%); font-size: 48px; }
.teab-projektgalleri__lb-count { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); color: rgba(237,244,239,.7); font-family: var(--_font-ui); font-size: 13px; letter-spacing: .08em; }

.teab-projektgalleri__empty {
	padding: 40px; border: 1px dashed var(--_line); color: var(--_muted);
	font-family: var(--_font-ui); text-align: center;
}

/* ============ RESPONSIVT ============ */
@media (max-width: 1024px) { .teab-projektgalleri__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
	.teab-projektgalleri__grid { grid-template-columns: 1fr 1fr; }
	.teab-projektgalleri__lb-prev { font-size: 34px; }
	.teab-projektgalleri__lb-next { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
	.teab-projektgalleri__btn img { transition: none; }
	.teab-projektgalleri__btn:hover img { transform: none; }
}
