
* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #101010;
  --surface: #191919;
  --text: #f2f0eb;
  --muted: #888;
  --line: #292929;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

.page {
  width: min(1440px, calc(100% - 40px));
  margin: auto;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .13em;
}

.brand span {
  color: var(--muted);
  margin-left: 7px;
  font-weight: 500;
}

.count {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 22px 0;
}

.toolbar input {
  width: min(280px, 70vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  color: var(--text);
  outline: none;
}

.toolbar input:focus {
  border-color: #777;
}

.gallery {
  columns: 4 230px;
  column-gap: 14px;
  min-height: 180px;
}

.photo {
  display: block;
  width: 100%;
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  break-inside: avoid;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform .35s ease;
}

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

.status,
.empty {
  color: var(--muted);
  text-align: center;
  padding: 60px 10px;
}

footer {
  border-top: 1px solid var(--line);
  margin-top: 45px;
  padding: 22px 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* Fullscreen viewer */

.viewer {
  width: min(1100px, calc(100% - 24px));
  max-width: none;
  max-height: 94vh;
  padding: 54px 54px 65px;
  border: 1px solid #333;
  border-radius: 12px;
  background: #111;
  color: white;
}

.viewer::backdrop {
  background: rgba(0, 0, 0, .91);
  backdrop-filter: blur(5px);
}

.viewer figure {
  margin: 0;
  display: grid;
  place-items: center;
  gap: 12px;
}

.viewer figure img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
}

.viewer figcaption {
  color: #aaa;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.close,
.nav {
  position: absolute;
  border: 0;
  color: white;
  background: #282828;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.close {
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  font-size: 25px;
}

.nav {
  top: 50%;
  width: 40px;
  height: 40px;
  font-size: 28px;
  transform: translateY(-50%);
}

.prev { left: 8px; }
.next { right: 8px; }

.download {
  position: absolute;
  bottom: 12px;
  right: 14px;
  color: #ddd;
  font-size: 12px;
  text-decoration: none;
  border: 1px solid #444;
  padding: 8px 12px;
  border-radius: 6px;
}

.download:hover {
  background: #252525;
}

@media (max-width: 600px) {
  .page {
    width: calc(100% - 24px);
  }

  .topbar {
    height: 64px;
  }

  .gallery {
    columns: 2 145px;
    column-gap: 9px;
  }

  .photo {
    margin-bottom: 9px;
  }

  .viewer {
    padding: 48px 12px 65px;
  }
}
