/* ESTILO CON STILETO — 方向 C「印章作坊」
   黑白版画 + 一处皮革棕；雕刻感衬线标题；2px 黑线做结构分隔。
   桌面 1440 与手机 390 同等优先。
   版本：v=20261015e（walletDebug 诊断框已移除） */
:root {
  --ink: #111111;
  --paper: #ffffff;
  --muted: #555555;
  --faint: #e4e4e4;
  --accent: #8a6d3b;          /* 皮革棕：只用在细分割线与类目标签 */
  --accent-dark: #6f562e;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- 页眉 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.97);
  border-bottom: 2px solid var(--ink);
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-seal { width: 38px; height: 38px; border-radius: 50%; display: block; }
.brand-name { font-weight: 800; letter-spacing: 2px; font-size: 15px; }
.category-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.category-nav button {
  border: 0; background: none; padding: 9px 15px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer;
  min-height: 40px;
}
.category-nav button:hover { color: var(--ink); background: #f2f2f2; }
.category-nav button.active { color: #fff; background: var(--ink); }
.cart-btn {
  border: 2px solid var(--ink); background: #fff; border-radius: 999px;
  padding: 8px 18px; font-size: 14px; font-weight: 700; cursor: pointer;
  min-height: 44px; flex-shrink: 0;
}
.cart-btn:hover { background: var(--ink); color: #fff; }
.cart-btn span {
  background: var(--ink); color: #fff; border-radius: 999px;
  padding: 1px 8px; font-size: 12px; margin-left: 6px;
}
.cart-btn:hover span { background: #fff; color: var(--ink); }

/* ---------- 首屏：印章 ---------- */
.hero { border-bottom: 2px solid var(--ink); }
.hero-inner {
  max-width: 860px; margin: 0 auto; padding: 44px 24px 40px;
  text-align: center;
}
.hero-seal { width: 220px; height: 220px; display: block; margin: 0 auto; }
.hero-rule { width: 56px; height: 3px; background: var(--accent); margin: 24px auto 20px; }
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.6vw, 46px);
  font-weight: 700; letter-spacing: .3px; line-height: 1.15;
}
.hero h1 .nw { white-space: nowrap; } /* 关键语义不断开（P2 修复） */
.hero-sub { color: var(--muted); margin-top: 12px; font-size: 16px; }
.btn-hero {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 26px; padding: 14px 40px; min-height: 52px;
  background: var(--ink); color: #fff; border-radius: 999px;
  font-size: 16px; font-weight: 700; text-decoration: none; letter-spacing: .3px;
  transition: transform .15s ease, background .15s ease;
}
.btn-hero:hover { background: #2c2c2c; transform: translateY(-1px); }
.btn-hero:active { transform: translateY(0); }
.hero-pickup { margin-top: 16px; font-size: 13.5px; color: var(--muted); }

/* ---------- 商品网格 ---------- */
.grid-head {
  display: flex; align-items: baseline; gap: 16px;
  padding: 30px 0 6px;
}
.grid-head h2 { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.grid-head .line { flex: 1; height: 2px; background: var(--ink); }
.product-grid {
  display: grid; gap: 26px; padding: 22px 0 70px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card {
  border: 2px solid var(--ink); border-radius: var(--radius);
  overflow: hidden; background: #fff; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 6px 6px 0 rgba(17,17,17,.9); }
.card-img { aspect-ratio: 1; background: #f4f4f4; overflow: hidden; border-bottom: 2px solid var(--ink); }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 16px 18px 20px; }
.card-cat {
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--accent); font-weight: 800;
}
.card h3 { font-family: var(--serif); font-size: 17px; font-weight: 700; margin: 6px 0 4px; line-height: 1.3; }
.card-variant { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-price { font-size: 16px; font-weight: 800; margin-top: 4px; }
.card-add {
  margin-top: 14px; width: 100%; padding: 11px; min-height: 46px;
  border: 2px solid var(--ink); background: #fff; border-radius: 6px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.card-add:hover { background: var(--ink); color: #fff; }
.card-add:active { transform: translateY(1px); }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 2px solid var(--ink); padding: 36px 24px;
  color: var(--muted); font-size: 14px;
}
.footer-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  gap: 24px; flex-wrap: wrap;
}
.footer-name { font-family: var(--serif); font-weight: 700; color: var(--ink); margin-bottom: 4px; font-size: 16px; }
.pay-note { margin-top: 6px; font-size: 13px; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }

/* ---------- 政策页 ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 48px 24px 72px; }
.page h1 { font-family: var(--serif); font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.page h2 { font-family: var(--serif); font-size: 20px; margin: 32px 0 8px; padding-top: 24px; border-top: 2px solid var(--ink); }
.page h2:first-of-type { border-top: 0; padding-top: 0; }
.page p, .page li { color: #333; font-size: 16px; line-height: 1.7; margin-bottom: 8px; }
.page ul { padding-left: 20px; }
.back-link { display: inline-block; margin-bottom: 24px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
.back-link:hover { color: var(--ink); }

/* ---------- 弹窗 / 抽屉 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.5); display: flex;
  align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: #fff; border: 2px solid var(--ink); border-radius: 12px;
  max-width: 560px; width: 100%;
  max-height: 90vh; overflow: auto; padding: 28px; position: relative;
  box-shadow: 8px 8px 0 rgba(17,17,17,.9);
}
.modal-checkout { max-width: 480px; }
.modal h2 { font-family: var(--serif); font-size: 24px; margin-bottom: 12px; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  border: 0; background: none; font-size: 28px; cursor: pointer; color: var(--muted);
  width: 44px; height: 44px; line-height: 1;
}
.modal-close:hover { color: var(--ink); }
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.detail-img img { width: 100%; border-radius: var(--radius); border: 2px solid var(--ink); background: #f4f4f4; display: block; }
.detail-info h3 { font-family: var(--serif); font-size: 23px; margin: 4px 0 8px; line-height: 1.3; }
.stock-badge { display: inline-block; font-size: 13px; font-weight: 700; color: #1c7a3d; background: #e8f7ee; border: 1.5px solid #1c7a3d; border-radius: 999px; padding: 3px 12px; margin-bottom: 10px; }
.detail-info .price { font-size: 22px; font-weight: 800; margin: 14px 0; }
.detail-info p.desc { color: var(--muted); font-size: 15px; line-height: 1.65; }
.detail-perks { margin-top: 16px; padding-top: 14px; border-top: 2px solid var(--ink); font-size: 13.5px; color: var(--muted); display: grid; gap: 6px; }

.related { margin-top: 26px; padding-top: 20px; border-top: 2px solid var(--ink); }
.related h4 { font-family: var(--serif); font-size: 17px; margin-bottom: 12px; }
.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.related-card { cursor: pointer; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; background: #fff; transition: transform .15s ease; }
.related-card:hover { transform: translateY(-2px); }
.related-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #f4f4f4; display: block; border-bottom: 2px solid var(--ink); }
.related-name { font-size: 12.5px; font-weight: 700; padding: 8px 8px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.related-price { font-size: 13px; font-weight: 800; padding: 2px 8px 10px; }
.qty-row { display: flex; gap: 10px; align-items: center; margin-top: 18px; }
.qty-row input { width: 64px; padding: 10px 8px; border: 2px solid var(--ink); border-radius: 6px; font-size: 15px; }
.btn-primary {
  background: var(--ink); color: #fff; border: 0; border-radius: 8px;
  padding: 13px 24px; min-height: 50px; font-size: 15px; font-weight: 700; cursor: pointer; width: 100%;
}
.btn-primary:hover { background: #2c2c2c; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.drawer-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.5); }
.drawer-overlay[hidden] { display: none; }
.drawer {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(400px, 94vw);
  background: #fff; display: flex; flex-direction: column;
  border-left: 2px solid var(--ink);
}
.drawer-header { padding: 20px 24px; border-bottom: 2px solid var(--ink); position: relative; }
.drawer-header h2 { font-family: var(--serif); font-size: 21px; }
.drawer-body { flex: 1; overflow: auto; padding: 12px 24px; }
.cart-line { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--faint); }
.cart-line img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 2px solid var(--ink); background: #f4f4f4; }
.cart-line-info { flex: 1; }
.cart-line-info h4 { font-size: 14px; font-weight: 700; }
.cart-line-info .unit { color: var(--muted); font-size: 13px; }
.cart-line-controls { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cart-line-controls button {
  width: 32px; height: 32px; border: 2px solid var(--ink); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: 700; line-height: 1;
}
.cart-line-controls button:hover { background: var(--ink); color: #fff; }
.cart-remove { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; padding: 6px 0; }
.cart-empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px; }
.drawer-footer { padding: 18px 24px 24px; border-top: 2px solid var(--ink); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.cart-hint { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }

.checkout-total { margin-bottom: 18px; font-size: 16px; }
.fulfillment { margin-bottom: 16px; }
.fulfillment h3 { font-size: 15px; margin-bottom: 10px; font-weight: 700; }
.fulfill-option { display: block; margin-bottom: 8px; cursor: pointer; }
.fulfill-option input { display: none; }
.fulfill-card {
  display: block; border: 2px solid var(--faint); border-radius: var(--radius);
  padding: 12px 14px; transition: border-color .15s ease, background .15s ease;
}
.fulfill-card strong { display: block; font-size: 15px; }
.fulfill-card em { font-style: normal; font-size: 13px; color: var(--muted); }
.fulfill-option input:checked + .fulfill-card { border-color: var(--ink); background: #f6f6f6; }
.fulfill-option input:focus-visible + .fulfill-card { outline: 2px solid var(--ink); outline-offset: 2px; }
.fulfill-detail { margin-bottom: 16px; }
.fulfill-detail[hidden] { display: none; }
.store-line { font-size: 14px; margin-bottom: 4px; }
.muted-sm { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.field {
  width: 100%; padding: 12px; margin-bottom: 8px;
  border: 2px solid var(--faint); border-radius: 6px; font-size: 16px; font-family: var(--sans);
}
.field:focus { outline: none; border-color: var(--ink); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.payment-status { padding: 12px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; border: 2px solid transparent; }
.payment-status.ok { background: #e8f7ee; color: #1c7a3d; border-color: #1c7a3d; }
.payment-status.err { background: #fdecec; color: #b3261e; border-color: #b3261e; }
.secure-note { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }

.wallet-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.wallet-buttons > div { min-height: 48px; }
.wallet-buttons > div:empty { display: none; }
.wallet-skeleton { display: flex; flex-direction: column; gap: 10px; }
.wallet-skeleton[hidden] { display: none; }
.wallet-skeleton span {
  display: block; height: 50px; border-radius: 8px;
  background: linear-gradient(90deg, #f1f1f1 25%, #e2e2e2 50%, #f1f1f1 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
#googlePayButton { width: 100%; }
#googlePayButton .gpay-button { width: 100% !important; min-height: 50px !important; border-radius: 8px !important; }
.apple-pay-btn {
  -webkit-appearance: -apple-pay-button;
  -apple-pay-button-type: buy;
  -apple-pay-button-style: black;
  width: 100%; min-height: 50px; border: 0; border-radius: 8px; cursor: pointer; padding: 0;
}
/* ---------- 信用卡表单 ---------- */
.card-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .5px; }
.card-divider::before, .card-divider::after { content: ""; flex: 1; height: 2px; background: var(--ink); }
.card-container {
  border: 2px solid var(--ink); border-radius: 6px; background: #fff;
  padding: 8px 12px; margin-bottom: 12px; min-height: 58px;
}
.card-container[hidden] { display: none; }
#cardPayButton { margin-bottom: 6px; }
#cardPayButton[hidden] { display: none; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .header-inner { gap: 10px; padding: 10px 14px; }
  .brand-seal { width: 32px; height: 32px; }
  .brand-name { font-size: 11.5px; letter-spacing: 1px; }
  .category-nav {
    flex-wrap: nowrap; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: 0 -2px; padding: 2px 24px 2px 2px;
    /* 右边缘渐隐：提示可以横滑（P1 修复） */
    -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent 100%);
    mask-image: linear-gradient(90deg, #000 80%, transparent 100%);
  }
  .category-nav::-webkit-scrollbar { display: none; }
  .category-nav button { flex-shrink: 0; padding: 9px 13px; min-height: 42px; }
  .cart-btn { padding: 8px 14px; min-height: 42px; font-size: 13px; }

  .hero-inner { padding: 36px 20px 40px; }
  .hero-seal { width: 160px; height: 160px; }
  .hero h1 { font-size: clamp(28px, 7.4vw, 36px); }
  .hero-sub { font-size: 15px; }
  .btn-hero { width: 100%; max-width: 340px; }

  .container { padding: 0 14px; }
  .grid-head { padding: 24px 0 4px; }
  .grid-head h2 { font-size: 20px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 16px 0 56px; }
  .card-body { padding: 12px 12px 14px; }
  .card h3 { font-size: 14px; }
  .card-price { font-size: 14px; }
  .card-cat { font-size: 10px; }
  .card-add { min-height: 46px; font-size: 13.5px; margin-top: 10px; }

  .footer-inner { flex-direction: column; align-items: flex-start; gap: 18px; }
  .footer-links { gap: 16px; }

  .product-detail { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 16px 16px 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    max-height: 94vh; box-shadow: none;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  }
  .modal-checkout { max-width: none; }
  .drawer { width: 100vw; border-left: 0; }
  .field { font-size: 16px; padding: 14px 12px; }
  .fulfill-card { padding: 14px; }
  .btn-primary { min-height: 54px; font-size: 16px; }
}
