#pictures .picture-top,
#pictures .picture-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#pictures .picture-top {
  justify-content: space-between;
  margin-bottom: 14px;
}

#pictures :is(.picture-filter, .gallery-add),
#gallery-upload button {
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}

#pictures .picture-filter.active,
#pictures .gallery-add {
  border-color: #96b3d1;
  background: #e5eef8;
  color: #174975;
}

#pictures .picture-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 16px);
}

#pictures .picture-card {
  position: relative;
  min-width: 0;
  min-height: 120px;
  padding: 0;
  overflow: hidden;
  aspect-ratio: 5 / 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111721;
  text-align: start;
  cursor: pointer;
}

#pictures [hidden],
#gallery-upload [hidden] {
  display: none !important;
}

#pictures .picture-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background-size: cover;
  background-position: center;
}

#pictures [data-picture="0"] .picture-art { background-image: url("assets/promo-tides.webp"); }
#pictures [data-picture="1"] .picture-art { background-image: url("assets/promo-arrival.webp"); }
#pictures [data-picture="2"] .picture-art { background-image: url("assets/promo-beyond.webp"); }
#pictures [data-picture="3"] .picture-art { background-image: url("assets/promo-screening.webp"); }
#pictures [data-picture="4"] .picture-art { background-image: url("https://images.unsplash.com/photo-1472396961693-142e6e269027?auto=format&fit=crop&w=900&q=85"); }
#pictures [data-picture="5"] .picture-art { background-image: url("https://images.unsplash.com/photo-1519608487953-e999c86e7455?auto=format&fit=crop&w=900&q=85"); }

#pictures .picture-caption {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 3px;
  padding: 24px 10px 10px;
  background: linear-gradient(transparent, #07101be8 48%);
  color: #fff;
  overflow-wrap: anywhere;
}

#pictures .picture-caption small {
  color: #dce5f1;
  font-size: 11px;
}

#pictures .picture-expand {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #07101bc9;
  color: #fff;
}

#gallery-status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

#gallery-status:empty { display: none; }

:is(#picture-viewer, #gallery-upload) {
  box-sizing: border-box;
  max-height: calc(100dvh - 32px);
  padding: clamp(14px, 3vw, 22px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 65px #11182640;
}

:is(#picture-viewer, #gallery-upload)::backdrop { background: #1118269e; }
#picture-viewer { width: min(920px, calc(100% - 32px)); }
#gallery-upload { width: min(460px, calc(100% - 32px)); }

#picture-viewer .picture-viewer-top,
#gallery-upload header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

:is(#picture-viewer, #gallery-upload) h2 {
  margin: 0;
  flex: 1;
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

#picture-viewer .picture-position { color: var(--muted); font-size: 13px; }

#picture-viewer .picture-viewer-close,
#picture-viewer .picture-move,
#gallery-upload [data-gallery-close] {
  display: grid;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font-size: 23px;
  cursor: pointer;
}

#picture-viewer .picture-full {
  position: relative;
  height: min(60dvh, 620px);
  min-height: 180px;
  overflow: hidden;
  border-radius: 8px;
  background: #111721;
}

#picture-viewer .picture-full-art {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
}

#picture-viewer .picture-move {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}

#picture-viewer .previous { left: 8px; }
#picture-viewer .next { right: 8px; }
#picture-viewer .picture-description,
#gallery-upload > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

#gallery-upload form { display: grid; gap: 13px; margin-top: 16px; }
#gallery-upload label { display: grid; gap: 4px; font-size: 13px; }
#gallery-upload :is(input, select) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

#gallery-upload img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: var(--canvas);
  border-radius: 6px;
}

#gallery-upload [role="alert"] { margin: 0; color: #a13527; font-size: 13px; overflow-wrap: anywhere; }
#gallery-upload [role="alert"]:empty { display: none; }
#gallery-upload footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
#gallery-upload [type="submit"] { border-color: #0864b5; background: #0864b5; color: #fff; }
#gallery-upload button:disabled { opacity: .5; cursor: default; }

@media (max-width: 560px) {
  #pictures .picture-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #gallery-upload :is(input, select) { font-size: 16px; }
}
