/* =========================================================
   好伴 HOBAN｜樣式
   版面尺寸依設計稿（1536 × 1024）量測：側欄 222px、內容左右 21／19px
   ========================================================= */
:root {
  --bg: #FAF9F6;
  --ink: #282823;
  --ink-2: #4a4a43;
  --muted: #6d6d64;
  --sage: #858F81;
  --sage-d: #5f6a5b;
  --line: rgba(40, 40, 35, .16);
  --line-2: rgba(40, 40, 35, .28);
  --side: 222px;
  --pad-l: 21px;
  --pad-r: 19px;
  --zh: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font: "Inter", var(--zh);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.7 var(--font); -webkit-font-smoothing: antialiased; }
body.lock { overflow: hidden; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ul, figure { margin: 0; }
ul { list-style: none; padding: 0; }
.i { width: 20px; height: 20px; flex: none; }
.i.sm { width: 16px; height: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 99; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 4px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--sage-d); outline-offset: 2px; }
.en { font-family: "Inter", sans-serif; }

/* ---------- 左側導覽 ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); border-right: 1px solid rgba(40, 40, 35, .2); background: var(--bg);
  display: flex; flex-direction: column; z-index: 40; }
.side-top { padding: 40px 21px 0 22px; flex: none; position: relative; }
.logo { display: flex; align-items: center; gap: 6px; margin-left: 24px; width: max-content; }
.logo-mark { width: 54px; height: auto; }
.logo-txt { display: flex; flex-direction: column; align-items: center; line-height: 1; margin-top: -6px; }
.logo-txt b { font: 500 29px/1 var(--zh); letter-spacing: .04em; }
.logo-txt em { font: 500 11px/1 "Inter", sans-serif; letter-spacing: .26em; margin-top: 9px; font-style: normal; padding-left: .26em; }
.side .side-x { display: none; }
.search { display: flex; align-items: center; gap: 10px; margin-top: 52px; border-bottom: 1px solid var(--ink); height: 42px; padding-left: 4px; }
.search .i { width: 21px; height: 21px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; font: 400 14px var(--font); color: var(--ink); padding: 8px 0; outline: none; }
.search input::placeholder { color: #5b5b54; }
.search:focus-within { border-bottom-color: var(--sage-d); }
.side-mid { flex: 1 1 auto; overflow-y: auto; padding: 38px 21px 20px 22px; scrollbar-width: thin; min-height: 80px; }
.acc { border-top: 1px solid var(--line); }
.acc-row { border-bottom: 1px solid var(--line); }
.acc h3 { font: inherit; }
.acc-head { width: 100%; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 0 3px;
  font: 600 18px/1.3 var(--zh); letter-spacing: .03em; text-align: left; }
.acc-head .i.sm { width: 18px; height: 18px; }
.acc-head:hover span:first-child { color: var(--sage-d); }
.pm .m { display: none; }
.acc-head[aria-expanded="true"] .pm .m { display: block; }
.acc-head[aria-expanded="true"] .pm .p { display: none; }
a.acc-head { justify-content: flex-start; gap: 14px; min-height: 59px; }
.acc-body { padding: 2px 0 24px 3px; }
.subs { display: grid; grid-template-columns: 90px 1fr; row-gap: 11px; }
.subs a { display: block; font: 400 14px/24px var(--zh); color: var(--ink-2); letter-spacing: .02em; }
.subs a:hover { color: var(--sage-d); }
.side-foot { flex: none; margin: 0 20px 0 22px; border-top: 1px solid var(--line-2); padding: 16px 0 26px; }
.side-foot ul a { display: block; font: 400 13.5px/29px var(--zh); letter-spacing: .03em; }
.side-foot ul a:hover { color: var(--sage-d); }
.sidebag { display: flex; align-items: center; gap: 12px; margin-top: 14px; min-height: 40px; font: 400 15px "Inter", sans-serif; }
.sidebag .bag { width: 27px; height: 27px; }

/* ---------- 主內容 ---------- */
.main { margin-left: var(--side); padding: 0 var(--pad-r) 0 var(--pad-l); outline: none; min-width: 0; }
.topline { height: 55px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px 0 18px; font-size: 15px; letter-spacing: .07em; }
.topline a { font-size: 15px; letter-spacing: .04em; }
.topline .en { letter-spacing: .1em; }
.topline .sl { margin: 0 4px; }
.topline a:hover { color: var(--sage-d); }

