:root {
  --brand: #ea5442;
  --brand-dark: #c9412f;
  --shopee: #ee4d2d;
  --shopee-dark: #d73211;
  --ink: #2b2522;
  --muted: #7a6f69;
  --line: #eadfd8;
  --bg: #fffdfb;
  --bg-soft: #faf3ee;
  --radius: 10px;
  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.8 "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: "Noto Serif TC", serif; line-height: 1.4; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 14px; }

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: 999px; font-weight: 700;
  border: 2px solid transparent; cursor: pointer; text-decoration: none !important;
  transition: background .15s, color .15s;
}
.btn svg { width: 1.2em; height: 1.2em; flex: none; }
.btn-shopee { background: var(--shopee); color: #fff; }
.btn-shopee:hover { background: var(--shopee-dark); }
.btn-outline { border-color: var(--brand); color: var(--brand); }
.btn-outline:hover { background: var(--brand); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-lg { padding: 14px 28px; font-size: 18px; width: 100%; max-width: 380px; }

/* 頁首 */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
}
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 72px; }
.logo img { height: 48px; width: auto; }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav > ul { display: flex; gap: 4px; }
.site-nav a { display: block; padding: 8px 14px; color: #fff; font-weight: 500; }
.site-nav a:hover { opacity: .8; text-decoration: none; }
.sub a { color: var(--ink); }
.sub a:hover { color: var(--brand); opacity: 1; }
.header-shopee { background: #fff; color: var(--shopee); }
.header-shopee:hover { background: #fff3ef; }
.has-sub { position: relative; }
.has-sub > .sub {
  display: none; position: absolute; top: 100%; left: 0; min-width: 140px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .08); padding: 6px 0;
}
.has-sub:hover > .sub, .has-sub:focus-within > .sub { display: block; }
.menu-toggle { display: none; }

/* 頁尾 */
.site-footer { margin-top: 80px; background: var(--bg-soft); color: var(--brand); border-top: 1px solid var(--line); }
.footer-inner { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 32px; padding-top: 48px; padding-bottom: 32px; align-items: center; }
.footer-brand img { max-width: 220px; }
.footer-info p { margin: 0; }
.footer-info a { text-decoration: underline; }
.footer-info .company { margin-top: 12px; padding-top: 12px; border-top: 4px solid var(--brand); display: inline-block; letter-spacing: .3em; }
.footer-links { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.copyright { text-align: center; font-size: 13px; color: var(--muted); margin: 0; padding: 16px; border-top: 1px solid var(--line); }

/* 頁面 */
.page { padding-top: 32px; }
.page-title { text-align: center; color: var(--brand); font-size: 30px; margin: 8px 0 24px; padding-bottom: 16px; border-bottom: 1px solid var(--brand); }
.section { margin-top: 56px; }
.section-title { font-size: 22px; color: var(--brand); margin: 0 0 20px; display: flex; align-items: center; gap: 12px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.narrow { max-width: 760px; }
.rich { overflow-wrap: anywhere; }
.rich img { margin: 12px auto; height: auto !important; max-width: 720px; }
.rich p { margin: 0 0 .4em; }
.rich table { max-width: 100%; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* 首頁與自訂頁面版塊 */
.page-home { padding-top: 0; }
.page-home > .blk-img, .page-home > .row { max-width: var(--wrap); margin: 0 auto 24px; padding: 0 16px; }
.page-home > .blk-img:first-child { max-width: none; padding: 0; }
.page-home > .blk-img:first-child img { width: 100%; max-height: none; border-radius: 0; }
.page-home .blk-fb { text-align: center; margin: 40px 0; }
.blk-img { margin: 0 0 24px; }
.blk-img img { margin: 0 auto; border-radius: 4px; max-height: 85vh; width: auto; }
.blk-text { margin-bottom: 24px; }
.blk-map { margin: 0 0 24px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.row > * { margin-bottom: 0; }
.page-custom .row { margin-bottom: 24px; }

/* 商品卡片 */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.card a { display: block; color: var(--ink); text-decoration: none; }
.card-img { position: relative; aspect-ratio: 1; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card a:hover .card-img img { transform: scale(1.04); }
.card-title { font-family: inherit; font-size: 15px; font-weight: 500; margin: 10px 0 0; line-height: 1.5; }
.card a:hover .card-title { color: var(--brand); }
.card-price { margin: 4px 0 0; color: var(--brand); font-weight: 700; }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(43, 37, 34, .75); color: #fff; font-size: 12px; padding: 2px 10px; border-radius: 999px; }

.cat-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 20px; }
.cat-bar a { padding: 6px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: 15px; }
.cat-bar a:hover, .cat-bar a.on { border-color: var(--brand); background: var(--brand); color: #fff; text-decoration: none; }
.shop-note { text-align: center; color: var(--muted); margin: 0 0 28px; }

/* 商品頁 */
.crumb { font-size: 14px; color: var(--muted); margin: 0 0 16px; }
.crumb a { color: var(--muted); }
.product-top { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.gallery-main { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.gallery-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.gallery-thumbs button { width: 72px; height: 72px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #fff; cursor: pointer; }
.gallery-thumbs button.on { border-color: var(--brand); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.product-info h1 { font-size: 26px; margin: 0 0 16px; }
.price { font-size: 24px; font-weight: 700; color: var(--brand); margin: 0 0 20px; }
.price small { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.stock-note { background: var(--bg-soft); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.buy-note { font-size: 13px; color: var(--muted); margin: 12px 0 24px; }
.share { font-size: 14px; color: var(--muted); }
.share a { margin-right: 12px; }
.detail-media img { margin: 0 auto 12px; max-width: 720px; }
.sticky-buy { display: none; }

/* 手機 */
@media (max-width: 960px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .header-inner { min-height: 60px; gap: 12px; }
  .logo img { height: 38px; }
  .header-shopee { margin-left: auto; }
  .menu-toggle {
    display: flex; flex-direction: column; justify-content: center; gap: 5px; order: 3;
    width: 40px; height: 40px; padding: 8px; background: none; border: 0; cursor: pointer;
  }
  .menu-toggle span { display: block; height: 2px; background: #fff; border-radius: 2px; }
  .site-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); margin: 0; }
  .nav-open .site-nav { display: block; }
  .site-nav > ul { flex-direction: column; padding: 8px 16px 16px; gap: 0; }
  .site-nav a { padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
  .has-sub > .sub { display: block; position: static; border: 0; box-shadow: none; padding: 0 0 0 16px; }

  .grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .row { grid-template-columns: 1fr; }
  .product-top { grid-template-columns: 1fr; gap: 24px; }
  .product-info h1 { font-size: 22px; }
  .page-title { font-size: 24px; }
  .footer-inner { grid-template-columns: 1fr; text-align: left; gap: 20px; }
  .footer-brand img { max-width: 160px; }

  .product { padding-bottom: 72px; }
  .sticky-buy {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 253, 251, .96); border-top: 1px solid var(--line);
  }
  .sticky-buy .btn { width: 100%; }
}
