/* ─── Reset + Grundlagen ─────────────────────────────────────────── */

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

/* Chrome reserviert 15px für die Scrollbar (Safari: Overlay). Ohne stable
   springt die Breite, sobald der Inhalt höher als der Viewport wird. */
html { scrollbar-gutter: stable; }

html, body {
  margin: 0;
  padding: 0;
  background: #ffffff;
  color: #111111;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
               Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Sticky Footer: main füllt die Resthöhe, damit der Footer auf kurzen
   Seiten (About, Kontakt, Impressum) unten sitzt statt mitten im Weiß. */
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
/* Flex-Kinder mit margin:auto stretchen nicht — Breite explizit setzen */
.site-header, .site-footer { width: 100%; }

/* Tastaturfokus in Schwarz-Weiß statt Browser-Blau */
:focus-visible {
  outline: 1px solid #111;
  outline-offset: 3px;
}
.gallery-item:focus-visible { outline-offset: 0; }
.lightbox :focus-visible { outline-color: #fff; }

img { display: block; max-width: 100%; height: auto; }


/* ─── Header ─────────────────────────────────────────────────────── */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 40px 80px 36px;
  border-bottom: 1px solid #ececec;
  flex-wrap: wrap;
  gap: 16px;
  max-width: 1800px;
  margin: 0 auto;
  animation: fade-down 600ms ease-out both;
}

@keyframes fade-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header { animation: none; }
}

.logo {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.14em;
}

.site-nav {
  display: flex;
  gap: 28px;
  font-size: 12px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #666;
}

.site-nav a {
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 120ms, border-color 120ms;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: #111;
  border-bottom-color: #111;
}


/* ─── Gallery (Justified Rows) ───────────────────────────────────── */

.gallery {
  padding: 40px 80px 64px;
  font-size: 0;       /* entfernt Inline-Whitespace zwischen Items */
  max-width: 1800px;
  margin: 0 auto;
}

.gallery-item {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  background: #f5f5f5;
  margin: 0 4px 4px 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms ease, transform 500ms ease;
  -webkit-touch-callout: none;
  /* Platzhaltergröße vor dem JS-Layout: verhindert Kollaps auf 0×0
     (img { width:100%; height:100% } in einem breiten-undefinierten
     inline-block wäre sonst zirkulär). --ratio kommt als Inline-Style
     aus dem Template (photo.ratio). 280px muss mit TARGET_ROW_HEIGHT
     in justified-gallery.js übereinstimmen — justified-gallery.js
     überschreibt width/height ohnehin mit den exakten Zeilenmaßen. */
  width: calc(280px * var(--ratio, 1.5));
  height: 280px;
}

.gallery-item.is-laid-out {
  /* Layout berechnet, aber noch unsichtbar — wartet auf Intersection Observer */
}

.gallery-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms ease;
  -webkit-touch-callout: none;
  user-select: none;
}

.lightbox img {
  pointer-events: none; /* Rechtsklick trifft den Overlay, nicht das img-Element */
}

.gallery-item:hover img {
  transform: scale(1.015);
}

/* Respektiere System-Einstellungen für reduzierte Bewegung */
@media (prefers-reduced-motion: reduce) {
  .gallery-item {
    transition: opacity 200ms ease;
    transform: none;
  }
  .gallery-item.is-visible {
    transform: none;
  }
  .gallery-item img {
    transition: none;
  }
  .gallery-item:hover img {
    transform: none;
  }
}


/* ─── Kategorie-Label ────────────────────────────────────────────── */

.gallery-title {
  max-width: 1800px;
  margin: 40px auto 0;
  padding: 0 80px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #666;
}
.gallery-title + .gallery { padding-top: 24px; }


/* ─── Prose (About, Kontakt) ─────────────────────────────────────── */

.prose {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 80px;
  font-size: 16px;
  line-height: 1.7;
}

.prose h1 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 24px;
  color: #666;
}

.prose p { margin: 0 0 1em; }


/* ─── Footer ─────────────────────────────────────────────────────── */

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 80px 40px;
  margin: 32px auto 0;
  max-width: 1800px;
  border-top: 1px solid #ececec;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #999;
  flex-wrap: wrap;
  gap: 16px;
}

.site-footer .footer-links {
  display: flex;
  gap: 20px;
}

.site-footer a:hover { color: #111; }


/* ─── Lightbox ───────────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  cursor: zoom-out;
  padding: 40px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 250ms ease;
  -webkit-touch-callout: none;
}

.lightbox.is-open {
  display: flex;
  opacity: 1;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 200ms ease;
}

.lightbox img.is-loaded {
  opacity: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  font-weight: 200;
  padding: 16px 24px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 150ms;
}

.lightbox-nav:hover { opacity: 1; }
.lightbox-nav.prev { left: 0; }
.lightbox-nav.next { right: 0; }

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  font-weight: 200;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 150ms;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 11px;
  letter-spacing: 0.10em;
  opacity: 0.6;
  pointer-events: none;
}


/* ─── Ausstellung (3D Gallery Walk) ──────────────────────────────── */

/* Seite füllt genau den Viewport — die Wand scrollt horizontal,
   vertikal bewegt sich nichts. Footer entfällt für die Immersion. */
body.page-ausstellung {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.page-ausstellung main { flex: 1; min-height: 0; }
body.page-ausstellung .site-footer { display: none; }

.exhibition-room {
  position: relative;
  height: 100%;
  animation: fade-down 600ms ease-out both;
}

.exhibition-wall {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 13vw;
  padding: 0 22vw;
  overflow-x: auto;
  overflow-y: hidden;
  perspective: 1200px;
  scrollbar-width: none;
}

.exhibition-wall::-webkit-scrollbar { display: none; }

.exhibition-item {
  flex: 0 0 auto;
  margin-bottom: 7vh;   /* hebt die Bilder auf "Augenhöhe" über die Mitte */
  background: #f5f5f5;
  box-shadow:
    0 22px 50px -14px rgba(0, 0, 0, 0.30),
    0 4px 14px rgba(0, 0, 0, 0.10);
  will-change: transform;
  -webkit-touch-callout: none;
}

.exhibition-item img {
  max-height: 56vh;
  max-width: 76vw;
  width: auto;
  height: auto;
  user-select: none;
  -webkit-touch-callout: none;
}

.exhibition-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 16%;
  background: linear-gradient(to bottom, #ffffff, #ececec);
  pointer-events: none;
}

.exhibition-counter {
  position: absolute;
  z-index: 2;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.10em;
  color: #999;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .exhibition-room { animation: none; }
}


/* ─── Mobile ─────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .site-header  { padding: 36px 48px 24px; }
  .gallery      { padding: 32px 48px 48px; }
  .gallery-title { padding: 0 48px; margin-top: 32px; }
  .site-footer  { padding: 24px 48px 32px; }
  .prose        { padding: 0 48px; }
}

@media (max-width: 640px) {
  .site-header  { padding: 24px 20px 16px; }
  .gallery      { padding: 20px 20px 32px; }
  .site-footer  { padding: 20px 20px 28px; }
  .prose        { padding: 0 20px; }
  .site-nav     { gap: 10px 16px; font-size: 11px; flex-wrap: wrap; }
  .site-nav a   { white-space: nowrap; }
  .gallery-title { padding: 0 20px; margin-top: 20px; }
  .lightbox     { padding: 16px; }
  .exhibition-wall     { gap: 9vw; padding: 0 12vw; }
  .exhibition-item img { max-height: 46vh; max-width: 84vw; }
}
