/* shop 頁面樣式 — R13「金漆濃」藝術總監重排。
   賣場＝結緣品，不是電商：結緣/隨喜語氣、暖白面板卡、商品照為主角、
   價格清楚不喧嘩（墨色粗體，不用紅色價格標）、觸控 ≥44px。
   契約面（shop.js 渲染/查詢的 class 與 id）一律保留：series-header、product-card、
   p-img、p-info、p-title、p-price、p-desc、p-link、variant-pills、variant-pill、
   add-box、qty-in、add-btn、cat-btn(.active)、floating-cart、cart-○、checkout-○、
   btn-submit、store-lookup-○。色彩全走 theme.css token（色彩棘輪把關）；
   唯一硬編＝LINE 品牌綠（外部品牌色，不入 token）。 */

/* === 頁面殼：米宣紙底＋頂部一抹金暈（JS 驗登入後才顯示） === */
#shopping-section {
    display: none;
    min-height: 100vh;
    padding: clamp(64px, 8vw, 110px) 16px 120px;
    background:
        radial-gradient(ellipse at 50% 0%, var(--c-231-201-133-a18), transparent 46%),
        var(--cream-site);
    color: var(--ink);
}

/* === 頁首：一屏一事——「這裡是結緣品」 === */
.shop-hero {
    max-width: var(--content-width);
    margin: 0 auto clamp(48px, 6vw, 80px);
    text-align: center;
}
.shop-hero__eyebrow {
    margin: 0 0 14px;
    font-size: 0.9375rem;
    letter-spacing: 0.3em;
    color: var(--gold-deep);
}
.shop-hero__title {
    position: relative;
    margin: 0 0 26px;
    padding-bottom: 18px;
    font-family: var(--font-brand);
    font-size: clamp(2.5rem, 4vw, 3.25rem);
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1.3;
    color: var(--ink);
}
.shop-hero__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    border-radius: var(--radius-2);
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.shop-hero__lede {
    max-width: 34em;
    margin: 0 auto;
    font-size: 1.0625rem;
    line-height: 1.9;
    color: var(--ink-soft);
}

/* === 訂購流程帶：安靜的四步（資訊在前，不搶商品的戲） === */
.shop-instructions {
    max-width: 1100px;
    margin: 0 auto clamp(56px, 7vw, 90px);
    padding: clamp(24px, 4vw, 40px);
    background: var(--white-warm);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}
.instruction-header { text-align: center; margin-bottom: 30px; }
.instruction-header h2 {
    margin: 0 0 12px;
    font-family: var(--font-brand);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--gold-deep);
}
.shipping-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-999);
    background: var(--gold-wash);
    color: var(--ink-soft);
    font-size: 0.875rem;
}
.process-steps { display: flex; justify-content: space-between; align-items: flex-start; padding: 0; margin: 0; list-style: none; position: relative; }
.process-steps::before {
    content: '';
    position: absolute;
    top: 40px; left: 50px; right: 50px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}
.step-item { flex: 1; text-align: center; position: relative; z-index: 1; padding: 0 10px; }
.step-icon-box {
    width: 80px; height: 80px;
    margin: 0 auto 15px;
    background: var(--white-warm);
    border: 2px solid var(--gold-line);
    border-radius: var(--radius-full);
    display: flex; justify-content: center; align-items: center;
    font-size: 2rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
}
.step-item:hover .step-icon-box { transform: translateY(-3px); border-color: var(--gold); }
.step-icon-box--pay { border-color: var(--cta-red); }
.step-title { display: block; margin-bottom: 8px; font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.step-title--pay { color: var(--cta-red); }
.step-desc { display: block; font-size: 0.875rem; line-height: 1.6; color: var(--ink-soft); }
.icon-custom { width: 45px; height: auto; }
.highlight-text { color: var(--cta-red); font-weight: 700; }

/* === 分類：金線膠囊（觸控 ≥44px；選中＝廟金底） === */
.category-nav { display: flex; justify-content: center; gap: 12px; margin-bottom: 34px; flex-wrap: wrap; }
.cat-btn {
    min-height: 44px;
    padding: 10px 22px;
    border: 1.5px solid var(--gold-line);
    border-radius: var(--radius-999);
    background: var(--white-warm);
    color: var(--ink-soft);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease;
}
.cat-btn:hover { background: var(--gold-pale); border-color: var(--gold); color: var(--gold-rich); }
.cat-btn.active {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--white-warm);
    box-shadow: var(--shadow-gold);
}

