/* SPDX-FileCopyrightText: Copyright 2026 Camiel Vanderhoeven <iamcamiel@gmail.com> */
/* SPDX-License-Identifier: AGPL-3.0-or-later */

.accession-gallery {
  --accession-gallery-shadow-left: 7px;
  --accession-gallery-shadow-right: 10px;
  --accession-gallery-shadow-inline: calc(var(--accession-gallery-shadow-left) + var(--accession-gallery-shadow-right));
  margin: 1rem 0;
  overflow: visible !important;
}

.accession-gallery[hidden] {
  display: none;
}

.accession-gallery ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  overflow: visible !important;
  padding: 0.75rem 1rem 1rem 0.75rem;
}

.accession-gallery li {
  margin: 0;
  max-width: 100%;
  padding: 0;
  overflow: visible !important;
}

.accession-gallery-caption {
  color: #334155;
  display: block;
  font-size: 0.9rem;
  line-height: 1.35;
  margin: 0.75rem 0 0 var(--accession-gallery-shadow-left);
  max-width: calc(100% - var(--accession-gallery-shadow-inline));
}

.accession-gallery-thumb {
  background: #ffffff;
  display: inline-flex;
  margin-left: var(--accession-gallery-shadow-left);
  margin-right: var(--accession-gallery-shadow-right);
  max-width: max(0px, calc(100% - var(--accession-gallery-shadow-inline)));
  min-width: 0;
  overflow: visible !important;
  text-decoration: none;
}

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

.accession-gallery .accession-gallery-thumbnail {
  border: 0;
  border-radius: 0;
  -webkit-box-shadow: 0 0 0 5px #ffffff, 0 0 0 7px #0088cc, 3px 3px 3px 7px #777777;
  -moz-box-shadow: 0 0 0 5px #ffffff, 0 0 0 7px #0088cc, 3px 3px 3px 7px #777777;
  box-shadow: 0 0 0 5px #ffffff, 0 0 0 7px #0088cc, 3px 3px 3px 7px #777777;
}

.accession-gallery--normal .accession-gallery-thumb img {
  max-height: 140px;
  max-width: min(180px, 100%);
}

.accession-gallery--large .accession-gallery-thumb img {
  max-height: 280px;
  max-width: min(360px, 100%);
}

.accession-gallery--larger .accession-gallery-thumb img {
  max-height: 420px;
  max-width: min(540px, 100%);
}

.accession-gallery--small .accession-gallery-thumb img {
  max-height: 90px;
  max-width: min(120px, 100%);
}

.accession-gallery--square .accession-gallery-thumb {
  aspect-ratio: 1 / 1;
  height: auto;
}

.accession-gallery--square .accession-gallery-thumb img {
  height: 100%;
  width: 100%;
}

.accession-gallery--square-normal .accession-gallery-thumb {
  width: 150px;
}

.accession-gallery--square-large .accession-gallery-thumb {
  width: 300px;
}

.accession-gallery--square-larger .accession-gallery-thumb {
  width: 450px;
}

.accession-gallery--square-small .accession-gallery-thumb {
  width: 100px;
}

.accession-gallery--square .accession-gallery-thumb img {
  object-fit: cover;
}

.accession-gallery--fit .accession-gallery-thumb img {
  background: #ffffff;
  object-fit: contain;
}

.accession-gallery-viewer {
  align-items: stretch;
  background: rgba(2, 6, 23, 0.94);
  color: #ffffff;
  display: grid;
  grid-template-rows: auto 1fr;
  inset: 0;
  position: fixed;
  z-index: 100000;
}

.accession-gallery-viewer[hidden] {
  display: none;
}

.accession-gallery-viewer-toolbar {
  align-items: center;
  background: rgba(15, 23, 42, 0.92);
  display: flex;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.5rem;
}

.accession-gallery-viewer-title {
  flex: 1;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accession-gallery-viewer button,
.accession-gallery-viewer a[download] {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  justify-content: center;
  min-height: 2.25rem;
  min-width: 2.25rem;
  padding: 0 0.65rem;
  text-decoration: none;
}

.accession-gallery-viewer-stage {
  align-items: center;
  display: grid;
  grid-template-columns: auto 1fr auto;
  min-height: 0;
  overflow: hidden;
}

.accession-gallery-viewer-canvas {
  align-items: center;
  cursor: grab;
  display: flex;
  height: 100%;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  touch-action: none;
}

.accession-gallery-viewer-canvas img {
  max-height: 100%;
  max-width: 100%;
  transform-origin: center center;
  user-select: none;
}

.accession-gallery-viewer-nav {
  height: 100%;
  width: clamp(2.5rem, 8vw, 5rem);
}

.accession-gallery-viewer-info {
  background: rgba(15, 23, 42, 0.94);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  bottom: 0;
  max-width: 24rem;
  overflow: auto;
  padding: 1rem;
  position: absolute;
  right: 0;
  top: 3.25rem;
  width: min(88vw, 24rem);
}

.accession-gallery-viewer-info[hidden] {
  display: none;
}

.accession-gallery-viewer-info dl {
  margin: 0;
}

.accession-gallery-viewer-info dt {
  font-weight: 700;
  margin-top: 0.75rem;
}

.accession-gallery-viewer-info dd {
  margin: 0.25rem 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
