/* =====================================================================
   商品展示網站 — 全站樣式（獨立檔案，日後統一修改）
   架構：變數 → 基底 → 容器 → 頁首/導覽 → 區塊 → 卡片 → 詳情頁
         → 按鈕 → 頁尾 → 響應式
   ===================================================================== */

/* ---------- 設計變數 ---------- */
:root {
    --c-primary: #1f6f54;
    --c-primary-dark: #16543f;
    --c-accent: #e8f3ef;
    --c-text: #1f2937;
    --c-text-muted: #6b7280;
    --c-border: #e5e7eb;
    --c-bg: #ffffff;
    --c-bg-alt: #f6f8f7;
    --c-whatsapp: #25d366;
    --c-wechat: #07c160;
    --c-email: #2b6cb0;
    --radius: 12px;
    --shadow: 0 6px 20px rgba(17, 24, 39, .08);
    --container: 1200px;
    --header-h: 72px;
}

/* ---------- 基底 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 180px; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK",
        "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
    color: var(--c-text);
    background: var(--c-bg);
    line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.3; margin: 0 0 .6em; }

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--c-primary);
    color: #fff;
    padding: 10px 16px;
    z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- 按鈕 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none !important;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn--primary { background: var(--c-primary); color: #fff; }
.btn--primary:hover { background: var(--c-primary-dark); }
.btn--whatsapp { background: var(--c-whatsapp); color: #fff; }
.btn--wechat { background: var(--c-wechat); color: #fff; }
.btn--email { background: var(--c-email); color: #fff; }

/* ---------- 頁首 ---------- */
.site-header { background: #fff; box-shadow: 0 1px 0 var(--c-border); position: sticky; top: 0; z-index: 50; }

.topbar { background: var(--c-bg-alt); font-size: 13px; }
.topbar__inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 6px; padding-bottom: 6px; }
.topbar__contact { display: flex; gap: 18px; flex-wrap: wrap; }
.topbar__contact a { color: var(--c-text-muted); }
.topbar__lang a { font-weight: 600; color: var(--c-primary); }

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-top: 16px;
    padding-bottom: 16px;
    flex-wrap: wrap;
}

.brand { display: flex; flex-direction: column; }
.brand__name { font-size: 22px; font-weight: 800; color: var(--c-text); }
.brand__tagline { font-size: 13px; color: var(--c-text-muted); }

.search { display: flex; flex: 0 1 420px; }
.search input[type="search"] {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid var(--c-border);
    border-right: 0;
    border-radius: 10px 0 0 10px;
    font-size: 15px;
    outline: none;
}
.search input[type="search"]:focus { border-color: var(--c-primary); }
.search button {
    padding: 11px 20px;
    border: 0;
    border-radius: 0 10px 10px 0;
    background: var(--c-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

/* 主選單 */
.main-nav { border-top: 1px solid var(--c-border); }
.nav-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav-menu > li { position: relative; }
.nav-menu > li > a {
    display: block;
    padding: 14px 16px;
    color: var(--c-text);
    font-weight: 600;
}
.nav-menu > li > a:hover,
.nav-menu > li:hover > a { color: var(--c-primary); text-decoration: none; }

.sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    list-style: none;
    margin: 0;
    padding: 8px 0;
    display: none;
    z-index: 60;
}
.has-sub:hover .sub-menu,
.has-sub:focus-within .sub-menu { display: block; }
.sub-menu a { display: block; padding: 10px 18px; color: var(--c-text); }
.sub-menu a:hover { background: var(--c-accent); color: var(--c-primary); text-decoration: none; }

.nav-toggle { display: none; }

/* ---------- Hero Banner ---------- */
.hero {
    background-size: cover;
    background-position: center;
    background-color: var(--c-accent);
    color: var(--c-text);
}
.hero__inner {
    padding: 80px 20px;
    max-width: 720px;
}
.hero__title { font-size: clamp(28px, 4vw, 42px); font-weight: 800; }
.hero__subtitle { font-size: clamp(15px, 2vw, 18px); color: var(--c-text-muted); margin-bottom: 28px; }

/* ---------- 提示列 ---------- */
.notice-strip { background: var(--c-accent); }
.notice-strip__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
    font-weight: 600;
}

/* ---------- 區塊 ---------- */
.section { padding: 56px 0; }
.section--alt { background: var(--c-bg-alt); }
.section__title { font-size: 26px; margin-bottom: 28px; }
.page-title { font-size: 30px; margin-bottom: 4px; }
.page-title-en, .page-title--query { color: var(--c-text-muted); font-weight: 400; }
.page-desc { color: var(--c-text-muted); max-width: 720px; }
.page-title-en { font-size: 18px; }
.block-title { font-size: 22px; margin: 36px 0 18px; }

.narrow { max-width: 880px; }

/* 麵包屑 */
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; font-size: 14px; }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: var(--c-text-muted); }

