/*
  [생성일] 2026-11-24
  [경위] 티팡 시안 「직접 꾸며 보기」(/custom) 전용 스타일. 미리보기(옷 사진 + 인쇄 영역), 선택 칸, 이름 목록, 수량표, 예상 금액, 작업지시서
  [변경이력]
    - 2026-11-24: 최초 생성 (스탠다드커스텀 커스텀 오더 시안의 구조만 참고. 색 · 글꼴 · 사진은 티팡 것으로 새로 만듦)
*/

/* ── 틀: PC 는 미리보기(왼쪽, 붙어 있음) / 선택(오른쪽) ── */
.head--cz { padding-bottom: 24px; }
.cz-app { padding-bottom: 72px; }
.cz-grid { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 40px; align-items: start; }
.cz-view { position: sticky; top: 16px; }

/* ── 미리보기: 옷 사진 위에 인쇄 내용을 % 좌표로 올린다. 글자 크기는 사진 폭 기준(cqw) ── */
.stage { position: relative; width: 100%; max-width: calc(100vh - 150px); margin: 0 auto; background: var(--photo); container-type: inline-size; overflow: hidden; }
.stage-img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.ov { position: absolute; inset: 0; }
.ov .g { position: absolute; border: 1.5px dashed var(--orange); }
.ov .g--dark { border-color: #FFB27A; }
.ov .m { position: absolute; transform: translate(-50%, -50%); aspect-ratio: 1; object-fit: contain; }
.ov .t { position: absolute; transform: translate(-50%, -50%); font-weight: 800; line-height: 1; white-space: nowrap; }
.ov .ph { position: absolute; transform: translate(-50%, -50%); padding: 2px 6px; background: rgba(255, 255, 255, .85); color: var(--navy); font-size: 12px; font-weight: 500; white-space: nowrap; border-radius: var(--r-chip); }
.ov .cm { position: absolute; transform: translateX(-50%); padding: 2px 6px; border-radius: var(--r-chip); background: var(--navy); color: var(--white); font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ov .cm--up { transform: translate(-50%, -100%); }
.stage--s .ov .ph { display: none; }

.cz-vbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.seg { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--navy); border-radius: var(--r); overflow: hidden; }
.seg button { min-width: 64px; min-height: 40px; padding: 0 16px; border: 0; background: var(--white); font-size: 15px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--navy); color: var(--white); }
.seg button:focus-visible { outline-offset: -4px; }
.seg button[aria-pressed="true"]:focus-visible { outline-color: var(--white); }
.who { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.cz-hint { margin-top: 8px; font-size: 13px; color: var(--ink-3); }

/* ── 선택 칸 공통 ── */
.fs { margin: 0 0 12px; padding: 20px; border: 1px solid var(--line); min-width: 0; }
.fs legend { display: flex; align-items: center; gap: 8px; padding: 0 8px; margin-left: -8px; font-size: 17px; font-weight: 700; }
.fs legend .n { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 22px; border: 1px solid var(--navy); border-radius: var(--r-chip); font-size: 12px; font-weight: 700; }
.hint { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.hint:empty { display: none; }
.hint--warn { color: var(--orange-ink); font-weight: 500; }
.row { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.lb { font-size: 14px; font-weight: 600; min-width: 56px; }
.val { font-size: 14px; color: var(--ink-2); }

/* 품목 4 */
.items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.items button { padding: 0 0 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); font-size: 14px; font-weight: 500; overflow: hidden; }
.items button img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--photo); margin-bottom: 6px; }
.items button[aria-pressed="true"] { border-color: var(--navy); outline: 1px solid var(--navy); font-weight: 700; }

