/* 결 GYEOL — 사진이 주인공인 미니멀 셀렉트숍. 데님 인디고를 유일한 포인트 색으로 사용 */
:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --ink: #161616;
  --muted: #6e6f6b;
  --line: #e3e3df;
  --accent: #2c3e63;
  --accent-ink: #ffffff;
  --sale: #b2452e;
  --ko: "Gothic A1", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --num: "Inter Tight", "Gothic A1", sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121212; --surface: #1b1b1b; --ink: #ededea; --muted: #9a9b97; --line: #2c2c2b; --accent: #8fa6d6; --accent-ink: #0f1420; --sale: #e07a62; color-scheme: dark; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--ko); font-size: 15px; line-height: 1.6; word-break: keep-all; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

.notice { background: var(--ink); color: var(--bg); font-size: 12px; text-align: center; padding: 6px 16px; padding-top: calc(6px + env(safe-area-inset-top, 0px)); }

/* 상단바 */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top-in { height: 60px; display: flex; align-items: center; gap: 32px; }
.logo { display: flex; align-items: baseline; gap: 8px; }
.logo-ko { font-weight: 800; font-size: 24px; letter-spacing: -.04em; }
.logo-en { font-family: var(--num); font-weight: 600; font-size: 11px; letter-spacing: .32em; color: var(--muted); }
.top-nav { display: flex; gap: 24px; font-size: 14px; color: var(--muted); flex: 1; }
.top-nav a:hover, .top-nav a.on { color: var(--ink); }
.cart-link { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.badge { font-family: var(--num); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 11px; display: inline-grid; place-items: center; }

main { min-height: 70vh; padding-block: 24px 80px; outline: none; }

/* 히어로 */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 0; background: var(--surface); border: 1px solid var(--line); margin-bottom: 40px; overflow: hidden; }
.hero-copy { padding: 56px 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.eyebrow { font-family: var(--num); font-size: 11px; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-size: clamp(30px, 4.2vw, 52px); line-height: 1.2; letter-spacing: -.035em; font-weight: 800; margin-top: 14px; text-wrap: balance; }
.hero p { color: var(--muted); max-width: 26em; margin-top: 16px; }
.hero-img { position: relative; min-height: 340px; }
.hero-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-tag { position: absolute; left: 16px; bottom: 16px; background: var(--surface); color: var(--ink); padding: 10px 14px; font-size: 13px; display: flex; gap: 12px; align-items: baseline; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; height: 52px; padding: 0 24px; font-weight: 700; font-size: 15px; border: 1px solid var(--ink); background: var(--ink); color: var(--bg); transition: opacity .15s; }
.btn:hover { opacity: .88; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn.block { width: 100%; }

/* 카테고리 칩 */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 16px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; display: inline-flex; align-items: center; border-radius: 18px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.list-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.list-head h2 { font-size: 20px; letter-spacing: -.02em; }

/* 상품 그리드 */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 16px; }
.card { display: block; }
.card .ph { aspect-ratio: 4 / 5; background: var(--line); overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .ph img { transform: scale(1.03); }
.card .meta { padding-top: 10px; }
.card .cat { font-size: 12px; color: var(--muted); }
.card h3 { font-size: 14px; font-weight: 500; margin: 2px 0 4px; }
.card .price { font-weight: 700; }
.swatches { display: flex; gap: 4px; margin-top: 6px; font-size: 11px; color: var(--muted); }

/* 상세 */
.back { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.pdp { display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: start; }
.pdp-img { aspect-ratio: 4 / 5; background: var(--line); overflow: hidden; }
.pdp-img img { width: 100%; height: 100%; object-fit: cover; }
.pdp-info { position: sticky; top: 84px; }
.pdp-info .en { font-family: var(--num); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.pdp-info h1 { font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.03em; line-height: 1.3; margin: 6px 0 10px; }
.pdp-info .price { font-size: 22px; font-weight: 700; }
.ship-note { font-size: 13px; color: var(--muted); margin-top: 4px; }
.opt { margin-top: 28px; }
.opt-label { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; justify-content: space-between; }
.opt-label span { font-weight: 400; color: var(--muted); }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts button { min-width: 56px; height: 42px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.opts button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--surface); height: 42px; }
.qty button { width: 42px; height: 100%; font-size: 18px; }
.qty span { min-width: 36px; text-align: center; font-family: var(--num); font-weight: 600; }
.qty.sm { height: 34px; }
.qty.sm button { width: 34px; }
.pdp-total { display: flex; justify-content: space-between; align-items: baseline; padding: 20px 0; margin-top: 28px; border-top: 1px solid var(--line); }
.pdp-total strong { font-size: 22px; }
.pdp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail { margin-top: 32px; border-top: 1px solid var(--line); }
.detail details { border-bottom: 1px solid var(--line); }
.detail summary { list-style: none; cursor: pointer; padding: 16px 0; font-weight: 600; display: flex; justify-content: space-between; }
.detail summary::-webkit-details-marker { display: none; }
.detail summary::after { content: "+"; font-weight: 400; }
.detail details[open] summary::after { content: "–"; }
.detail details p { padding-bottom: 16px; color: var(--muted); }

/* 장바구니 · 주문서 */
.page-title { font-size: 24px; letter-spacing: -.03em; margin-bottom: 20px; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); padding: 24px; }
.sticky { position: sticky; top: 84px; }
.line { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.line:first-child { padding-top: 0; }
.line:last-child { border-bottom: 0; padding-bottom: 0; }
.line img { width: 88px; aspect-ratio: 4 / 5; object-fit: cover; background: var(--line); }
.line h3 { font-size: 15px; font-weight: 600; }
.line .opt-text { font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.line .right { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; }
.remove { font-size: 13px; color: var(--muted); text-decoration: underline; }
.sum-row { display: flex; justify-content: space-between; padding: 6px 0; }
.sum-row.total { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 16px; font-weight: 700; font-size: 18px; }
.free-bar { height: 4px; background: var(--line); margin: 12px 0 6px; }
.free-bar i { display: block; height: 100%; background: var(--accent); }
.small { font-size: 13px; }
.empty { text-align: center; padding: 80px 16px; }
.empty p { color: var(--muted); margin: 8px 0 24px; }

.form { display: grid; gap: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 0; }
.field textarea { height: 80px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--ink); }
.field .err { color: var(--sale); font-size: 12px; margin-top: 4px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section-h { font-size: 16px; font-weight: 700; margin: 4px 0 12px; }
.mini-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 6px 0; }
.mini-line span:first-child { min-width: 0; }
#payment-method, #agreement { margin: 0 -8px; }
.testcard { font-size: 13px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); padding: 12px 14px; margin-top: 12px; }
.alert { background: color-mix(in srgb, var(--sale) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--sale) 35%, var(--line)); color: var(--ink); padding: 14px 16px; font-size: 14px; }

/* 결과 */
.result { max-width: 560px; margin: 24px auto; text-align: center; }
.result .mark { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 18px; background: var(--accent); color: var(--accent-ink); font-size: 30px; font-weight: 700; }
.result .mark.bad { background: var(--sale); color: #fff; }
.result h1 { font-size: 24px; letter-spacing: -.03em; }
.result .panel { text-align: left; margin: 24px 0; }
.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { overflow-wrap: anywhere; }
.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.foot { border-top: 1px solid var(--line); padding-block: 32px; font-size: 13px; }
.foot-in { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot p { color: var(--muted); }

/* 하단 탭바 (모바일 앱 느낌) */
.tabbar { display: none; }
.mobile-cta { display: none; }

.toast { position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 12px 18px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.view-enter { animation: fade .25s ease; }
@keyframes fade { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout-2 { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 760px) {
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .top-nav, .cart-link { display: none; }
  .top-in { height: 52px; justify-content: center; }
  main { padding-block: 16px 32px; }
  .hero { grid-template-columns: 1fr; margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px))) 28px; border-left: 0; border-right: 0; }
  .hero-img { min-height: 0; aspect-ratio: 4 / 3; order: -1; }
  .hero-copy { padding: 24px 16px 28px; gap: 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 10px; }
  .pdp { grid-template-columns: 1fr; gap: 20px; }
  .pdp-img { margin: 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px))); }
  .pdp-info { position: static; }
  .pdp-actions { display: none; }
  .layout-2 { grid-template-columns: 1fr; gap: 16px; }
  .panel { padding: 18px 16px; }
  .sticky { position: static; }
  .row-2 { grid-template-columns: 1fr; }
  .foot { padding-bottom: 24px; }

  .tabbar {
    display: grid; grid-template-columns: repeat(3, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); }
  .tabbar a.on { color: var(--ink); font-weight: 700; }
  .tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
  .tab-ico { position: relative; display: block; height: 22px; }
  .tab-ico .dot { position: absolute; top: -5px; right: -10px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 10px; font-family: var(--num); display: grid; place-items: center; font-weight: 700; }
  .tab-ico .dot[data-zero] { display: none; }

  /* 상세·장바구니·주문서에서는 탭바 대신 구매 버튼 바 */
  body.has-cta .tabbar { display: none; }
  .mobile-cta {
    display: grid; gap: 8px; grid-template-columns: 1fr 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .mobile-cta.one { grid-template-columns: 1fr; }
  .toast { bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