/* ---------- 分類卡片 ---------- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.cat-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}
.cat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.cat-card__media { display: block; aspect-ratio: 4 / 3; background: var(--c-bg-alt); }
.cat-card__media img { width: 100%; height: 100%; object-fit: cover; }
.cat-card__body { padding: 18px; }
.cat-card__title { font-size: 18px; margin-bottom: 4px; }
.cat-card__title-en { color: var(--c-text-muted); font-size: 14px; margin: 0 0 12px; }
.cat-card__chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cat-card__chips a {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--c-bg-alt);
    font-size: 13px;
    color: var(--c-text);
}
.cat-card__chips a:hover { background: var(--c-accent); color: var(--c-primary); text-decoration: none; }

/* ---------- 產品卡片 ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 24px;
}
.product-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
    display: flex;
    flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card__media { display: block; aspect-ratio: 1 / 1; background: var(--c-bg-alt); }
.product-card__media img { width: 100%; height: 100%; object-fit: cover; }
.product-card__body { padding: 16px; }
.product-card__model { font-size: 13px; color: var(--c-text-muted); margin: 0 0 6px; letter-spacing: .03em; }
.product-card__name { font-size: 16px; margin: 0 0 4px; }
.product-card__name a { color: var(--c-text); }
.product-card__name-en { font-size: 13px; color: var(--c-text-muted); margin: 0 0 6px; }
.product-card__cat { font-size: 13px; margin: 0; }

.result-count { color: var(--c-text-muted); margin-bottom: 18px; }

/* ---------- 產品詳情頁（無邊框式） ---------- */
.product-detail { padding-top: 24px; }
.product-detail__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

.gallery { width: 100%; min-width: 0; }

/* 主圖舞台：固定正方形畫布，圖片完整置中顯示，不裁切 */
.gallery__main {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--c-bg-alt);
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery__main img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    padding: 16px;
}

/* 縮圖列 */
.gallery__thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery__thumb {
    width: 84px;
    height: 84px;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--c-bg-alt);
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.gallery__thumb.is-active { border-color: var(--c-primary); }

.product-detail__model { color: var(--c-text-muted); font-weight: 600; }
.product-detail__name { font-size: 28px; margin: 6px 0; }
.product-detail__name-en { color: var(--c-text-muted); font-size: 17px; margin: 0 0 12px; }
.product-detail__cat { margin-bottom: 20px; }

.specs { margin: 24px 0; }
.specs__title { font-size: 18px; margin-bottom: 12px; }
.specs__table { width: 100%; border-collapse: collapse; }
.specs__table th, .specs__table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--c-border);
    vertical-align: top;
}
.specs__table th { width: 38%; color: var(--c-text-muted); font-weight: 600; }

.product-detail__desc p { color: var(--c-text); }

.inquiry-box {
    margin-top: 28px;
    padding: 22px;
    border-radius: var(--radius);
    background: var(--c-bg-alt);
}
.inquiry-box--center { text-align: center; }
.inquiry-box__title { font-weight: 700; margin: 0 0 14px; }
.inquiry-box__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.inquiry-box--center .inquiry-box__actions { justify-content: center; }

.related { margin-top: 56px; }

/* ---------- 交易說明頁 ---------- */
.payment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.payment-card {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 24px;
    background: #fff;
}
.payment-card__icon { font-size: 30px; margin-bottom: 10px; }
.payment-card h3 { margin-bottom: 8px; }
.payment-card p { color: var(--c-text-muted); margin: 0; }

.rules-list { padding-left: 22px; }
.rules-list li { margin-bottom: 12px; }

.footer-contact { list-style: none; padding: 0; margin: 12px 0; }
.footer-contact li { margin-bottom: 8px; }
.footer-contact--inline { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }

/* ---------- 狀態 ---------- */
.empty-state, .empty-text { color: var(--c-text-muted); }
.empty-state { padding: 40px 0; text-align: center; }