/* === 搜尋（flag shop_search） === */
.shop-search { max-width: 420px; margin: 0 auto 24px; padding: 0 8px; }
#shop-search-input {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-999);
    background: var(--white-warm);
    color: var(--ink);
    font-size: 1rem;
}
#shop-search-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }

/* === 商品列表：真實商品照為主角、暖白面板卡 === */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto 100px;
}
.series-header {
    grid-column: 1 / -1;
    margin: 40px 0 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gold-line);
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-brand);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--gold-deep);
}
.series-header:first-child { margin-top: 0; }
.product-card {
    display: flex; flex-direction: column;
    overflow: hidden;
    background: var(--white-warm);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.p-img { display: block; width: 100%; height: 230px; object-fit: cover; background: var(--cream-warm); }
.p-info { padding: 18px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.p-title { margin-bottom: 6px; font-size: 1.125rem; font-weight: 700; line-height: 1.45; color: var(--ink); }
.p-price { margin-bottom: 8px; font-size: 1.0625rem; font-weight: 700; color: var(--ink); }
.p-desc { flex: 1; margin-bottom: 16px; font-size: 0.875rem; line-height: 1.6; color: var(--ink-gray); white-space: pre-wrap; }

/* 商品圖＋品名連詳情頁（flag product_page）；連結不改變外觀（純包一層 <a>）。 */
.p-link { text-decoration: none; color: inherit; display: block; }
.p-title a, a.p-link .p-title { color: inherit; }
/* 規格膠囊（沿用 theme.css 共用 .filter-pill）在卡內縮小、左對齊、觸控友善。 */
.product-card .variant-pills { justify-content: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; overflow-x: visible; }
.variant-pill { min-height: 44px; padding: 8px 16px; font-size: 0.8125rem; letter-spacing: 0; }
.add-box { display: flex; gap: 8px; margin-top: auto; }
.qty-in {
    width: 64px; min-height: 44px;
    text-align: center;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-8);
    background: var(--white-warm);
    color: var(--ink);
    font-size: 1rem;
}
.add-btn {
    flex: 1;
    min-height: 44px;
    background: var(--gold);
    color: var(--white-warm);
    border: none;
    border-radius: var(--radius-15);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}
.add-btn:hover { background: var(--gold-rich); }
.add-btn:active { transform: scale(0.97); }

/* === 懸浮購物車（金＝行動） === */
.floating-cart {
    position: fixed; bottom: 100px; right: 20px;
    width: 65px; height: 65px;
    display: flex; justify-content: center; align-items: center;
    background: var(--gold);
    border: 2px solid var(--gold-bright);
    color: var(--white-warm);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-gold);
    cursor: pointer; z-index: 990;
    transition: transform 0.2s ease;
    box-sizing: border-box;
}
.floating-cart:hover { transform: translateY(-2px); }
.floating-cart__icon { font-size: 1.5rem; }
/* 加入購物車回饋：安靜的金脈動（不彈跳；reduced-motion 於檔尾關閉） */
@keyframes cart-pulse { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
.floating-cart.animating { animation: cart-pulse 0.45s var(--ease-out); }
.cart-count {
    position: absolute; top: -4px; right: -4px;
    width: 24px; height: 24px;
    display: flex; justify-content: center; align-items: center;
    background: var(--cta-red);
    color: var(--white);
    border: 2px solid var(--white-warm);
    border-radius: var(--radius-full);
    font-size: 0.75rem; font-weight: 700;
    box-sizing: border-box;
}

/* === 購物車側欄 === */
.cart-overlay { display: none; position: fixed; inset: 0; background: var(--c-black-a50); z-index: 1000; justify-content: flex-end; }
.cart-overlay.open { display: flex; }
.cart-sidebar {
    width: 100%; max-width: 400px; height: 100%;
    padding: 20px;
    display: flex; flex-direction: column;
    background: var(--white-warm);
    transform: translateX(100%);
    transition: transform 0.3s var(--ease-out);
    box-sizing: border-box;
}
.cart-overlay.open .cart-sidebar { transform: translateX(0); }
.cart-head {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--gold-border);
    padding-bottom: 10px;
}
.cart-head h3 { margin: 0; font-size: 1.25rem; letter-spacing: 0.1em; color: var(--ink); }
.cart-close {
    width: 44px; height: 44px;
    background: none; border: none;
    font-size: 1.5rem; line-height: 1;
    color: var(--ink-gray);
    cursor: pointer;
}
.cart-items { flex: 1; overflow-y: auto; margin: 15px 0; }
.cart-item { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed var(--gold-border); padding: 12px 0; }
.cart-qty-ctrl { display: flex; align-items: center; gap: 8px; }
.c-q-btn {
    width: 44px; height: 44px; padding: 0;
    display: flex; justify-content: center; align-items: center;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-full);
    background: var(--white-warm);
    color: var(--ink-soft);
    font-size: 1.125rem;
    cursor: pointer;
}
.c-q-btn:hover { border-color: var(--gold); color: var(--gold-rich); }
.cart-foot { border-top: 1px solid var(--gold-border); padding-top: 15px; }
.cart-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.875rem; color: var(--ink-soft); }
.cart-row--total { margin: 4px 0 0; font-size: 1.25rem; font-weight: 700; color: var(--ink); }

