/* 삼일돗자리 v2 — A안(갤러리형) 기반 */
:root {
  --ink: #161616;
  --sub: #4F4F4F;     /* 보조 글씨 — 흰 바탕 대비 약 8:1 */
  --faint: #666666;   /* 상품번호 등 — 약 5.7:1 */
  --line: #E9E9E7;
  --soft: #F5F5F2;
  --frame: #F3F2EE;   /* 사진 틀 배경 — 제품 전체가 보이도록 여백을 둠 */
  --serif: "Nanum Myeongjo", serif;
  --sans: "Pretendard", -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { word-break: keep-all; overflow-wrap: anywhere; font-family: var(--sans); color: var(--ink); background: #fff; font-size: 16px; line-height: 1.55; letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.note { background: #FFF6D8; font-size: 12px; text-align: center; padding: 4px 16px; color: #6b5b2a; }

/* 헤더 — 로고만 명조로 전통성 표현 */
header { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
header .hrow { display: flex; align-items: center; height: 52px; padding: 0 20px; }
.gnb { display: flex; justify-content: space-between; padding: 0 14px; }
.gnb a { text-align: center; font-size: 15px; letter-spacing: -0.03em; font-weight: 500; color: var(--sub); padding: 10px 0 11px; border-bottom: 2px solid transparent; white-space: nowrap; }
.gnb a[aria-current="page"] { color: var(--ink); font-weight: 700; border-color: var(--ink); }
@media (max-width: 374px) { .gnb { padding: 0 10px; } .gnb a { font-size: 14px; } }
@media (min-width: 768px) { .gnb { max-width: 600px; margin: 0 auto; } }
@media (min-width: 900px) { header .hrow { max-width: 1080px; margin: 0 auto; } }
.logo { font-family: var(--serif); font-weight: 800; font-size: 21px; letter-spacing: -0.03em; margin-right: auto; }
.logo img { display: block; height: 30px; width: auto; }   /* 붓글씨 로고 */
header .t { font-size: 15px; font-weight: 500; margin-left: 18px; color: #333; }

/* 사진 틀 — 모든 상품 사진을 같은 비율·같은 여백으로 */
.frame { position: relative; aspect-ratio: 1 / 1; background: var(--frame); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.frame img { width: 100%; height: 100%; object-fit: cover; }   /* 정사각형 제품컷을 그대로 꽉 채움 */
.frame .mat { position: relative; }   /* 사진 받기 전 임시: 실제 치수 비율로 그린 돗자리 */
.frame .ph-label { position: absolute; left: 8px; top: 8px; bottom: auto; background: rgba(255,255,255,.9); color: var(--sub); font-size: 11px; padding: 1px 6px; border-radius: 3px; z-index: 2; }

/* 하단 고정 버튼 — 작고 나란히 */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.bar .btn { height: 48px; font-size: 16px; }
.btn { display: flex; align-items: center; justify-content: center; border-radius: 4px; font-weight: 600; font-size: 16px; }
:where(button.btn) { border: 0; background: none; cursor: pointer; color: inherit; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-line { border: 1px solid #CFCFCC; color: var(--ink); background: #fff; }

footer { background: var(--soft); padding: 28px 20px 96px; font-size: 13px; color: var(--sub); line-height: 1.8; }
footer .nw { white-space: nowrap; }
footer .logo { font-size: 17px; color: var(--ink); display: block; margin-bottom: 6px; }
footer .logo img { height: 24px; }

/* ───────── 주문·조회·상담 화면 공통 ───────── */
.testbar { background: #FFF1C2; color: #5A4300; font-size: 13px; line-height: 1.5; padding: 10px 20px; border-bottom: 1px solid #F0DC94; }
.testbar b { font-weight: 700; }
.page-title { padding: 20px 20px 4px; font-size: 21px; font-weight: 600; letter-spacing: -0.03em; }
.page-sub { padding: 0 20px; font-size: 14px; color: var(--sub); }

.block { padding: 26px 20px 0; }
.block > h2 { font-size: 16px; font-weight: 600; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; align-items: baseline; }
.block > h2 small { font-size: 13px; font-weight: 400; color: var(--sub); }

.field { margin-bottom: 14px; }
.field label, .field .lbl { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: #B3261E; margin-left: 2px; }
.field .opt-tag { color: var(--sub); font-weight: 400; font-size: 13px; margin-left: 4px; }
.input, select.input, textarea.input { width: 100%; height: 50px; padding: 0 14px; border: 1px solid #CFCFCC; border-radius: 4px; font: 400 16px var(--sans); color: var(--ink); background: #fff; }
textarea.input { height: 96px; padding: 12px 14px; resize: vertical; }
.input:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.input[aria-invalid="true"] { border-color: #B3261E; }
.err { display: none; font-size: 13px; color: #B3261E; margin-top: 4px; }
.err.show { display: block; }
.hint { font-size: 13px; color: var(--sub); margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.row2 .btn { height: 50px; padding: 0 16px; white-space: nowrap; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; padding: 6px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; margin-top: 1px; }
.check a { color: var(--sub); text-decoration: underline; margin-left: auto; font-size: 13px; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; }
.chips span { display: inline-flex; align-items: center; height: 42px; padding: 0 14px; border: 1px solid #CFCFCC; border-radius: 21px; font-size: 15px; cursor: pointer; background: #fff; }
.chips input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

.pay { display: grid; gap: 8px; }
.pay label { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid #CFCFCC; border-radius: 4px; font-size: 15px; cursor: pointer; }
.pay label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pay input { width: 20px; height: 20px; accent-color: var(--ink); }
.pay small { color: var(--sub); font-size: 13px; margin-left: auto; }

.mini { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; }
.mini .frame { aspect-ratio: 1 / 1; }
.mini .no { font-size: 12px; color: var(--faint); }
.mini b { display: block; font-weight: 500; font-size: 15px; }
.mini span { display: block; font-size: 14px; color: var(--sub); }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 15px; }
.kv dt { color: var(--sub); }
.kv dd { word-break: keep-all; }
.total-box { display: grid; gap: 6px; font-size: 15px; }
.total-box div { display: flex; justify-content: space-between; }
.total-box span:first-child { color: var(--sub); }
.total-box .grand { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; font-weight: 600; }
.total-box .grand b { font-size: 20px; font-weight: 700; }

.status { display: inline-block; font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 3px; background: var(--soft); }
.status.test { background: #FFF1C2; color: #5A4300; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 12px; }
.steps div { text-align: center; font-size: 13px; color: var(--faint); padding-top: 10px; border-top: 3px solid var(--line); }
.steps div.on { color: var(--ink); font-weight: 600; border-color: var(--ink); }

/* 테스트 결제창 */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45); display: none; align-items: flex-end; }
.modal.open { display: flex; }
.sheet { background: #fff; width: 100%; border-radius: 12px 12px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); }
.sheet h3 { font-size: 18px; font-weight: 600; }
.sheet p { font-size: 14px; color: var(--sub); margin: 6px 0 16px; }
.sheet .btn { height: 50px; margin-top: 8px; }

/* ───────── 서버 버전 추가 ───────── */
/* 사진이 아직 없을 때: 장식 없이 상품번호만 */
.frame .empty-ph { color: #8A8A86; font-size: 13px; text-align: center; line-height: 1.5; }
.frame .empty-ph b { display: block; font-size: 22px; font-weight: 600; color: #B4B3AE; letter-spacing: .04em; }
.soldout { position: absolute; left: 8px; top: 8px; background: var(--ink); color: #fff; font-size: 12px; padding: 2px 7px; border-radius: 3px; z-index: 2; }
.hero { position: relative; height: 240px; background: #EFEEEA center / cover no-repeat; }
.hero .cap { position: absolute; left: 20px; top: 26px; right: 30%; color: var(--ink); }
.hero.has-img .cap { color: var(--ink); text-shadow: 0 0 12px rgba(255,255,255,.7); }
.hero small { font-size: 12px; letter-spacing: .14em; color: var(--sub); }
.hero h1 { font-family: var(--serif); font-weight: 700; font-size: 22px; line-height: 1.4; margin-top: 4px; white-space: pre-line; }
.notice { margin: 16px 20px 0; padding: 12px 14px; border-radius: 4px; background: var(--soft); font-size: 14px; color: var(--sub); }
.notice.warn { background: #FFF1C2; color: #5A4300; }
.loading { padding: 40px 20px; text-align: center; color: var(--sub); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.hero:not(.has-img) { height: 150px; }

/* PC: 아래 정보도 머리글과 같은 폭으로 (footer 기본값 뒤에 있어야 적용됨) */
@media (min-width: 900px) { footer { padding-left: max(20px, calc(50% - 520px)); padding-right: max(20px, calc(50% - 520px)); } }
