/* =========================================================
   machbar.ch – CSS (Masonry/Mosaik Gallery + kompakter)
   ========================================================= */

:root {
  --primary-color: #2c3e50;
  --secondary-color: #34495e;
  --accent-color: #326096;
  --light-color: #ecf0f1;
  --dark-color: #2c3e50;
  --text-color: #333;
  --text-light: #fff;
}

/* Grundlayout */
body {
  font-family: sans-serif;
  margin: 0;
  background: #f4f4f4;
  color: var(--text-color);
}

header,
footer {
  text-align: center;
  padding: 1em;
  background-color: var(--accent-color);
  color: var(--text-light);
}

.logo {
  font-size: 1.5em;
  font-weight: bold;
}

/* Container */
.gallery-container,
.gallery-container2 {
  line-height: 1.5;
  font-size: 1em;
  max-width: 1600px; /* etwas breiter, damit 6 Spalten schön wirken */
  margin: 2.25rem auto;
  padding: 0 1rem;
}

/* Filter / Navigation */
.gallery-filter {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  gap: 0.5rem;
}

.filter-btn {
  background: var(--light-color);
  border: none;
  padding: 0.45rem 1.15rem;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--accent-color);
  color: var(--text-light);
}

.filter-btn a {
  color: inherit;
  text-decoration: none;
}

/* =========================================================
   Galerie – Masonry / Mosaik (CSS Columns)
   ========================================================= */

/* grosse Desktops: 6 Spalten */
.gallery-grid {
  column-count: 6;
  column-gap: 0.55rem;
}

/* Desktop normal: 5 Spalten */
@media (max-width: 1600px) {
  .gallery-grid { column-count: 5; }
}

/* Laptop: 4 Spalten */
@media (max-width: 1200px) {
  .gallery-grid { column-count: 4; }
}

/* Tablet: 3 Spalten */
@media (max-width: 900px) {
  .gallery-grid { column-count: 3; }
}

/* Mobile: 2 Spalten */
@media (max-width: 600px) {
  .gallery-grid { column-count: 2; }
}

/* kleines Mobile: 1 Spalte */
@media (max-width: 400px) {
  .gallery-grid { column-count: 2; }
}

/* Masonry-Baustein */
.gallery-item {
  display: inline-block;
  width: 100%;
  margin: 0 0 0.55rem;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;

  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 10px;
  transition: box-shadow 0.25s ease;
}

.gallery-item:nth-child(-n+5) {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: -2px;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;

  /* „Pinterest“-Feeling: leichtes Zoom beim Hover */
  transition: transform 0.25s ease;
}

.gallery-item:hover {
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

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

/* Overlay */
.item-overlay {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 0.45em 0.5em;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.85em;
  text-align: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gallery-item:hover .item-overlay {
  opacity: 1;
}

/* =========================================================
   Lightbox
   ========================================================= */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,1);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1000;
}

.lightbox img {
  max-width: 92%;
  max-height: 92%;
  border-radius: 10px;
}

.lightbox-caption {
  margin-top: 10px;
  font-size: 1.1em;
  color: var(--text-light);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 2em;
  cursor: pointer;
  z-index: 1001;
}

.lightbox-close { top: 20px; right: 30px; }
.lightbox-prev  { top: 50%; left: 20px;  transform: translateY(-50%); }
.lightbox-next  { top: 50%; right: 20px; transform: translateY(-50%); }