/* ---------- 主視覺 ---------- */
.hero { position: relative; }
.hero-media { position: relative; aspect-ratio: 1274 / 518; overflow: hidden; background: #dcd8d0; }
.hero-media > img:first-child { width: 100%; height: 100%; object-fit: cover; object-position: var(--fx); }
.hero-label { position: absolute; right: 2.1%; top: 6%; border: 1.5px solid rgba(255, 255, 255, .92); color: #fff; padding: 6px 17px 5px;
  font: 500 13px/1.4 "Inter", sans-serif; letter-spacing: .18em; }
.hero-line { position: absolute; left: 3.9%; top: 81%; width: 12.4%; height: auto; opacity: .3; pointer-events: none; }
.hero-card { position: absolute; left: 7.85%; top: 21.6%; width: 360px; min-height: 246px; padding: 30px 22px 28px 34px; border-radius: 6px;
  background: rgba(255, 255, 255, .95); border: 1px solid rgba(255, 255, 255, .7); box-shadow: 0 1px 2px rgba(40, 40, 35, .04); }
@supports ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  .hero-card { background: rgba(255, 255, 255, .82); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
}
.hero-card h1 { font: 600 34px/48px var(--zh); letter-spacing: .08em; }
.hero-card p { font-size: 13.5px; letter-spacing: .02em; white-space: nowrap; margin-top: 14px; color: var(--ink); }
.ulink { display: inline-flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--ink); padding-bottom: 3px; font-size: 15px; letter-spacing: .06em; }
.ulink .ar { width: 18px; height: 18px; transition: transform .2s; }
.ulink:hover .ar { transform: translateX(3px); }
.ulink.sm { font-size: 13px; gap: 6px; }
.hero-card .ulink { margin-top: 28px; }
.hero-line-m { display: none; }