/* ---------- 頁尾 ---------- */
.site-footer { background: #111827; color: #d1d5db; margin-top: 56px; }
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px;
    padding-top: 48px;
    padding-bottom: 32px;
}
.footer-col h3 { color: #fff; font-size: 16px; margin-bottom: 14px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: #d1d5db; }
.footer-brand { font-size: 18px; font-weight: 700; color: #fff; }
.footer-payment-note { color: var(--c-accent); font-size: 14px; }
.footer-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.footer-bottom { border-top: 1px solid #374151; padding: 16px 0; font-size: 13px; color: #9ca3af; }

/* ---------- 響應式 ---------- */
@media (max-width: 900px) {
    .product-detail__grid { grid-template-columns: 1fr; gap: 28px; }
    .gallery__thumb { width: 76px; height: 76px; }
}

@media (max-width: 768px) {
    .header-inner { flex-direction: column; align-items: stretch; }
    .search { flex: 1 1 auto; }

    .nav-toggle {
        display: inline-flex;
        flex-direction: column;
        gap: 5px;
        background: none;
        border: 0;
        padding: 14px 0;
        cursor: pointer;
    }
    .nav-toggle span { width: 24px; height: 2px; background: var(--c-text); }

    .nav-menu {
        display: none;
        flex-direction: column;
        padding-bottom: 14px;
    }
    .nav-menu.is-open { display: flex; }
    .sub-menu {
        position: static;
        box-shadow: none;
        border: 0;
        padding-left: 16px;
        display: block;
    }
    .has-sub .sub-menu { display: none; }
    .has-sub.is-open .sub-menu { display: block; }

    .hero__inner { padding: 56px 20px; }
    .section { padding: 40px 0; }

    .product-detail { padding-top: 16px; }
    .gallery__main img { padding: 10px; }
    .gallery__thumbs { gap: 8px; margin-top: 10px; }
    .gallery__thumb { width: 64px; height: 64px; border-radius: 8px; }
    .product-detail__name { font-size: 22px; }
}

/* 產品詳情頁響應式圖片修正 */
.product-single{
    margin-top:30px;
}
.product-row{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:40px;
    align-items: start;
}
.product-gallery {
    width: 100%;
}
.product-main-img-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}
.product-main-img-wrap img.main-photo {
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.product-thumbs {
    display: flex;
    gap:10px;
    flex-wrap: wrap;
    margin-top:14px;
}
.product-thumbs img {
    width:72px;
    height:72px;
    object-fit: contain;
    border:1px solid #eee;
    cursor: pointer;
    background:#fff;
}
.product-thumbs img.active {
    border-color:#222;
}
.product-info h1{
    font-size:28px;
    margin:0 0 8px;
}
.product-subtitle{
    color:#666;
    margin-bottom:16px;
}
.product-meta p{
    margin:6px 0;
}
.product-spec h3, .product-desc h3{
    margin:20px 0 8px;
    font-size:18px;
}
.inquiry-box{
    background:#f5f7f7;
    padding:20px;
    border-radius:8px;
    margin-top:24px;
}
.inquiry-buttons{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin-top:12px;
}
.btn{
    padding:10px 18px;
    border-radius:6px;
    color:#fff;
    text-decoration:none;
    border:none;
}
.btn.whatsapp{background:#25D366;}
.btn.wechat{background:#07C160;}
.btn.email{background:#2b7ccd;}

/* 平板 */
@media (max-width: 992px) {
    .product-row{
        grid-template-columns:1fr;
    }
    .product-main-img-wrap img.main-photo {
        max-height: 360px;
    }
}
/* 手機 */
@media (max-width: 768px) {
    .product-single{margin-top:20px;}
    .product-main-img-wrap img.main-photo {
        max-height: 300px;
    }
    .product-thumbs img {
        width:60px;
        height:60px;
    }
    .product-info h1{font-size:22px;}
}
/* ===== 產品單頁 響應式修正 ===== */
.product-single{
    margin-top:32px;
}
.product-row{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:40px;
    align-items: start;
}
.product-gallery {
    width: 100%;
}
.product-main-img-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}
.product-main-img-wrap img.main-photo {
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.product-thumbs {
    display: flex;
    gap:10px;
    flex-wrap: wrap;
    margin-top:14px;
}
.product-thumbs img {
    width:72px;
    height:72px;
    object-fit: contain;
    border:1px solid #eee;
    cursor: pointer;
    background:#fff;
}
.product-thumbs img.active {
    border-color:#222;
}
.product-info h1{
    font-size:28px;
    margin:0 0 8px;
}
.product-subtitle{
    color:#666;
    margin-bottom:16px;
}
.product-meta p{
    margin:6px 0;
}
.product-spec h3, .product-desc h3{
    margin:20px 0 8px;
    font-size:18px;
}
.inquiry-box{
    background:#f5f7f7;
    padding:20px;
    border-radius:8px;
    margin-top:24px;
}
.inquiry-buttons{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin-top:12px;
}
.btn{
    padding:10px 18px;
    border-radius:6px;
    color:#fff;
    text-decoration:none;
    border:none;
}
.btn.whatsapp{background:#25D366;}
.btn.wechat{background:#07C160;}
.btn.email{background:#2b7ccd;}

/* 平板 */
@media (max-width: 992px) {
    .product-row{
        grid-template-columns:1fr;
    }
    .product-main-img-wrap img.main-photo {
        max-height: 360px;
    }
}
/* 手機 */
@media (max-width: 768px) {
    .product-single{margin-top:20px;}
    .product-main-img-wrap img.main-photo {
        max-height: 300px;
    }
    .product-thumbs img {
        width:60px;
        height:60px;
    }
    .product-info h1{font-size:22px;}
}

