/* ── Variables ──────────────────────────────────── */
:root {
  --bg:       #f5f3ef;
  --surface:  #ffffff;
  --border:   #e8e4dc;
  --text:     #1a1814;
  --muted:    #7a7165;
  --accent:   #c8402a;
  --accent2:  #e8956d;
  --gold:     #c9a84c;
  --radius:   12px;
  --shadow:   0 4px 24px rgba(0,0,0,0.08);
  --shadow-lg:0 16px 48px rgba(0,0,0,0.14);
  --font-serif: 'Noto Serif SC', serif;
  --font-sans:  'DM Sans', sans-serif;
  --header-h: 68px;
  --ease:     cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select { font-family: inherit; }
img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }

/* ── Header ─────────────────────────────────────── */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(245,243,239,0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s;
}
.header.scrolled { box-shadow: var(--shadow); }
.header-inner {
  max-width: 1400px; margin: 0 auto;
  height: 100%; padding: 0 32px;
  display: flex; align-items: center; gap: 24px;
}

.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent);
  color: #fff; font-family: var(--font-serif);
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.logo-text { font-family: var(--font-serif); font-size: 18px; font-weight: 600; letter-spacing: 0.05em; }

.nav-cats { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav-cats::-webkit-scrollbar { display: none; }
.nav-cat {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 30px;
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  color: var(--muted); transition: all 0.2s;
}
.nav-cat:hover { color: var(--text); background: var(--border); }
.nav-cat.active { background: var(--text); color: var(--bg); }
.cat-icon { font-size: 15px; }

.header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.search-wrap { position: relative; }
.search-input {
  width: 200px; padding: 8px 16px 8px 38px;
  border: 1.5px solid var(--border); border-radius: 30px;
  background: var(--surface); font-size: 13.5px;
  color: var(--text); outline: none;
  transition: all 0.25s;
}
.search-input:focus { border-color: var(--accent); width: 240px; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; stroke: var(--muted); fill: none;
  stroke-width: 2; stroke-linecap: round; pointer-events: none;
}

.cart-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface); border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.cart-btn:hover { border-color: var(--accent); background: var(--accent); }
.cart-btn:hover svg { stroke: #fff; }
.cart-btn svg { width: 18px; stroke: var(--text); fill: none; stroke-width: 1.8; stroke-linecap: round; }
.cart-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
  border: 2px solid var(--bg);
}

/* ── Hero Banner ─────────────────────────────────── */
.hero {
  margin-top: var(--header-h);
  position: relative; height: 520px; overflow: hidden;
}
.hero-track { display: flex; height: 100%; transition: transform 0.6s var(--ease); }
.hero-slide { min-width: 100%; height: 100%; position: relative; }
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transition: transform 8s ease;
}
.hero-slide.active .hero-bg { transform: scale(1.04); }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(20,17,13,0.75) 0%, rgba(20,17,13,0.1) 100%);
}
.hero-content {
  position: relative; z-index: 2;
  max-width: 1400px; margin: 0 auto; padding: 0 80px;
  height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 18px;
}
.hero-tag {
  display: inline-block; padding: 5px 14px; border-radius: 4px;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  width: fit-content;
}
.hero-title {
  font-family: var(--font-serif); font-size: 52px; font-weight: 700;
  color: #fff; line-height: 1.15; max-width: 560px;
}
.hero-sub { font-size: 18px; color: rgba(255,255,255,0.8); max-width: 420px; font-weight: 300; }
.hero-cta {
  width: fit-content; padding: 14px 32px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600;
  letter-spacing: 0.03em; transition: all 0.2s;
  box-shadow: 0 8px 24px rgba(200,64,42,0.35);
}
.hero-cta:hover { background: #a83420; transform: translateY(-2px); box-shadow: 0 12px 32px rgba(200,64,42,0.45); }

.hero-dots {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 10;
}
.dot {
  width: 8px; height: 8px; border-radius: 4px;
  background: rgba(255,255,255,0.4); transition: all 0.3s;
}
.dot.active { background: #fff; width: 24px; }

.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 10; width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(8px);
  color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; border: 1px solid rgba(255,255,255,0.2);
}
.hero-arrow:hover { background: rgba(255,255,255,0.3); }
.hero-arrow.left { left: 24px; }
.hero-arrow.right { right: 24px; }

/* ── Toolbar ─────────────────────────────────────── */
.toolbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: var(--header-h); z-index: 50; }
.toolbar-inner {
  max-width: 1400px; margin: 0 auto; padding: 12px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.result-count { font-size: 13.5px; color: var(--muted); }
.sort-group { display: flex; align-items: center; gap: 10px; }
.sort-label { font-size: 13px; color: var(--muted); }
.sort-select {
  padding: 7px 32px 7px 12px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--bg);
  font-size: 13.5px; color: var(--text); outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a7165' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
  cursor: pointer; transition: border-color 0.2s;
}
.sort-select:focus { border-color: var(--accent); }

