:root {
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #242424;
  background: #fafafa;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #fafafa;
}

a {
  color: inherit;
}

.app-header {
  width: min(100% - 2rem, 960px);
  margin: 0 auto;
  padding: 1.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgb(36 36 36 / 12%);
}

.brand {
  font-weight: 750;
  text-decoration: none;
}

.app-header nav {
  display: flex;
  gap: 1rem;
  font-size: 0.9rem;
}

.app-header nav a {
  color: #656565;
  text-decoration: none;
}

.app-header nav a:hover,
.app-header nav a[aria-current="page"] {
  color: #242424;
}

main {
  width: min(100% - 2rem, 960px);
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.5rem);
  letter-spacing: -0.05em;
}

#map {
  height: 300px;
  margin: 1em 0;
  border-radius: 4px;
}

.leaflet-popup-content {
  margin: 0.5em;
}

.leaflet-popup-content img {
  max-width: 200px;
  max-height: 200px;
  display: block;
}

#filters {
  margin: 1.5em 0;
  display: flex;
  flex-direction: column;
  gap: 0.75em;
}

.year-row-wrap {
  display: flex;
  gap: 0.5em;
  align-items: flex-start;
}

.year-row {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
}

.year-row button,
#more-toggle {
  padding: 0.3em 0.7em;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 3px;
  cursor: pointer;
  opacity: 0.6;
}

.year-row button:hover,
#more-toggle:hover {
  opacity: 1;
}

.year-row button.active {
  opacity: 1;
  font-weight: bold;
}

#more-toggle {
  flex-shrink: 0;
}

#more-filters {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

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

.filter-row {
  display: flex;
  gap: 0.5em;
  flex-wrap: wrap;
}

.filter-row input,
.filter-row select {
  padding: 0.3em 0.5em;
  font: inherit;
  flex: 1;
  min-width: 8em;
}

.filter-row button {
  padding: 0.3em 1em;
  font: inherit;
  cursor: pointer;
  color: inherit;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: transparent;
}

.filter-row label {
  display: flex;
  gap: 0.4em;
  align-items: center;
}

.status {
  padding: 1em;
  text-align: center;
  opacity: 0.7;
}

.status.error {
  color: #c33;
  opacity: 1;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75em;
}

.photo {
  cursor: pointer;
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  background: rgb(128 128 128 / 10%);
}

.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}

.photo:hover img {
  transform: scale(1.04);
}

.photo[data-video="1"]::after {
  content: "▶";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.4em;
  line-height: 1;
  color: rgb(255 255 255 / 95%);
  text-shadow: 0 2px 10px rgb(0 0 0 / 60%);
  pointer-events: none;
}

.photo .date {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0.25em 0.5em;
  background: linear-gradient(to top, rgb(0 0 0 / 70%), transparent);
  color: #fff;
  font-size: 0.75em;
  pointer-events: none;
}

.photo .format {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 1px 5px;
  background: rgb(0 0 0 / 55%);
  color: #fff;
  font-size: 0.7em;
  letter-spacing: 0.05em;
  border-radius: 3px;
  pointer-events: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 2em;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 92%);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-close {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  padding: 0.2em 0.5em;
  color: #fff;
  background: transparent;
  border: 0;
  font-size: 2em;
  line-height: 1;
  cursor: pointer;
}

.lightbox-content {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: calc(100vh - 6em);
  object-fit: contain;
}

.lightbox-caption {
  padding: 0.5em;
  color: #ccc;
  font-size: 0.85em;
}

@media (max-width: 560px) {
  .app-header,
  main {
    width: min(100% - 1.25rem, 960px);
  }

  main {
    padding-top: 1.75rem;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
