/* 색상 (지정 팔레트) */
:root {
  --parchment: #edede9;
  --dust-grey: #d6ccc2;
  --linen: #f5ebe0;
  --powder-petal: #e3d5ca;
  --almond-silk: #d5bdaf;
  --text: #3d3430;
  --text-sub: #8a7d74;
  --bg: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  /* 영문·숫자는 세리프(EB Garamond), 한글은 Pretendard로 자동 분리 표시 */
  font-family: "EB Garamond", "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }

/* 상단 고정 영역 */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--linen);
  border-bottom: 1px solid var(--dust-grey);
}
.bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 2px 12px; }
.logo { font-size: 20px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: 1px; }
input, button { font-family: inherit; }
.logo { margin-right: auto; }
.ibtn {
  position: relative; flex: none; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center; color: var(--text);
}
.ibtn[hidden] { display: none; }
#cbtn .badge { top: 0; right: -2px; }
/* 🔍 누르면 로고 자리에 검색창 펼침 */
#search { display: none; }
.bar.searching .logo { display: none; }
.bar.searching #search { display: block; }
#search {
  flex: 1; min-width: 0; height: 34px; padding: 0 12px;
  border: 1px solid var(--dust-grey); border-radius: 17px;
  background: var(--bg); font-size: 14px; color: var(--text); outline: none;
}
#search:focus { border-color: var(--almond-silk); }


/* 대분류 칩 줄 (넘치면 가로 스크롤) */
#chips {
  display: flex; gap: 6px; padding: 4px 12px 8px; overflow-x: auto; scrollbar-width: none;
}
#chips::-webkit-scrollbar { display: none; }
#chips button {
  flex: none; padding: 5px 12px; border-radius: 15px; font-size: 14px; letter-spacing: .3px;
  border: 1px solid var(--dust-grey); background: var(--bg);
}
#chips button.on { background: var(--text); border-color: var(--text); color: #fff; }

/* 소분류 표시 줄 */
#crumb {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px 8px 14px; font-size: 14px; letter-spacing: .5px;
}
#crumb[hidden] { display: none; }
#crumbx { width: 28px; height: 28px; font-size: 14px; color: var(--text-sub); }

/* ☰ 전체 화면 메뉴 */
#menu {
  position: fixed; inset: 0; z-index: 30;
  background: var(--linen); display: flex; flex-direction: column;
}
#menu[hidden] { display: none; }
.mbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--dust-grey);
}
#mtitle { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: 1px; }
#mclose { width: 36px; height: 36px; font-size: 20px; }
#mlist { list-style: none; overflow-y: auto; padding: 8px 0; }
#mlist button {
  display: block; width: 100%; text-align: left;
  padding: 16px 24px; font-size: 22px; letter-spacing: .5px;
  border-bottom: 1px solid var(--powder-petal);
}
#mlist .mhead { padding: 18px 24px 10px; font-size: 15px; font-weight: 700; color: var(--text-sub); }
#mlist .msub { padding: 12px 24px 12px 40px; font-size: 20px; }
#mlist button.on { font-weight: 700; color: #b8833a; }