/* === 結帳視窗 === */
.checkout-modal { display: none; position: fixed; inset: 0; background: var(--c-black-a60); z-index: 1100; justify-content: center; align-items: center; }
.checkout-box {
    position: relative;
    width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto;
    padding: 28px 24px;
    background: var(--white-warm);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.checkout-box--success { text-align: center; }
.checkout-title { margin: 0 0 16px; text-align: center; font-size: 1.4rem; letter-spacing: 0.1em; color: var(--gold-deep); }
.checkout-stepper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 0 0 16px;
}
.checkout-step {
    min-height: 44px;
    padding: 6px 8px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-8);
    background: var(--cream);
    color: var(--ink-gray);
    text-align: center;
    font-size: 0.8125rem; font-weight: 700; line-height: 1.25;
    box-sizing: border-box;
}
.checkout-step.is-active {
    border-color: var(--gold);
    background: var(--gold-pale);
    color: var(--ink);
}
.checkout-step.is-complete {
    border-color: var(--matsuba);
    background: var(--cream-warm);
    color: var(--matsuba);
}
#checkout-summary {
    margin-bottom: 15px;
    padding: 12px 14px;
    background: var(--cream);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-8);
}

/* 優惠碼（flag coupons） */
#coupon-box { display: flex; gap: 8px; margin-bottom: 6px; }
#coupon-code {
    flex: 1; min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-8);
    background: var(--white-warm);
    color: var(--ink);
    font-size: 1rem;
    text-transform: uppercase;
    box-sizing: border-box;
}
#coupon-apply-btn { width: auto; padding: 8px 18px; margin: 0; }
#coupon-msg { margin: 0 0 14px; font-size: 0.8125rem; min-height: 1.1em; }

