/* =========================================================
   528商城首頁（528.com.tw）— 清爽的電商樣式
   白底、淺灰卡片、一個主色（綠）。想換顏色，改最上面這一區就好。
   商店頁（/shop/代號）用的是 style.css，跟這裡分開。
   ========================================================= */
:root {
  --bg: #ffffff;
  --bg-2: #f5f6f8;      /* 第二底色（區塊、搜尋框） */
  --card: #ffffff;
  --ink: #1d2125;       /* 主要文字 */
  --ink-2: #5b6470;     /* 次要文字 */
  --ink-3: #8a929c;     /* 小字 */
  --line: #e6e8eb;      /* 邊框線 */
  --brand: #0a8a4a;     /* 主色（綠） */
  --brand-d: #077038;
  --brand-l: #e8f6ee;   /* 很淡的綠 */
  --sale: #d93025;      /* 特價紅 */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 10px 28px -14px rgba(16, 24, 40, .22);
  --sans: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  --wrap: 1180px;
  --header-h: 68px;
}

/* ---------- 基本設定 ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.7; letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; text-wrap: pretty;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
section[id] { scroll-margin-top: calc(var(--header-h) + 12px); }
:focus-visible { outline: 3px solid rgba(10, 138, 74, .45); outline-offset: 2px; border-radius: 8px; }
.m-wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.m-skip {
  position: absolute; left: 16px; top: -999px; z-index: 100; padding: 10px 16px; border-radius: 8px;
  background: var(--ink); color: #fff; text-decoration: none;
}
.m-skip:focus { top: 12px; }

/* ---------- 按鈕 ---------- */
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 8px 24px; border: 1.5px solid var(--brand); border-radius: 999px;
  background: var(--brand); color: #fff; font-size: 16px; font-weight: 700; text-decoration: none;
  transition: background-color .2s, border-color .2s, color .2s;
}
.m-btn:hover { border-color: var(--brand-d); background: var(--brand-d); }
.m-btn-ghost { background: #fff; color: var(--brand); }
.m-btn-ghost:hover { background: var(--brand-l); color: var(--brand-d); }

/* ---------- 頁首：標誌、搜尋、選單 ---------- */
.m-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(8px); }
.m-header-in { display: flex; align-items: center; gap: 20px; min-height: var(--header-h); }
.m-logo { flex: none; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.m-logo span { font-size: 20px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.m-search {
  flex: 1; display: flex; align-items: center; gap: 8px; max-width: 560px; min-height: 44px; padding: 0 16px;
  border: 1.5px solid transparent; border-radius: 999px; background: var(--bg-2); color: var(--ink-3);
  transition: border-color .2s, background-color .2s;
}
.m-search:focus-within { border-color: var(--brand); background: #fff; }
.m-search svg { flex: none; width: 20px; height: 20px; }
.m-search input {
  flex: 1; min-width: 0; height: 42px; border: 0; outline: 0; background: transparent;
  color: var(--ink); font: inherit; font-size: 16px;
}
.m-search input::-webkit-search-cancel-button { cursor: pointer; }
.m-nav { display: flex; gap: 4px; margin-left: auto; }
.m-nav a { padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-weight: 700; text-decoration: none; white-space: nowrap; }
.m-nav a:hover { background: var(--bg-2); color: var(--ink); }

/* ---------- 大橫幅 ---------- */
.m-hero { padding-top: 24px; }
.m-banner {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); align-items: center; gap: 24px;
  min-height: 300px; padding: 44px 48px; border-radius: 24px;
  background: radial-gradient(120% 140% at 100% 0%, #d6f1e2 0%, rgba(214, 241, 226, 0) 55%), linear-gradient(120deg, #f2faf5, #e8f6ee);
}
.m-eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .24em; color: var(--brand); }
.m-banner h1 { margin: 10px 0 12px; font-size: clamp(32px, 4.6vw, 52px); font-weight: 900; line-height: 1.2; letter-spacing: .02em; }
.m-lead { max-width: 30em; font-size: 17px; color: var(--ink-2); }
.m-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
/* 右邊的小插圖：三張小小的商店卡片 */
.m-banner-art { position: relative; height: 220px; }
.m-mini {
  position: absolute; display: flex; flex-direction: column; gap: 8px; width: 150px; padding: 0 0 14px;
  overflow: hidden; border-radius: 16px; background: #fff; box-shadow: var(--shadow);
}
.m-mini i { display: block; height: 70px; margin-bottom: 4px; }
.m-mini b { display: block; height: 9px; margin: 0 14px; border-radius: 9px; background: #e9ecef; }
.m-mini b + b { width: 50%; }
.m-mini-1 { left: 4%; top: 30px; transform: rotate(-6deg); }
.m-mini-1 i { background: linear-gradient(120deg, #f7d9a8, #e9b670); }
.m-mini-2 { left: 34%; top: 0; z-index: 2; }
.m-mini-2 i { background: linear-gradient(120deg, #bfe6cf, #7fcca0); }
.m-mini-3 { left: 62%; top: 44px; transform: rotate(7deg); }
.m-mini-3 i { background: linear-gradient(120deg, #c9d8f5, #93b1ea); }

/* ---------- 區塊共用 ---------- */
.m-section { padding: 48px 0 8px; }
.m-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 20px; }
.m-head h2 { font-size: 26px; font-weight: 900; letter-spacing: .02em; }
.m-head p { color: var(--ink-3); font-size: 15px; }

/* ---------- 精選商店 ---------- */
.m-shops { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.m-shop {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  color: inherit; text-decoration: none; transition: transform .25s, box-shadow .25s, border-color .25s;
}
.m-shop:hover { transform: translateY(-3px); border-color: transparent; box-shadow: var(--shadow); }
/* 封面：沒放照片（或照片還沒載到）就是淡淡的綠 */
.m-shop-cover { position: relative; aspect-ratio: 16 / 7; background: radial-gradient(90% 120% at 100% 0%, #d6f1e2, rgba(214, 241, 226, 0) 60%), linear-gradient(120deg, #f3faf6, #e3f3ea); }
.m-shop-cover > img:not(.m-shop-logo) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.m-shop-logo {
  position: absolute; left: 16px; bottom: -26px; width: 56px; height: 56px; border-radius: 50%;
  border: 3px solid #fff; background: #fff; object-fit: cover; box-shadow: 0 4px 12px -4px rgba(16, 24, 40, .3);
}
.m-initial { display: grid; place-items: center; background: var(--brand-l); color: var(--brand-d); font-size: 22px; font-weight: 900; }
.m-shop-body { flex: 1; display: flex; flex-direction: column; padding: 34px 18px 18px; }
.m-shop-body h3 { font-size: 19px; font-weight: 800; line-height: 1.45; }
.m-shop-tag { margin-top: 2px; font-size: 13.5px; font-weight: 700; color: var(--brand); }
.m-shop-intro {
  margin-top: 8px; font-size: 14.5px; line-height: 1.7; color: var(--ink-2);
  display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.m-shop-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 14px; }
.m-shop-count { font-size: 13.5px; color: var(--ink-3); }
.m-shop-go { margin-top: auto; padding-top: 14px; font-size: 14.5px; font-weight: 700; color: var(--brand); }
.m-shop-foot .m-shop-go { margin: 0; padding: 0; }

/* ---------- 最新上架 ---------- */
.m-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 16px; }
.m-product {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  color: inherit; text-decoration: none; transition: transform .25s, box-shadow .25s, border-color .25s;
}
.m-product:hover { transform: translateY(-2px); border-color: transparent; box-shadow: var(--shadow); }
.m-product-photo { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--bg-2); }
.m-product-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.m-product:hover .m-product-photo img { transform: scale(1.04); }
.m-product-photo .m-initial { position: absolute; inset: 0; font-size: 40px; }
.m-product-sale {
  position: absolute; top: 8px; left: 8px; padding: 1px 9px; border-radius: 999px;
  background: var(--sale); color: #fff; font-size: 12.5px; font-weight: 700;
}
.m-product-info { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.m-product-info h3 {
  font-size: 15px; font-weight: 700; line-height: 1.5;
  display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.m-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-weight: 800; }
.m-price .is-sale { color: var(--sale); }
.m-price s { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.m-price .is-ask { color: var(--ink-3); font-size: 13.5px; font-weight: 600; }
.m-product-shop { margin-top: auto; font-size: 12.5px; color: var(--ink-3); }

.m-noresult { padding: 40px 0 8px; color: var(--ink-2); text-align: center; }

/* ---------- 想開店 ---------- */
.m-join { margin-top: 56px; padding: 40px 0; background: var(--bg-2); }
.m-join-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 32px; }
.m-join h2 { font-size: 24px; font-weight: 900; }
.m-join p { margin-top: 4px; color: var(--ink-2); }

/* ---------- 頁尾 ---------- */
.m-footer { margin-top: 56px; padding: 28px 0 40px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 14px; }
.m-join + .m-footer, main:has(> .m-join:not([hidden])) + .m-footer { margin-top: 0; }
.m-footer-in { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.m-footer .m-logo span { font-size: 17px; }
.m-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.m-footer nav a { color: var(--ink-2); text-decoration: none; }
.m-footer nav a:hover { color: var(--brand); text-decoration: underline; }
.m-footer p { margin-left: auto; }

/* ---------- 手機、平板 ---------- */
@media (max-width: 860px) {
  .m-banner { grid-template-columns: minmax(0, 1fr); padding: 32px 24px; }
  .m-banner-art { display: none; }
  .m-nav a:not(:first-child) { display: none; }
}
@media (max-width: 640px) {
  :root { --header-h: 112px; }
  .m-header-in { flex-wrap: wrap; gap: 8px 12px; padding: 10px 0; }
  .m-search { order: 3; flex: 1 1 100%; max-width: none; }
  .m-hero { padding-top: 14px; }
  .m-banner { min-height: 0; padding: 28px 20px; border-radius: 18px; }
  .m-lead { font-size: 16px; }
  .m-actions .m-btn { flex: 1 1 auto; }
  .m-section { padding-top: 36px; }
  .m-head h2 { font-size: 22px; }
  .m-shops { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .m-shop-cover { aspect-ratio: 16 / 5; }
  .m-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .m-product-info { padding: 8px 10px 10px; }
  .m-join-in .m-btn { flex: 1 1 100%; }
  .m-footer p { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .m-shop, .m-product, .m-product-photo img { transition: none; }
}
