/*
 * Fotogalerie (HEIMDALL, ab 1.47): Titelfoto als Breitbild-Header, Raster auf Bildschirmbreite, Vollbild.
 * Farben und Schrift kommen vom Design (Photo Eckert: --pe-*, --hg-*); die Werte hinter dem Komma sind Rückfälle.
 */
.hg-site.hg-site-foto {
  --fv-text: var(--hg-text, var(--pe-text, #DDD8CF));
  --fv-mute: var(--hg-mute, var(--pe-mute, #9A968F));
  --fv-accent: var(--hg-accent, var(--pe-accent, #C29A5B));
  --fv-panel: var(--hg-panel, #23282D);
  --fv-gutter: var(--hg-gutter, var(--pe-gutter, clamp(16px, 4vw, 48px)));
  --fv-gap: clamp(4px, .6vw, 10px);
  --fv-edge: clamp(8px, 2vw, 32px);          /* Rand des Rasters — die Bilder nutzen fast die ganze Bildschirmbreite */
  --fv-row: clamp(160px, 22vw, 340px);       /* Zielhöhe einer Bildzeile — die Zeilen füllen immer die ganze Breite */
  /* Seitenrand des Designs (Photo Eckert: .pe-page hat links/rechts --pe-gutter) aufheben: Header und Raster randlos */
  width: auto; max-width: none; margin: 0 calc(-1 * var(--pe-gutter, 0px)); padding: 0 0 80px; min-width: 0;
  color: var(--fv-text);
}

/* Titelfoto: Breitbild 21:9 über die ganze Breite (auf dem Handy 16:9) */
.hg-hero { position: relative; width: 100%; aspect-ratio: 21 / 9; max-height: 78vh; min-height: 260px; overflow: hidden; background: var(--fv-panel); margin: 0 0 clamp(20px, 3vw, 40px); }
.hg-hero.is-empty { aspect-ratio: auto; min-height: 0; max-height: none; background: none; }
.hg-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--hg-hero-x, 50%) var(--hg-hero-pos, 50%); transform: scale(var(--hg-hero-zoom, 1)); transform-origin: var(--hg-hero-x, 50%) var(--hg-hero-pos, 50%); display: block; }
/* Höhe frei gewählt: Prozent der Bildschirmhöhe (svh = sichtbare Höhe auf dem Handy) */
.hg-hero.has-height { aspect-ratio: auto; height: calc(var(--hg-hero-h) * 1vh); height: calc(var(--hg-hero-h) * 1svh); max-height: none; min-height: 180px; }
/* Fixiert: das Titelfoto ist ein fester Rahmen oben — die Bilder scrollen darunter durch (verschwinden hinter seiner Unterkante).
   Nur das Vollbild deckt es zu. */
.hg-hero.is-fixed { position: sticky; top: 0; z-index: 3; margin-bottom: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.hg-hero.is-fixed ~ .hg-just, .hg-hero.is-fixed ~ .hg-intro, .hg-hero.is-fixed ~ .hg-sec { position: relative; z-index: 1; }
.hg-hero.is-fixed + .hg-just { padding-top: clamp(14px, 2vw, 28px); }
/* Beschreibung zwischen Titelfoto und Raster */
.hg-intro { padding: clamp(16px, 2.4vw, 32px) var(--fv-edge) clamp(14px, 2vw, 28px); /* gleiche Breite wie das Raster */ color: var(--hg-desc-color, var(--fv-mute)); }
.hg-hero:not(.is-fixed) + .hg-intro { padding-top: 0; }
.hg-intro .hg-site-desc { color: inherit; font-size: 1.08rem; line-height: 1.6; max-width: none; }
.hg-intro .hg-site-desc p { margin: 0 0 .6em; }
.hg-intro .hg-site-desc p:last-child { margin-bottom: 0; }
.hg-lb-open .hg-hero.is-fixed { visibility: hidden; }
.admin-bar .hg-hero.is-fixed { top: 32px; } /* angemeldet: unter der WordPress-Leiste */
@media (max-width: 782px) { .admin-bar .hg-hero.is-fixed { top: 46px; } }
@media (max-width: 600px) { .admin-bar .hg-hero.is-fixed { top: 0; } } /* dort scrollt die Leiste mit */
.hg-hero:not(.is-empty)::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(12, 14, 16, .78) 0%, rgba(12, 14, 16, .35) 38%, rgba(12, 14, 16, 0) 70%); pointer-events: none; }
.hg-hero-text { position: absolute; left: var(--fv-gutter); right: var(--fv-gutter); bottom: clamp(18px, 4vw, 48px); z-index: 1; max-width: none; }
/* Titel + «Alle Galerien» bleiben unter Logo und Menü: oberer Freiraum = Kopfzeile (gallery.js misst sie genau);
   reicht die Höhe des Titelfotos nicht, wird es so weit höher wie nötig. */
.hg-hero:not(.is-empty) { --hg-top-safe: calc(var(--fv-corner, 14px) + var(--pe-logo-height, 72px) * .5 + 14px); }
.hg-hero:not(.is-empty) .hg-hero-text { top: var(--hg-top-safe); display: flex; flex-direction: column; justify-content: flex-end; }
.hg-hero:not(.is-empty) .hg-hero-text > * { flex: none; }
.hg-hero.is-empty .hg-hero-text { position: static; padding: clamp(28px, 6vw, 72px) var(--fv-gutter) 0; }
.hg-hero h1 { font-family: var(--hg-font, var(--pe-font, inherit)); font-weight: var(--hg-weight-display, 300); font-size: var(--hg-size-h1, clamp(2.2rem, 5vw, 4rem)); line-height: 1.05; margin: 4px 0 10px; color: var(--hg-title-color, #fff); text-shadow: 0 1px 18px rgba(0, 0, 0, .35); }
.hg-hero.is-empty h1 { color: var(--hg-title-color, var(--fv-text)); text-shadow: none; }
.hg-hero .hg-site-desc { color: rgba(255, 255, 255, .86); font-size: 1.05rem; line-height: 1.55; max-width: none; }
.hg-hero.is-empty .hg-site-desc { color: var(--fv-mute); }
.hg-hero .hg-site-desc p { margin: 0 0 .5em; }
.hg-hero .hg-site-back { color: rgba(255, 255, 255, .8); text-decoration: none; font-size: .95rem; }
.hg-hero.is-empty .hg-site-back { color: var(--fv-mute); }
.hg-hero .hg-site-back:hover, .hg-hero .hg-site-back:focus-visible { color: var(--fv-accent); }
.hg-hero .hg-site-preview { margin: 0 0 12px; }
@media (max-width: 700px) {
  .hg-hero { min-height: 220px; }
  .hg-hero:not(.has-height) { aspect-ratio: 4 / 3; } /* etwas höher, damit Titel und Beschreibung Platz haben */
  .hg-intro .hg-site-desc { font-size: 1rem; }
  .hg-hero + .hg-just { margin-top: 0; }
}

/* Raster: Zeilen gleicher Höhe, auf die Bildschirmbreite ausgeglichen (ohne Zuschnitt, ohne JavaScript) */
.hg-just { display: flex; flex-wrap: wrap; gap: var(--fv-gap); padding: 0 var(--fv-edge); }
.hg-just::after { content: ''; flex-grow: 1000000; } /* letzte Zeile nicht aufblähen */
.hg-just-item { margin: 0; flex-grow: calc(var(--r, 1.5) * 100); flex-basis: calc(var(--r, 1.5) * var(--fv-row)); min-width: 0; }
.hg-just-item .hg-open { display: block; width: 100%; aspect-ratio: var(--r, 1.5); padding: 0; border: 0; background: var(--fv-panel); cursor: zoom-in; overflow: hidden; border-radius: 2px; }
.hg-just-item .hg-open img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, filter .3s; }
.hg-just-item .hg-open:hover img, .hg-just-item .hg-open:focus-visible img { transform: scale(1.025); }
.hg-just-item .hg-open:focus-visible { outline: 2px solid var(--fv-accent); outline-offset: 2px; }
.hg-just-item figcaption { color: var(--fv-mute); font-size: .85rem; padding: 5px 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .hg-site-foto { --fv-row: 46vw; } }
.hg-site-foto .hg-site-empty { padding: 0 var(--fv-edge); }

/* Vollbild */
.hg-lb-open, .hg-lb-open body { overflow: hidden; }
.hg-fv { position: fixed; inset: 0; z-index: 99999; background: #0b0c0d; color: #eee; display: grid; grid-template-rows: minmax(0, 1fr) auto; font-family: var(--pe-font, system-ui, sans-serif); user-select: none; }
.hg-fv[hidden] { display: none; }
.hg-fv-stage { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; padding: clamp(8px, 2vh, 24px) clamp(8px, 5vw, 80px); }
.hg-fv-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; transition: opacity .25s; box-shadow: 0 10px 60px rgba(0, 0, 0, .5); }
.hg-fv-img.is-loading { opacity: .35; }
.hg-fv-hit { position: absolute; top: 0; bottom: 0; width: 50%; border: 0; padding: 0; background: none; cursor: pointer; }
.hg-fv-hit-l { left: 0; cursor: w-resize; }
.hg-fv-hit-r { right: 0; cursor: e-resize; }
.hg-fv-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .35); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: opacity .3s, background .2s; }
.hg-fv-nav svg, .hg-fv-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hg-fv-nav:hover, .hg-fv-nav:focus-visible { background: rgba(0, 0, 0, .6); }
.hg-fv-nav:focus-visible, .hg-fv-btn:focus-visible { outline: 2px solid var(--pe-accent, #C29A5B); outline-offset: 2px; }
.hg-fv-prev { left: clamp(6px, 1.5vw, 24px); }
.hg-fv-next { right: clamp(6px, 1.5vw, 24px); }
.hg-fv-nav[hidden] { display: none; }
.hg-fv-bar { display: flex; align-items: center; gap: 14px; padding: 10px clamp(12px, 2vw, 24px) max(10px, env(safe-area-inset-bottom)); font-size: .92rem; color: rgba(255, 255, 255, .78); transition: opacity .3s; min-height: 52px; }
.hg-fv-count { font-variant-numeric: tabular-nums; letter-spacing: .04em; flex: none; }
.hg-fv-cap { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hg-fv-cap strong { color: #fff; font-weight: 500; }
.hg-fv-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: none; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.hg-fv-btn:hover { background: rgba(255, 255, 255, .1); }
/* Ruhe: Bedienelemente ausblenden, Mauszeiger auch */
.hg-fv.is-idle .hg-fv-nav, .hg-fv.is-idle .hg-fv-bar { opacity: 0; }
.hg-fv.is-idle, .hg-fv.is-idle .hg-fv-hit { cursor: none; }
.hg-fv.is-full .hg-fv-stage { padding: 0; }
.hg-fv.is-full .hg-fv-img { box-shadow: none; }
@media (hover: none) { .hg-fv-nav { display: none; } .hg-fv.is-idle .hg-fv-bar { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hg-just-item .hg-open img, .hg-fv-img { transition: none; } }

/* Logo + Menü über dem Titelfoto (Photo Eckert: .pe-page > .pe-top): gleiche Ecke, Grösse und Abstände wie auf allen
   anderen Seiten (Theme ≥ 1.5.1: --pe-corner, Logo halb so gross) — nur hell mit Schatten. Bei fixiertem Titelfoto bleibt es stehen. */
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-page { --fv-top: var(--pe-pad-top, clamp(20px, 4vh, 40px)); --fv-corner: var(--pe-corner, clamp(10px, 1.4vw, 18px)); }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-page .pe-top { position: absolute; z-index: 5; top: var(--fv-corner); left: var(--fv-corner); right: var(--fv-corner); margin: 0; min-height: 0; background: none; pointer-events: none; }
.heimdall-gallery-foto:has(.hg-hero.is-fixed) .pe-page .pe-top { position: fixed; }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-company-logo { height: calc(var(--pe-logo-height, 72px) * .5); }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-brand:not(.has-company-logo) { zoom: .5; }
/* Angemeldet: nur die FIXIERTE Kopfzeile (bezogen auf das Fenster) rückt unter die WordPress-Leiste.
   Die nicht fixierte (absolut in .pe-page) liegt schon darunter — kein zweites Mal verschieben (Fehler bis 1.54.3).
   Bei fixiertem Titelfoto führt gallery.js die Kopfzeile genau mit dem Rahmen mit (auch auf dem Handy). */
.heimdall-gallery-foto.admin-bar:has(.hg-hero.is-fixed) .pe-page .pe-top { top: calc(var(--fv-corner) + 32px); }
@media (max-width: 782px) { .heimdall-gallery-foto.admin-bar:has(.hg-hero.is-fixed) .pe-page .pe-top { top: calc(var(--fv-corner) + 46px); } }
.hg-lb-open .pe-top { visibility: hidden; }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-top a { pointer-events: auto; }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-top .pe-brand { filter: drop-shadow(0 1px 6px rgba(0, 0, 0, .45)); }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-menu a { color: rgba(255, 255, 255, .86); text-shadow: 0 1px 6px rgba(0, 0, 0, .55); }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-menu a:hover, .heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-menu a.is-current { color: #fff; }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .pe-menu a.is-current { border-bottom-color: rgba(255, 255, 255, .7); }
.heimdall-gallery-foto:has(.hg-hero:not(.is-empty)) .hg-site.hg-site-foto { margin-top: calc(-1 * var(--fv-top)); }
/* zarter Verlauf oben, damit das Logo auch auf hellen Bildern lesbar bleibt (keine Fläche) */
.hg-hero:not(.is-empty)::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 34%; z-index: 0; background: linear-gradient(to bottom, rgba(12, 14, 16, .42), rgba(12, 14, 16, 0)); pointer-events: none; }

/* Aufnahmeort (nur wenn in der Galerie eingeschaltet): Stecknadel im Raster, Knopf im Vollbild */
.hg-just-item { position: relative; }
.hg-map-pin { position: absolute; top: 8px; right: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .5); color: #fff; opacity: 0; transition: opacity .2s, background .2s; }
.hg-map-pin svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.hg-just-item:hover .hg-map-pin, .hg-map-pin:focus-visible { opacity: 1; }
.hg-map-pin:hover { background: var(--fv-accent); color: #111; }
@media (hover: none) { .hg-map-pin { opacity: .85; } }
a.hg-fv-btn { text-decoration: none; }
.hg-fv-btn[hidden] { display: none; }

/* Hintergrundfarbe der Galerie (Einstellung je Galerie): HEIMDALL setzt --pe-bg/--hg-bg auf der Seite */
.heimdall-gallery-foto .hg-hero.is-empty { background: none; }

/* Abschnitte (ab 1.54): Leiste oben — bleibt immer sichtbar (unter dem fixierten Titelfoto oder ganz oben),
   Schrift in der Farbe des Galerietitels */
.hg-secbar { position: sticky; top: 0; z-index: 4; background: var(--hg-bg, var(--pe-bg, #1E2226)); background: color-mix(in srgb, var(--hg-bg, var(--pe-bg, #1E2226)) 90%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--pe-line, rgba(221, 216, 207, .14)); }
.admin-bar .hg-secbar:not(.is-under-hero) { top: 32px; }
@media (max-width: 782px) { .admin-bar .hg-secbar:not(.is-under-hero) { top: 46px; } }
.hg-hero:has(+ .hg-secbar) { margin-bottom: 0; }
.hg-hero.is-fixed:has(+ .hg-secbar) { box-shadow: none; }
.hg-secbar.is-under-hero { box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
/* Alle Abschnitte immer sichtbar: was nicht in eine Zeile passt, kommt auf die nächste (ab 1.56.3) */
.hg-secbar ul { list-style: none; margin: 0; padding: 0 var(--fv-edge); display: flex; flex-wrap: wrap; column-gap: clamp(20px, 2.8vw, 44px); row-gap: 0; }
.hg-secbar li { flex: 0 1 auto; min-width: 0; }
/* Positionsanzeige: kleines Dreieck unter der Leiste — wandert beim Scrollen durch den Abschnitt unter seinem Link mit */
.hg-secbar-pos { position: absolute; top: 100%; left: 0; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 8px solid var(--hg-pos-color, var(--fv-accent, #C29A5B)); margin-top: -1px; transform: translateX(var(--hg-pos-x, 0px)); transition: transform .12s linear, opacity .2s; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.hg-secbar-pos.is-before { opacity: .4; }
@media (prefers-reduced-motion: reduce) { .hg-secbar-pos { transition: none; } }
.hg-secbar a { display: block; padding: 14px 0 11px; color: var(--hg-title-color, var(--fv-text)); opacity: .66; text-decoration: none; font-size: .98rem; letter-spacing: .05em; border-bottom: 2px solid transparent; transition: opacity .2s, border-color .2s; }
.hg-secbar a:hover, .hg-secbar a:focus-visible { opacity: 1; }
.hg-secbar a.is-active { opacity: 1; border-bottom-color: currentColor; }
.hg-secbar a:focus-visible { outline: 2px solid var(--fv-accent); outline-offset: 2px; }
.hg-secbar + .hg-intro { padding-top: clamp(20px, 2.8vw, 36px); }
.hg-secbar + .hg-just, .hg-secbar + .hg-sec { margin-top: clamp(14px, 2vw, 28px); }
/* Abschnitt im Raster: Überschrift (Farbe des Titels) + Beschreibung (Farbe der Beschreibung), dann seine Bilder */
.hg-sec { scroll-margin-top: calc(var(--hg-secbar-bottom, 60px) + 20px); }
.hg-sec + .hg-sec, .hg-just + .hg-sec { margin-top: clamp(36px, 5vw, 72px); }
.hg-sec-head { padding: 0 var(--fv-edge) clamp(14px, 1.8vw, 24px); }
.hg-sec-head h2 { font-family: var(--hg-font, var(--pe-font, inherit)); font-weight: var(--hg-weight-display, 300); font-size: clamp(1.5rem, 2.6vw, 2.25rem); line-height: 1.15; margin: 0 0 8px; color: var(--hg-title-color, var(--fv-text)); }
.hg-sec-desc { color: var(--hg-desc-color, var(--fv-mute)); font-size: 1.02rem; line-height: 1.6; max-width: none; }
.hg-sec-desc p { margin: 0 0 .5em; }
.hg-sec-desc p:last-child { margin-bottom: 0; }
@media (max-width: 700px) { .hg-secbar a { font-size: .92rem; padding: 12px 0 9px; } }

/* Videos (ab 1.56): im Raster stumm in Schleife über dem Standbild, kleines ▶ mit Dauer; im Vollbild mit Ton und Steuerleiste */
.hg-just-item .hg-open { position: relative; }
.hg-just-item .hg-vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s, transform .5s ease; pointer-events: none; }
.hg-just-item .hg-vid.is-playing { opacity: 1; }
.hg-just-item .hg-open:hover .hg-vid, .hg-just-item .hg-open:focus-visible .hg-vid { transform: scale(1.025); }
.hg-vid-badge { position: absolute; left: 8px; bottom: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .75rem; font-variant-numeric: tabular-nums; letter-spacing: .02em; pointer-events: none; }
.hg-vid-badge svg { width: 12px; height: 12px; fill: currentColor; }
.hg-fv-vid { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; background: #000; box-shadow: 0 10px 60px rgba(0, 0, 0, .5); }
.hg-fv-vid[hidden], .hg-fv-img[hidden] { display: none; }
.hg-fv.is-video .hg-fv-hit { display: none; }          /* Klick aufs Video bedient die Steuerleiste, Pfeile blättern */
.hg-fv.is-video.is-idle { cursor: auto; }

/* Formatierte Texte (ab 1.57): Links sichtbar, Farbe vom Text — eigene Farben aus dem Editor gehen vor */
.hg-hero-text h1 a, .hg-site-desc a, .hg-sec-desc a, .hg-fv-cap a, .hg-lb-caption a { color: inherit; text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: from-font; }
.hg-hero-text h1 a:hover, .hg-site-desc a:hover, .hg-sec-desc a:hover, .hg-fv-cap a:hover, .hg-lb-caption a:hover { text-decoration-thickness: 2px; }
