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

body {
  font-family: sans-serif;
  background: #111;
  color: #fff;
  padding: 1rem;
  transition: background 0.3s ease, color 0.3s ease;
}

body.light {
  background: #f5f5f5;
  color: #111;
}

/* Toolbar */
.toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.theme-toggle {
  background: none;
  border: 1px solid currentColor;
  color: inherit;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: opacity 0.2s ease;
}

.theme-toggle:hover {
  opacity: 0.7;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
}

.gallery__item {
  cursor: pointer;
  overflow: hidden;
  border-radius: 4px;
}

.gallery__item img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery__item:hover img {
  transform: scale(1.05);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.modal img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}

.modal__close {
  position: absolute;
  top: -2.5rem;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover {
  color: #ccc;
}

.modal__caption {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.95rem;
  color: #ddd;
}
