:root {
  --dmns-gallery-ink: #171515;
  --dmns-gallery-paper: #fcfaf3;
  --dmns-gallery-panel: #e8e2d4;
  --dmns-gallery-line: #cfc8b9;
}

body.single-post .dmns-small-image-gallery {
  box-sizing: border-box;
  width: min(100%, 72.6ch);
  max-width: 72.6ch;
  margin: 40px auto;
  padding: 24px 0;
  border-top: 1px solid var(--dmns-gallery-line);
  border-bottom: 1px solid var(--dmns-gallery-line);
  color: var(--dmns-gallery-ink);
}

.dmns-small-image-gallery__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 0 18px;
}

.dmns-small-image-gallery__title {
  margin: 0;
  font-family: "freight-big-pro", "Freight Big Pro", Georgia, serif;
  font-size: 32px;
  font-weight: 400;
  line-height: 40px;
  letter-spacing: -.01em;
}

.dmns-small-image-gallery__count {
  color: #7a7975;
  font-size: 14px;
  line-height: 20px;
}

.dmns-small-image-gallery__viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
  user-select: none;
}

.dmns-small-image-gallery__viewport.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.dmns-small-image-gallery__viewport::-webkit-scrollbar {
  display: none;
}

.dmns-small-image-gallery__track {
  display: flex;
  align-items: stretch;
  gap: 16px;
  width: max-content;
}

.dmns-small-image-gallery__item {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 clamp(210px, 22vw, 280px);
  width: clamp(210px, 22vw, 280px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  scroll-snap-align: start;
  background: var(--dmns-gallery-panel);
}

body.single-post .dmns-small-image-gallery__item > :is(p, figure, .wp-caption),
body.single-post .dmns-small-image-gallery__item > .frame-wrap,
body.single-post .dmns-small-image-gallery__item > :is(p, figure, .wp-caption, .frame-wrap) > a {
  display: grid !important;
  place-items: center !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

body.single-post .dmns-small-image-gallery__item img {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  margin: 0 !important;
  object-fit: contain !important;
}

.dmns-small-image-gallery__open {
  position: absolute;
  inset: 0;
  z-index: 2;
  appearance: none;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
}

.dmns-small-image-gallery__viewport.is-dragging .dmns-small-image-gallery__open {
  cursor: grabbing;
}

.dmns-small-image-gallery__open:focus-visible {
  outline: 2px solid var(--dmns-gallery-ink);
  outline-offset: -4px;
}

.dmns-small-image-gallery__controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.dmns-small-image-gallery__arrow {
  appearance: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--dmns-gallery-ink);
  border-radius: 50%;
  background: transparent;
  color: var(--dmns-gallery-ink);
  cursor: pointer;
}

.dmns-small-image-gallery__arrow svg {
  display: block;
  width: 18px;
  height: 18px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dmns-small-image-gallery__item img {
  -webkit-user-drag: none;
  user-select: none;
}

.dmns-small-image-gallery__arrow:disabled {
  opacity: .28;
  cursor: default;
}

.dmns-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 32px;
  background: rgba(23, 21, 21, .9);
}

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

.dmns-gallery-lightbox__image {
  display: block;
  max-width: min(92vw, 1200px);
  max-height: 86vh;
  width: auto;
  height: auto;
  object-fit: contain;
  background: var(--dmns-gallery-paper);
}

.dmns-gallery-lightbox__close {
  position: fixed;
  top: 20px;
  right: 20px;
  appearance: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: var(--dmns-gallery-paper);
  color: var(--dmns-gallery-ink);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

body.dmns-gallery-lightbox-open {
  overflow: hidden;
}

@media (max-width: 700px) {
  body.single-post .dmns-small-image-gallery {
    width: 100%;
    margin: 32px auto;
    padding: 20px 0;
  }

  .dmns-small-image-gallery__item {
    flex-basis: min(76vw, 280px);
    width: min(76vw, 280px);
  }

  .dmns-small-image-gallery__controls {
    display: none;
  }

  .dmns-gallery-lightbox {
    padding: 18px;
  }
}
