/* 手作乾爹肉 — 煙燻培根的世界：煙燻棕 × 牛皮紙 × 培根紅 × 楓糖
   手機優先；桌機只是放寬的手機版 */
: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);
  display: flex; align-items: center; gap: 9px;
}
/* 印章 logo 的紅底在深燻棕頂欄上對比偏低，加一圈脂白細邊把它托出來 */
.brand img {
  width: 34px; height: 34px; display: block;
  border-radius: 50%; box-shadow: 0 0 0 1.5px var(--fat);
}
.iconbtn {
  background: none; border: 0; cursor: pointer;
  color: var(--kraft); font-size: 1.4rem;
  position: relative; padding: 6px 10px; line-height: 1;
}
.iconbtn svg { display: block; }
.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-outline {
  background: var(--fat); color: var(--meat);
  border: 2px solid var(--meat);
  box-shadow: 0 3px 0 var(--meat-dark);
}
.btn-outline:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--meat-dark); }
.btn-block { display: block; width: 100%; }

/* ---- 結帳：寄送方式選項卡 ---- */
.ship-choices { border: 0; padding: 0; margin: 0; }
.ship-choices legend { font-weight: 500; margin-bottom: 4px; padding: 0; }
.ship-option { margin-bottom: 8px; }
.ship-option label {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin: 0;
  background: #fff; border: 1px solid var(--twine); border-radius: 12px;
  font-weight: 400; cursor: pointer;
}
.ship-option input { accent-color: var(--meat); width: 18px; height: 18px; margin: 0; }
.ship-option label:hover { border-color: var(--maple); }
/* 選中的選項卡：左緣壓一道培根紅，像價目牌上被圈起來的那行 */
.ship-option label:has(input:checked) {
  border-color: var(--meat); background: var(--fat);
  box-shadow: inset 4px 0 0 var(--meat);
}
.ship-fee { color: var(--mut); font-size: .9rem; margin-left: auto; white-space: nowrap; }
.free-tag { color: var(--meat); font-weight: 700; }

/* ---- 結帳：已選門市卡與地址列 ---- */
.picked-store {
  background: var(--fat); border: 1px solid var(--twine);
  border-left: 4px solid var(--meat); border-radius: 10px;
  padding: 10px 14px; margin: 10px 0 6px;
}
.picked-store small { color: var(--mut); }
.addr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-bottom: 0; }
.addr-row > div { margin-bottom: 14px; }
@media (min-width: 480px) { .addr-row { grid-template-columns: 1fr 1fr 108px; } }
/* 親收／管理室收：RadioSelect 的 fieldset 去框、兩顆 radio 橫排 */
.receive-by fieldset { border: 0; padding: 0; margin: 0; }
.receive-by legend { font-weight: 500; margin-bottom: 4px; padding: 0; }
.receive-by #id_receive_by { display: flex; gap: 20px; }
.receive-by #id_receive_by label {
  display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 0;
}
.receive-by input { accent-color: var(--meat); width: 17px; height: 17px; margin: 0; }

/* ---- 版面 ---- */
.container { max-width: 820px; 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 {
  position: relative; overflow: hidden;
  display: flex; align-items: flex-end;
  /* clamp 而非純 vh：手機網址列收合會改變 vh，純 vh 會讓 hero 高度跳動 */
  min-height: clamp(420px, 68vh, 620px);
  margin-bottom: 0;
  /* 圖片載入失敗時的底色，維持煙燻色調不開天窗 */
  background: linear-gradient(160deg, #c98a63, #8a4a33 60%, #6e3826);
}
.hero-img {
  position: absolute; inset: 0; display: block;
  width: 100%; height: 100%;
  /* 手機是直式裁切，焦點右移才不會把主體切掉（圖的主體刻意構在右半邊） */
  object-fit: cover; object-position: 65% center;
}
.hero.noimg .hero-img { display: none; }
/* 左下往右上淡出的深色罩：保證疊在圖上的白字讀得到 */
.hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top right,
    rgba(40, 24, 16, .88) 0%, rgba(40, 24, 16, .6) 40%,
    rgba(40, 24, 16, .12) 72%, transparent 100%);
}
.hero-inner {
  position: relative; z-index: 1;
  width: 100%; max-width: 820px; margin: 0 auto;
  padding: 0 16px 40px;
}
.hero-inner .eyebrow { color: var(--maple); }
.hero-inner h1 { color: var(--fat); text-shadow: 0 2px 14px rgba(0, 0, 0, .5); }
.hero-inner p {
  color: rgba(251, 245, 233, .92); margin: 0 0 20px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}