/* 匯款提醒：香火紅講重點，不用滿版大紅 */
.shop-notice {
    margin: 0 0 14px;
    padding: 10px 12px;
    background: var(--cta-cream);
    border: 1px dashed var(--cta-red);
    border-radius: var(--radius-8);
    color: var(--cta-red-deep);
    font-size: 0.875rem; font-weight: 700;
    text-align: center;
}

/* 表單 */
.form-group { margin-bottom: 14px; }
.form-group > label { display: block; margin-bottom: 6px; font-weight: 700; color: var(--ink); }
.form-required { color: var(--cta-red); }
.form-control {
    width: 100%; min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-8);
    background: var(--white-warm);
    color: var(--ink);
    font-size: 1rem;
    box-sizing: border-box;
}
.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.form-note { margin-top: 6px; font-size: 0.8125rem; line-height: 1.6; color: var(--cta-red); }
.form-hint { margin-top: 5px; font-size: 0.75rem; color: var(--ink-gray); }

.form-group--shipping {
    padding: 12px;
    background: var(--cream-warm);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-8);
}
.shipping-option { display: flex; gap: 12px; margin-top: 8px; }
.shipping-label {
    flex: 1;
    min-height: 44px;
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-8);
    background: var(--white-warm);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
}
.shipping-label:hover { border-color: var(--gold); }
input[type="radio"]:checked + span { font-weight: 700; color: var(--gold-deep); }

.store-label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.store-map-link { font-size: 0.8125rem; font-weight: 700; color: var(--gold-deep); text-decoration: underline; }
.store-lookup-row { display: flex; gap: 8px; align-items: stretch; }
.store-lookup-row .form-control { flex: 1; min-width: 0; }
.store-lookup-btn {
    min-height: 44px;
    padding: 0 14px;
    border: none;
    border-radius: var(--radius-8);
    background: var(--ink-soft);
    color: var(--white-warm);
    font-size: 0.875rem; font-weight: 700;
    cursor: pointer; white-space: nowrap;
}
.store-lookup-btn:hover { background: var(--ink); }
.store-lookup-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.store-lookup-result {
    margin-top: 8px;
    padding: 9px 10px;
    border-radius: var(--radius-8);
    font-size: 0.8125rem; line-height: 1.5;
    background: var(--cream);
    border: 1px solid var(--gold-border);
    color: var(--ink-soft);
}
.store-lookup-result.ok { background: var(--cream-warm); border-color: var(--matsuba); color: var(--matsuba); }
.store-lookup-result.error { background: var(--c-error-bg); border-color: var(--c-error); color: var(--cta-red); }

.form-group--last5 {
    margin-top: 15px;
    padding: 12px;
    background: var(--c-fdf6e9);
    border: 1px dashed var(--gold);
    border-radius: var(--radius-8);
}
.form-group--last5 > label { color: var(--gold-deep); }
.form-group--last5 .form-control { border-color: var(--gold); }

