.screenshot-link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.screenshot-link:focus-visible {
  outline: 3px solid var(--blue, #1677f3);
  outline-offset: -4px;
}

.screenshot-link::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  border: 1px solid transparent;
  border-radius: inherit;
  pointer-events: none;
  content: "";
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

@media (hover: hover) {
  .screenshot-link:hover::after {
    border-color: rgba(22, 119, 243, 0.36);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
  }
}

.screenshot-gallery {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: clamp(20px, 3vw, 48px);
  overflow: hidden;
  color: #172234;
  background: transparent;
  border: 0;
  overscroll-behavior: contain;
}

.screenshot-gallery::backdrop {
  background: rgba(14, 25, 44, 0.62);
  -webkit-backdrop-filter: blur(16px) saturate(85%);
  backdrop-filter: blur(16px) saturate(85%);
}

.screenshot-gallery[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.screenshot-gallery-panel {
  display: flex;
  flex-direction: column;
  width: min(1380px, 100%);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  background: #f3f6fa;
  box-shadow: 0 32px 100px rgba(5, 16, 34, 0.32);
}

.screenshot-gallery[open] .screenshot-gallery-panel {
  animation: screenshot-gallery-enter 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.screenshot-gallery-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 12px 18px 12px 24px;
  border-bottom: 1px solid rgba(55, 79, 113, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.screenshot-gallery-brand {
  font-family: "Figtree", "Inter", sans-serif;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.screenshot-gallery-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.screenshot-gallery-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 40px;
  height: 40px;
  padding: 0 13px;
  color: #35445b;
  background: #e9eef5;
  border: 1px solid rgba(61, 88, 122, 0.05);
  border-radius: 12px;
  font: 550 13px/1 "Inter", sans-serif;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.screenshot-gallery-actions .screenshot-gallery-close { padding: 0; }
.screenshot-gallery-actions button:hover { color: #0c61cb; background: #dfeaf9; }
.screenshot-gallery-actions button:focus-visible,
.screenshot-gallery-viewport:focus-visible { outline: 3px solid #1677f3; outline-offset: -3px; }

.screenshot-gallery-viewport {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 28px;
  overflow: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(ellipse at 16% 15%, rgba(148, 195, 255, 0.17), transparent 65%),
    radial-gradient(ellipse at 85% 85%, rgba(128, 218, 225, 0.14), transparent 65%);
}

.screenshot-gallery-image {
  display: block;
  flex: 0 0 auto;
  width: auto;
  max-width: none;
  height: auto;
  max-height: none;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 14px 46px rgba(29, 54, 91, 0.18);
  cursor: zoom-in;
}

.screenshot-gallery.is-zoomed .screenshot-gallery-viewport {
  display: block;
}

.screenshot-gallery.is-zoomed .screenshot-gallery-image {
  max-width: none;
  max-height: none;
  margin: 0 auto;
  cursor: zoom-out;
}

.screenshot-gallery-caption {
  flex: 0 0 auto;
  margin: 0;
  padding: 14px 28px 18px;
  color: #596a80;
  border-top: 1px solid rgba(55, 79, 113, 0.07);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

@keyframes screenshot-gallery-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 640px) {
  .screenshot-gallery { padding: 10px; }
  .screenshot-gallery-panel { border-radius: 18px; }
  .screenshot-gallery-toolbar { min-height: 60px; padding: 10px 12px 10px 16px; }
  .screenshot-gallery-brand { font-size: 16px; }
  .screenshot-gallery-viewport { padding: 14px; }
  .screenshot-gallery-caption { padding: 12px 16px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .screenshot-link::after,
  .screenshot-gallery-actions button { transition: none; }
  .screenshot-gallery[open] .screenshot-gallery-panel { animation: none; }
}