/* ---- 商品卡 ---- */
.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; }

/* ---- 無添加宣言：三條都是否定句，用培根紅左邊條標成同一組 ---- */
.additive-free .lead { margin: 0 0 14px; color: #5c4938; }
.no-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.no-list li {
  background: var(--fat);
  border: 1px solid var(--twine); border-left: 4px solid var(--meat);
  border-radius: 12px; padding: 12px 14px;
  font-family: var(--display); font-weight: 700; font-size: 1.05rem;
}

/* ---- 運費與配送 ---- */
.ship-options { display: grid; gap: 12px; margin-bottom: 26px; }
.ship-card {
  background: var(--fat); border: 1px solid var(--twine);
  border-radius: 14px; padding: 14px 16px;
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 4px 12px;
}
.ship-card b { font-family: var(--display); font-size: 1.05rem; }
.ship-card .ship-fee { font-family: var(--display); color: var(--maple); font-weight: 700; font-size: 1.25rem; }
.ship-card p { grid-column: 1 / -1; margin: 0; font-size: .9rem; color: #5c4938; }
.ship-card.ship-free { border-color: var(--maple); border-width: 1.5px; }

.price-table { width: 100%; border-collapse: collapse; background: var(--fat); font-size: .95rem; }
.price-table th, .price-table td {
  border: 1px solid var(--twine); padding: 9px 10px; text-align: right;
}
.price-table th { background: var(--smoke); color: var(--kraft); font-weight: 500; }
.price-table th:first-child, .price-table td:first-child { text-align: left; }
/* 免運列上底色，讓「1200 克起兩種運送同價」一眼看得出來 */
.price-table .is-free td { background: #f6e7cd; font-weight: 700; }
/* 每個免運價格格子都掛紅字標，底色在小螢幕不明顯時仍讀得出免運 */
.free-tag {
  margin-left: 6px; color: var(--meat); font-weight: 700;
  font-size: .78rem; white-space: nowrap;
}

.ship-hint { font-size: .9rem; color: var(--mut); margin: 10px 0 0; }
.ship-hint.is-free { color: var(--maple); font-weight: 700; }
.unit-weight { display: block; color: var(--mut); font-size: .78rem; }

/* ---- 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);
}
/* select 比照文字輸入框，去掉瀏覽器原生外觀、右側放麻繩色小箭頭 */
form select {
  width: 100%; padding: 12px 38px 12px 12px; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--twine); border-radius: 12px;
  color: var(--smoke); appearance: none; cursor: pointer;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M4 6l4 4 4-4' fill='none' stroke='%238a6f57' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 12px center / 14px;
}
form input:focus-visible, form select:focus-visible {
  outline: 2px solid var(--maple); outline-offset: 1px; border-color: var(--maple);
}
/* 唯讀欄位（門市、郵遞區號由系統帶入）：牛皮紙底＋虛線框，示意不可打字 */
form input[readonly] { background: var(--kraft); border-style: dashed; }
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: separate; border-spacing: 0;
  background: var(--fat); font-size: .92rem;
  border: 1px solid var(--twine); border-radius: 12px; overflow: hidden;
}
.order-table th, .order-table td {
  border: 0; border-bottom: 1px solid var(--twine);
  padding: 10px 12px; text-align: left;
}
.order-table thead th { background: rgba(216, 198, 164, .35); }
.order-table tfoot td { font-weight: 700; }
.order-table tfoot tr:last-child td { border-bottom: 0; background: rgba(216, 198, 164, .25); }
.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; }
  .no-list { grid-template-columns: repeat(3, 1fr); }
  /* 桌機不再分欄，文字一律疊在滿版圖上 */
  .hero-inner { padding-bottom: 56px; }
  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; }
}