/* 신상 가로줄 + 전체 3열 그리드 */
#list { padding-bottom: 60px; }   /* 맨 아래 TOP 버튼 자리 */
.sec h2 { font-size: 14px; font-weight: 600; padding: 10px 12px 6px; }
.sechead { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px 0 0; }
.sechead h2 { padding-top: 6px; }
/* 정렬: 버튼 아래로 펼침 */
#sortbox { position: relative; }
#sortbtn {
  display: flex; align-items: center; gap: 4px; font-size: 13px;
  border: 1px solid var(--dust-grey); border-radius: 14px; padding: 3px 10px;
}
#sortlist {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 12; min-width: 100%;
  list-style: none; background: var(--bg); border: 1px solid var(--dust-grey); border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1); overflow: hidden;
}
#sortlist[hidden] { display: none; }
#sortlist button { display: block; width: 100%; padding: 9px 14px; font-size: 13px; text-align: left; white-space: nowrap; }
#sortlist button.on { font-weight: 700; color: #b8833a; }
.row {
  display: flex; gap: 3px; padding: 0 3px; overflow-x: auto;
  scroll-snap-type: x proximity; scrollbar-width: none;
}
.row::-webkit-scrollbar { display: none; }
.row .card { flex: none; width: calc((100% - 12px) / 4.5); scroll-snap-align: start; }   /* 화면에 4.5장 */
#totop {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 15;
  padding: 8px 18px; border-radius: 18px; letter-spacing: 1px;
  background: rgba(61, 52, 48, .85); color: #fff; font-size: 13px;
}
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 0 3px; }
.card { display: block; color: var(--text); text-decoration: none; }
.thumb { aspect-ratio: 3 / 4; background: var(--powder-petal); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.price { font-size: 12px; padding: 3px 4px 6px; }
#more { height: 1px; }
#empty { padding: 60px 0; text-align: center; color: var(--text-sub); font-size: 14px; }

/* 넓은 화면(PC)은 열 수 증가 */
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0 12px; }
  .row { gap: 6px; padding: 0 12px; }
  .row .card { width: calc((100% - 36px) / 6.5); }
  main, header, #detail { max-width: 1100px; margin: 0 auto; }
}

/* 상세 화면 */
#detail {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg); overflow-y: auto;
  display: flex; flex-direction: column;
}
#detail[hidden] { display: none; }
.dbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; background: var(--linen); border-bottom: 1px solid var(--dust-grey);
}
#back { font-size: 22px; padding: 0 8px; }
#count {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 1;
  padding: 3px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, .75); font-size: 12px; color: var(--text);
}
#count[hidden] { display: none; }

#slides {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; background: var(--parchment);
}
#slides::-webkit-scrollbar { display: none; }
.gallery { position: relative; }
.nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, .75); color: var(--text);
  font-size: 26px; line-height: 1; padding-bottom: 3px;
  display: flex; align-items: center; justify-content: center;
}
.nav[hidden] { display: none; }
#prev { left: 8px; }
#next { right: 8px; }
.slide {
  flex: none; width: 100%; aspect-ratio: 3 / 4; max-height: 80vh;
  scroll-snap-align: center; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
#zoom {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, .75); color: var(--text);
  display: flex; align-items: center; justify-content: center;
}

/* 확대 보기 */
#viewer {
  position: fixed; inset: 0; z-index: 40; background: #111;
  touch-action: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#viewer[hidden] { display: none; }
#vimg { max-width: 100%; max-height: 100%; transform-origin: center; will-change: transform; }
#vclose {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 1;
  padding: 8px 16px; border-radius: 18px;
  background: rgba(255, 255, 255, .9); color: #191919; font-size: 14px; font-weight: 600;
}
.vhint {
  position: absolute; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom));
  text-align: center; font-size: 12px; color: rgba(255, 255, 255, .6); pointer-events: none;
}

.info { padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 6px; }
#pid { font-size: 12px; color: var(--text-sub); }
#pname { font-size: 16px; font-weight: 600; }
#pprice { font-size: 18px; font-weight: 700; }
#pdesc { font-size: 14px; line-height: 1.6; white-space: pre-line; color: var(--text); }
.askbar {   /* 문의 버튼 화면 하단 고정 */
  position: sticky; bottom: 0; margin-top: auto; z-index: 2;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--parchment);
}
#detail .askbar { display: flex; gap: 8px; }
#ask {
  display: block; flex: 1; width: 100%;
  padding: 14px; border-radius: 10px;
  background: #fee500; color: #191919; font-size: 15px; font-weight: 700;
}



/* 상세 🛒 담기: 문의하기 왼쪽 */
#add {
  position: relative; flex: none; width: 38%;
  padding: 14px 8px; border-radius: 10px; font-size: 15px; font-weight: 700;
  background: #fff; border: 1px solid var(--dust-grey);
}
.badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #b8833a; color: #fff;
  font: 700 11px/18px -apple-system, "Malgun Gothic", sans-serif; text-align: center;
}
.badge[hidden] { display: none; }

