@charset "utf-8";

/* 상품 상세 (sub_detail.html) — breadcrumb, badge, info-bar는 sub.css 사용 */

/* ==========================================================================
   Layout
   ========================================================================== */
.pd { display: flex; align-items: flex-start; justify-content: space-between; gap: 40px; margin-top: 40px; }

/* ==========================================================================
   Gallery
   ========================================================================== */
.pd-gallery { position: sticky; top: 40px; width: 560px; min-width: 0; }
.pd-gallery__main { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--c-base9); }

/* 상품 이미지 크롭 (Figma 오프셋 그대로) */
.pd-figure { position: absolute; left: 50%; top: 50%; overflow: hidden; transform: translate(-50%, -50%); }
.pd-figure img { position: absolute; left: -11.75%; top: -8.67%; width: 120.18%; height: 111.9%; max-width: none; }
.pd-gallery__main .pd-figure { width: 78.48%; height: 86.31%; }

.pd-gallery__nav { display: flex; align-items: center; gap: 5px; margin-top: 32px; }
.pd-gallery__arrow { flex-shrink: 0; width: 20px; height: 20px; }
.pd-gallery__arrow img { width: 100%; height: 100%; }
.pd-gallery__arrow--prev img { transform: scaleX(-1); }
.pd-gallery__arrow:disabled { cursor: default; }
.pd-gallery__thumbs { flex: 1; min-width: 0; display: flex; gap: 5px; }
.pd-gallery__thumbs li { flex: 1; min-width: 0; }
.pd-gallery__thumb { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; background: var(--c-base9); }
.pd-gallery__thumb::after { content: ''; position: absolute; inset: 0; border: 1px solid transparent; transition: border-color .2s; }
.pd-gallery__thumb.is-active::after { border-color: var(--c-primary); }
.pd-gallery__thumb .pd-figure { width: 75.77%; height: 83.33%; }

/* ==========================================================================
   Info
   ========================================================================== */
.pd-info { width: 512px; flex-shrink: 0; }

