:root {
  --gallery-bg: #f6f2ec;
  --gallery-ink: #171717;
  --gallery-muted: #6b6862;
  --frame-color: #111111;
  --frame-width: 8px;
  --card-frame-color: var(--frame-color);
  --card-frame-width: var(--frame-width);
  --frame-radius: 1.15rem;
  --image-radius: .65rem;
  --tile-width: 300px;
  --tile-aspect: 4 / 3;
  --tile-gap: 32px;
  --grid-gap: var(--tile-gap);
  --grid-row-gap: calc(var(--tile-gap) + 2.75rem);
  --tile-image-max-height: 330px;
}


html,
body {
  min-height: 100%;
}

body {
  background: var(--gallery-bg);
  color: var(--gallery-ink);
}

html.frame-square,
body.frame-square {
  --frame-radius: 0;
  --image-radius: 0;
}

html.frame-square .art-frame,
html.frame-square .art-frame img,
html.frame-square .detail-frame,
html.frame-square .detail-frame img,
body.frame-square .art-frame,
body.frame-square .art-frame img,
body.frame-square .detail-frame,
body.frame-square .detail-frame img {
  border-radius: 0 !important;
}

.gallery-navbar {
  background: color-mix(in srgb, var(--gallery-bg), white 72%);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.navbar-grid {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto minmax(12rem, 1fr);
  align-items: center;
  gap: .75rem;
}

.gallery-brand { justify-self: start; }
.navbar-center-slot { justify-self: center; }
.gallery-main-nav { justify-self: end; }

.settings-gear {
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(0,0,0,.16);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--gallery-ink);
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  transition: transform .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.settings-gear:hover,
.settings-gear:focus-visible {
  transform: translateY(-1px) rotate(12deg);
  background: rgba(255,255,255,.94);
  box-shadow: 0 14px 30px rgba(0,0,0,.12);
}

.hero-wrap {
  min-height: calc(100vh - 64px);
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 4vw, 4rem);
}

.hero-image-panel {
  width: min(1120px, 100%);
  min-height: 68vh;
  border-radius: 2rem;
  display: grid;
  align-items: end;
  padding: clamp(1.5rem, 6vw, 5rem);
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.9), transparent 32%),
    linear-gradient(135deg, rgba(0,0,0,.12), rgba(0,0,0,.02)),
    var(--gallery-bg);
  box-shadow: 0 24px 70px rgba(0,0,0,.12);
}

.hero-copy { width: min(760px, 100%); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .8rem;
  color: var(--gallery-muted);
}

.hero-copy h1 {
  font-size: clamp(2.7rem, 8vw, 7rem);
  line-height: .92;
  letter-spacing: -.06em;
  margin-bottom: 1.5rem;
}

.gallery-shell { padding: clamp(1rem, 2vw, 2rem); }

.gallery-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.selected-filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  margin-top: .35rem;
  color: var(--gallery-muted);
  font-size: .9rem;
}

.selected-filter-chip {
  display: inline-flex;
  align-items: center;
  padding: .12rem .55rem;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(0,0,0,.08);
  color: var(--gallery-ink);
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  align-items: center;
  padding: .75rem;
  margin-bottom: 1.35rem;
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(14px);
}

.filter-field {
  min-width: 145px;
  flex: 1 1 145px;
}

/*
  Wichtig: Die Kachelung verändert nur die maximale Zeilenbreite.
  Die einzelnen .art-card-Elemente bleiben immer gleich groß.
*/
.image-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  column-gap: var(--grid-gap);
  row-gap: var(--grid-row-gap);
  width: 100%;
  margin-inline: auto;
}

.image-grid.tile-1 { max-width: var(--tile-width); }
.image-grid.tile-2 { max-width: calc(var(--tile-width) + var(--tile-width) + var(--grid-gap)); }
.image-grid.tile-4 { max-width: calc(var(--tile-width) + var(--tile-width) + var(--tile-width) + var(--tile-width) + var(--grid-gap) + var(--grid-gap) + var(--grid-gap)); }

