.screenshot-link {
  position: relative;
  display: block;
  cursor: zoom-in;
}

.screenshot-link-icon {
  position: absolute;
  inset-block-start: 12px;
  inset-inline-end: 12px;
  z-index: 2;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  color: #fff;
  background: rgba(5, 7, 13, .72);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  backdrop-filter: blur(12px);
  pointer-events: none;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease;
}

.screenshot-link-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screenshot-link:hover .screenshot-link-icon {
  border-color: rgba(255, 255, 255, .32);
  background: rgba(11, 14, 25, .88);
  transform: translateY(-1px);
}

.screenshot-link-action {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html.screenshot-viewer-open,
html.screenshot-viewer-open body {
  overflow: hidden;
}

.screenshot-viewer {
  width: min(calc(100vw - 32px), 1600px);
  max-width: none;
  height: min(calc(100vh - 32px), 1000px);
  height: min(calc(100dvh - 32px), 1000px);
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 20px;
  color: #f7f8fc;
  background: #070910;
  box-shadow: 0 30px 120px rgba(0, 0, 0, .82);
  color-scheme: dark;
}

.screenshot-viewer[open] {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
}

.screenshot-viewer::backdrop {
  background: rgba(1, 2, 6, .88);
  backdrop-filter: blur(8px);
}

.screenshot-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  background: rgba(10, 12, 21, .96);
}

.screenshot-viewer-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #d9dce7;
  background: transparent;
  cursor: pointer;
  transition: color .18s ease, background-color .18s ease, border-color .18s ease;
}

.screenshot-viewer-button:hover {
  border-color: rgba(255, 255, 255, .1);
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.screenshot-viewer-button:focus-visible,
.screenshot-link:focus-visible {
  outline: 2px solid #22d3ee;
  outline-offset: 3px;
}

.screenshot-viewer-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.screenshot-viewer-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  place-items: center;
  background: radial-gradient(circle at 50% 44%, #111627 0, #080a12 55%, #05070c 100%);
  direction: ltr;
  overscroll-behavior: contain;
}

.screenshot-viewer-image {
  position: absolute;
  inset: 18px;
  display: block;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.screenshot-viewer.is-zoomed .screenshot-viewer-stage {
  display: block;
}

.screenshot-viewer.is-zoomed .screenshot-viewer-image {
  position: static;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .screenshot-link-icon {
    inset-block-start: 8px;
    inset-inline-end: 8px;
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .screenshot-viewer {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .screenshot-viewer-stage {
    padding: 10px;
  }

  .screenshot-viewer-image {
    inset: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screenshot-link-icon,
  .screenshot-viewer-button {
    transition: none;
  }
}