/* .btn-submit：本頁定義收斂到 token 寫法（已知債務：多頁各自定義；此處只治本頁，不動他頁） */
.btn-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 10px;
    padding: 12px;
    background: var(--gold);
    color: var(--white-warm);
    border: none;
    border-radius: var(--radius-15);
    font-size: 1.125rem; font-weight: 700; letter-spacing: 0.08em;
    cursor: pointer;
    box-shadow: var(--shadow-gold);
    transition: background 0.2s ease;
}
.btn-submit:hover { background: var(--gold-rich); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.checkout-back {
    width: 100%;
    min-height: 44px;
    margin-top: 10px;
    padding: 10px;
    background: transparent;
    color: var(--ink-soft);
    border: 1px solid var(--gold-line);
    border-radius: var(--radius-15);
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.checkout-back:hover { border-color: var(--gold); color: var(--gold-rich); }

/* JS 動態注入的金額列（renderCheckoutSummary） */
.price-summary { background: var(--cream); padding: 15px; border-radius: var(--radius-8); margin-bottom: 15px; }
.price-row { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 0.9375rem; color: var(--ink-soft); }

/* === 訂單完成視窗 === */
.success-title { margin: 0 0 6px; letter-spacing: 0.1em; color: var(--gold-deep); }
.success-bank-box {
    margin: 20px 0;
    padding: 16px;
    background: var(--cream-warm);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-8);
    text-align: left;
}
.success-bank-box p { margin: 0 0 8px; }
.success-total { margin-top: 10px; font-size: 1rem; font-weight: 700; color: var(--cta-red); }
.success-deadline { margin-top: 15px; font-size: 0.875rem; font-weight: 700; color: var(--cta-red); }
.success-hint { font-size: 0.8125rem; color: var(--ink-soft); }

/* === LINE 登入視窗 === */
.modal-overlay {
    position: fixed; inset: 0;
    background: var(--c-black-a50);
    z-index: 9999;
    justify-content: center; align-items: center;
}
.shop-login__box {
    position: relative;
    width: 90%; max-width: 400px;
    padding: 40px 24px;
    background: var(--white-warm);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.shop-login__close {
    position: absolute; top: 6px; right: 6px;
    width: 44px; height: 44px;
    background: none; border: none;
    color: var(--ink-gray);
    font-size: 1.5rem; line-height: 1;
    cursor: pointer;
}
.shop-login__title { margin: 0 0 10px; font-size: 1.25rem; letter-spacing: 0.1em; color: var(--gold-deep); }
.shop-login__text { margin: 0 0 25px; line-height: 1.8; color: var(--ink-soft); }
/* LINE 登入鈕版位（T5 綠金規則）：外觀＝components.css .btn-line 單一真相（綠底白字）。
   ⚠️ 只准放版位——shop.css 在 components.css 之後載入，同權重會蓋掉綠底。 */
.shop-login__line-btn {
    display: inline-flex;
}

/* === 手機版（≤768：大標降階、雙欄卡、流程改直排） === */
@media (max-width: 768px) {
    #shopping-section { padding-top: 48px; }
    .shop-hero__title { font-size: 2rem; }
    .shop-hero__lede { font-size: 1rem; }
    .process-steps { flex-direction: column; gap: 20px; align-items: center; }
    .process-steps::before { width: 1px; height: calc(100% - 80px); top: 40px; left: 29px; right: auto; }
    .step-item { display: flex; align-items: center; text-align: left; width: 100%; gap: 15px; padding-right: 0; background: var(--white-warm); }
    .step-icon-box { margin: 0; width: 60px; height: 60px; font-size: 1.5rem; flex-shrink: 0; }
    .icon-custom { width: 30px; }
    .shop-instructions { padding: 20px 15px; }
    .instruction-header h2 { font-size: 1.25rem; }
    .cat-btn { font-size: 0.875rem; padding: 8px 16px; }
    .products-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .p-img { height: 160px; }
    .p-info { padding: 12px 10px; }
    .p-title { font-size: 0.9375rem; }
    .p-price { font-size: 0.9375rem; }
    .p-desc { display: none; }
    .checkout-stepper { gap: 6px; }
    .checkout-step { font-size: 0.75rem; padding: 6px 4px; }
    .add-box { flex-direction: column; gap: 6px; }
    .qty-in { width: 100%; }
    .shipping-option { flex-direction: column; }
    .store-lookup-row { flex-direction: column; }
    .store-lookup-btn { padding: 10px 14px; }
}

/* === 動效安全網：reduced-motion 全關（含 cart-bounce、hover 位移、側欄滑入） === */
@media (prefers-reduced-motion: reduce) {
    .step-item:hover .step-icon-box,
    .product-card:hover,
    .floating-cart:hover,
    .add-btn:active { transform: none; }
    .floating-cart.animating { animation: none; }
    .cart-sidebar { transition: none; transform: none; }
    .product-card,
    .step-icon-box,
    .cat-btn,
    .add-btn,
    .btn-submit,
    .checkout-back,
    .shipping-label { transition: none; }
}
