/* heyder-gallery – Galerie-Darstellung. Farben über Variablen mit Rückfallwerten;
   das Theme überschreibt sie (z. B. im Dunkel-Modus). */
:root {
	--hg-bg: var(--wp--preset--color--base, #fff);
	--hg-text: var(--wp--preset--color--text, #5c5c5c);
	--hg-heading: var(--wp--preset--color--heading, #333);
	--hg-muted: var(--wp--preset--color--muted, #707070);
	--hg-line: var(--wp--preset--color--line, #e4e4e4);
	--hg-surface: var(--wp--preset--color--surface, #f3f3f3);
	--hg-placeholder: var(--wp--preset--color--placeholder, #efefef);
	--hg-focus: var(--wp--preset--color--focus, #1a1a1a);
	--hg-lb-bg: #fff;
	--hg-lb-ui: #1d1d1d;
	--hg-lb-ui-2: #fff;
	--hg-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Masonry ---------- */
.hg-masonry { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; align-items: start; }
.hg-masonry.is-laid-out { display: flex; gap: 10px; align-items: flex-start; }
.hg-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.hg-tile { position: relative; display: block; overflow: hidden; background: var(--hg-placeholder); cursor: zoom-in; }
/* <picture> mit WebP-Quelle (Derivatives::picture) nimmt nicht am Layout teil – Regeln für img greifen unverändert. */
.hg-picture { display: contents; }
.hg-tile img { display: block; width: 100%; height: auto; transition: transform 0.8s var(--hg-ease); }
.hg-tile:hover img { transform: scale(1.025); }
.hg-tile:focus-visible { outline: 2px solid var(--hg-focus); outline-offset: 2px; }
.hg-empty { text-align: center; color: var(--hg-muted); padding: 48px 16px; }

/* ---------- Album ---------- */
.hg-album {
	list-style: none; margin: 0; padding: 0;
	display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 36px 20px;
}
@media (max-width: 560px) { .hg-album { grid-template-columns: 1fr 1fr; gap: 24px 12px; } }
.hg-album-card a { display: block; text-decoration: none; color: inherit; }
.hg-album-cover { display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--hg-placeholder); }
.hg-album-cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; transition: transform 0.8s var(--hg-ease); }
.hg-album-card a:hover .hg-album-cover img { transform: scale(1.03); }
.hg-album-card a:focus-visible { outline: 2px solid var(--hg-focus); outline-offset: 3px; }
.hg-album-title {
	display: block; margin-top: 12px; color: var(--hg-heading);
	font-size: 0.95rem; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.35; overflow-wrap: anywhere;
}
.hg-album-desc { display: block; color: var(--hg-text); font-size: 0.95rem; margin-top: 2px; line-height: 1.4; }
.hg-album-count { display: block; color: var(--hg-muted); font-size: 0.875rem; margin-top: 2px; }

/* ---------- Einzelne Galerie ---------- */
.hg-gallery-head { text-align: center; padding: 0 0 clamp(20px, 3vw, 32px); }
.hg-back {
	display: inline-block; margin-bottom: 14px; color: var(--hg-muted); text-decoration: none;
	font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.075em;
}
.hg-back:hover { color: var(--hg-heading); }
.hg-gallery-title {
	margin: 0; color: var(--hg-heading); font-weight: 300; text-transform: uppercase; letter-spacing: 0.14em;
	font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2rem); line-height: 1.25;
}
.hg-gallery-meta { margin: 12px auto 0; color: var(--hg-muted); font-size: 1rem; }
.hg-credits { margin: 6px auto 0; color: var(--hg-text); font-size: 0.95rem; }
.hg-credits a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }

/* ---------- Slideshow ---------- */
.hg-slideshow { position: relative; }
.hg-ss-stage { position: relative; height: clamp(380px, calc(100svh - 230px), 860px); touch-action: pan-y; outline-offset: -2px; }
.hg-slide {
	position: absolute; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center;
	opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.hg-slide.is-active { opacity: 1; visibility: visible; transition-delay: 0s; }
.hg-slide img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.hg-ss-nav {
	position: absolute; top: calc((100% - 50px) / 2 - 22px); z-index: 2; width: 44px; height: 44px;
	display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; color: var(--hg-heading);
	background: color-mix(in srgb, var(--hg-bg) 78%, transparent); transition: background-color 0.2s;
}
.hg-ss-nav:hover { background: var(--hg-bg); }
.hg-ss-nav svg { width: 22px; height: 22px; }
.hg-ss-prev { left: 8px; }
.hg-ss-next { right: 8px; }
.hg-ss-bar { display: flex; justify-content: center; align-items: center; gap: 10px; padding-top: 14px; }
.hg-ss-counter { margin: 0; min-width: 4.5em; text-align: center; color: var(--hg-muted); font-size: 0.875rem; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.hg-ss-play {
	display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
	background: none; color: var(--hg-heading); cursor: pointer;
}
.hg-ss-play:hover { background: var(--hg-surface); }
.hg-ss-play svg { width: 19px; height: 19px; }
.hg-ss-play .i-play, .hg-ss-play[aria-pressed="false"] .i-pause { display: none; }
.hg-ss-play[aria-pressed="false"] .i-play { display: block; }
.hg-ss-nav:focus-visible, .hg-ss-play:focus-visible, .hg-ss-stage:focus-visible { outline: 2px solid var(--hg-focus); outline-offset: 2px; }
@media (max-width: 700px) {
	.hg-ss-stage { height: auto; aspect-ratio: 2 / 3; max-height: 72svh; margin-inline: auto; }
	.hg-ss-nav { top: auto; bottom: -2px; background: none; }
	.hg-ss-prev { left: 0; }
	.hg-ss-next { right: 0; }
}

/* ---------- Teaser ---------- */
.hg-teaser { display: block; text-decoration: none; color: inherit; }
.hg-teaser-media { display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--hg-placeholder); }
.hg-teaser-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; transition: transform 0.8s var(--hg-ease); }
.hg-teaser:hover .hg-teaser-media img { transform: scale(1.03); }
.hg-teaser:focus-visible { outline: 2px solid var(--hg-focus); outline-offset: 3px; }
.hg-teaser-label { display: block; margin-top: 14px; color: var(--hg-heading); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.95rem; }
.hg-teaser-count { display: block; color: var(--hg-muted); font-size: 0.875rem; }
@media (max-width: 760px) { .hg-teaser-media { aspect-ratio: 3 / 2; } }

/* Bildschutz */
.hg-tile img, .hg-slide img, .hg-album-cover img, .hg-teaser img, .pswp img {
	-webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}

/* ---------- Lightbox (PhotoSwipe 5) ---------- */
.pswp {
	--pswp-bg: var(--hg-lb-bg);
	--pswp-placeholder-bg: var(--hg-placeholder);
	--pswp-icon-color: var(--hg-lb-ui);
	--pswp-icon-color-secondary: var(--hg-lb-ui-2);
	--pswp-icon-stroke-color: var(--hg-lb-ui-2);
	--pswp-error-text-color: var(--hg-lb-ui);
	font-family: inherit;
}
.pswp__counter { color: var(--hg-lb-ui); font-size: 13px; letter-spacing: 0.12em; opacity: 1; text-shadow: none; }
.pswp__button { color: var(--hg-lb-ui); }
.pswp__icn-custom {
	position: absolute; top: 14px; left: 9px; width: 32px; height: 32px;
	fill: var(--hg-lb-ui); stroke: var(--hg-lb-ui-2); stroke-width: 1.5px; paint-order: stroke fill; stroke-linejoin: round;
	pointer-events: none;
}
.pswp__button--play .i-pause { display: none; }
.pswp__button--play.is-playing .i-pause { display: block; }
.pswp__button--play.is-playing .i-play { display: none; }
.pswp__thumbs {
	position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
	display: flex; gap: 6px; padding: 12px 16px 14px;
	overflow-x: auto; overscroll-behavior: contain; scrollbar-width: none;
	opacity: 0; transition: opacity 0.3s ease;
}
.pswp__thumbs::-webkit-scrollbar { display: none; }
.pswp--ui-visible .pswp__thumbs { opacity: 1; }
.pswp__thumbs::before, .pswp__thumbs::after { content: ""; margin: auto; }
.pswp__thumb {
	flex: 0 0 auto; height: 68px; padding: 0; border: 0; background: var(--hg-placeholder); cursor: pointer;
	opacity: 0.45; transition: opacity 0.2s, outline-color 0.2s; outline: 2px solid transparent; outline-offset: 2px;
}
.pswp__thumb img { height: 100%; width: auto; display: block; }
.pswp__thumb:hover { opacity: 0.85; }
.pswp__thumb.is-active, .pswp__thumb:focus-visible { opacity: 1; outline-color: var(--hg-lb-ui); }
.pswp__toast {
	position: absolute; left: 50%; bottom: 110px; z-index: 11; transform: translate(-50%, 8px);
	padding: 9px 16px; background: var(--hg-lb-ui); color: var(--hg-lb-bg); font-size: 14px; letter-spacing: 0.04em;
	pointer-events: none; transition: opacity 0.25s, transform 0.25s, visibility 0s linear 0.25s;
}
.pswp .pswp__toast:not(.is-visible) { opacity: 0; visibility: hidden; }
.pswp .pswp__toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
@media (max-width: 700px) {
	.pswp__thumbs { padding: 8px 10px 10px; gap: 4px; }
	.pswp__thumb { height: 50px; }
}

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