.pixa-image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  align-items: center;
  justify-items: center;
  padding: 28px 16px;
  background: rgba(17, 17, 17, 0.72);
  min-width: 0;
  min-height: 0;
}

.pixa-image-viewer__frame {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 10px;
  justify-items: center;
  grid-column: 2;
  width: 100%;
  max-width: calc(100vw - 144px);
  height: calc(100vh - 56px);
  height: calc(100dvh - 56px);
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  min-height: 0;
}

.pixa-image-viewer__text {
  display: contents;
}

.pixa-image-viewer__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 30px;
  overflow: hidden;
}

.pixa-image-viewer__tab {
  min-height: 34px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.66);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pixa-image-viewer__tab[aria-current] {
  border-color: #fff;
  background: #fff;
  color: #111;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.pixa-image-viewer__image-stage {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.pixa-image-viewer__image {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}

.pixa-image-viewer__caption,
.pixa-image-viewer__message,
.pixa-image-viewer__note {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pixa-image-viewer__message {
  color: #fff;
  min-height: 24px;
  max-height: 42px;
  text-align: center;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow-y: auto;
}

.pixa-image-viewer__note {
  min-height: 16px;
  max-height: 32px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  white-space: normal;
}

.pixa-image-viewer__close,
.pixa-image-viewer__nav {
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.18);
  color: #fff;
  font: inherit;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.pixa-image-viewer__close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  font-size: 24px;
}

.pixa-image-viewer__nav {
  position: static;
  width: 44px;
  height: 62px;
  font-size: 42px;
}

.pixa-image-viewer__nav--prev {
  grid-column: 1;
}

.pixa-image-viewer__nav--next {
  grid-column: 3;
}

.pixa-image-viewer__nav:hover,
.pixa-image-viewer__nav:focus-visible,
.pixa-image-viewer__close:hover,
.pixa-image-viewer__close:focus-visible {
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.12);
}

.pixa-image-viewer__nav:disabled {
  display: none;
}

@media (max-width: 760px) {
  .pixa-image-viewer {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 6px 12px;
    padding: 18px 0 12px;
  }

  .pixa-image-viewer__frame,
  .pixa-image-viewer__image-stage,
  .pixa-image-viewer__image {
    max-width: 100%;
  }

  .pixa-image-viewer__frame {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 2px;
  }

  .pixa-image-viewer__text {
    position: absolute;
    top: var(--viewer-text-top, auto);
    left: 0;
    z-index: 1;
    display: grid;
    gap: 2px;
    width: 100%;
    max-height: var(--viewer-text-max-height, 4.5em);
    overflow: hidden;
  }

  .pixa-image-viewer__image-stage {
    min-height: 0;
  }

  .pixa-image-viewer__image {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    object-position: center center;
  }

  .pixa-image-viewer__caption {
    max-height: 1.5em;
    line-height: 1.5;
    white-space: nowrap;
    overflow-wrap: anywhere;
  }

  .pixa-image-viewer__message {
    max-height: 4.5em;
    min-height: 0;
    padding: 0 8px;
    overflow: hidden;
    line-height: 1.5;
    text-overflow: clip;
    white-space: normal;
  }

  .pixa-image-viewer__note {
    display: none;
  }

  .pixa-image-viewer__nav {
    width: 30px;
    height: 30px;
    font-size: 24px;
  }

  .pixa-image-viewer__nav--prev {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
  }

  .pixa-image-viewer__nav--next {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }
}

@media (max-height: 520px) {
  .pixa-image-viewer {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 6px 12px;
    padding: 10px 12px 8px;
  }

  .pixa-image-viewer__frame {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 2px;
  }

  .pixa-image-viewer__text {
    position: absolute;
    top: var(--viewer-text-top, auto);
    left: 0;
    z-index: 1;
    display: grid;
    gap: 2px;
    width: 100%;
    max-height: var(--viewer-text-max-height, 3em);
    overflow: hidden;
  }

  .pixa-image-viewer__tabs {
    min-height: 0;
    max-height: 30px;
  }

  .pixa-image-viewer__tab {
    min-height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }

  .pixa-image-viewer__image-stage,
  .pixa-image-viewer__image {
    max-width: 100%;
    max-height: 100%;
  }

  .pixa-image-viewer__image {
    width: 100%;
    height: 100%;
    object-position: center center;
  }

  .pixa-image-viewer__image-stage {
    min-height: 0;
  }

  .pixa-image-viewer__caption {
    max-height: 1.5em;
    line-height: 1.5;
    white-space: nowrap;
  }

  .pixa-image-viewer__message {
    max-height: 3em;
    min-height: 0;
    padding: 0 8px;
    overflow: hidden;
    line-height: 1.5;
    white-space: normal;
  }

  .pixa-image-viewer__note {
    display: none;
  }

  .pixa-image-viewer__nav {
    width: 30px;
    height: 30px;
    font-size: 24px;
  }

  .pixa-image-viewer__nav--prev {
    grid-column: 1;
    grid-row: 2;
    justify-self: end;
  }

  .pixa-image-viewer__nav--next {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }
}
