#photo-viewer {
  --viewer-white: #fdfdfc;
  --viewer-bronze: #c8a970;
  position: fixed;
  inset: 0;
  width: min(1200px, calc(100vw - 64px));
  max-width: none;
  max-height: calc(100dvh - 64px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(253, 253, 252, .17);
  border-radius: 0;
  color: var(--viewer-white);
  background: #161719;
  font-family: var(--font, 'Archivo', -apple-system, 'Helvetica Neue', sans-serif);
  box-shadow: 0 30px 100px rgba(0, 0, 0, .3);
}

#photo-viewer::backdrop {
  background: rgba(9, 11, 14, .88);
  backdrop-filter: blur(7px);
}

#photo-viewer[open] {
  animation: photo-viewer-enter .2s ease-out both;
}

#photo-viewer .photo-viewer__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(860px, calc(100dvh - 64px));
}

#photo-viewer .photo-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 22px 30px;
  border-bottom: 1px solid rgba(253, 253, 252, .12);
}

#photo-viewer .photo-viewer__heading {
  min-width: 0;
}

#photo-viewer .photo-viewer__title {
  margin: 0;
  color: var(--viewer-white);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 500;
  letter-spacing: -.015em;
  line-height: 1.2;
}

#photo-viewer .photo-viewer__subtitle {
  margin: 7px 0 0;
  color: rgba(253, 253, 252, .6);
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .12em;
  line-height: 1.5;
  text-transform: uppercase;
}

#photo-viewer .photo-viewer__stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #101113;
  touch-action: pan-y pinch-zoom;
}

#photo-viewer .photo-viewer__image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 1;
  transition: opacity .18s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

#photo-viewer .is-loading .photo-viewer__image,
#photo-viewer .has-error .photo-viewer__image {
  opacity: 0;
}

#photo-viewer .photo-viewer__notice {
  position: absolute;
  left: 72px;
  right: 72px;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
  color: rgba(253, 253, 252, .65);
  font-size: .8rem;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}

#photo-viewer .photo-viewer__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(253, 253, 252, .3);
  border-radius: 0;
  color: var(--viewer-white);
  background: rgba(16, 17, 19, .65);
  appearance: none;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
  -webkit-tap-highlight-color: transparent;
}

#photo-viewer .photo-viewer__button svg {
  display: block;
  width: 22px;
  height: 22px;
}

#photo-viewer .photo-viewer__button:hover {
  border-color: var(--viewer-bronze);
  color: var(--viewer-bronze);
  background: rgba(143, 115, 70, .15);
}

#photo-viewer .photo-viewer__button:focus-visible {
  outline: 2px solid var(--viewer-bronze);
  outline-offset: 4px;
}

#photo-viewer .photo-viewer__button:disabled {
  opacity: .28;
  cursor: default;
}

#photo-viewer .photo-viewer__previous,
#photo-viewer .photo-viewer__next {
  position: absolute;
  top: 50%;
  z-index: 1;
  transform: translateY(-50%);
}

#photo-viewer .photo-viewer__previous {
  left: 18px;
}

#photo-viewer .photo-viewer__next {
  right: 18px;
}

#photo-viewer .photo-viewer__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 21px 30px 24px;
  border-top: 1px solid rgba(253, 253, 252, .12);
}

#photo-viewer .photo-viewer__details {
  min-width: 0;
}

#photo-viewer .photo-viewer__kind {
  margin: 0 0 7px;
  color: var(--viewer-bronze);
  font-size: .6rem;
  font-weight: 600;
  letter-spacing: .14em;
  line-height: 1.5;
  text-transform: uppercase;
}

#photo-viewer .photo-viewer__caption {
  margin: 0;
  color: rgba(253, 253, 252, .82);
  font-size: .87rem;
  font-weight: 400;
  line-height: 1.5;
}

#photo-viewer .photo-viewer__counter {
  flex: 0 0 auto;
  margin: 0;
  color: rgba(253, 253, 252, .6);
  font-size: .66rem;
  font-weight: 500;
  letter-spacing: .08em;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  white-space: nowrap;
}

#photo-viewer [hidden] {
  display: none !important;
}

@keyframes photo-viewer-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  #photo-viewer {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  #photo-viewer .photo-viewer__panel {
    height: min(780px, calc(100dvh - 24px));
  }

  #photo-viewer .photo-viewer__header {
    gap: 12px;
    padding: 16px;
  }

  #photo-viewer .photo-viewer__subtitle {
    font-size: .59rem;
    letter-spacing: .08em;
  }

  #photo-viewer .photo-viewer__previous {
    left: 10px;
  }

  #photo-viewer .photo-viewer__next {
    right: 10px;
  }

  #photo-viewer .photo-viewer__footer {
    align-items: flex-start;
    gap: 14px;
    padding: 17px 16px 20px;
  }

  #photo-viewer .photo-viewer__caption {
    font-size: .78rem;
  }

  #photo-viewer .photo-viewer__counter {
    font-size: .59rem;
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  #photo-viewer {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 16px);
  }

  #photo-viewer .photo-viewer__panel {
    height: calc(100dvh - 16px);
  }

  #photo-viewer .photo-viewer__header {
    padding: 8px 16px;
  }

  #photo-viewer .photo-viewer__title {
    font-size: 1rem;
  }

  #photo-viewer .photo-viewer__subtitle {
    margin-top: 3px;
    font-size: .55rem;
  }

  #photo-viewer .photo-viewer__footer {
    padding: 8px 16px;
  }

  #photo-viewer .photo-viewer__kind {
    margin-bottom: 2px;
    font-size: .53rem;
  }

  #photo-viewer .photo-viewer__caption {
    font-size: .7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #photo-viewer[open] {
    animation: none;
  }

  #photo-viewer .photo-viewer__image,
  #photo-viewer .photo-viewer__button {
    transition: none;
  }
}
