/* 手機優先。桌機只是把同一套版型放寬，不另外設計（ADR 0004）。
   字級刻意偏大 —— 主要使用者是中高齡鴿友。 */

:root {
  --navy: #16335c;
  --navy-dark: #0f2545;
  --blue: #2563a8;
  --ink: #16202e;
  --muted: #6b7787;
  --line: #dfe4ec;
  --bg: #f4f6f9;
  --card: #fff;
  --danger: #c0392b;
  --ok: #1c7a4a;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding-bottom: 90px;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

.wrap { width: 100%; max-width: 900px; margin: 0 auto; padding: 0 14px; }

/* ---- 店家自己上傳的背景圖 ---- */

/* 圖固定在視窗上、內容在它上面捲動。白紗的濃度由後台決定（bg_dim），
   沒有紗的話深色照片會讓 .muted 這類淺色小字完全讀不到。 */
.site-bg {
  position: fixed; inset: 0; z-index: -1;
  background-size: cover; background-position: center;
}
.site-bg-veil { position: absolute; inset: 0; display: block; background: var(--bg); }

/* 有背景圖時 body 自己不能再鋪底色，否則會蓋掉背景 */
body.has-bg { background: transparent; }

/* ---- 頁首與搜尋 ---- */

.site-header {
  background: var(--navy);
  color: #fff;
  padding: 12px 0 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner { display: flex; align-items: center; }

.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }

.logo-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  background: #fff; color: var(--navy);
  border-radius: 10px; font-weight: 800; font-size: 21px;
}

/* 店徽多半不是正方形，所以固定高度、寬度自己長，contain 不裁到字 */
.logo-img {
  height: 38px; width: auto; max-width: 120px; flex: none;
  object-fit: contain; border-radius: 8px;
}

.logo-text { font-size: 20px; font-weight: 700; line-height: 1.2; }
.logo-text small { display: block; font-size: 12px; font-weight: 400; opacity: .75; }

.search { display: flex; gap: 8px; margin-top: 12px; }

.search input {
  flex: 1; min-width: 0;
  padding: 13px 14px;
  font-size: 17px;
  border: none; border-radius: 10px;
  background: #fff; color: var(--ink);
}

.search button {
  flex: none; padding: 0 18px;
  font-size: 16px; font-weight: 700;
  color: #fff; background: var(--blue);
  border: none; border-radius: 10px; cursor: pointer;
}

/* ---- 通用 ---- */

h1 { font-size: 24px; margin: 0; }
.section { font-size: 17px; margin: 24px 0 10px; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); font-size: 14px; }
.crumb { font-size: 14px; color: var(--muted); padding: 14px 0 0; }
.crumb a { color: var(--blue); text-decoration: none; }
.page-head { padding: 10px 0 4px; }
.link { color: var(--blue); font-weight: 600; text-decoration: none; }
.empty { padding: 32px 4px; color: var(--muted); }
.err { color: var(--danger); font-size: 14px; font-weight: 600; }

.hero {
  margin-top: 16px; padding: 22px 18px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff; border-radius: var(--radius);
}
.hero h1 { font-size: 21px; }
.hero p { margin: 8px 0 0; opacity: .85; font-size: 15px; }

/* ---- 分類 ---- */

.cats { display: grid; gap: 10px; }

.cat {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit;
}

.cat-mark {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: var(--navy); color: #fff;
  border-radius: 10px; font-weight: 800; font-size: 19px;
}

/* 跟 .cat-mark 佔一樣的位置，換圖不會讓四張卡的高度跳動 */
.cat-img {
  width: 44px; height: 44px; flex: none;
  object-fit: cover; border-radius: 10px; background: var(--bg);
}

.cat-body { flex: 1; }
.cat-body b { display: block; font-size: 18px; }
.cat-body small { color: var(--muted); font-size: 13px; }
.cat-go { color: var(--muted); font-size: 22px; }

/* ---- 商品卡 ---- */