/* 장바구니 페이지 */
#cartpage {
  position: fixed; inset: 0; z-index: 20;
  background: var(--bg); overflow-y: auto;
  display: flex; flex-direction: column;
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", sans-serif;
}
#cartpage[hidden] { display: none; }
#cartpage .dbar h2 { font-size: 17px; font-weight: 700; }
#cartpage .dbar span, #cback { width: 38px; }
#cback { font-size: 22px; text-align: left; padding: 0 8px; }
.ctools {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--parchment); font-size: 14px;
}
#cdel { font-size: 13px; color: var(--text-sub); padding: 6px 10px; border: 1px solid var(--dust-grey); border-radius: 14px; }
#cdel:disabled { opacity: .4; }
/* 체크박스 (동그라미 체크) */
.chk { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.chk input { position: absolute; opacity: 0; pointer-events: none; }
.chk i {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--dust-grey); background: #fff; position: relative;
}
.chk input:checked + i { background: var(--text); border-color: var(--text); }
.chk input:checked + i::after {
  content: ''; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
#clist { list-style: none; }
#clist li {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--parchment);
}
.cthumb { flex: none; width: 64px; aspect-ratio: 3 / 4; border-radius: 6px; overflow: hidden; background: var(--powder-petal); }
.cthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cinfo { flex: 1; min-width: 0; font-size: 13px; line-height: 1.4; }
.cid { color: var(--text-sub); font-size: 12px; }
.cname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cname:empty { display: none; }
.cprice { font-weight: 700; font-size: 14px; }
.cqty { flex: none; display: flex; align-items: center; border: 1px solid var(--dust-grey); border-radius: 16px; }
.cqty button { width: 30px; height: 30px; font-size: 16px; }
.cqty span { min-width: 20px; text-align: center; font-size: 14px; }
#cempty { padding: 60px 0; text-align: center; color: var(--text-sub); font-size: 14px; }
#cempty[hidden], #csum[hidden] { display: none; }
.cnote { padding: 12px 16px; text-align: center; font-size: 11px; color: #999; }
#csum { padding: 0 2px 8px; text-align: right; font-size: 15px; font-weight: 700; }
#cgo {
  display: block; width: 100%; padding: 14px; border-radius: 10px;
  background: #fee500; color: #191919; font-size: 15px; font-weight: 700;
}
#cgo:disabled { opacity: .4; }

/* 카카오톡 문의 안내 (아래에서 올라오는 패널) */
#guide {
  position: fixed; inset: 0; z-index: 25;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
#guide[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 480px;
  background: #f2f2f2; border-radius: 16px 16px 0 0;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", sans-serif;
}
.sheet h3 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.gmid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.gimg { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--powder-petal); }
.gimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.steps {
  list-style: none; background: #fff; border: 1px solid #ddd; border-radius: 10px;
  padding: 10px; display: flex; flex-direction: column; justify-content: space-evenly;
}
.steps li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.4; word-break: keep-all; }
.steps b {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: #b8833a; color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.steps em { font-style: normal; font-weight: 700; color: #b8833a; }
.steps small { display: block; font-size: 11px; color: #888; }
#go, #gclose { display: block; width: 100%; border-radius: 12px; font-weight: 700; }
#go { padding: 16px; background: #fee500; color: #191919; font-size: 17px; }
#gclose { margin-top: 8px; padding: 13px; background: #fff; border: 1px solid #ddd; font-size: 15px; font-weight: 600; }

#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 30;
  padding: 10px 16px; border-radius: 20px;
  background: rgba(61, 52, 48, .9); color: #fff; font-size: 13px;
  display: flex; align-items: center; gap: 12px; white-space: nowrap;
}
#toast[hidden] { display: none; }
#toast a { color: #fee500; font-weight: 700; text-decoration: none; }

/* 사진 보호: 길게 눌러 저장·드래그·선택 차단 */
img {
  -webkit-touch-callout: none;
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;   /* 사진 자체를 누를 수 없게 → 길게 누르기·우클릭 '이미지 저장' 메뉴 자체가 안 뜸 */
}
