html:has(.sg-photo-viewer[open]) { overflow: hidden; }

.sg-photo-viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(var(--sg-space-xs), env(safe-area-inset-top)) max(var(--sg-space-md), env(safe-area-inset-right))
           max(var(--sg-space-xs), env(safe-area-inset-bottom)) max(var(--sg-space-md), env(safe-area-inset-left));
  border: 0;
  overflow: hidden;
  background: transparent;
  color: #fff;
  font-family: var(--sg-font-family);
  font-size: var(--sg-font-small);
}

.sg-photo-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--sg-space-xs);
}
.sg-photo-viewer:not([open]) { display: none; }

.sg-photo-viewer::backdrop {
  background: rgb(17 24 39 / .92);
  opacity: 1;
  transition: opacity var(--sg-motion-enter);
}

@starting-style {
  .sg-photo-viewer[open]::backdrop { opacity: 0; }
}

.sg-photo-viewer[data-closing]::backdrop {
  opacity: 0;
  transition: opacity var(--sg-motion-exit);
}

.sg-photo-viewer__toolbar,
.sg-photo-viewer__controls {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sg-photo-viewer__controls { justify-content: center; gap: var(--sg-space-md); }
.sg-photo-viewer [hidden] { display: none; }

.sg-photo-viewer__button {
  display: grid;
  place-items: center;
  width: var(--sg-control-height);
  height: var(--sg-control-height);
  padding: 0;
  border: 1px solid rgb(255 255 255 / .24);
  border-radius: 50%;
  background: rgb(255 255 255 / .1);
  color: inherit;
  cursor: pointer;
}

.sg-photo-viewer__button:hover { background: rgb(255 255 255 / .2); }
.sg-photo-viewer__button:focus-visible, .sg-photo-viewer a:focus-visible { outline-color: #fff; }
.sg-photo-viewer__button svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sg-photo-viewer__stage { position: relative; display: grid; place-items: center; margin: 0; }
.sg-photo-viewer__stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.sg-photo-viewer__stage a { position: relative; padding: var(--sg-space-sm); color: inherit; }
.portfolio-work__slide [data-photo-preview] { display: block; }
a[data-photo-preview] { cursor: zoom-in; }
