:root {
  --gap: 12px;
  --tile: 180px;
}

@media (width <= 600px) {
  :root {
    --tile: 140px;
  }

  #crumbs a {
    padding: 10px 14px;
    font-size: 1rem;
  }
}

body {
  margin: 20px;
  padding-top: 10px;
  padding-bottom: 20px;
  font-family: system-ui, sans-serif;
}

header {
  z-index: 10;
  background: inherit;
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  display: flex;
  position: sticky;
  top: 0;
}

h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

#crumbs {
  flex-wrap: wrap;
  gap: 6px;
  display: flex;
}

#crumbs a {
  color: #0a58ca;
  background: #f0f0f0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .9rem;
  text-decoration: none;
  transition: background .15s, transform 50ms;
  display: inline-block;
}

#crumbs a:hover {
  background: #e0e0e0;
}

#crumbs a:active {
  transform: scale(.95);
}

#crumbs span {
  color: #888;
  user-select: none;
}

#status {
  color: #666;
  font-size: .9rem;
}

.grid {
  grid-template-columns: repeat(auto-fill, minmax(var(--tile), 1fr));
  gap: var(--gap);
  display: grid;
}

.item {
  text-align: center;
  font-size: .85rem;
}

.item a {
  color: #333;
  text-decoration: none;
}

.thumb {
  width: var(--tile);
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
  place-items: center;
  height: 140px;
  display: grid;
  overflow: hidden;
}

.thumb img {
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.thumb video {
  object-fit: contain;
  width: 100%;
  height: 100%;
  display: block;
}

.folder {
  font-size: 48px;
  line-height: 1;
}

.name {
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-top: 6px;
  overflow: hidden;
}

.hidden {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }

  body {
    color: #e6e6e6;
    background: #0b0b0c;
  }

  #crumbs a {
    color: #8bb4ff;
    background: #1e1e22;
  }

  #crumbs a:hover {
    background: #2a2a30;
  }

  #crumbs span {
    color: #777;
  }

  .item a {
    color: #dfe3ff;
  }

  .thumb {
    background: #141416;
    border-color: #2a2a2e;
  }

  #status {
    color: #9aa0a6;
  }
}

#modal {
  z-index: 999;
  position: fixed;
  inset: 0;
}

#modal.hidden {
  display: none;
}

#modal .overlay {
  background: #000000b3;
  position: absolute;
  inset: 0;
}

#modal .content {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  display: flex;
  position: absolute;
  inset: 0;
}

#modal img, #modal video {
  max-width: 90%;
  max-height: 80%;
}

#modal .bar {
  gap: 6px;
  width: 90%;
  display: flex;
}

#modal input {
  flex: 1;
}

#repo-link {
  z-index: 20;
  color: #fff;
  background: #0a58ca80;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: .9rem;
  text-decoration: none;
  transition: transform .1s, box-shadow .1s, background .2s;
  position: fixed;
  bottom: 12px;
  right: 12px;
  box-shadow: 0 4px 12px #0003;
}
