.back-link {
  font-size: 16px;
}

.back-link > svg,
.back-link-icon {
  flex: 0 0 auto;
  height: 19px;
  width: 19px;
}

.attachment-lightbox {
  background: transparent;
  border: 0;
  max-height: calc(100dvh - 32px);
  max-width: calc(100vw - 32px);
  overflow: visible;
  padding: 0;
  width: min(920px, calc(100vw - 32px));
}

.attachment-lightbox::backdrop {
  backdrop-filter: blur(2px);
  background: var(--theme-overlay, rgb(15 23 42 / 72%));
}

.attachment-lightbox-shell {
  background: var(--theme-content-surface, #ffffff);
  border: 1px solid var(--theme-border, rgb(255 255 255 / 22%));
  border-radius: 12px;
  box-shadow: var(--theme-shadow-md, 0 24px 70px rgb(15 23 42 / 38%));
  padding: 46px 54px 42px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.attachment-lightbox-stage {
  align-items: center;
  background: var(--theme-page-background, #f3f5f8);
  border: 1px solid var(--theme-border, #dfe5ed);
  border-radius: 8px;
  display: flex;
  height: min(68dvh, 660px);
  justify-content: center;
  overflow: hidden;
}

.attachment-lightbox-image {
  display: block;
  height: auto;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  width: auto;
}

.attachment-lightbox-close,
.attachment-lightbox-control {
  align-items: center;
  border: 0;
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 0;
  position: absolute;
}

.attachment-lightbox-close {
  background: var(--theme-content-surface, #ffffff);
  border: 1px solid var(--theme-border, #dfe5ed);
  border-radius: 50%;
  color: var(--theme-secondary-text, #526074);
  height: 32px;
  right: 10px;
  top: 9px;
  width: 32px;
}

.attachment-lightbox-close:hover {
  background: var(--theme-quiet-surface-strong, #eef1f5);
  color: var(--theme-primary-text, #1b2430);
}

.attachment-lightbox-close svg {
  height: 14px;
  width: 14px;
}

.attachment-lightbox-control {
  background: rgb(27 36 48 / 82%);
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 50%;
  color: #ffffff;
  height: 38px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
}

.attachment-lightbox-control:hover {
  background: #1b2430;
}

.attachment-lightbox-control[hidden] {
  display: none;
}

.attachment-lightbox-control.previous {
  left: 8px;
}

.attachment-lightbox-control.next {
  right: 8px;
}

.attachment-lightbox-control svg {
  height: 18px;
  width: 18px;
}

.attachment-lightbox-meta {
  align-items: center;
  bottom: 13px;
  color: var(--theme-secondary-text, #526074);
  display: flex;
  font-size: 12px;
  gap: 10px;
  justify-content: space-between;
  left: 54px;
  position: absolute;
  right: 54px;
}

.attachment-lightbox-caption {
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-lightbox-position {
  color: var(--theme-muted-text, #8593a6);
  flex: none;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

@media (max-width: 620px) {
  .attachment-lightbox {
    max-height: calc(100dvh - 20px);
    max-width: calc(100vw - 20px);
    width: calc(100vw - 20px);
  }

  .attachment-lightbox-shell {
    padding: 44px 12px 42px;
  }

  .attachment-lightbox-stage {
    height: min(62dvh, 560px);
  }

  .attachment-lightbox-control.previous {
    left: 18px;
  }

  .attachment-lightbox-control.next {
    right: 18px;
  }

  .attachment-lightbox-meta {
    left: 14px;
    right: 14px;
  }
}
