/* 布局思路：顶部固定导航，首页一条主视觉色带放三只错落的手机壳，下面是不带边框的商品格子 */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --tile: #e7ebf3;
  --ink: #131a2b;
  --muted: #5d6679;
  --line: #d5dbe7;
  --accent: #2743e6;
  --accent-ink: #ffffff;
  --hero: #dfe6ff;
  --flag: #ffd84a;
  --flag-ink: #2b2300;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --num: "DIN Alternate", "Bahnschrift", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d111c; --surface: #161c2b; --tile: #1d2436; --ink: #eef1f8; --muted: #9aa4ba;
    --line: #2a3349; --accent: #7f93ff; --accent-ink: #0b1030; --hero: #171f3d;
    --flag: #ffd84a; --flag-ink: #2b2300; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d111c; --surface: #161c2b; --tile: #1d2436; --ink: #eef1f8; --muted: #9aa4ba;
  --line: #2a3349; --accent: #7f93ff; --accent-ink: #0b1030; --hero: #171f3d;
  --flag: #ffd84a; --flag-ink: #2b2300; color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; z-index: 10;
  height: env(safe-area-inset-top, 0px); background: var(--surface);
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; line-height: 1.2; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }

.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* 顶部导航 */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-row { display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding-block: 12px; }
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: .02em; text-decoration: none; margin-right: auto; }
.nav { display: flex; gap: 20px; }
.nav a, .cart-link { text-decoration: none; padding-block: 4px; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"], .cart-link[aria-current="page"] { border-bottom-color: var(--accent); }
.cart-count {
  display: inline-block; min-width: 1.5em; padding: 0 .4em; text-align: center;
  background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; font-family: var(--num); font-size: .85rem; font-weight: 700;
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); text-decoration: underline; }

/* 首页主视觉 */
.hero { background: var(--hero); overflow: hidden; }
.hero-row { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; align-items: center; padding-block: 48px; }
.hero-copy { display: flex; flex-direction: column; gap: 20px; align-items: flex-start; min-width: 0; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 900; letter-spacing: -.01em; }
.hero p { max-width: 30em; color: var(--muted); font-size: 1.05rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; align-items: flex-end; min-width: 0; }
.hero-art .art { width: 34%; max-width: 170px; filter: drop-shadow(0 18px 20px rgba(10, 20, 60, .25)); }
.hero-art .art:nth-child(1) { transform: rotate(-10deg) translate(18%, 4%); }
.hero-art .art:nth-child(2) { z-index: 1; transform: translateY(-6%); }
.hero-art .art:nth-child(3) { transform: rotate(10deg) translate(-18%, 4%); }

.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 32px; padding-block: 28px; border-bottom: 1px solid var(--line); }
.perks strong { display: block; }
.perks span { color: var(--muted); font-size: .92rem; }

/* 区块 */
.section { padding-block: 40px; display: flex; flex-direction: column; gap: 24px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.section-head h1, .section-head h2 { font-size: 1.6rem; font-weight: 800; }

/* 商品格子 */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px 20px; }
.card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; min-width: 0; }
.card-art { position: relative; background: var(--tile); border-radius: 18px; padding: 22px 0; display: flex; justify-content: center; }
.card-art .art { width: 46%; transition: transform .25s ease; }
.card:hover .card-art .art { transform: translateY(-6px) rotate(-3deg); }
.card h3 { font-size: 1rem; font-weight: 600; }
.card .material { color: var(--muted); font-size: .85rem; }
.tag {
  position: absolute; top: 12px; left: 12px;
  background: var(--flag); color: var(--flag-ink);
  font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px;
}
.price { font-family: var(--num); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.price s { color: var(--muted); font-weight: 400; font-size: .9rem; margin-left: 6px; }

/* 筛选 */
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-right: auto; }
.chip { padding: 6px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
select, .qty input {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px;
}

/* 商品详情 */
.detail { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.detail-art { background: var(--tile); border-radius: 24px; padding: 40px 0; display: flex; justify-content: center; }
.detail-art .art { width: 42%; max-width: 220px; filter: drop-shadow(0 18px 20px rgba(10, 20, 60, .22)); }
.detail-info { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.detail-info h1 { font-size: 1.9rem; font-weight: 800; }
.detail-info .price { font-size: 1.8rem; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: .88rem; color: var(--muted); }
.field select { max-width: 100%; width: 280px; }
.buy-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty button {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.qty input { width: 56px; text-align: center; font-family: var(--num); }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 24px; margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; }
.back { color: var(--muted); }

/* 购物车 */
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; }
.lines { display: flex; flex-direction: column; min-width: 0; }
.line { display: grid; grid-template-columns: 72px 1fr auto; gap: 16px; align-items: center; padding-block: 16px; border-bottom: 1px solid var(--line); }
.line-art { background: var(--tile); border-radius: 12px; padding: 8px 0; display: flex; justify-content: center; }
.line-art .art { width: 44%; }
.line-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.line-main a { font-weight: 600; text-decoration: none; }
.line-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.summary { background: var(--surface); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.summary h2 { font-size: 1.15rem; }
.sum-row { display: flex; justify-content: space-between; gap: 12px; }
.sum-row.total { border-top: 1px solid var(--line); padding-top: 12px; font-weight: 700; }
.sum-row .price { font-size: 1rem; }
.sum-row.total .price { font-size: 1.4rem; }
.notice { background: var(--hero); border-radius: 12px; padding: 12px 14px; font-size: .92rem; }
.empty { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; padding-block: 24px; }

/* 页脚与提示 */
.site-footer { border-top: 1px solid var(--line); margin-top: 32px; }
.footer-row { display: flex; flex-direction: column; gap: 4px; padding-block: 28px; font-size: .9rem; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  background: var(--ink); color: var(--bg);
  padding: 10px 20px; border-radius: 999px; font-size: .95rem; max-width: calc(100% - 32px);
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .cart-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 22px 12px; }
  .hero-row { grid-template-columns: 1fr; padding-block: 32px; }
  .hero-art { order: -1; }
  .detail { grid-template-columns: 1fr; gap: 24px; }
  .perks { grid-template-columns: 1fr; }
  .line { grid-template-columns: 56px 1fr; }
  .line-side { grid-column: 2; flex-direction: row; justify-content: space-between; align-items: center; }
}
@media (prefers-reduced-motion: reduce) {
  .card-art .art { transition: none; }
}