/* ---------- 日常選物 ---------- */
.products { padding-top: 32px; }
.sec-head { display: flex; align-items: center; min-height: 52px; padding: 0 21px 0 24px; flex-wrap: wrap; row-gap: 10px; }
.sec-head h2 { font: 600 29px/1.2 var(--zh); letter-spacing: .08em; }
.vline { width: 1px; height: 25px; background: var(--ink); opacity: .55; margin: 0 26px 0 32px; }
.sec-head p { font-size: 16px; letter-spacing: .12em; color: var(--ink-2); }
.tabs { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 16px; letter-spacing: .08em; }
.tabs .sl { color: var(--ink-2); }
.tabs button { position: relative; min-height: 44px; padding: 0 1px; }
.tabs button::after { content: ""; position: absolute; left: -2px; right: -4px; bottom: 6px; height: 2px; background: var(--sage-d); transform: scaleX(0); transition: transform .2s; }
.tabs button[aria-pressed="true"]::after { transform: scaleX(1); }
.tabs button:hover { color: var(--sage-d); }
.qinfo { padding: 4px 24px 0; font-size: 14px; color: var(--muted); }
.qinfo .ulink { margin-left: 10px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); column-gap: 15px; row-gap: 28px; margin-top: 18px; }
.item { min-width: 0; }
.pimg { aspect-ratio: 414 / 259; overflow: hidden; background: #ebe8e1; position: relative; }
.pimg img { width: 100%; height: 100%; object-fit: cover; object-position: var(--fx); transition: transform .5s ease; }
.item:hover .pimg img { transform: scale(1.03); }
.pinfo { display: flex; justify-content: space-between; align-items: center; padding: 10px 8px 0 4px; }
.pinfo h3 { font: 600 16px/1.5 var(--zh); letter-spacing: .06em; }
.price { font: 400 14px/1.6 "Inter", sans-serif; letter-spacing: .05em; color: var(--ink-2); margin-top: 2px; }
.add { width: 44px; height: 44px; display: grid; place-items: center; margin-right: -8px; border-radius: 50%; }
.add .pc { width: 26px; height: 26px; transition: color .2s; }
.add:hover .pc { color: var(--sage-d); }
.add.ok .pc { animation: pop .45s ease; color: var(--sage-d); }
@keyframes pop { 40% { transform: scale(1.22); } }
.empty { grid-column: 1 / -1; padding: 40px 4px; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }

/* 圖片載入失敗的替換框 */
.ph { background: #e9e7e0 !important; }
.ph img { opacity: 0; }
.ph::after { content: "可替換圖片：" attr(data-ph); position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center;
  font: 400 12px/1.5 var(--font); color: var(--muted); background: url(../svg/hero-lineart.svg) 50% 38% / 90px auto no-repeat; padding-top: 70px; }

/* ---------- 生活情境 ---------- */
.scenes { display: grid; grid-template-columns: 1.62fr 1fr; gap: 15px; margin-top: 72px; align-items: start; }
.scene-img { display: block; overflow: hidden; background: #ebe8e1; position: relative; }
.scene.lg .scene-img { aspect-ratio: 16 / 10; }
.scene.sm .scene-img { aspect-ratio: 4 / 4.2; }
.scene-img img { width: 100%; height: 100%; object-fit: cover; object-position: var(--fx); transition: transform .6s ease; }
.scene:hover .scene-img img { transform: scale(1.02); }
.scene-txt { padding: 18px 4px 0; }
.scene.sm { margin-top: 56px; }
.en, .scene-txt .en, .brand-txt .en { font: 500 11.5px/1.4 "Inter", sans-serif; letter-spacing: .2em; color: var(--sage-d); }
.topline .en { font: inherit; color: inherit; letter-spacing: .1em; }
.scene-txt h2 { font: 500 20px/1.5 var(--zh); letter-spacing: .06em; margin-top: 8px; }
.scene-txt p:not(.en) { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.scene-txt .ulink { margin-top: 14px; font-size: 14px; }

/* ---------- 品牌介紹 ---------- */
.brand { display: grid; grid-template-columns: 1fr minmax(260px, 34%); gap: 48px; align-items: center; margin-top: 88px; padding: 56px 40px 56px 24px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.brand-txt { max-width: 520px; position: relative; }
.brand-txt h2 { font: 500 26px/1.5 var(--zh); letter-spacing: .06em; margin-top: 12px; }
.brand-txt p:not(.en) { font-size: 15px; line-height: 1.95; color: var(--ink-2); margin-top: 16px; letter-spacing: .03em; }
.brand-line { width: 200px; height: auto; opacity: .3; margin-top: 36px; }
.brand-img { aspect-ratio: 4 / 4.6; overflow: hidden; background: #ebe8e1; position: relative; }
.brand-img img { width: 100%; height: 100%; object-fit: cover; object-position: var(--fx); }

/* ---------- 頁尾 ---------- */
.foot { padding: 56px 4px 32px 24px; }
.foot-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.3fr 1.3fr; gap: 32px; }
.foot-brand { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 8px; justify-items: start; }
.foot-brand img { width: 38px; height: auto; }
.foot-brand .logo-txt b { font-size: 22px; }
.foot-brand .logo-txt em { font-size: 9px; margin-top: 7px; }
.foot-brand p { grid-column: 1 / -1; margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.foot h3 { font: 500 14px/1.6 var(--zh); letter-spacing: .08em; margin-bottom: 10px; }
.foot li { font-size: 14px; line-height: 2; color: var(--ink-2); }
.foot li a:hover { color: var(--sage-d); }
.foot-note { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; }
.foot-note a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 遮罩與購物袋抽屜 ---------- */
.scrim { position: fixed; inset: 0; background: rgba(40, 40, 35, .32); z-index: 50; opacity: 0; transition: opacity .25s; }
.scrim.on { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg); z-index: 60; display: flex; flex-direction: column;
  border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .26s ease; outline: none; }
.drawer.on { transform: none; }
.dr-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 16px 24px; border-bottom: 1px solid var(--line); }
.dr-head h2 { font: 500 18px/1.4 var(--zh); letter-spacing: .06em; }
.dr-head h2 span { font: 400 14px "Inter", sans-serif; color: var(--muted); }
.ibtn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; position: relative; }
.ibtn:hover { background: rgba(40, 40, 35, .05); }
.dr-list { flex: 1; overflow-y: auto; padding: 4px 24px; }
.cl { display: grid; grid-template-columns: 80px 1fr auto; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.cl-img { width: 80px; height: 60px; overflow: hidden; background: #ebe8e1; position: relative; }
.cl-img img { width: 100%; height: 100%; object-fit: cover; object-position: var(--fx); }
.cl-img.ph::after { content: ""; background-size: 40px auto; }
.cl-name { font: 500 14px/1.5 var(--zh); letter-spacing: .04em; }
.cl-price { font: 400 13px "Inter", sans-serif; color: var(--muted); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 4px; margin-top: 8px; }
.qty button { width: 44px; height: 36px; display: grid; place-items: center; }
.qty button:hover { background: rgba(40, 40, 35, .05); }
.qty output { min-width: 28px; text-align: center; font: 500 14px "Inter", sans-serif; }
.cl-end { text-align: right; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; }
.cl-end p { font: 500 14px "Inter", sans-serif; }
.del { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); min-height: 44px; padding: 0 2px; }
.del:hover { color: var(--ink); }
.dr-foot { padding: 18px 24px calc(22px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.sub { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.sub b { font: 600 18px "Inter", sans-serif; }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.btn { width: 100%; min-height: 48px; margin-top: 16px; background: var(--ink); color: #fff; border-radius: 4px; font-size: 15px; letter-spacing: .12em; }
.btn:hover { background: #3a3a33; }
.demo-note { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--sage); border-radius: 4px; background: rgba(133, 143, 129, .1); font-size: 13.5px; line-height: 1.7; }
.dr-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; color: var(--ink-2); }
.dr-empty img { width: 120px; opacity: .35; }
.bump { animation: pop .45s ease; }

/* 手機頂部列：桌機隱藏 */
.mbar { display: none; }

/* =========================================================
   平板與手機（< 1024px）：左側導覽改為抽屜
   ========================================================= */
@media (max-width: 1023px) {
  .mbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; height: 60px; padding: 0 8px;
    background: rgba(250, 249, 246, .96); border-bottom: 1px solid var(--line); }
  .mbrand { display: flex; align-items: center; gap: 6px; min-height: 44px; }
  .mbrand img { width: 24px; height: auto; }
  .mbrand span { font: 500 20px/1 var(--zh); letter-spacing: .04em; }
  .mbrand em { font: 500 10px/1 "Inter", sans-serif; letter-spacing: .24em; font-style: normal; margin-left: 4px; }
  .bagnum { position: absolute; top: 5px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--ink); color: #fff;
    font: 500 11px/18px "Inter", sans-serif; text-align: center; }
  .side { width: min(320px, 86vw); transform: translateX(-100%); visibility: hidden; transition: transform .26s ease, visibility 0s .26s; z-index: 60; }
  .side.on { transform: none; visibility: visible; transition: transform .26s ease; }
  .side-top { padding-top: 24px; }
  .side .side-x { display: inline-grid; position: absolute; right: 8px; top: 14px; }
  .logo { margin-left: 4px; }
  .logo-mark { width: 44px; }
  .search { margin-top: 28px; height: 46px; }
  .search input { font-size: 16px; }
  .side-mid { padding-top: 20px; }
  .subs { grid-template-columns: 1fr 1fr; row-gap: 0; }
  .subs a { font-size: 14px; line-height: 24px; padding: 10px 0; }
  .acc-body { padding-bottom: 12px; }
  .side-foot ul a { line-height: 44px; font-size: 14px; }
  .main { margin-left: 0; padding: 0 20px; }
  .topline { padding: 0 2px; height: 52px; font-size: 13px; }
  .topline a { font-size: 13px; }
  .hero-media { aspect-ratio: 16 / 9; }
  .hero-media > img:first-child { object-position: var(--ft); }
  .hero-card { left: 4%; top: 50%; transform: translateY(-50%); width: min(300px, 44%); min-height: 0; padding: 24px 22px 22px 24px; }
  .hero-card h1 { font-size: 27px; line-height: 40px; }
  .hero-card p { font-size: 14px; white-space: normal; }
  .hero-card .ulink { margin-top: 20px; }
  .hero-line, .hero-label { display: none; }
  .sec-head { padding: 0 2px; }
  .tabs { margin-left: 0; width: 100%; }
  .scenes, .brand, .foot { padding-left: 0; padding-right: 0; }
  .brand { padding: 48px 0; gap: 32px; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .tabs { margin-left: auto; width: auto; }
  .vline { margin: 0 18px; }
}

/* 手機（< 640px） */
@media (max-width: 639px) {
  .main { padding: 0 16px; }
  .topline { flex-direction: column; align-items: flex-start; justify-content: center; height: auto; padding: 12px 0 12px; gap: 2px; }
  .topline p { font-size: 14px; }
  .topline a { font-size: 12.5px; color: var(--sage-d); }
  .hero { margin: 0 -16px; }
  .hero-media { aspect-ratio: 6 / 5; }
  .hero-media > img:first-child { object-position: var(--fm); }
  .hero-card { position: relative; left: auto; top: auto; transform: none; width: auto; margin: 0; border: 0; border-bottom: 1px solid var(--line);
    border-radius: 0; padding: 22px 16px 26px; background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; overflow: hidden; }
  .hero-card h1 { font-size: 26px; line-height: 38px; letter-spacing: .06em; }
  .hero-card p { font-size: 14px; margin-top: 10px; white-space: normal; }
  .hero-card .ulink { margin-top: 18px; min-height: 44px; padding-bottom: 0; }
  .hero-line-m { display: block; position: absolute; right: 14px; bottom: 22px; width: 104px; height: auto; opacity: .3; pointer-events: none; }
  .products { padding-top: 30px; }
  .sec-head h2 { font-size: 24px; }
  .vline { height: 20px; margin: 0 14px; }
  .sec-head p { font-size: 14px; letter-spacing: .06em; }
  .tabs { gap: 10px; font-size: 15px; }
  .tabs button { min-width: 44px; }
  .grid { grid-template-columns: repeat(2, 1fr); column-gap: 12px; row-gap: 22px; margin-top: 10px; }
  .pimg { aspect-ratio: 1 / 1; }
  .pinfo { align-items: flex-start; padding: 8px 0 0 0; }
  .pinfo h3 { font-size: 14px; letter-spacing: .03em; }
  .price { font-size: 14px; }
  .add { margin: -4px -10px 0 0; }
  .add .pc { width: 24px; height: 24px; }
  .scenes { grid-template-columns: 1fr; gap: 36px; margin-top: 52px; }
  .scene.sm { margin-top: 0; }
  .scene.sm .scene-img { aspect-ratio: 4 / 3; }
  .brand { grid-template-columns: 1fr; margin-top: 56px; padding: 40px 0; }
  .brand-txt h2 { font-size: 22px; }
  .brand-img { aspect-ratio: 4 / 3; order: -1; }
  .brand-line { width: 150px; margin-top: 24px; }
  .foot { padding: 44px 0 28px; }
  .foot-grid { grid-template-columns: 1fr; gap: 26px; }
  .foot-note { flex-direction: column; }
  .cl { grid-template-columns: 64px 1fr auto; gap: 12px; }
  .cl-img { width: 64px; height: 52px; }
  .dr-list, .dr-foot { padding-left: 16px; padding-right: 16px; }
  .dr-head { padding-left: 16px; }
  .topline a { min-height: 44px; display: flex; align-items: center; margin: -10px 0; }
  .scene-txt .ulink, .foot .ulink { min-height: 44px; padding-bottom: 0; }
  .foot li a { display: inline-flex; align-items: center; min-height: 44px; }
  .foot li { line-height: 1.9; }
  .foot-note a { display: inline-flex; align-items: center; min-height: 44px; }
  .qty button { height: 44px; }
}

/* 平板寬度的商品網格：640–1023 維持三欄 */
@media (min-width: 640px) and (max-width: 1023px) {
  .grid { grid-template-columns: repeat(3, 1fr); column-gap: 12px; }
  .pinfo h3 { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
