/* 手作乾爹肉 — 煙燻培根的世界：煙燻棕 × 牛皮紙 × 培根紅 × 楓糖
   手機優先；桌機只是放寬的手機版 */
:root {
  --smoke: #33241A;   /* 燻木深棕：標題與內文 */
  --kraft: #EFE2C8;   /* 牛皮紙：頁面底色 */
  --meat: #A93F35;    /* 培根紅：主要按鈕 */
  --meat-dark: #7e2d26;
  --maple: #C07A2E;   /* 楓糖：價格與點綴 */
  --fat: #FBF5E9;     /* 脂白：卡片底色 */
  --twine: #D8C6A4;   /* 麻繩：邊框 */
  --mut: #8a6f57;     /* 次要文字 */
  --line-green: #06C755; /* 僅 LINE 相關按鈕 */
  --display: 'LXGW WenKai TC', 'Microsoft JhengHei', serif;
  --body: 'Noto Sans TC', 'Microsoft JhengHei', system-ui, sans-serif;
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--smoke);
  background: var(--kraft);
  line-height: 1.8;
}
a { color: var(--meat); }
h1, h2, h3, h4, .brand, .price { font-family: var(--display); }

/* ---- 頂欄（深燻棕，品牌置中） ---- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px;
  background: var(--smoke);
  color: var(--kraft);
}
.brand {
  font-size: 1.35rem; font-weight: 700; letter-spacing: .08em;
  text-decoration: none; color: var(--kraft);
}
.iconbtn {
  background: none; border: 0; cursor: pointer;
  color: var(--kraft); font-size: 1.4rem;
  position: relative; padding: 6px 10px; line-height: 1;
}
.iconbtn:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--maple); outline-offset: 2px;
}
.badge {
  position: absolute; top: -2px; right: 0;
  background: var(--meat); color: #fff;
  border-radius: 999px; padding: 1px 5px;
  font-size: .65rem; font-weight: 700; font-family: var(--body);
}

/* ---- 漢堡抽屜（註冊/登入收合處） ---- */
.drawer {
  position: sticky; top: 52px; z-index: 99;
  background: var(--fat);
  border-bottom: 1px solid var(--twine);
  padding: 10px 20px 18px;
  display: grid; gap: 2px;
  box-shadow: 0 10px 24px rgba(51, 36, 26, .15);
}
/* CSS display 會蓋過 hidden 屬性的預設 display:none，需明確補回 */
.drawer[hidden], .mini-cart[hidden], .cart-backdrop[hidden] { display: none; }
.drawer > a {
  color: var(--smoke); text-decoration: none;
  font-size: 1.05rem; padding: 10px 0;
  border-bottom: 1px dashed var(--twine);
}
.drawer-auth { padding-top: 14px; display: grid; gap: 6px; }
.hello { color: var(--mut); font-size: .95rem; }
.hint { font-size: .8rem; color: var(--mut); text-align: center; margin: 0; }
.logout-form { margin: 0; }
.link-btn {
  background: none; border: none; padding: 0;
  color: var(--mut); cursor: pointer; font-size: .95rem;
  text-decoration: underline; font-family: inherit;
}