/* ── Main / Grid ─────────────────────────────────── */
.main { max-width: 1400px; margin: 0 auto; padding: 36px 32px 64px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

/* ── Product Card ────────────────────────────────── */
.product-card {
  background: var(--surface); border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden; cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  animation: fadeUp 0.5s var(--ease) both;
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-image-wrap {
  position: relative; height: 220px; overflow: hidden;
  background: #f0ece4;
}
.card-image-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.product-card:hover .card-image-wrap img { transform: scale(1.06); }

.card-badge {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px; border-radius: 4px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
}
.card-badge.gold { background: var(--gold); }

.card-body { padding: 18px 20px 20px; }
.card-brand { font-size: 11.5px; color: var(--muted); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; }
.card-name { font-family: var(--font-serif); font-size: 15px; font-weight: 600; line-height: 1.45; margin-bottom: 12px; }

.card-rating {
  display: flex; align-items: center; gap: 6px; margin-bottom: 14px;
}
.stars { display: flex; gap: 2px; }
.star { font-size: 12px; }
.rating-num { font-size: 13px; font-weight: 600; color: var(--gold); }
.review-cnt { font-size: 12px; color: var(--muted); }

.card-price { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.price-now { font-size: 22px; font-weight: 700; color: var(--accent); }
.price-now::before { content: '¥'; font-size: 14px; }
.price-old { font-size: 13px; color: var(--muted); text-decoration: line-through; }
.price-old::before { content: '¥'; }
.discount-tag {
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 4px;
  background: rgba(200,64,42,0.1); color: var(--accent);
}

.add-cart-btn {
  width: 100%; padding: 11px;
  background: var(--text); color: var(--bg);
  border-radius: 10px; font-size: 14px; font-weight: 600;
  letter-spacing: 0.03em; transition: all 0.2s;
}
.add-cart-btn:hover { background: var(--accent); transform: translateY(-1px); }
.add-cart-btn:active { transform: scale(0.98); }

/* ── Loading & Empty ─────────────────────────────── */
.loading-state {
  grid-column: 1/-1; display: flex; flex-direction: column;
  align-items: center; gap: 16px; padding: 80px 0; color: var(--muted);
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  text-align: center; padding: 80px 0; color: var(--muted);
}
.empty-icon { font-size: 52px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; margin-bottom: 16px; }
.empty-state button {
  padding: 10px 28px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: 14px;
}

/* ── Cart Drawer ─────────────────────────────────── */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }

.cart-drawer {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 201;
  width: 420px; background: var(--surface);
  box-shadow: -8px 0 40px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.4s var(--ease);
}
.cart-drawer.open { transform: translateX(0); }

.cart-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px; border-bottom: 1px solid var(--border);
}
.cart-header h2 { font-family: var(--font-serif); font-size: 20px; }
.close-cart {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg); font-size: 14px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.close-cart:hover { background: var(--border); color: var(--text); }

.cart-items { flex: 1; overflow-y: auto; padding: 20px 28px; display: flex; flex-direction: column; gap: 16px; }

.cart-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px; border-radius: 12px; background: var(--bg);
  border: 1px solid var(--border);
}
.cart-item-img {
  width: 70px; height: 70px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-size: 13px; font-weight: 500; line-height: 1.4;
  margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-item-price { font-size: 14px; font-weight: 700; color: var(--accent); }
.cart-item-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 16px; display: flex; align-items: center; justify-content: center;
  background: var(--surface); transition: all 0.15s;
}
.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-num { font-size: 14px; font-weight: 600; min-width: 20px; text-align: center; }
.cart-item-del {
  margin-left: auto; font-size: 15px; color: var(--muted);
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.cart-item-del:hover { background: rgba(200,64,42,0.1); color: var(--accent); }

.cart-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; color: var(--muted);
}
.cart-empty .empty-icon { font-size: 48px; }
.cart-empty p { font-size: 15px; font-weight: 500; }
.cart-empty small { font-size: 13px; }