.art-card {
  flex: 0 0 var(--tile-width);
  width: var(--tile-width);
  max-width: min(100%, var(--tile-width));
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.art-link {
  min-height: calc(var(--tile-image-max-height) + var(--card-frame-width) + var(--card-frame-width));
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  text-decoration: none;
}

.art-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: var(--card-frame-width);
  box-sizing: border-box;
  border-radius: var(--frame-radius);
  background: var(--card-frame-color);
  box-shadow: 0 18px 44px rgba(0,0,0,.14);
  overflow: visible;
}

.art-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(var(--tile-width) - var(--card-frame-width) - var(--card-frame-width));
  max-height: var(--tile-image-max-height);
  object-fit: contain;
  background: transparent;
  border-radius: var(--image-radius);
}

.no-image {
  width: 100%;
  min-height: 12rem;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.7);
  color: var(--gallery-muted);
}

.art-meta {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  padding: .7rem .2rem 0;
}

.art-meta h2 {
  font-size: 1rem;
  margin: 0;
}

.art-meta p {
  margin: .15rem 0 0;
  font-size: .9rem;
  color: var(--gallery-muted);
}

.color-dot {
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.18);
  vertical-align: middle;
  flex: 0 0 auto;
}

.settings-section {
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.settings-panel-top {
  --bs-offcanvas-height: min(58vh, 460px);
  top: 0;
  right: 0;
  bottom: auto !important;
  left: 0;
  height: min(58vh, 460px) !important;
  min-height: 0 !important;
  max-height: min(58vh, 460px) !important;
  overflow: hidden;
  background: color-mix(in srgb, var(--gallery-bg), white 78%);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(0,0,0,.1);
  box-shadow: 0 18px 46px rgba(0,0,0,.14);
}

.settings-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem 1rem;
  align-items: start;
  max-height: calc(min(58vh, 460px) - 4.5rem);
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 1rem;
}

.settings-body .settings-section {
  padding: .75rem;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 1rem;
  background: rgba(255,255,255,.5);
}

.settings-actions {
  display: grid;
  gap: .5rem;
}

.slideshow-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,.92);
  display: grid;
  place-items: center;
  padding: 2rem;
}

.slideshow-overlay[hidden] { display: none; }

.slideshow-overlay figure {
  margin: 0;
  width: min(92vw, 1500px);
  height: min(86vh, 980px);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 1rem;
}

.slideshow-overlay img {
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  object-fit: contain;
  box-shadow: 0 28px 80px rgba(0,0,0,.45);
}

.slideshow-overlay figcaption {
  color: white;
  text-align: center;
}

.slideshow-overlay figcaption span {
  display: block;
  opacity: .72;
}

.slide-close,
.slide-nav {
  position: absolute;
  border: 0;
  color: white;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  width: 3rem;
  height: 3rem;
  font-size: 2rem;
  line-height: 1;
}

.slide-close {
  top: 1rem;
  right: 1rem;
}

.slide-nav {
  top: 50%;
  transform: translateY(-50%);
}

.slide-prev { left: 1rem; }
.slide-next { right: 1rem; }

.detail-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: clamp(1rem, 3vw, 3rem);
  padding: clamp(1rem, 3vw, 3rem);
}

.detail-image {
  display: grid;
  place-items: center;
  min-height: 72vh;
}

.detail-frame {
  display: inline-grid;
  place-items: center;
  max-width: min(100%, 980px);
  max-height: 82vh;
  margin: 0;
  padding: var(--card-frame-width);
  border-radius: var(--frame-radius);
  background: var(--card-frame-color);
  box-shadow: 0 24px 70px rgba(0,0,0,.16);
  overflow: hidden;
}

.detail-frame img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 920px);
  max-height: min(78vh, 820px);
  object-fit: contain;
  background: transparent;
  border-radius: var(--image-radius);
}

.detail-panel,
.form-card {
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 1.5rem;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  box-shadow: 0 16px 44px rgba(0,0,0,.08);
}

.detail-neighbor-nav {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  margin-top: .85rem;
  font-size: .9rem;
}

.detail-neighbor-nav a {
  color: var(--gallery-muted);
  text-decoration: none;
}

.detail-neighbor-nav a:hover,
.detail-neighbor-nav a:focus-visible {
  color: var(--gallery-ink);
  text-decoration: underline;
}

.detail-panel h1,
.detail-title {
  margin-top: .85rem;
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: -.025em;
}

