/* ===========================================================
   天鴻商行 — 自訂樣式 (Custom site styles)
   由 index.html inline <style> 搬遷至此，方便長遠維護。
   =========================================================== */

/* --- CSS Variables --- */
:root {
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
}

/* --- Mobile horizontal scroll guard (全站防止橫向滾動) --- */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* --- Base typography --- */
body {
    font-family: 'Noto Sans TC','PingFang TC','Microsoft JhengHei','Heiti TC','PMingLiU','Arial', sans-serif;
    background-color: var(--site-bg);
    /* 數字用等寬＋襯線數字，避免中文字體的數字寬度不一 */
    font-feature-settings: "tnum" 1, "lnum" 1;
}
h1, h2, h3, h4, h5, h6 {
    font-family: 'Noto Sans TC','PingFang TC','Microsoft JhengHei','Heiti TC','PMingLiU','Arial', sans-serif;
    text-wrap: balance;
}
/* font-serif class 用真襯線字體（標題分層） */
.font-serif,
h1.font-serif,
h2.font-serif,
h3.font-serif,
h4.font-serif,
h5.font-serif,
h6.font-serif {
    font-family: 'Noto Serif TC','Source Han Serif TC','STZhongsong','SimSun','PMingLiU', serif;
    letter-spacing: 0.01em;
}

/* --- 數字專用：等寬（tabular）+ 襯線數字（lining） --- */
.tabular-nums,
.tnum,
.trust-strip-unit,
.cat-price-range,
.pbar-label,
/* 自動命中 trust-strip 的數字區塊（含子元素 .trust-strip-unit 的容器） */
:where(div,span):has(> .trust-strip-unit) {
    font-variant-numeric: tabular-nums lining-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

/* --- Utility --- */
.no-scroll { overflow: hidden; }

/* --- FAQ details --- */
.faq-details > summary::-webkit-details-marker { display: none; }
.faq-details .faq-caret { transition: transform 0.3s ease; }
.faq-details[open] .faq-caret { transform: rotate(180deg); }

/* --- Brand scroller --- */
@keyframes scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}
.start-scrolling .brands-animation {
    animation: scroll 40s linear infinite;
}
#brands-container:hover .brands-animation {
    animation-play-state: paused;
}

/* --- Footer brand --- */
#site-footer .brand-wrap,
#site-footer .brand-wrap * {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    -webkit-text-stroke: 0 !important;
    text-decoration: none !important;
}
#site-footer .brand-name {
    font-family: "Noto Sans TC","PingFang TC","Microsoft JhengHei","Heiti TC","PMingLiU","Arial",sans-serif;
    letter-spacing: 0.02em;
}
#site-footer a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* --- No-scroll reveal animations --- */
html { scroll-behavior: auto !important; }
.animate-in,
.content-fade-in,
.animate-when-visible,
.reveal-on-scroll,
.fade-in-up,
.fade-up,
.scroll-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
}
.is-visible {
    opacity: 1 !important;
    transform: none !important;
}

/* --- Responsive Tables (rtable) ---
   Mobile-first: convert tables into stacked cards on small screens */
@media (max-width: 768px) {
  .rtable-wrap { overflow: visible !important; }
  table.rtable {
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }
  table.rtable thead { display: none !important; }
  table.rtable tbody,
  table.rtable tr,
  table.rtable td,
  table.rtable th {
    display: block !important;
    width: 100% !important;
  }
  table.rtable tr {
    margin: 0 0 12px 0 !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    background: #fff !important;
  }
  table.rtable td,
  table.rtable th {
    padding: 10px 12px !important;
    border: 0 !important;
  }
  table.rtable td + td,
  table.rtable th + td,
  table.rtable td + th {
    border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
  }
  table.rtable td::before,
  table.rtable th::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    line-height: 1.2;
    opacity: 0.75;
    margin-bottom: 4px;
    font-weight: 600;
  }
  table.rtable td[data-label=""]::before,
  table.rtable th[data-label=""]::before {
    display: none;
  }
}