.cart-footer {
  padding: 20px 28px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
}
.cart-total {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 16px;
}
.cart-total strong { font-size: 22px; color: var(--accent); }
.checkout-btn {
  padding: 14px; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700; letter-spacing: 0.03em;
  transition: all 0.2s; box-shadow: 0 6px 20px rgba(200,64,42,0.3);
}
.checkout-btn:hover { background: #a83420; transform: translateY(-1px); }
.clear-btn {
  padding: 10px; border-radius: 10px;
  border: 1.5px solid var(--border); color: var(--muted);
  font-size: 13.5px; transition: all 0.2s;
}
.clear-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Product Modal ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 300; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  position: fixed; z-index: 301;
  top: 50%; left: 50%; transform: translate(-50%,-52%) scale(0.96);
  width: min(900px, 92vw); max-height: 88vh;
  background: var(--surface); border-radius: 20px;
  overflow: hidden; opacity: 0; pointer-events: none;
  transition: all 0.35s var(--ease);
  box-shadow: var(--shadow-lg);
}
.modal.open {
  transform: translate(-50%,-50%) scale(1);
  opacity: 1; pointer-events: all;
}
.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
  font-size: 15px; color: var(--text); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.modal-body { display: flex; max-height: 88vh; overflow-y: auto; }
.modal-img {
  width: 45%; flex-shrink: 0; background: #f0ece4;
}
.modal-img img { width: 100%; height: 100%; object-fit: cover; }
.modal-info { flex: 1; padding: 40px 36px; overflow-y: auto; }
.modal-brand { font-size: 12px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.modal-name { font-family: var(--font-serif); font-size: 22px; font-weight: 700; line-height: 1.4; margin-bottom: 16px; }
.modal-rating { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.modal-price { display: flex; align-items: baseline; gap: 12px; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.modal-price-now { font-size: 32px; font-weight: 700; color: var(--accent); }
.modal-price-now::before { content: '¥'; font-size: 18px; }
.modal-price-old { font-size: 15px; color: var(--muted); text-decoration: line-through; }
.modal-price-old::before { content: '¥'; }

.specs-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.specs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 28px; }
.spec-item {
  background: var(--bg); border-radius: 10px; padding: 12px 14px;
  border: 1px solid var(--border);
}
.spec-key { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.spec-val { font-size: 13.5px; font-weight: 600; }

.modal-add-btn {
  width: 100%; padding: 15px;
  background: var(--accent); color: #fff; border-radius: 12px;
  font-size: 16px; font-weight: 700; letter-spacing: 0.03em;
  transition: all 0.2s; box-shadow: 0 8px 24px rgba(200,64,42,0.3);
  margin-bottom: 12px;
}
.modal-add-btn:hover { background: #a83420; transform: translateY(-2px); }

.related-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.related-title { font-size: 14px; font-weight: 700; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 14px; }
.related-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.related-card {
  border-radius: 10px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg);
  transition: all 0.2s;
}
.related-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-card img { width: 100%; height: 80px; object-fit: cover; }
.related-card-info { padding: 8px 10px; }
.related-card-name { font-size: 11.5px; font-weight: 500; line-height: 1.35; margin-bottom: 4px; }
.related-card-price { font-size: 12.5px; font-weight: 700; color: var(--accent); }
.related-card-price::before { content: '¥'; font-size: 10px; }

/* ── Toast ───────────────────────────────────────── */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 12px 24px; border-radius: 30px;
  font-size: 14px; font-weight: 500; z-index: 500;
  opacity: 0; pointer-events: none; transition: all 0.3s var(--ease);
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Footer ─────────────────────────────────────── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 32px;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}
.footer-info {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.footer-address {
  margin-bottom: 8px;
}
.footer-icp a {
  color: var(--muted);
  transition: color 0.2s;
}
.footer-icp a:hover {
  color: var(--accent);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
  .header-inner { padding: 0 16px; gap: 12px; }
  .nav-cats { display: none; }
  .search-input { width: 160px; }
  .hero-title { font-size: 34px; }
  .hero-content { padding: 0 40px; }
  .main { padding: 24px 16px 48px; }
  .toolbar-inner { padding: 12px 16px; }
  .cart-drawer { width: 100vw; }
  .modal-body { flex-direction: column; }
  .modal-img { width: 100%; height: 220px; }
  .footer { padding: 20px 16px; }
}
@media (max-width: 600px) {
  .hero { height: 360px; }
  .hero-title { font-size: 26px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .card-image-wrap { height: 160px; }
  .specs-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: repeat(3,1fr); }
  .footer-info { font-size: 12px; }
}