.detail-list {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: .55rem 1rem;
  margin-top: 1.5rem;
}

.detail-list dt {
  color: var(--gallery-muted);
  font-weight: 500;
}

.instance-card {
  display: flex;
  justify-content: space-between;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 1rem;
  padding: .8rem 1rem;
  margin-top: .5rem;
  background: rgba(255,255,255,.65);
}

.form-shell {
  padding: clamp(1rem, 4vw, 4rem);
  display: grid;
  place-items: start center;
}

.form-card { width: min(760px, 100%); }
.form-card.wide { width: min(1040px, 100%); }

.code-hint {
  padding: 1rem;
  background: #171717;
  color: #f4f4f4;
  border-radius: 1rem;
  white-space: pre-wrap;
}

.empty-state {
  width: 100%;
  padding: 4rem 1rem;
  text-align: center;
  color: var(--gallery-muted);
}

.pagination-wrap { margin-top: 2rem; }

@media (max-width: 1320px) {
  :root { --tile-width: 280px; }
}

@media (max-width: 980px) {
  :root { --tile-width: min(42vw, 300px); --tile-image-max-height: 320px; }
  .image-grid.tile-4 { max-width: calc(var(--tile-width) + var(--tile-width) + var(--grid-gap)); }
  .detail-shell { grid-template-columns: 1fr; }
  .detail-panel { order: -1; }
}

@media (max-width: 991.98px) {
  .navbar-grid { grid-template-columns: 1fr auto auto; }
  .navbar-center-slot { grid-column: 2; }
  .navbar-toggler {
    grid-column: 3;
    justify-self: end;
  }
  .gallery-main-nav {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
}

@media (max-width: 640px) {
  :root {
    --tile-width: min(92vw, 320px);
    --tile-gap: 20px;
    --grid-gap: var(--tile-gap);
    --grid-row-gap: calc(var(--tile-gap) + 3rem);
    --tile-image-max-height: 340px;
  }
  .gallery-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .image-grid.tile-2,
  .image-grid.tile-4 { max-width: var(--tile-width); }
  .filter-field { flex-basis: 100%; }
  .detail-image { min-height: auto; }
  .detail-frame img { max-width: calc(100vw - 3rem); max-height: 70vh; }
  .settings-panel-top {
    --bs-offcanvas-height: min(72vh, 520px);
    height: min(72vh, 520px) !important;
    max-height: min(72vh, 520px) !important;
  }
  .settings-body { max-height: calc(min(72vh, 520px) - 4.5rem); }
}

.publication-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: .25rem;
  padding: .15rem .55rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, .08);
  color: var(--gallery-muted);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.phase-description {
  display: inline-block;
  margin-top: .25rem;
  color: var(--gallery-muted);
  line-height: 1.45;
}

.vita-shell {
  min-height: calc(100vh - 64px);
  padding: clamp(1.5rem, 5vw, 5rem);
  display: grid;
  place-items: start center;
}

.vita-card {
  width: min(1120px, 100%);
  padding: clamp(1.25rem, 4vw, 4rem);
  border-radius: 2rem;
  background: rgba(255,255,255,.76);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 24px 70px rgba(0,0,0,.11);
}

.vita-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.vita-portrait-wrap {
  position: sticky;
  top: 6rem;
}

.vita-portrait {
  display: block;
  width: 100%;
  border-radius: 1.4rem;
  box-shadow: 0 18px 46px rgba(0,0,0,.14);
  background: transparent;
  object-fit: cover;
}

.vita-content {
  font-size: clamp(1.05rem, 1.5vw, 1.24rem);
  line-height: 1.65;
}

.vita-content h1 {
  margin: 0 0 1.2rem;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -.045em;
}

.vita-content h2 {
  margin-top: 2.2rem;
  margin-bottom: .85rem;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}

.vita-intro {
  margin-bottom: 1.4rem;
  font-size: clamp(1.08rem, 1.7vw, 1.32rem);
}

.vita-list {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding-left: 1.25rem;
}

.vita-list li::marker {
  color: var(--gallery-muted);
}

@media (max-width: 820px) {
  .vita-layout {
    grid-template-columns: 1fr;
  }
  .vita-portrait-wrap {
    position: static;
    width: min(360px, 100%);
  }
}
