* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

h1 {
  margin: 0;
  font-weight: bold;
}

body {
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;
  color: #333;
}

header {
  text-align: center;
  padding: 2rem 0;
}

.stack-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  grid-column: span 6;
}

/* Gallery Container */
.gallery-container {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Variable Height Gallery Item */
.gallery-item {
  position: relative;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.gallery-item img:hover {
  transform: scale(1.05);
}

.gallery-item.image-container {
  aspect-ratio: unset;
  position: relative;
  z-index: 1;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 20px 0;
}

.gallery-grid .gallery-item {
  grid-column: span 1;
}


/* Layout classes */
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
.span-12 { 
  grid-column: span 12;
}

/* Text block */
.text-block {
    aspect-ratio: unset; /* Removes fixed aspect ratio */
    height: auto;
    padding: 20px;
    margin: 0;
    align-self: start; /* Aligns to top of grid cell */
    background: white;
}

/* Overlay for enlarged images */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.overlay.active {
  display: flex;
}

.overlay-content {
  position: relative;
  max-width: 90%;
  max-height: 90vh;
}

.overlay-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
}

.close-button {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: white;
  font-size: 30px;
  cursor: pointer;
  padding: 5px;
}

@media (max-width: 1024px) {
  .span-3 { grid-column: span 4; }
  .span-4 { grid-column: span 6; }
}

@media (max-width: 768px) {
  .gallery-container {
      gap: 15px;
      padding: 15px;
  }
  .span-3, .span-4, .span-6, .span-8 { grid-column: span 12; }
}

/* Make it responsive */
@media (max-width: 768px) {
  .gallery-grid .gallery-item {
      max-width: 200px; /* Smaller size for mobile */
  }
}

/* Add to responsive section */
@media (max-width: 768px) {
  .stack-container {
      grid-column: span 12;
  }
}

.lazy-load {
  opacity: 0;
  transition: opacity 0.5s ease-in;
  min-height: 200px;
  background: #f0f0f0;
  width: 100%;
  height: 100%;
}

.lazy-load.loaded {
  opacity: 1;
  min-height: auto;
  background: none;
}

.lazy-load.loading {
  background: linear-gradient(110deg, #ececec 8%, #f5f5f5 18%, #ececec 33%);
  background-size: 200% 100%;
  animation: 1.5s shine linear infinite;
}

/* Loading animation keyframes */
@keyframes shine {
  to {
      background-position-x: -200%;
  }
}

@media (max-width: 768px) {
  .gallery-grid {
      grid-template-columns: 1fr;
  }
  .nav-button {
    bottom: 10px;
    font-size: 16px;
    width: 35px;
    height: 35px;
}
.nav-button.prev {
  left: 35%;
}

.nav-button.next {
  right: 35%;
}
}


/*Translations*/
.translation-text {
  display: none;
  margin-top: 10px;
  font-family: "Crimson Text", Georgia, serif;
  font-size: 0.9em;
  color: #444;
}

.translation-toggle {
  color: #6495ED;
  font-size: 0.8em;
  font-family: "Crimson Text", Georgia, serif;
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  margin-top: 5px;
}

.translation-toggle:hover {
  color: #4169E1;
}

.show {
  display: block;
}

.nav-container {
  position: absolute;
  bottom: 20px; /* Position below the image */
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 20px; /* Space between buttons */
}

/*Navigation controls*/
.nav-button {
  transform: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 10px;
  z-index: 1001;
  border-radius: 50%; /* Make it circular */
  width: 40px; 
  height: 40px; 
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease;
}

.nav-button:hover {
  background: rgba(255, 255, 255, 0.3); /* More visible on hover */
  color: #ddd;
}

.nav-button.prev {
  left: 42%;
}

.nav-button.next {
  right: 42%;
}

/* Add touch support hints */
.overlay-content {
  touch-action: pan-y pinch-zoom;
}

/* Optional: Make buttons more visible on light images */
.nav-button {
  text-shadow: 0 0 10px rgba(0,0,0,0.5);
}