/* ========================================================
   螯界 CLAWVERSE — 共用導覽列（所有頁面 nav 一致同首頁）
   依賴 CSS 變數：--ink, --paper, --rust, --muted
   ======================================================== */

nav.cw-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 4rem;
  background: rgba(245,240,232,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(13,13,13,0.1);
}

nav.cw-nav .logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.4rem;
  letter-spacing: 0.12em;
  color: var(--ink, #0d0d0d);
  text-decoration: none;
  white-space: nowrap;
}
nav.cw-nav .logo span { color: var(--rust, #c4451a); }

nav.cw-nav .nav-ham-only { display: none; }

nav.cw-nav ul {
  list-style: none;
  display: flex;
  gap: 2.5rem;
  margin: 0; padding: 0;
}
nav.cw-nav ul a {
  text-decoration: none;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink, #0d0d0d);
  font-weight: 500;
  transition: color 0.2s;
}
nav.cw-nav ul a:hover { color: var(--rust, #c4451a); }

/* 商品分類下拉 */
nav.cw-nav .nav-cat-parent { position: relative; }
nav.cw-nav .nav-cat-toggle { display: inline-flex; align-items: baseline; gap: .3rem; cursor: pointer; line-height: 20px; }
nav.cw-nav .nav-cat-chevron { font-size: .8rem; display: inline-block; transition: transform .2s; }
nav.cw-nav .nav-cat-parent.open .nav-cat-chevron { transform: rotate(90deg); }
nav.cw-nav .nav-cat-sub { display: none; list-style: none; flex-direction: column; }
nav.cw-nav .nav-cat-parent.open .nav-cat-sub { display: flex; }
nav.cw-nav .nav-cat-count { font-size: .75rem; color: var(--muted, #8a8070); margin-left: .15rem; font-weight: 400; letter-spacing: 0; text-transform: none; }

@media (min-width: 901px) {
  nav.cw-nav .nav-cat-sub {
    position: absolute;
    top: calc(100% + .6rem);
    left: 50%; transform: translateX(-50%);
    background: var(--paper, #f5f0e8);
    border: 1px solid rgba(13,13,13,0.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    padding: .4rem 0;
    min-width: 130px;
    z-index: 200;
    gap: 0;
  }
  nav.cw-nav .nav-cat-sub li a {
    display: block;
    padding: .45rem 1.1rem;
    white-space: nowrap;
    font-size: .85rem;
    letter-spacing: .08em;
  }
  nav.cw-nav .nav-cat-sub li a:hover { background: rgba(196,69,26,.06); }
}

@media (max-width: 900px) {
  nav.cw-nav .nav-cat-sub {
    padding-left: .9rem;
    margin-top: .5rem;
    gap: .75rem;
    border-left: 2px solid rgba(13,13,13,0.12);
  }
}

/* 會員 / 購物車 icon */
nav.cw-nav .nav-cart, nav.cw-nav #nav-member {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  font-size: 1.4rem;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--ink, #0d0d0d);
  text-decoration: none;
  padding: 0;
  border-radius: 4px;
  transition: background .2s;
}
nav.cw-nav .nav-cart:hover, nav.cw-nav #nav-member:hover { background: rgba(13,13,13,.06); }
nav.cw-nav .nav-cart-count {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--rust, #c4451a); color: #fff;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: .6rem; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; padding: 0 3px;
}

/* 漢堡 */
nav.cw-nav .hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
}
nav.cw-nav .hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--ink, #0d0d0d);
  transition: all 0.3s;
}
nav.cw-nav .hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
nav.cw-nav .hamburger.open span:nth-child(2) { opacity: 0; }
nav.cw-nav .hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 行動版（≤900px）顯示漢堡、隱藏桌機 nav 連結 */
@media (max-width: 900px) {
  nav.cw-nav { padding: 1rem 2rem; }
  nav.cw-nav ul { display: none; }
  nav.cw-nav ul.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--paper, #f5f0e8);
    border-top: 1px solid rgba(13,13,13,0.1);
    padding: 1.5rem 2rem;
    gap: 1.2rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  }
  nav.cw-nav ul.open > li > a,
  nav.cw-nav ul.open .nav-cat-toggle {
    font-family: 'Noto Serif TC', serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
  }
  nav.cw-nav ul.open .nav-cat-sub li a {
    font-family: 'Noto Sans TC', sans-serif;
    font-size: .92rem;
    font-weight: 400;
    letter-spacing: .06em;
    text-transform: none;
  }
  nav.cw-nav .hamburger { display: flex; }
  nav.cw-nav .logo { font-size: 1.8rem; }
  nav.cw-nav .nav-ham-only { display: block; }
}

/* 內容上方留出 nav 高度（fixed nav 不會擋住） */
body.cw-has-nav { padding-top: 110px; }
@media (max-width: 900px) {
  body.cw-has-nav { padding-top: 80px; }
}
