:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: #1b1e26;
  --panel2: #242833;
  --line: #303542;
  --text: #f2f3f5;
  --muted: #9ba2b1;
  --accent: #a9c7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

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

.top-note,
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .16em;
}

.page {
  width: min(1400px, 92vw);
  margin: 0 auto;
  min-height: calc(100vh - 110px);
}

.intro {
  padding: 48px 0 30px;
}

.eyebrow {
  margin: 0 0 10px;
}

h1 {
  font-size: clamp(28px, 5vw, 42px);
  margin: 0;
  letter-spacing: -.04em;
}

.sub {
  color: var(--muted);
  margin: 12px 0 0;
  font-size: 14px;
}

.browser {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  min-height: 28px;
}

.crumbs button {
  border: 0;
  padding: 0;
  color: var(--accent);
  background: none;
  cursor: pointer;
  font: inherit;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 20px 0;
}

h2 {
  margin: 0 0 5px;
  font-size: 19px;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.search-wrap input {
  width: min(260px, 42vw);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
}

.folder-card {
  min-height: 90px;
  padding: 17px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}

.folder-card:active {
  background: var(--panel2);
}

.folder-icon {
  font-size: 23px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 13px;
}

.image-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  cursor: pointer;
  min-width: 0;
}

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #0b0c10;
}

.image-card .filename {
  display: block;
  padding: 9px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #dfe3eb;
}

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

.viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 65px 70px;
  background: rgba(0,0,0,.94);
}

.viewer[hidden] {
  display: none;
}

.viewer figure {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.viewer figure img {
  max-width: 100%;
  max-height: calc(100% - 48px);
  object-fit: contain;
}

.viewer figcaption {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(900px, 100%);
  padding-top: 12px;
  color: #ddd;
  font-size: 13px;
}

.viewer a {
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}

.viewer-close,
.viewer-nav {
  position: absolute;
  border: 0;
  color: white;
  background: rgba(255,255,255,.12);
  cursor: pointer;
}

.viewer-close {
  top: 15px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 30px;
}

.viewer-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 64px;
  border-radius: 10px;
  font-size: 40px;
}

.viewer-nav.prev {
  left: 15px;
}

.viewer-nav.next {
  right: 15px;
}

footer {
  border-top: 1px solid var(--line);
  padding: 18px 4vw;
  color: #747b89;
  font-size: 11px;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 600px) {
  .topbar {
    height: 52px;
  }

  .intro {
    padding: 34px 0 24px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-wrap input {
    width: 100%;
  }

  .folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .folder-card {
    min-height: 76px;
    padding: 12px;
    font-size: 13px;
  }

  .image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .viewer {
    padding: 60px 12px;
  }

  .viewer-nav {
    width: 34px;
    height: 52px;
  }

  .viewer-nav.prev {
    left: 5px;
  }

  .viewer-nav.next {
    right: 5px;
  }
}
