.design-assets-section {
  padding-top: 4rem;
}

.design-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.design-page-head h1 {
  margin-bottom: .25rem;
}

.design-count {
  margin: 0 0 .35rem;
  font-size: .92rem;
  opacity: .56;
  white-space: nowrap;
}

/* 썸네일 크게 보이도록 설정 */
.design-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}
/* 이미지 카드 */
.design-card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 2px;
  background: rgba(255, 255, 255, .045);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .16);
  isolation: isolate;
}

/* 호버 시 어두운 그라데이션 */
.design-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, .02) 0%,
      rgba(0, 0, 0, .08) 48%,
      rgba(0, 0, 0, .50) 100%
    );
  transition: opacity .24s ease;
}

/* 이미지 전체 클릭 영역 */
.design-preview-button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.design-preview-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transform: scale(1);
  transition:
    transform .36s ease,
    filter .36s ease;
}

.design-card:hover::after,
.design-card:focus-within::after {
  opacity: 1;
}

.design-card:hover .design-preview-button img,
.design-card:focus-within .design-preview-button img {
  transform: scale(1.045);
  filter: saturate(1.05) contrast(1.04);
}

/* 오른쪽 위 다운로드 아이콘 */
.design-download-icon {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 48px;
  height: 48px;
  border-radius: 999px;

  color: #111;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .24);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  opacity: 0;
  transform: translateX(10px) scale(.96);
  pointer-events: none;

  transition:
    opacity .22s ease,
    transform .22s ease,
    background .22s ease;
}

.design-download-icon:hover {
  background: #fff;
  transform: translateX(0) scale(1.05);
}

.design-card:hover .design-download-icon,
.design-card:focus-within .design-download-icon {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.design-download-icon svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.2;
}

.design-caption {
  display: none !important;
}

/* 비어 있을 때 */
.design-empty {
  grid-column: 1 / -1;
  padding: 1.5rem;
  border: 1px dashed rgba(255, 255, 255, .2);
  border-radius: 22px;
  opacity: .68;
}

/* ─────────────────────────────────────────────
   Design preview lightbox
   ───────────────────────────────────────────── */

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: none;
  padding: clamp(10px, 2vw, 24px);

  overflow: hidden;
}

.preview-modal.is-open {
  display: grid;
  place-items: center;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/*
  panel은 검은 박스가 아니라 투명 컨테이너.
  이미지 크기는 부모 100%가 아니라 화면 기준 max-height로 직접 제어.
*/
.preview-panel {
  position: relative;
  z-index: 1;

  width: min(920px, calc(100vw - 32px));
  max-width: 920px;
  max-height: calc(100svh - 32px);

  display: grid;
  grid-template-rows: auto auto;
  justify-items: center;

  overflow: visible;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* 상단 바 */
.preview-topbar {
  min-height: 52px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;

  width: 100%;
  padding: 0 0 10px;
  border-bottom: 0;
}

.preview-title {
  margin: 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.preview-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;

  color: #111;
  background: rgba(255, 255, 255, .92);
  cursor: pointer;
  text-decoration: none;

  transition:
    transform .18s ease,
    background .18s ease;
}

.preview-icon-btn:hover {
  background: #fff;
  transform: translateY(-1px);
  text-decoration: none;
}

.preview-icon-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.preview-close {
  font-size: 1.5rem;
  line-height: 1;
}

/* 중앙 뷰어 스테이지 */
.preview-stage {
  position: relative;

  width: 100%;
  min-width: 0;

  display: grid;
  place-items: center;

  overflow: visible;
  touch-action: pan-y;
  user-select: none;
  background: transparent;
}

/* 이미지 래퍼 */
.preview-image-wrap {
  width: 100%;
  min-width: 0;

  display: grid;
  place-items: center;

  padding: 0 72px;
}

/*
  핵심:
  부모 높이 100%에 의존하지 않고,
  이미지 자체를 화면 높이 기준으로 제한.
*/
.preview-image-wrap img {
  display: block;

  width: auto;
  height: auto;

  max-width: min(100%, calc(100vw - 180px));
  max-height: calc(100svh - 120px);

  object-fit: contain;
  object-position: center;

  border-radius: 2px;
  background: transparent;

  will-change: transform, opacity;
  transition:
    transform .22s ease,
    opacity .22s ease;

  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* 좌우 이동 버튼 */
.preview-nav {
  position: absolute;
  top: 50%;
  z-index: 3;

  width: 52px;
  height: 76px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;

  color: #fff;
  background: rgba(0, 0, 0, .34);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  font-size: 44px;
  line-height: 1;
  cursor: pointer;

  transform: translateY(-50%);
  transition:
    background .18s ease,
    transform .18s ease,
    opacity .18s ease;
}

.preview-nav:hover {
  background: rgba(255, 255, 255, .14);
  transform: translateY(-50%) scale(1.04);
}

.preview-prev {
  left: 16px;
}

.preview-next {
  right: 16px;
}

/* 좌우 전환 애니메이션 */
.preview-image-wrap img.is-slide-next {
  animation: previewSlideNext .28s ease both;
}

.preview-image-wrap img.is-slide-prev {
  animation: previewSlidePrev .28s ease both;
}

@keyframes previewSlideNext {
  from {
    opacity: .25;
    transform: translateX(46px) scale(.985);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes previewSlidePrev {
  from {
    opacity: .25;
    transform: translateX(-46px) scale(.985);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* 반응형 */
@media (max-width: 1100px) {
  .design-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .design-gallery {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

.design-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 28px 0 0;
}

.design-page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .05);
  color: inherit;
  cursor: pointer;
}

.design-page-btn:hover {
  background: rgba(255, 255, 255, .12);
}

.design-page-btn.is-current {
  background: #ffffff;
  color: #111111;
  border-color: #ffffff;
  cursor: default;
}

.design-page-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
@media (max-width: 720px) {
  .design-assets-section {
    padding-top: 3rem;
  }

  .design-page-head {
    display: block;
    margin-bottom: 1.5rem;
  }

  .design-count {
    margin-top: .75rem;
  }

  .design-gallery {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .design-card {
    border-radius: 2px;
  }

  .design-download-icon {
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .design-caption {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .design-caption-title {
    font-size: .95rem;
  }

  .preview-modal {
    padding: 10px;
  }

  .preview-panel {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100svh - 20px);

    display: grid;
    grid-template-rows: auto auto;
    justify-items: center;

    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .preview-topbar {
    min-height: 50px;
    padding: 0 0 8px;
  }

  .preview-stage {
    width: 100%;
    min-height: 0;
    overflow: visible;
    touch-action: pan-y;
  }

  .preview-image-wrap {
    width: 100%;
    padding: 0 12px;
  }

  .preview-image-wrap img {
    width: auto;
    height: auto;

    max-width: calc(100vw - 24px);
    max-height: calc(100svh - 86px);

    object-fit: contain;
    object-position: center;
  }

  .preview-nav {
    display: none;
  }
  
}

.design-lightbox-zoom-clone {
  position: fixed;
  z-index: 10000;

  display: block;

  max-width: none;
  max-height: none;

  object-fit: cover;
  object-position: center;

  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;

  border-radius: 2px;
  background: transparent;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22);

  opacity: 1;
  will-change: left, top, width, height, opacity, transform;
}

/* 썸네일 clone이 이동 중일 때 실제 모달 이미지는 잠깐 숨김 */
.preview-modal.is-opening #previewImage {
  opacity: 0;
}

/* clone 애니메이션이 끝나면 실제 모달 이미지 표시 */
.preview-modal:not(.is-opening) #previewImage {
  opacity: 1;
}