/**
 * Lugnalandet – galleri och ljusbox.
 *
 * Fristående CSS: temats style.css är en kompilerad Tailwind-bundle, så
 * utility-klasser som inte redan används där finns inte att tillgå här.
 */

/* ── Sektion ───────────────────────────────────────────────────────────── */
.lg-gallery {
	position: relative;
	padding-block: 6rem;
	background:
		radial-gradient(120% 80% at 50% 0%, hsl(35 55% 58% / 0.07), transparent 60%),
		var(--color-card, #fff);
}

.lg-gallery__inner {
	max-width: 80rem;
	margin-inline: auto;
	padding-inline: 1.5rem;
}

.lg-gallery__head {
	max-width: 42rem;
	margin: 0 auto 3.5rem;
	text-align: center;
}

.lg-gallery__rule {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.lg-gallery__lead {
	margin-top: 1rem;
	font-size: 1.0625rem;
	line-height: 1.7;
	color: var(--color-muted-foreground, #6b7280);
}

/* ── Rutnät ───────────────────────────────────────────────────────────
 * auto-fit fyller alltid ut raden, så antalet bilder kan variera utan
 * att sista raden lämnar tomma spalter efter sig.
 */
.lg-gallery__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
	gap: 1.25rem;
}

@media (min-width: 1024px) {
	.lg-gallery__grid { gap: 1.5rem; }
}

.lg-gallery__item {
	min-width: 0;
}

/* ── Bildplatta ───────────────────────────────────────────────────────── */
.lg-gallery__tile {
	display: block;
	position: relative;
	width: 100%;
	padding: 0;
	border: 0;
	border-radius: 1rem;
	overflow: hidden;
	background: hsl(220 14% 96%);
	cursor: zoom-in;
	box-shadow: 0 1px 2px hsl(220 10% 20% / 0.06), 0 8px 24px hsl(220 10% 20% / 0.07);
	transition: box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.lg-gallery__tile:hover,
.lg-gallery__tile:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 2px 4px hsl(220 10% 20% / 0.08), 0 18px 44px hsl(220 10% 20% / 0.16);
}

.lg-gallery__tile:focus-visible {
	outline: 2px solid var(--color-gold, #c9a227);
	outline-offset: 3px;
}

/* 3:4 matchar bildernas egna proportioner – inget beskärs. */
.lg-gallery__tile img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.lg-gallery__tile:hover img,
.lg-gallery__tile:focus-visible img {
	transform: scale(1.045);
}

/* Guldslöja + bildtext som tonas in */
.lg-gallery__veil {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-end;
	padding: 1.25rem;
	background: linear-gradient(to top, hsl(0 0% 0% / 0.62), hsl(0 0% 0% / 0.12) 45%, transparent 70%);
	opacity: 0;
	transition: opacity 0.45s ease;
}

.lg-gallery__tile:hover .lg-gallery__veil,
.lg-gallery__tile:focus-visible .lg-gallery__veil {
	opacity: 1;
}

.lg-gallery__caption {
	color: #fff;
	font-size: 0.875rem;
	line-height: 1.45;
	text-align: left;
	transform: translateY(6px);
	transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.lg-gallery__tile:hover .lg-gallery__caption,
.lg-gallery__tile:focus-visible .lg-gallery__caption {
	transform: none;
}

.lg-gallery__zoom {
	position: absolute;
	top: 0.875rem;
	right: 0.875rem;
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 999px;
	color: #fff;
	background: hsl(0 0% 0% / 0.35);
	backdrop-filter: blur(4px);
	opacity: 0;
	transform: scale(0.85);
	transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lg-gallery__tile:hover .lg-gallery__zoom,
.lg-gallery__tile:focus-visible .lg-gallery__zoom {
	opacity: 1;
	transform: none;
}

/* ── Ljusbox ──────────────────────────────────────────────────────────── */
.lg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	flex-direction: column;
	background: hsl(220 18% 5% / 0.94);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.lg-lightbox.is-open { opacity: 1; }

@supports (backdrop-filter: blur(1px)) {
	.lg-lightbox { backdrop-filter: blur(8px); }
}

.lg-lightbox__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 1.25rem;
	color: hsl(0 0% 100% / 0.75);
	font-size: 0.8125rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.lg-lightbox__stage {
	position: relative;
	flex: 1;
	display: grid;
	place-items: center;
	min-height: 0;
	padding: 0 1rem;
}

.lg-lightbox__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	max-height: 100%;
}

.lg-lightbox__img {
	max-width: min(100%, 1100px);
	max-height: 72vh;
	width: auto;
	height: auto;
	object-fit: contain;
	border-radius: 0.75rem;
	box-shadow: 0 30px 80px hsl(0 0% 0% / 0.55);
	opacity: 0;
	transform: scale(0.98);
	transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.lg-lightbox__img.is-ready {
	opacity: 1;
	transform: none;
}

.lg-lightbox__figcaption {
	max-width: 46rem;
	padding: 0 1rem 1.5rem;
	color: hsl(0 0% 100% / 0.8);
	font-size: 0.9375rem;
	line-height: 1.6;
	text-align: center;
}

/* Knappar */
.lg-lightbox__btn {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid hsl(0 0% 100% / 0.16);
	border-radius: 999px;
	color: #fff;
	background: hsl(0 0% 100% / 0.06);
	cursor: pointer;
	transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.lg-lightbox__btn:hover {
	background: hsl(35 55% 58% / 0.22);
	border-color: hsl(35 55% 58% / 0.5);
}

.lg-lightbox__btn:focus-visible {
	outline: 2px solid var(--color-gold, #c9a227);
	outline-offset: 3px;
}

.lg-lightbox__btn[disabled] {
	opacity: 0.3;
	cursor: default;
	pointer-events: none;
}

.lg-lightbox__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 3rem;
	height: 3rem;
}

.lg-lightbox__nav--prev { left: 0.5rem; }
.lg-lightbox__nav--next { right: 0.5rem; }

@media (min-width: 768px) {
	.lg-lightbox__nav--prev { left: 1.75rem; }
	.lg-lightbox__nav--next { right: 1.75rem; }
}

/* Miniatyrrad */
.lg-lightbox__thumbs {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
	flex-wrap: nowrap;
	overflow-x: auto;
	padding: 0.75rem 1.25rem 1.5rem;
	scrollbar-width: none;
}

.lg-lightbox__thumbs::-webkit-scrollbar { display: none; }

.lg-lightbox__thumb {
	flex: 0 0 auto;
	width: 3.5rem;
	height: 3.5rem;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 0.5rem;
	overflow: hidden;
	background: none;
	cursor: pointer;
	opacity: 0.45;
	transition: opacity 0.25s ease, border-color 0.25s ease;
}

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

.lg-lightbox__thumb:hover { opacity: 0.8; }

.lg-lightbox__thumb[aria-current="true"] {
	opacity: 1;
	border-color: var(--color-gold, #c9a227);
}

.lg-lightbox__thumb:focus-visible {
	outline: 2px solid var(--color-gold, #c9a227);
	outline-offset: 2px;
}

body.lg-lightbox-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.lg-gallery__tile,
	.lg-gallery__tile img,
	.lg-gallery__veil,
	.lg-gallery__caption,
	.lg-gallery__zoom,
	.lg-lightbox,
	.lg-lightbox__img {
		transition: none;
	}
	.lg-gallery__tile:hover { transform: none; }
	.lg-gallery__tile:hover img { transform: none; }
}
