@media screen {
  .gallery-thumbnails {
    display: flex;
    gap: .4rem;
    align-items: center;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--muted) transparent;
    margin-top: .6rem;
    padding: 3px 3px .45rem;
    min-width: 0;
  }
  .gallery-thumbnail {
    flex: 0 0 clamp(99px, 17.6vw, 141px);
    height: clamp(73px, 12.1vw, 97px);
    display: grid;
    place-items: center;
    padding: 2px;
    border: 1px solid var(--rule);
    border-radius: 2px;
    background: var(--white);
    color: var(--muted);
    font: 700 .8rem/1 var(--sans);
    cursor: pointer;
    overflow: hidden;
  }
  .gallery-thumbnail img {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: none;
    object-fit: contain;
  }
  .gallery-thumbnail:hover { border-color: var(--accent); }
  .gallery-thumbnail[aria-current="true"] {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
  }
  .gallery-thumbnail:focus-visible { outline-offset: 1px; }
  .viewer-frame:has(.gallery-thumbnails) { grid-template-rows: auto minmax(0, 1fr) auto; }
  .viewer-frame .gallery-thumbnails {
    border-top: 1px solid #635661;
    margin: 0;
    padding: .65rem .85rem;
  }
  .viewer-frame .gallery-thumbnail {
    min-height: 44px;
    padding: 2px;
    background: #282329;
  }
  .viewer-frame .gallery-thumbnail[aria-current="true"] {
    border-color: #ffa4b5;
    box-shadow: inset 0 0 0 1px #ffa4b5;
  }
  .viewer-frame:has(.gallery-thumbnails) .viewer-stage img {
    max-height: min(calc(85dvh - 108px), calc(100dvh - 223px));
  }
}
@media print {
  .gallery-thumbnails { display: none; }
}