/* ===========================================================
   New 2026-04 — UI Refresh
   =========================================================== */

/* --- Category card top bar + hover border ---
   按品類用色：酒紅 / 海藍 / 古銅 / 紫 / 金 */
.cat-card {
  position: relative;
  overflow: hidden;
}
.cat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--cat-color, #0ea5e9);
  z-index: 3;
}
.cat-card[data-cat="wine"]         { --cat-color: #7f1d1d; }
.cat-card[data-cat="seafood"]      { --cat-color: #0369a1; }
.cat-card[data-cat="collectibles"] { --cat-color: #7e5a16; }
.cat-card[data-cat="luxury"]       { --cat-color: #6d28d9; }
.cat-card[data-cat="gold"]         { --cat-color: #a6781c; }
.cat-card:hover {
  border-color: var(--cat-color, #0ea5e9) !important;
  box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--cat-color, #0ea5e9) 35%, transparent);
}
.cat-card .cat-more {
  color: var(--cat-color, #0369a1);
}
.cat-card:hover .cat-more {
  filter: brightness(0.9);
}

/* Category chip displayed over image top-left */
.cat-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--cat-color, #0ea5e9);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  z-index: 3;
}

/* --- Pricing range bar --- */
.pbar {
  position: relative;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
  max-width: 180px;
}
.pbar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, #0891b2, #0ea5e9);
  border-radius: 999px;
}
.pbar-fill.is-muted {
  background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}
/* 品類卡片：用品類色做 pbar 填充 */
.cat-card .pbar {
  max-width: 100%;
  background: color-mix(in srgb, var(--cat-color, #0ea5e9) 14%, #eef2f7);
}
.cat-card .pbar-fill {
  background: linear-gradient(90deg, color-mix(in srgb, var(--cat-color, #0ea5e9) 70%, #ffffff), var(--cat-color, #0ea5e9));
}
.cat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(15, 23, 42, 0.12);
  font-size: 12px;
  color: #475569;
}
.cat-meta .cat-price-range {
  font-weight: 700;
  color: var(--cat-color, #0ea5e9);
  font-family: 'Noto Serif TC', 'Source Han Serif TC', serif;
  letter-spacing: 0.02em;
}

/* --- Topic badges (精選專題) --- */
.topic-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 6px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.topic-badge.is-hot {
  background: #fee2e2;
  color: #b91c1c;
}
.topic-badge.is-new {
  background: #dcfce7;
  color: #166534;
}

/* --- Storefront inset image --- */
.shop-inset {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 168px;
  z-index: 10;
  transform: rotate(3deg);
  transition: transform 0.4s var(--ease-out-quart);
}
.shop-inset:hover {
  transform: rotate(0deg) scale(1.03);
}
.shop-inset img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.2);
  border: 3px solid #ffffff;
}
@media (max-width: 640px) {
  .shop-inset { display: none; }
}

/* ===========================================================
   2026-04-23 — Mobile UX Refinements
   - 行動版 header 由 80px 收為 64px，還多 16px 可視區
   - Hero trust strip 在 400px 以下收細 padding，避免 iPhone SE 擠爆
   - prefers-reduced-motion：關閉動畫／過場，照顧暈眩敏感使用者
   =========================================================== */

/* 1. Mobile header — 平板以下收細，配合 logo h-12 (48px) 仍有餘裕 */
@media (max-width: 1023px) {
  .header-bar {
    height: 4rem !important; /* 64px */
  }
}

/* 2. Hero trust strip — 極細屏 (≤400px) 收細內距，字級亦輕微降低 */
@media (max-width: 400px) {
  .hero-stats {
    gap: 0.5rem !important;
  }
  .hero-stats > div {
    padding: 0.625rem !important; /* 10px */
  }
  .hero-stats .text-2xl {
    font-size: 1.375rem !important; /* 22px */
    line-height: 1 !important;
  }
}

/* 3. 尊重使用者「減少動態效果」偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  .start-scrolling .brands-animation {
    animation: none !important;
  }
}