/* ---- 按鈕 ---- */
.btn {
  display: inline-block; border: 0; cursor: pointer;
  padding: 12px 20px; border-radius: 14px;
  font-size: 1rem; font-weight: 700; font-family: var(--body);
  text-decoration: none; text-align: center;
}
.btn-meat, .btn-primary {
  background: var(--meat); color: var(--fat);
  box-shadow: 0 3px 0 var(--meat-dark);
}
.btn-meat:active, .btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--meat-dark); }
.btn-line { background: var(--line-green); color: #fff; }
.btn-block { display: block; width: 100%; }

/* ---- 版面 ---- */
.container { max-width: 720px; margin: 0 auto; padding: 0 16px 56px; }
section { margin-bottom: 52px; }
h1 { font-size: 2rem; line-height: 1.35; margin: 8px 0 12px; }
h2 { font-size: 1.5rem; margin: 0 0 16px; }
h2::after {
  content: ''; display: block; width: 2.2em; height: 4px;
  margin-top: 6px; border-radius: 2px; background: var(--maple);
}
.note { color: var(--mut); font-size: .9rem; }
.eyebrow {
  font-size: .85rem; letter-spacing: .35em;
  color: var(--meat); font-weight: 500;
}

/* ---- 簽名元素：培根紋分隔線 ---- */
.bacon-divider { display: block; width: 100%; height: 22px; margin: 8px 0 40px; }

/* ---- Hero ---- */
.hero { padding-top: 20px; margin-bottom: 12px; }
.hero-photo {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--twine);
  aspect-ratio: 3 / 2; background: linear-gradient(160deg, #c98a63, #8a4a33 60%, #6e3826);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-photo.noimg img { display: none; }
.hero-text { padding: 18px 4px 0; }
.hero-text p { color: #5c4938; margin: 0 0 18px; }

/* ---- 商品卡 ---- */
.product-grid { display: grid; gap: 22px; }
.product-card {
  background: var(--fat); border: 1px solid var(--twine);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(51, 36, 26, .08);
}
.product-card .photo { aspect-ratio: 4 / 3; }
.product-card .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #c98a63, #8a4a33 60%, #6e3826);
  color: var(--fat); font-family: var(--display);
  font-size: 1.2rem; letter-spacing: .3em;
}
.product-card .inner { padding: 16px 16px 18px; }
.product-card h3 { font-size: 1.35rem; margin: 0 0 4px; }
.product-card .desc { color: #5c4938; font-size: .92rem; margin: 0 0 14px; }
.product-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.price { color: var(--maple); font-weight: 700; font-size: 1.5rem; }
.price small { font-size: .8rem; }

/* ---- 柴燻工法（真實工序，編號承載順序） ---- */
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li {
  counter-increment: step;
  background: var(--fat); border: 1px solid var(--twine); border-radius: var(--radius);
  padding: 14px 16px 14px 58px; position: relative;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 14px; top: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--smoke); color: var(--kraft);
  font-family: var(--display); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.steps b { font-family: var(--display); font-size: 1.1rem; }
.steps p { margin: 2px 0 0; font-size: .92rem; color: #5c4938; }

/* ---- FAQ ---- */
.faq-item {
  background: var(--fat); border: 1px solid var(--twine);
  border-radius: 14px; margin-bottom: 10px; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; font-weight: 500; padding: 13px 16px;
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '＋'; color: var(--maple); font-weight: 700; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { color: #5c4938; margin: 0; padding: 0 16px 14px; font-size: .92rem; }

.line-section { text-align: center; }
.line-section h2::after { margin-left: auto; margin-right: auto; }

/* ---- 表單 ---- */
form div { margin-bottom: 14px; }
form label { display: block; font-weight: 500; margin-bottom: 4px; }
form input[type="text"], form input[type="tel"], form input[type="number"] {
  width: 100%; padding: 12px; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--twine); border-radius: 12px;
  background: #fff; color: var(--smoke);
}
form .helptext { color: var(--mut); font-size: .85rem; }
.errorlist { color: var(--meat); list-style: none; padding: 0; margin: 4px 0 0; font-size: .88rem; }
.checkout-form, .report-form {
  background: var(--fat); border: 1px solid var(--twine);
  border-radius: var(--radius); padding: 20px;
}

/* ---- 表格 ---- */
.order-table { width: 100%; border-collapse: collapse; background: var(--fat); font-size: .92rem; }
.order-table th, .order-table td { border: 1px solid var(--twine); padding: 10px; text-align: left; }
.order-table tfoot td { font-weight: 700; }
.order-no { font-size: 1.05rem; }

/* ---- 付款資訊卡（肉舖手寫價目牌） ---- */
.bank-card {
  background: var(--fat); border: 1.5px dashed var(--maple);
  border-radius: var(--radius); padding: 20px 18px 14px;
  margin: 18px 0; position: relative;
}
.bank-card::before {
  content: '付款資訊';
  position: absolute; top: -12px; left: 14px;
  background: var(--kraft); color: var(--maple);
  font-size: .78rem; letter-spacing: .2em; padding: 0 8px;
}
.bank-card p { margin: 6px 0; display: flex; gap: 12px; }
.bank-card span { color: var(--mut); font-size: .9rem; min-width: 3em; }
.bank-card .account { font-family: var(--display); font-size: 1.3rem; letter-spacing: .05em; }

/* ---- messages ---- */
.messages { max-width: 720px; margin: 12px auto 0; padding: 0 16px; }
.message {
  padding: 10px 16px; border-radius: 12px; margin-bottom: 8px;
  background: var(--fat); border: 1px solid var(--twine); font-size: .95rem;
}
.message.success { border-color: #9db98a; background: #eef3e4; }
.message.warning { border-color: var(--maple); background: #f7ecd9; }
.message.error { border-color: var(--meat); background: #f6e3e1; }

/* ---- footer ---- */
.site-footer { background: var(--smoke); color: var(--kraft); }
.site-footer .bacon-divider { margin: 0; height: 22px; }
.footer-inner { text-align: center; padding: 26px 16px 34px; font-size: .9rem; }
.line-link { color: var(--line-green); font-weight: 700; }

/* ---- mini 購物袋（底部抽屜） ---- */
.cart-backdrop {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(51, 36, 26, .45);
}
.mini-cart {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  background: var(--fat);
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--twine); border-bottom: 0;
  padding: 12px 18px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 30px rgba(51, 36, 26, .25);
  max-height: 70vh; overflow-y: auto;
}
.grab { width: 44px; height: 4px; border-radius: 2px; background: var(--twine); margin: 0 auto 10px; }
.mini-cart h4 { margin: 0 0 8px; font-size: 1.1rem; }
.mini-cart .empty { color: var(--mut); text-align: center; margin: 18px 0; }
.mini-cart-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--twine);
  font-size: .92rem;
}
.item-name { flex: 1; }
.item-qty { display: inline-flex; align-items: center; gap: 10px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--twine); background: var(--kraft);
  color: var(--smoke); cursor: pointer; font-size: 1rem;
}
.mini-cart-footer { padding-top: 12px; }
.mini-cart-total {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}

/* ---- 桌機：放寬而不重排 ---- */
@media (min-width: 640px) {
  .product-grid { grid-template-columns: 1fr 1fr; }
  .hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; align-items: center; }
  .hero-text { padding: 0; }
  h1 { font-size: 2.4rem; }
  .mini-cart {
    left: auto; right: 16px; bottom: 16px; width: 380px;
    border-radius: 20px; border-bottom: 1px solid var(--twine);
  }
}

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