/* 색 칩 */
.sws { display: flex; gap: 8px; flex-wrap: wrap; }
.sws button { width: 36px; height: 36px; padding: 0; border: 1px solid #8A90A0; border-radius: var(--r); position: relative; }
.sws button[aria-pressed="true"] { outline: 2px solid var(--navy); outline-offset: 2px; }
.sws button.auto { width: auto; padding: 0 10px; background: var(--white); font-size: 13px; font-weight: 600; }

/* 로고 */
.lg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.lg-up { cursor: pointer; }
#lg-file:focus-visible + button, .lg:has(#lg-file:focus-visible) .lg-up { outline: 2px solid var(--navy); outline-offset: 2px; }

/* 인쇄 위치 4 */
.sp { border-top: 1px solid var(--line); padding: 12px 0; }
.sp:first-child { margin-top: 12px; }
.sp:last-child { padding-bottom: 0; }
.sp-h { display: flex; align-items: center; gap: 10px; }
.sp-h input { width: 22px; height: 22px; margin: 0; accent-color: var(--navy); flex: none; }
.sp-h label { font-size: 16px; font-weight: 600; cursor: pointer; }
.sp-h .face { margin-left: 4px; }
.sp-h .sum { margin-left: auto; font-size: 13px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.sp-b { margin-top: 12px; padding-left: 32px; display: grid; gap: 10px; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 12px; border: 1px solid #8A90A0; border-radius: var(--r-chip); background: var(--white); font-size: 14px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.chip[aria-pressed="true"]:focus-visible { outline-offset: 3px; }
.sp-b input[type="text"] { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #8A90A0; border-radius: var(--r); font-size: 16px; }
.sp-size { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; font-size: 14px; }
.sp-size input { width: 100%; accent-color: var(--navy); height: 28px; }

/* 이름 · 백넘버 목록 */
.ro { margin-top: 12px; display: grid; gap: 6px; }
.ro:empty { display: none; }
.ro-r { display: grid; grid-template-columns: 22px minmax(0, 1fr) 64px 76px 36px; gap: 6px; align-items: center; }
.ro-r .i { font-size: 13px; color: var(--ink-3); text-align: center; font-variant-numeric: tabular-nums; }
.ro-r input, .ro-r select { width: 100%; height: 42px; padding: 0 10px; border: 1px solid #8A90A0; border-radius: var(--r); background: var(--white); font-size: 16px; min-width: 0; }
.ro-r select { padding: 0 4px 0 8px; }
.ro-r .del { height: 42px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); font-size: 18px; line-height: 1; color: var(--ink-2); }
.ro + .lg { margin-top: 12px; }

/* 사이즈별 수량 */
.qt { display: grid; grid-template-columns: auto repeat(5, minmax(0, 1fr)); gap: 6px 6px; align-items: center; margin-top: 4px; }
.qt .h { display: flex; justify-content: center; }
.qt .rl { font-size: 13px; color: var(--ink-2); padding-right: 4px; white-space: nowrap; }
.qt .c { text-align: center; font-size: 15px; font-variant-numeric: tabular-nums; }
.qt input { width: 100%; height: 42px; padding: 0 2px; border: 1px solid #8A90A0; border-radius: var(--r); text-align: center; font-size: 16px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.qt input::-webkit-outer-spin-button, .qt input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qt .tot { font-weight: 700; }
.qt-sum { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 14px; }
.qt-sum b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* 인쇄 방식 */
.ms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ms button { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; padding: 10px 12px; min-height: 64px; border: 1px solid #8A90A0; border-radius: var(--r); background: var(--white); text-align: left; }
.ms button b { font-size: 16px; font-weight: 700; }
.ms button span { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ms button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }
.ms button[aria-pressed="true"] span { color: #C9CEDA; }
.ms button[aria-pressed="true"]:focus-visible { outline-offset: 3px; }
.ms button[disabled] { background: var(--band); border-color: var(--line); color: var(--ink-3); cursor: not-allowed; }
.ms button[disabled] span { color: var(--ink-3); }

/* 예상 금액 */
.pr { padding: 20px; border: 1px solid var(--navy); }
.pr h2 { font-size: 17px; font-weight: 700; }
.pr-list { margin-top: 12px; }
.pr-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.pr-list li span:first-child { color: var(--ink-2); }
.pr-list li.ev span { color: var(--orange-ink); font-weight: 600; }
.pr-total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; font-size: 15px; }
.pr-total b { font-size: 28px; font-weight: 800; }
.pr .btn { margin-top: 16px; }

/* ── 작업지시서 ── */
.sh-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: 32px; align-items: start; }
#sh-dl > div { grid-template-columns: 96px 1fr; }
#sh-dl dd .szs { gap: 6px 10px; }
#sh-dl dd .szs span.q { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
#sh-dl ol { margin: 0; padding: 0; font-weight: 400; font-size: 14px; font-variant-numeric: tabular-nums; }
#sh-dl ol li { display: grid; grid-template-columns: 24px 1fr 40px 40px; gap: 6px; padding: 2px 0; }
.sh-faces { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sh-faces figcaption { padding-top: 6px; font-size: 14px; font-weight: 600; text-align: center; }
.stage--s { max-width: none; border: 1px solid var(--line); }
.sh-btns { display: grid; gap: 8px; margin-top: 20px; }

/* ── 휴대폰 하단 고정: 예상 금액 + 견적문의 ── */
.cz-bar { display: none; }

@media (max-width: 1100px) {
  .cz-grid { grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; }
}
@media (max-width: 900px) {
  body.is-custom { padding-bottom: 72px; }
  .head--cz { padding: 20px 0 12px; }
  .head--cz h1 { font-size: 24px; }
  .head--cz p:not(.crumb) { font-size: 14px; }
  .cz-grid { display: block; }
  /* 미리보기는 화면 위쪽에 붙어 있되 화면의 절반을 넘지 않는다 */
  .cz-view { top: 0; z-index: 5; background: var(--white); padding: 8px 0 8px; margin: 0 -16px 12px; border-bottom: 1px solid var(--navy); }
  .cz-view .stage { max-width: min(100%, 34vh); }
  /* 붙어 있는 미리보기와 하단 줄에 가려지지 않게, 칸으로 이동할 때 여백을 둔다 */
  html:has(body.is-custom) { scroll-padding-top: calc(34vh + 72px); scroll-padding-bottom: 80px; }
  .cz-vbar { margin-top: 8px; padding: 0 16px; justify-content: center; }
  .seg button { min-height: 36px; }
  .who { font-size: 13px; gap: 8px; min-width: 0; }
  .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36vw; }
  .who .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .cz-hint { display: none; }
  .fs { padding: 16px; }
  .sh-grid { grid-template-columns: 1fr; }
  .cz-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 8px 16px; min-height: 64px; background: var(--white); border-top: 1px solid var(--navy); }
  .cz-bar p { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
  .cz-bar p > span { font-size: 12px; color: var(--ink-2); }
  .cz-bar b { font-size: 20px; font-weight: 800; }
  .cz-bar .btn { min-height: 48px; padding: 0 20px; }
}
@media (min-width: 641px) and (max-width: 900px) {
  .cz-view { margin: 0 -24px 12px; }
}
@media (max-width: 400px) {
  .items button { font-size: 13px; }
  .sp-b { padding-left: 0; }
  .ms button { padding: 8px; }
  .ms button b { font-size: 15px; }
  .ms button span { font-size: 12px; }
  .ro-r { grid-template-columns: 16px minmax(0, 1fr) 52px 66px 32px; gap: 4px; }
  .ro-r input, .ro-r select { padding: 0 6px; }
  .qt { gap: 6px 4px; }
  .qt .rl { font-size: 12px; }
}