.pd-head { display: flex; flex-direction: column; gap: 8px; padding-bottom: 20px; border-bottom: 1px solid #d9d9d9; }
.pd-head__title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pd-head__name { display: flex; align-items: center; gap: 8px; }
.pd-head__name h2 { font-size: 18px; line-height: 26px; }
.pd-like { flex-shrink: 0; width: 24px; height: 24px; }
.pd-like img { width: 100%; height: 100%; }
.pd-head__desc { font-size: 20px; line-height: 28px; }
.pd-head__price { display: flex; gap: 2px; font-size: 20px; line-height: 28px; }
.pd-head__price strong { font-weight: 700; }

.pd-delivery { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.pd-delivery li { display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; }
.pd-delivery img { flex-shrink: 0; width: 24px; height: 24px; }

/* 옵션 */
.pd-options { display: flex; flex-direction: column; gap: 40px; margin-top: 40px; }
.pd-opt { display: flex; flex-direction: column; gap: 8px; }
.pd-opt__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pd-opt__tit { font-size: 14px; line-height: 20px; font-weight: 500; }
.pd-opt__tit em { font-style: normal; color: var(--c-red); }
.pd-opt__link { flex-shrink: 0; padding: 0; font-size: 12px; line-height: 16px; color: #666; text-decoration: underline; text-underline-position: from-font; }
.pd-opt__note { font-size: 14px; line-height: 20px; color: var(--c-base4); }

.pd-opt__row { display: flex; gap: 8px; }
.pd-counter { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; padding: 9px 8px; border: 1px solid var(--c-base8); border-radius: 8px; }
.pd-counter button { flex-shrink: 0; width: 20px; height: 20px; }
.pd-counter button img { width: 100%; height: 100%; }
.pd-counter button:disabled { opacity: .4; cursor: default; }
.pd-counter input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500; text-align: center; color: var(--c-black); outline: 0; }
.pd-guide-btn { flex-shrink: 0; width: 174px; padding: 9px 8px; border: 1px solid var(--c-base8); border-radius: 8px; font-size: 14px; line-height: 20px; font-weight: 500; text-align: center; transition: background-color .2s; }
.pd-guide-btn:hover { background: var(--c-base9); }

/* 선택 칩 (라디오) */
.pd-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pd-chip { position: relative; cursor: pointer; }
.pd-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pd-chip span {
  display: block;
  padding: 9px 20px;
  border: 1px solid var(--c-base8);
  border-radius: 8px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .2s, border-color .2s, color .2s;
}
.pd-chip:hover span { border-color: var(--c-base6); }
.pd-chip input:checked + span { border-color: var(--c-primary); background: #f5f2ee; color: var(--c-primary); }
.pd-chip input:focus-visible + span { outline: 2px solid var(--c-primary); outline-offset: 2px; }

.pd-chips--size { flex-wrap: nowrap; }
.pd-chips--size .pd-chip { flex: 1; min-width: 0; }
.pd-chips--size span { display: flex; flex-direction: column; align-items: center; padding: 9px 4px; font-size: 13px; line-height: 18px; }
.pd-chips--size b { font-size: 14px; line-height: 20px; font-weight: 500; }

/* 각인 문구 */
.pd-input { display: flex; align-items: center; gap: 12px; height: 48px; margin: -1px 0; padding: 0 12px 0 14px; border: 1px solid var(--c-base8); border-radius: 4px; background: var(--c-white); transition: border-color .2s, background-color .2s; }
.pd-input:focus-within { border-color: var(--c-primary); }
.pd-input input { flex: 1; min-width: 0; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; line-height: 20px; color: var(--c-black); outline: 0; }
.pd-input input::placeholder { color: var(--c-base8); }
.pd-input__count { display: flex; gap: 4px; flex-shrink: 0; font-size: 14px; line-height: 20px; color: var(--c-base6); }
.pd-input__count b { font-weight: 400; color: var(--c-black); }
.pd-input__count i { font-style: normal; }
.pd-input[hidden] { display: none; }

/* 사진 업로드 */
.pd-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 1px dashed var(--c-base8);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.pd-upload:hover, .pd-upload.is-drag { border-color: var(--c-primary); background: #f5f2ee; }
.pd-upload:focus-within { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.pd-upload img { width: 24px; height: 24px; }
.pd-upload strong { font-size: 14px; line-height: 20px; font-weight: 500; }
.pd-upload span { font-size: 13px; line-height: 18px; color: var(--c-base4); }
.pd-upload em { font-style: normal; font-size: 14px; line-height: 20px; font-weight: 500; color: #0d6efd; text-decoration: underline; text-underline-position: from-font; }

.pd-files { display: flex; flex-direction: column; gap: 6px; }
.pd-files:empty { display: none; }
.pd-file { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; background: var(--c-base9); }
.pd-file__thumb { position: relative; flex-shrink: 0; width: 40px; height: 40px; overflow: hidden; border-radius: 6px; background: var(--c-base9); }
.pd-file__thumb img { position: absolute; top: 2px; bottom: 2px; left: calc(50% - .5px); width: 17px; height: 36px; max-width: none; object-fit: cover; transform: translateX(-50%); }
.pd-file__thumb--photo img { inset: 0; width: 100%; height: 100%; transform: none; }
.pd-file__info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 18px; }
.pd-file__info p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-file__info span { color: var(--c-base4); }
.pd-file__del { flex-shrink: 0; width: 20px; height: 20px; }
.pd-file__del img { width: 100%; height: 100%; }

/* 금액 */
.pd-total { display: flex; flex-direction: column; gap: 20px; margin-top: 40px; }
.pd-total__list { display: flex; flex-direction: column; gap: 6px; }
.pd-total__list div, .pd-total__sum { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pd-total__list dt, .pd-total__sum span { font-size: 14px; line-height: 20px; color: #666; }
.pd-total__list dd { font-size: 15px; line-height: 22px; white-space: nowrap; }
.pd-total__sum { padding-top: 20px; border-top: 1px solid #d9d9d9; }
.pd-total__sum p { display: flex; gap: 2px; font-size: 20px; line-height: 28px; white-space: nowrap; }
.pd-total__sum strong { font-weight: 700; }

/* 버튼 */
.pd-btns { display: flex; gap: 8px; margin-top: 40px; }
.pd-btns__like { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 48px; border-radius: 4px; background: var(--c-base9); }
.pd-btns__like img { width: 24px; height: 24px; }
.pd-btns__btn {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 20px;
  border: 1px solid var(--c-primary);
  border-radius: 4px;
  font-size: 16px;
  line-height: 24px;
  white-space: nowrap;
  transition: opacity .2s, background-color .2s;
}
.pd-btns__btn--line { background: var(--c-white); color: var(--c-primary); }
.pd-btns__btn--line:hover { background: #f5f2ee; }
.pd-btns__btn--primary { background: var(--c-primary); color: var(--c-white); }
.pd-btns__btn--primary:hover { opacity: .85; }

/* ==========================================================================
   Detail
   ========================================================================== */
.pd-detail { display: flex; flex-direction: column; gap: 80px; margin-top: 98px; }
.pd-detail__img { position: relative; overflow: hidden; }
.pd-detail__img img { position: absolute; max-width: none; }
.pd-detail__img--01 { aspect-ratio: 1499 / 982; }
.pd-detail__img--01 img { left: -1.23%; top: -2.14%; width: 102.47%; height: 104.28%; }
.pd-detail__img--02 { aspect-ratio: 1449 / 915; }
.pd-detail__img--02 img { left: -3.11%; top: -7.65%; width: 106.21%; height: 111.91%; }
.pd-detail__img--03 { aspect-ratio: 1391 / 980; }
.pd-detail__img--03 img { left: -5.18%; top: -2.24%; width: 110.42%; height: 104.49%; }
.pd-detail__img--04 { aspect-ratio: 1713 / 828; }
.pd-detail__img--04 img { left: -3.91%; top: -1.33%; width: 107.82%; height: 102.66%; }

/* 03 사이즈 비교: 이미지 속 받침대 문구를 덮는 수정 텍스트 (시안 1280px 기준 위치·크기를 이미지 폭에 비례) */
.pd-detail__img--02 { container-type: inline-size; }
.pd-detail__patch {
  position: absolute;
  z-index: 1;
  left: 4.14%;
  top: 46.7%;
  width: 14.92%;
  background: #fcfcfc;
  font-size: 1.016cqw;
  line-height: 1.5625cqw;
  color: var(--c-black);
}
.pd-detail__patch strong { display: block; margin-bottom: .156cqw; font-size: 1.172cqw; line-height: 1.719cqw; font-weight: 500; }

/* 05 제작·배송 안내 하단 문구 */
.pd-detail__caption { margin-top: 24px; font-size: 16px; line-height: 24px; text-align: center; }

/* ==========================================================================
   Popup (사이즈 가이드 9638:9859, 좋은 사진 고르는 TIP 9638:9869)
   ========================================================================== */
/* 팝업 폭을 화면 높이에 맞춰 줄여 이미지가 스크롤 없이 다 보이도록 함
   (--pop-head: 제목 높이 + 본문 간격, --pop-ratio: 이미지 가로/세로) */
.pop {
  --pop-img-w: 1012px;
  --pop-ratio: 1.3566; /* 1012 / 746 */
  --pop-pad: 32px;
  --pop-head: 52px;
  --pop-fit-w: calc((100vh - 64px - var(--pop-pad) * 2 - var(--pop-head)) * var(--pop-ratio) + var(--pop-pad) * 2);
  width: min(calc(var(--pop-img-w) + var(--pop-pad) * 2), calc(100% - 32px), var(--pop-fit-w));
  max-width: none;
  max-height: calc(100% - 64px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--c-white);
  color: var(--c-black);
  overflow: hidden;
}
.pop[open] { display: flex; flex-direction: column; }
.pop__inner { display: flex; flex-direction: column; min-height: 0; padding: var(--pop-pad); }
@supports (height: 100dvh) {
  .pop { --pop-fit-w: calc((100dvh - 64px - var(--pop-pad) * 2 - var(--pop-head)) * var(--pop-ratio) + var(--pop-pad) * 2); }
}
.pop::backdrop { background: rgba(0, 0, 0, .6); }
.pop[open] { animation: popIn .25s ease-out; }
@keyframes popIn { from { opacity: 0; transform: translateY(16px); } }
.pop__head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pop__tit { font-size: 24px; line-height: 32px; font-weight: 700; }
.pop__close { flex-shrink: 0; width: 32px; height: 32px; padding: 0; translate: 12px -12px; } /* 모서리 쪽으로 (우측 · 위) */
.pop__close img { display: block; width: 32px; height: 32px; }
.pop__body { margin-top: 20px; }
html.is-pop-open { overflow: hidden; }

/* 이미지 크롭 (Figma 오프셋 그대로) */
.pop-size { position: relative; aspect-ratio: 1012 / 746; overflow: hidden; }
.pop-size img { position: absolute; left: -26.48%; top: -17.02%; width: 134.47%; height: 121.42%; max-width: none; }
.pop--tip { --pop-img-w: 1262px; --pop-ratio: 1.6693; /* 1262 / 756 */ }
.pop-tip { position: relative; aspect-ratio: 1262 / 756; overflow: hidden; }
.pop-tip img { position: absolute; left: -6.44%; top: -20.14%; width: 112%; height: 124.64%; max-width: none; }

/* 장바구니 담기 */
.pop.pop--cart { width: min(440px, calc(100% - 32px)); }
.pop-cart__msg { display: flex; flex-direction: column; gap: 4px; padding: 12px 0 4px; font-size: 15px; line-height: 22px; color: var(--c-base4); text-align: center; }
.pop-cart__msg strong { font-size: 18px; line-height: 26px; font-weight: 500; color: var(--c-black); }
.pop-cart__btns { display: flex; gap: 8px; margin-top: 28px; }
.pop-cart__btns .pd-btns__btn { display: flex; align-items: center; justify-content: center; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1279px) {
  .pd-gallery { flex: 0 1 560px; width: auto; }
  .pd-info { width: 440px; }
}

@media (max-width: 1023px) {
  .pd { flex-direction: column; align-items: stretch; }
  .pd-gallery { position: static; flex: none; width: 100%; max-width: 560px; margin: 0 auto; }
  .pd-info { width: 100%; }
  .pd-detail { gap: 56px; margin-top: 80px; }
}

@media (max-width: 767px) {
  .pd { gap: 32px; margin-top: 24px; }
  .pd-gallery__nav { margin-top: 16px; }
  .pd-head__name h2 { font-size: 16px; line-height: 24px; }
  .pd-head__desc, .pd-head__price { font-size: 18px; line-height: 26px; }
  .pd-options { gap: 32px; margin-top: 32px; }
  .pd-guide-btn { width: 120px; }
  .pd-chips--size { display: grid; grid-template-columns: repeat(3, 1fr); }
  .pd-chip span { padding: 9px 16px; }
  .pd-chips--size span { padding: 9px 4px; }
  .pd-opt__note { font-size: 13px; line-height: 18px; }
  .pd-total, .pd-btns { margin-top: 32px; }
  .pd-detail { gap: 32px; margin-top: 56px; }
  .pop { border-radius: 16px; }
  .pop { --pop-pad: 20px; --pop-head: 42px; }
  .pop__tit { font-size: 18px; line-height: 26px; }
  .pop__close, .pop__close img { width: 24px; height: 24px; }
  .pop__close { translate: 8px -8px; }
  .pop__body { margin-top: 16px; }
  .pop-cart__msg { font-size: 14px; line-height: 20px; }
  .pop-cart__msg strong { font-size: 16px; line-height: 24px; }
  .pop-cart__btns { margin-top: 24px; }
}
