/* ─────────────────────────────────────────────────────────
   제품 목록 — 왼쪽 분류 메뉴(대 · 중 · 소)  (js/products-side.js 와 한 짝)
   Apple 스토어의 옆줄 방식: 상자 없이 글자와 가는 선만, 고른 분류만 펼쳐 보임
   넓은 화면은 왼쪽에 붙어 따라오고, 좁은 화면(900px 이하)은 아래에서 올라오는 창
   ───────────────────────────────────────────────────────── */
.catalog.has-side { --ps-ease: cubic-bezier(.32, .72, 0, 1); display: grid; grid-template-columns: minmax(216px, 268px) minmax(0, 1fr); column-gap: clamp(28px, 3.6vw, 68px); align-items: start; }

/* 제목 줄 (두 칸에 걸침) */
.pm-head { grid-column: 1 / -1; margin-bottom: clamp(26px, 3.4vw, 52px); }
.pm-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-height: 20px; margin-bottom: 14px; font-size: 13px; color: var(--ink-3); }
.pm-crumb a { transition: color .2s; } .pm-crumb a:hover { color: var(--ink); }
.pm-crumb em { font-style: normal; opacity: .5; } .pm-crumb span { color: var(--ink-2); }
.pm-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.pm-title h1 { font-weight: 600; font-size: clamp(36px, 5vw, 72px); line-height: 1.08; letter-spacing: -.028em; }
.pm-title p { font-size: 17px; font-weight: 600; color: var(--ink-3); }

/* ── 분류 메뉴 ────────────────────────────────────────── */
.ps { position: sticky; top: calc(var(--hd-c) + 20px); display: flex; flex-direction: column; max-height: calc(100vh - var(--hd-c) - 40px); }
.ps-scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding-bottom: 28px; }
.ps-scroll::-webkit-scrollbar { display: none; }
.ps-head, .ps-foot, .ps-bar, .ps-scrim, .pm-quick { display: none; }
.ps i { font: 400 12px var(--font-en); font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.ps a span { flex: 1; min-width: 0; }

.ps-all, .ps-main { display: flex; align-items: center; gap: 10px; min-height: 54px; font-size: 17px; font-weight: 600; letter-spacing: -.016em; color: var(--ink-2); transition: color .25s; }
.ps-all:hover, .ps-main:hover, .ps-all.is-active, .ps-main.is-here { color: var(--ink); }
.ps-g { border-top: 1px solid var(--line); } .ps-tree { border-bottom: 1px solid var(--line); }
.ps-chev { flex: none; color: var(--ink-3); transition: transform .5s var(--ps-ease), color .25s; }
.is-open > a .ps-chev { transform: rotate(180deg); } a:hover > .ps-chev { color: var(--ink); }

/* 펼침 · 접힘 — 높이를 0fr ↔ 1fr 로 */
.ps-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s var(--ps-ease); }
.ps-fold > * { min-height: 0; overflow: hidden; visibility: hidden; opacity: 0; transition: opacity .3s ease, visibility 0s .5s; }
.is-open > .ps-fold { grid-template-rows: 1fr; }
.is-open > .ps-fold > * { visibility: visible; opacity: 1; transition: opacity .45s ease .08s, visibility 0s; }

.ps-mids > :last-child { padding-bottom: 14px; }
.ps-mid { display: flex; align-items: center; gap: 10px; min-height: 38px; font-size: 15px; letter-spacing: -.01em; color: var(--ink-2); transition: color .25s; }
.ps-mid:hover, .ps-mid.is-here { color: var(--ink); } .ps-mid.is-here { font-weight: 600; }
.ps-mid .ps-chev { width: 12px; height: 12px; }
.ps-leaves { margin: 2px 0 10px 3px; padding-left: 15px; border-left: 1px solid var(--line-2); }
.ps-leaf { position: relative; display: flex; align-items: center; gap: 10px; min-height: 32px; font-size: 14px; color: var(--ink-3); transition: color .25s; }
.ps-leaf:hover { color: var(--ink); }
.ps-leaf.is-active { color: var(--ink); font-weight: 600; }
.ps-leaf.is-active::before { content: ""; position: absolute; left: -16px; top: 7px; bottom: 7px; width: 2px; background: var(--lime); }
/* 대 · 중분류 자체를 보고 있을 때(아래 분류를 고르지 않음)는 이름 앞에 작은 점 */
.ps-all.is-active span::before, .ps-main.is-active span::before, .ps-mid.is-active span::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 9px; border-radius: 50%; background: var(--lime); vertical-align: middle; transform: translateY(-2px); }