.cards { display: grid; gap: 10px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.card-out { opacity: .72; }

.card-head { display: flex; gap: 12px; align-items: flex-start; }
.card-head h3 { margin: 0; font-size: 17px; line-height: 1.4; flex: 1; }

.thumb {
  width: 62px; height: 62px; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: #eef2f7; border-radius: 10px;
  color: #aeb9c7; font-size: 24px; font-weight: 800;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-head .brand { color: var(--muted); font-weight: 600; }
.card-head .code {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; vertical-align: 2px;
}

.price { flex: none; font-size: 19px; font-weight: 800; color: var(--navy); text-align: right; }

.specs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.spec {
  padding: 7px 12px; font-size: 15px;
  background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.spec.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.spec[data-out] { opacity: .45; }
.unit-toggle { margin-top: 8px; }

.card-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}

.stock { font-size: 14px; color: var(--muted); flex: 1; min-width: 90px; }
.stock .out { color: var(--danger); font-weight: 700; }

.buy { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.quick { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.quick button {
  min-width: 42px; padding: 6px 0;
  font-size: 15px; background: #eef2f7; color: var(--navy);
  border: none; border-radius: 8px; cursor: pointer;
}

.qty { display: flex; align-items: center; gap: 4px; }
.qty button {
  width: 40px; height: 40px;
  font-size: 22px; line-height: 1;
  background: #eef2f7; color: var(--navy);
  border: none; border-radius: 10px; cursor: pointer;
}
.qty span { min-width: 58px; text-align: center; font-size: 17px; font-weight: 700; }
.qty em { font-style: normal; font-size: 14px; color: var(--muted); margin-left: 2px; }

.add {
  padding: 11px 18px; font-size: 16px; font-weight: 700;
  color: #fff; background: var(--blue);
  border: none; border-radius: 10px; cursor: pointer;
}
.add:disabled { background: #b9c2cf; cursor: not-allowed; }

/* ---- 購物車 ---- */

.cart-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--navy); color: #fff;
  font-size: 17px; font-weight: 700; text-decoration: none;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "main remove" "qty sub";
  gap: 8px 10px; align-items: center;
  padding: 14px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.cart-line.has-error { border-color: var(--danger); }
.cl-main { grid-area: main; }
.cl-name { font-weight: 700; }
.cl-name small { margin-left: 6px; font-weight: 400; }
.cl-price { font-size: 14px; color: var(--muted); }
.cl-qty { grid-area: qty; display: flex; align-items: center; gap: 4px; }
.cl-qty button {
  width: 36px; height: 36px; font-size: 20px;
  background: #eef2f7; color: var(--navy); border: none; border-radius: 8px; cursor: pointer;
}
.cl-qty span { min-width: 56px; text-align: center; font-weight: 700; }
.cl-qty em { font-style: normal; font-size: 13px; color: var(--muted); }
.cl-sub { grid-area: sub; text-align: right; font-size: 18px; font-weight: 800; color: var(--navy); }
.cl-remove {
  grid-area: remove; align-self: start;
  width: 32px; height: 32px; font-size: 20px;
  background: none; color: var(--muted); border: none; cursor: pointer;
}

.cart-total, .order-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 18px;
}
.cart-total b, .order-total b { font-size: 24px; color: var(--navy); }

/* ---- 結帳與訂單 ---- */

.checkout { margin-top: 8px; }
.checkout label { display: block; margin-bottom: 12px; font-weight: 700; font-size: 15px; }
.checkout input, .checkout textarea {
  display: block; width: 100%; margin-top: 6px; padding: 13px 14px;
  font-size: 17px; font-family: inherit; font-weight: 400;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}

.notice {
  padding: 13px 15px; margin: 14px 0;
  background: #fff6e6; border: 1px solid #f0d9a8; border-radius: var(--radius);
  font-size: 15px;
}

.submit {
  width: 100%; padding: 16px; margin-top: 4px;
  font-size: 18px; font-weight: 800; color: #fff; background: var(--blue);
  border: none; border-radius: var(--radius); cursor: pointer;
}
.submit:disabled { background: #b9c2cf; cursor: not-allowed; }

.order-box {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 4px 14px;
}
.order-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.order-row:last-child { border-bottom: none; }
.order-row span { color: var(--muted); font-size: 15px; }
.order-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.oi-name small { font-size: 13px; margin-left: 5px; }
.oi-qty { font-size: 14px; color: var(--muted); }
.oi-sub { grid-row: 1 / 3; align-self: center; font-size: 18px; font-weight: 700; }
.order-total { border: none; background: none; padding: 12px 0; }

.notes ol { padding-left: 22px; margin: 0 0 10px; }
.notes li { margin-bottom: 6px; }

.site-footer { margin-top: 28px; padding: 18px 14px; color: var(--muted); font-size: 14px; }

/* 店家資訊：自取流程的一部分，所以每一頁都在，且電話與地址要能一觸即用 */
.shop-info { display: grid; gap: 8px; margin-bottom: 14px; }
.info-row {
  display: block; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: inherit; text-decoration: none;
}
.info-row b { display: block; font-size: 17px; color: var(--ink); }
.info-row span { font-size: 13px; color: var(--muted); }
.info-row.phone b { color: var(--blue); }

.hero-photo { background-size: cover; background-position: center; position: relative; }
.hero-photo::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(22,51,92,.85), rgba(37,99,168,.7));
  border-radius: var(--radius);
}
.hero-photo h1, .hero-photo p { position: relative; }
.notice-shop { background: #eaf2fb; border-color: #b9d3ef; }

/* ---- 提示 ---- */

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  max-width: 90%; padding: 12px 18px; z-index: 40;
  background: rgba(15, 37, 69, .95); color: #fff;
  border-radius: 999px; font-size: 15px; font-weight: 600;
  opacity: 0; transition: opacity .18s;
}
.toast.on { opacity: 1; }

/* ---- 桌機：同一套版型放寬 ---- */

@media (min-width: 720px) {
  body { font-size: 16px; }
  .cats { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cart-bar { border-radius: 12px 12px 0 0; left: 50%; right: auto; transform: translateX(-50%); width: 420px; }
}
