:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: #2b2b2b;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header */

#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 25px;
  background: #000;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 100;
  font-size: 12px;
}

.site-title {
  background: none;
  border: none;
  color: #fff;
  font: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

#filter-toggle {
  background: none;
  border: none;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

/* Filter panel */

#filter-panel {
  position: fixed;
  top: 25px;
  left: 0;
  right: 0;
  background: #f4f4f4;
  color: #1a1a1a;
  padding: 16px 20px;
  z-index: 99;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

#filter-panel[hidden] {
  display: none;
}

#filter-panel h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.filter-subtext {
  margin: 0 0 12px;
  font-size: 13px;
  color: #555;
}

.filter-options {
  border: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-options label {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.filter-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}

.filter-sort-label {
  font-size: 13px;
  color: #555;
}

.filter-sort label {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.filter-sort input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin: 0;
  border: 1px solid #1a1a1a;
  background: #fff;
  position: relative;
  cursor: pointer;
}

.filter-sort input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  background: #1a1a1a;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.filter-actions button {
  padding: 8px 16px;
  font-size: 13px;
  border: 1px solid #1a1a1a;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
}

#filter-reset,
#filter-cancel {
  background: #fff;
  color: #1a1a1a;
}

/* Gallery */

#gallery {
  position: relative;
  margin-top: 25px;
  background: #2b2b2b;
  width: 100%;
  min-height: 200px;
}

.gallery-tile {
  position: absolute;
  overflow: hidden;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gallery-tile.loaded {
  opacity: 1;
}

.gallery-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Load more */

#load-more {
  display: block;
  margin: 24px auto;
  padding: 10px 28px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid #fff;
  background: none;
  color: #fff;
  cursor: pointer;
}

#load-more:hover {
  background: #fff;
  color: #1a1a1a;
}

#load-more[hidden] {
  display: none;
}

/* Lightbox */

#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#lightbox[hidden] {
  display: none;
}

#lightbox-image {
  max-width: 85vw;
  max-height: 90vh;
  object-fit: contain;
}

#lightbox-close,
#lightbox-prev,
#lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  padding: 8px;
}

#lightbox-close {
  top: 16px;
  right: 16px;
}

#lightbox-prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

#lightbox-next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

/* Mobile */

@media (max-width: 600px) {
  #filter-panel {
    padding: 14px 16px;
  }

  .filter-options {
    flex-direction: column;
    gap: 10px;
  }

  .filter-actions button {
    flex: 1;
  }

  #lightbox-prev,
  #lightbox-next {
    font-size: 22px;
    padding: 6px;
  }
}