.ps-filters { padding-top: 26px; display: grid; gap: 2px; }
.ps-filters h3 { margin-bottom: 6px; font-size: 12px; font-weight: 600; letter-spacing: .01em; color: var(--ink-3); }
.ps-check { display: flex; align-items: center; gap: 11px; min-height: 34px; font-size: 14px; color: var(--ink-2); transition: color .25s; }
.ps-check:hover, .ps-check.is-on { color: var(--ink); }
.ps-check i { flex: none; width: 16px; height: 16px; box-shadow: inset 0 0 0 1px var(--line-2); transition: background .2s, box-shadow .2s; }
.ps-check:hover i { box-shadow: inset 0 0 0 1px var(--ink-3); }
.ps-check.is-on i { box-shadow: none; background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 8.3 2.7 2.7L12 5.5' fill='none' stroke='%231d1d1f' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat; }

/* ── 오른쪽: 도구 줄 + 제품 목록 ───────────────────────── */
.pm { min-width: 0; }
.pm-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; margin-bottom: 4px; }
.pm-on { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pm-tools .sort { margin-left: auto; }
.ps-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 15px; border-radius: var(--r-pill); background: var(--bg); font-size: 14px; white-space: nowrap; color: var(--ink-2); transition: background .2s, color .2s; }
.ps-pill i { font: 400 11px var(--font-en); font-style: normal; color: var(--ink-3); }
.ps-pill:hover { color: var(--ink); background: var(--bg-2); }
.ps-pill.is-active { background: var(--ink); color: var(--page); font-weight: 600; } .ps-pill.is-active i { color: inherit; opacity: .6; }
.catalog.has-side .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .catalog.has-side .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } } /* 분류 메뉴가 창으로 바뀌는 좁은 화면만 2열 */

/* ── 좁은 화면: 분류 메뉴는 아래에서 올라오는 창 ───────── */
@media (max-width: 900px) {
  .catalog.has-side { display: block; }
  .pm-head { margin-bottom: 18px; } .pm-crumb { display: none; }
  .ps-bar { display: block; position: sticky; top: var(--hd-c); z-index: 20; margin-inline: calc(var(--pad) * -1); padding: 8px var(--pad); background: rgba(29, 29, 31, .82); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
  .ps-open { width: 100%; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 16px; border-radius: var(--r-pill); background: var(--bg); color: var(--ink); font-size: 15px; text-align: left; }
  .ps-open b { flex: none; font-weight: 600; } .ps-open span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); font-size: 14px; text-align: right; }

  .ps { position: fixed; inset: auto 0 0 0; top: auto; z-index: 80; max-height: 86vh; max-height: 86dvh; padding: 0 var(--pad); background: var(--sheet); box-shadow: 0 -1px 0 rgba(255, 255, 255, .08); transform: translateY(102%); visibility: hidden; transition: transform .55s var(--ps-ease), visibility 0s .55s; }
  .ps.is-sheet { transform: none; visibility: visible; transition: transform .55s var(--ps-ease), visibility 0s; }
  .ps-head { display: flex; align-items: center; justify-content: space-between; min-height: 58px; font-size: 17px; }
  .ps-head button { width: 40px; height: 40px; margin-right: -10px; display: grid; place-items: center; color: var(--ink-2); }
  .ps-foot { display: block; padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); } .ps-foot .btn { width: 100%; justify-content: center; }
  .ps-scroll { padding-bottom: 12px; }
  .ps-mid { min-height: 44px; font-size: 16px; } .ps-leaf { min-height: 40px; font-size: 15px; } .ps-check { min-height: 42px; font-size: 15px; } /* 손가락으로 누르기 좋은 높이 */
  .ps-leaf.is-active::before { top: 10px; bottom: 10px; }
  .ps-scrim { display: block; position: fixed; inset: 0; z-index: 79; background: rgba(0, 0, 0, .55); opacity: 0; pointer-events: none; transition: opacity .4s ease; }
  .ps.is-sheet + .ps-scrim { opacity: 1; pointer-events: auto; }
  html.ps-lock { overflow: hidden; }

  .pm-tools { min-height: 0; margin: 12px 0 10px; }
  .pm-quick { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--pad) * -1) 12px; padding-inline: var(--pad); }
  .pm-quick::-webkit-scrollbar { display: none; }
}
