:root {
  --bg: #f7f7f7;
  --text: #222;
  --muted: #666;
  --surface: #ffffff;
  --radius: 12px;
  --gap: 1rem;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Noto Sans,
    sans-serif;
}

h1 {
  text-align: center;
  margin: 1.5rem 0;
}

.gallery {
  --min: 220px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--min), 1fr));
  gap: var(--gap);
  width: min(1100px, 92vw);
  margin: 0 auto 2rem;
}

.gallery .item {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.06);
  cursor: zoom-in;
}

.gallery .item img {
  display: block;
  width: 100%;
  height: auto; /* WICHTIG: keine feste Höhe -> korrektes Seitenverhältnis */
}

.gallery .caption {
  padding: 0.75rem 0.9rem;
}

.gallery .title {
  font-weight: 600;
}
.gallery .format,
.gallery .cats {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 3vw;
  background: rgba(0, 0, 0, 0.8);
}
.lightbox.open {
  /* WICHTIG: Klasse 'open' wird per JS gesetzt */
  display: grid;
}
.lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.lightbox .close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
