.has-photo-viewer {
  position: relative;
}

.photo-viewer-trigger {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(24, 27, 24, 0.42);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.photo-viewer-trigger:hover,
.photo-viewer-trigger:focus-visible {
  background: rgba(24, 27, 24, 0.72);
}

.photo-viewer {
  width: min(1180px, calc(100vw - 32px));
  max-width: none;
  max-height: min(900px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #f7f8f8;
  background: #111511;
  overflow-y: auto;
  overflow-x: hidden;
}

.photo-viewer::backdrop {
  background: rgba(11, 13, 11, 0.76);
  backdrop-filter: blur(8px);
}

.photo-viewer__chrome,
.photo-viewer__footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
}

.photo-viewer__chrome {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.photo-viewer__chrome .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

.photo-viewer__chrome h2 {
  flex: 1;
  margin: 0;
  color: #ffffff;
  font-family: "MaruBuri", "Pretendard", serif;
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 400;
  line-height: 1.35;
}

.photo-viewer__close {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: #ffffff;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

.photo-viewer__stage {
  position: relative;
  min-height: 320px;
  touch-action: pan-y;
  background: #080a08;
}

.photo-viewer__stage figure {
  display: grid;
  min-height: min(62dvh, 620px);
  margin: 0;
  place-items: center;
}

.photo-viewer__stage img {
  width: 100%;
  height: min(62dvh, 620px);
  object-fit: contain;
  background: #080a08;
  opacity: 1;
  transition: opacity 180ms ease;
}

.photo-viewer__stage img.is-loading {
  opacity: 0.42;
}

.photo-viewer__stage figcaption {
  position: absolute;
  left: 22px;
  bottom: 18px;
  max-width: min(640px, calc(100% - 44px));
  padding: 8px 12px;
  border-radius: 4px;
  color: #ffffff;
  background: rgba(8, 10, 8, 0.58);
  backdrop-filter: blur(12px);
  font-size: 13px;
  line-height: 1.6;
}

.photo-viewer__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: grid;
  width: 48px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(8, 10, 8, 0.38);
  font-size: 42px;
  line-height: 1;
  transform: translateY(-50%);
  cursor: pointer;
}

.photo-viewer__nav:hover,
.photo-viewer__nav:focus-visible,
.photo-viewer__close:hover,
.photo-viewer__close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.photo-viewer__nav--prev {
  left: 18px;
}

.photo-viewer__nav--next {
  right: 18px;
}

.photo-viewer__footer {
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.photo-viewer__count {
  flex: none;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.photo-viewer__thumbs {
  display: flex;
  min-width: 0;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.photo-viewer__thumbs button {
  display: grid;
  width: 112px;
  flex: 0 0 auto;
  gap: 6px;
  padding: 0;
  border: 0;
  color: rgba(255, 255, 255, 0.66);
  background: transparent;
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.photo-viewer__thumbs img {
  width: 112px;
  height: 70px;
  border: 2px solid transparent;
  border-radius: 4px;
  object-fit: cover;
}

.photo-viewer__thumbs button[aria-current="true"] {
  color: #ffffff;
}

.photo-viewer__thumbs button[aria-current="true"] img {
  border-color: var(--sun, #f5d652);
}

@media (max-width: 700px) {
  .photo-viewer {
    width: 100vw;
    max-width: none;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
  }

  .photo-viewer__chrome,
  .photo-viewer__footer {
    padding: 14px 16px;
  }

  .photo-viewer__chrome {
    align-items: flex-start;
  }

  .photo-viewer__chrome .eyebrow {
    display: none;
  }

  .photo-viewer__close {
    width: 40px;
    height: 40px;
  }

  .photo-viewer__stage figure {
    min-height: 58dvh;
  }

  .photo-viewer__stage img {
    height: 58dvh;
  }

  .photo-viewer__stage figcaption {
    left: 16px;
    bottom: 14px;
    max-width: calc(100% - 32px);
    font-size: 12px;
  }

  .photo-viewer__nav {
    width: 42px;
    height: 54px;
    font-size: 34px;
  }

  .photo-viewer__nav--prev {
    left: 10px;
  }

  .photo-viewer__nav--next {
    right: 10px;
  }

  .photo-viewer__footer {
    display: grid;
    gap: 10px;
  }

  .photo-viewer__thumbs button,
  .photo-viewer__thumbs img {
    width: 92px;
  }

  .photo-viewer__thumbs img {
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photo-viewer__stage img,
  .photo-viewer-trigger {
    transition: none;
  }
}
