/* Gallery plugin. Uses the design's variables where they exist. */
.tx-gallery {
  --tx-gallery-gap: .6rem;
  display: grid;
  gap: var(--tx-gallery-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.5rem 0;
}
@media (min-width: 700px) {
  .tx-gallery--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tx-gallery--cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.tx-gallery--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tx-gallery__item { margin: 0; }
.tx-gallery__link { display: block; overflow: hidden; border-radius: 4px; background: var(--color-line, #ddd); }
.tx-gallery__link img { display: block; width: 100%; height: auto; transition: transform .25s ease; }
.tx-gallery--landscape .tx-gallery__link img { aspect-ratio: 4 / 3; object-fit: cover; }
.tx-gallery--square .tx-gallery__link img { aspect-ratio: 1; object-fit: cover; }
.tx-gallery__link:hover img, .tx-gallery__link:focus-visible img { transform: scale(1.03); }
.tx-gallery__link:focus-visible { outline: 3px solid var(--color-accent, #8a2f2b); outline-offset: 2px; }
.tx-gallery figcaption { margin-top: .3rem; font-size: .85em; color: var(--color-muted, #666); }
/* Long galleries: the rest opens below the first images. */
.tx-gallery-set { margin: 1.5rem 0; }
.tx-gallery-set > .tx-gallery { margin: 0; }
.tx-gallery__more > summary { display: inline-flex; margin-top: .9rem; padding: .45rem 1rem; border: 1px solid var(--color-line, #ccc); border-radius: 999px; cursor: pointer; list-style: none; }
.tx-gallery__more > summary::-webkit-details-marker { display: none; }
.tx-gallery__more > summary:hover { border-color: currentColor; }
.tx-gallery__more > summary:focus-visible { outline: 3px solid var(--color-accent, #8a2f2b); outline-offset: 2px; }
.tx-gallery__more[open] .tx-gallery__more-open, .tx-gallery__more:not([open]) .tx-gallery__more-close { display: none; }
.tx-gallery__more > .tx-gallery { margin: var(--tx-gallery-gap) 0 0; }
.tx-gallery__empty { padding: 1rem; border: 1px dashed var(--color-line, #ccc); color: var(--color-muted, #666); }

/* Viewer */
.tx-viewer { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; padding: 0; border: 0; background: rgba(10, 10, 12, .94); color: #f5f5f5; }
.tx-viewer::backdrop { background: rgba(10, 10, 12, .94); }
.tx-viewer__stage { position: absolute; inset: 3.5rem 4rem 4.5rem; display: grid; place-items: center; }
.tx-viewer__stage img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.tx-viewer__bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 1rem; align-items: baseline; justify-content: center; padding: 1rem 4rem; font: 15px/1.4 system-ui, sans-serif; }
.tx-viewer__count { opacity: .7; white-space: nowrap; }
.tx-viewer button { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.tx-viewer button:hover, .tx-viewer button:focus-visible { background: rgba(255,255,255,.25); outline: none; }
.tx-viewer__close { top: .75rem; right: .75rem; }
.tx-viewer__prev { left: .75rem; top: 50%; transform: translateY(-50%); }
.tx-viewer__next { right: .75rem; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  .tx-viewer__stage { inset: 3.5rem .5rem 5rem; }
  .tx-viewer__prev, .tx-viewer__next { top: auto; bottom: .75rem; transform: none; }
  .tx-viewer__bar { padding: 1rem 4.5rem; }
}
