/* 前台：列表页 + 详情页 */
.site-head {
  padding: 30px 0 22px; text-align: center;
  border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.site-head h1 {
  font-family: var(--serif); font-size: 27px; letter-spacing: .18em;
  margin: 0 0 6px; font-weight: 600;
}
.site-head p { margin: 0; color: var(--ink-faint); font-size: 13px; letter-spacing: .12em; }
.site-head .seal {
  display: inline-block; width: 26px; height: 2px;
  background: var(--clay); margin: 12px auto 0; opacity: .55;
}

/* 列表 */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; padding-bottom: 48px;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(60,50,30,.06), 0 16px 32px rgba(60,50,30,.10); }
/* 素材以微信竖版为主，封面按 3:4 裁 */
.card-media { position: relative; aspect-ratio: 3 / 4; background: #ece5d6; overflow: hidden; }
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; }
.card-media .placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: var(--ink-faint); font-family: var(--serif); font-size: 30px; letter-spacing: .1em;
}
.play-badge {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(20,18,14,.6); color: #fff; font-size: 11px;
  padding: 3px 8px; border-radius: 20px; backdrop-filter: blur(4px);
}
.card-body { padding: 13px 14px 15px; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { font-family: var(--serif); font-size: 17px; margin: 0 0 4px; font-weight: 600; letter-spacing: .04em; }
.card-body .sub {
  color: var(--ink-soft); font-size: 12.5px; margin: 0 0 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { margin-top: auto; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

/* 详情 */
.back-bar { padding: 16px 0 4px; font-size: 13px; color: var(--ink-soft); }
.detail-media {
  border-radius: var(--radius); overflow: hidden; background: #16150f;
  border: 1px solid var(--line); margin: 0 auto 12px;
  max-width: 440px;   /* 竖屏兜底宽度，JS 读到真实比例后覆盖 */
}
.detail-media video { width: 100%; display: block; background: #16150f; }
/* 图片轮播 */
.carousel { max-width: 440px; margin: 0 auto 12px; }
.carousel-main {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: #ece5d6; touch-action: pan-y;
}
.carousel-main img {
  width: 100%; display: block; aspect-ratio: 3 / 4; object-fit: cover; cursor: zoom-in;
}
.carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border: 0; border-radius: 50%;
  background: rgba(20,18,14,.42); color: #fff; font-size: 24px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(4px);
  transition: background .15s;
}
.carousel-arrow:hover { background: rgba(20,18,14,.68); }
.carousel-arrow.prev { left: 8px; }
.carousel-arrow.next { right: 8px; }
.carousel-count {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(20,18,14,.55); color: #fff; font-size: 12px;
  padding: 2px 9px; border-radius: 20px; backdrop-filter: blur(4px);
}
.carousel-thumbs {
  display: flex; gap: 7px; margin-top: 8px; overflow-x: auto;
  padding-bottom: 3px; scrollbar-width: thin;
}
.carousel-thumbs img {
  width: 54px; height: 54px; flex-shrink: 0; object-fit: cover;
  border-radius: 7px; border: 2px solid transparent; cursor: pointer; opacity: .6;
  transition: opacity .15s, border-color .15s;
}
.carousel-thumbs img.on { border-color: var(--green); opacity: 1; }
.carousel-thumbs img:hover { opacity: 1; }

.detail-head { margin-bottom: 18px; }
.detail-head h2 { font-family: var(--serif); font-size: 25px; margin: 0 0 6px; letter-spacing: .05em; }
.detail-head .sub { color: var(--ink-soft); margin: 0 0 12px; font-size: 14px; }
.price-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.price-row .price { font-size: 25px; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.panel h4 {
  font-family: var(--serif); font-size: 15px; margin: 0 0 10px; letter-spacing: .1em;
  color: var(--green-deep); display: flex; align-items: center; gap: 8px;
}
.panel h4::before { content: ''; width: 3px; height: 13px; background: var(--green); border-radius: 2px; }
.desc { white-space: pre-line; color: #45413a; font-size: 14.5px; }
.notice { font-size: 13px; color: var(--ink-faint); }

.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table td { padding: 8px 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table td:first-child { color: var(--ink-faint); width: 84px; white-space: nowrap; }

/* 固定在拇指区。sticky 在内容不够长时不会贴底，改 fixed；
   iPhone 底部横条会盖住内容，用 safe-area 把内边距顶上去。 */
.buy-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: rgba(246,242,233,.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 10px; align-items: center;
}
.buy-bar > * { max-width: 900px; }
@media (min-width: 620px) {
  .buy-bar { justify-content: center; }
  .buy-bar .btn { flex: 0 1 320px; }
}
.buy-bar .btn { flex: 1; min-height: 44px; }
.buy-bar .browse {
  flex-shrink: 0; min-width: 64px; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; font-size: 11px; color: var(--ink-soft); letter-spacing: .06em;
  border-right: 1px solid var(--line); padding-right: 12px; margin-right: 2px;
}
.buy-bar .browse .ico { font-size: 16px; line-height: 1; }
.buy-bar .browse:active { color: var(--green-deep); }
.buy-bar .hint { display: none; }

/* 给固定操作条让出位置 */
.has-buybar { padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }

@media (max-width: 480px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .card-body { padding: 10px 11px 12px; }
  .card-body h3 { font-size: 15px; }
  .price { font-size: 17px; }
  .site-head h1 { font-size: 23px; }
}

/* ---------- 店铺简介 ---------- */
.shop-intro {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 20px; margin-bottom: 20px;
}
.shop-intro .lead {
  font-family: var(--serif); font-size: 15px; color: var(--green-deep);
  letter-spacing: .1em; margin: 0 0 14px; display: flex; align-items: center; gap: 9px;
}
.shop-intro .lead::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.shop-intro .para {
  white-space: pre-line; font-size: 13.5px; color: #4b463d; line-height: 1.85; margin: 0 0 14px;
}
.shop-intro .para:last-child { margin-bottom: 0; }

/* 好物盘点：每行「功效 + 商品」变成可点的入口 */
.highlights {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 9px; margin: 4px 0 16px;
}
.hl {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: #fdfbf5;
  transition: border-color .15s, background .15s, transform .15s;
}
a.hl:hover { border-color: var(--green); background: rgba(61,92,72,.05); transform: translateX(2px); }
.hl .pic {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover;
  background: #ece5d6; flex-shrink: 0; border: 1px solid var(--line);
}
.hl .pic.none { display: grid; place-items: center; font-family: var(--serif); font-size: 15px; color: var(--ink-faint); }
.hl .txt { min-width: 0; flex: 1; }
.hl .eff { font-size: 11.5px; color: var(--ink-faint); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.hl .nm { font-family: var(--serif); font-size: 14.5px; color: var(--ink); letter-spacing: .04em; }
.hl .arrow { color: var(--ink-faint); font-size: 13px; flex-shrink: 0; }
.hl.soon .nm { color: var(--ink-faint); }
.hl.soon .arrow { font-size: 11px; }

/* ---------- 分类导航 ---------- */
.cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cat-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  padding: 0 15px; min-height: 38px; border-radius: 20px; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; transition: all .15s;
}
.cat-chip:hover { border-color: var(--green); color: var(--green-deep); }
.cat-chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.cat-chip .n { opacity: .6; font-size: 11.5px; margin-left: 3px; }

.card-media .post-count {
  position: absolute; right: 8px; top: 8px; background: rgba(20,18,14,.55);
  color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 20px; backdrop-filter: blur(4px);
}

/* ---------- 详情：制作日志 ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before {
  content: ''; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 1px; background: var(--line);
}
.moment { position: relative; padding-bottom: 20px; }
.moment:last-child { padding-bottom: 0; }
.moment::before {
  content: ''; position: absolute; left: -18px; top: 7px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--surface);
}
.moment .date { font-size: 12px; color: var(--ink-faint); letter-spacing: .06em; margin-bottom: 5px; }
.moment .text { white-space: pre-line; font-size: 14px; color: #45413a; }
.moment .media { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.moment .media img, .moment .media video {
  width: 92px; height: 122px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); background: #ece5d6; cursor: zoom-in;
}
.moment .media video { cursor: pointer; }

/* ---------- 详情：买家反馈 ---------- */
.reviews { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 9px; }
.reviews img {
  width: 100%; aspect-ratio: 9 / 16; object-fit: cover; object-position: top;
  border-radius: 9px; border: 1px solid var(--line); cursor: zoom-in; background: #ece5d6;
}
.panel .count { margin-left: auto; font-size: 12px; color: var(--ink-faint); font-family: var(--sans); letter-spacing: 0; }

/* 日志里的视频占位：点了才真正加载视频 */
.play-thumb {
  position: relative; width: 92px; height: 122px; padding: 0; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; background: #ece5d6; cursor: pointer; flex-shrink: 0;
}
.play-thumb img { width: 100%; height: 100%; object-fit: cover; }
.play-thumb .ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--ink-faint); font-size: 12px; }
.play-thumb .mark {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 22px; text-shadow: 0 1px 6px rgba(0,0,0,.5);
  background: rgba(0,0,0,.12); transition: background .15s;
}
.play-thumb:hover .mark { background: rgba(0,0,0,.28); }
.moment .media video { width: 92px; height: 122px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }

/* 导航：功效 / 剂型 两套切换 */
/* 切换器和标签分两行放。以前是同一行的 flex 兄弟，.cat-nav 会被压到
   「最宽标签」的宽度，标签在旁边挤成一竖列 —— 换维度时标签总宽变了就翻车。 */
.facet-bar {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; margin-bottom: 22px;
}
.facet-bar .cat-nav { justify-content: center; margin-bottom: 0; max-width: 100%; }
.facet-switch {
  display: inline-flex; border: 1px solid var(--line); border-radius: 20px;
  overflow: hidden; background: var(--surface); flex-shrink: 0;
}
.facet-switch button {
  background: none; border: 0; padding: 0 16px; min-height: 38px; font-size: 12.5px;
  color: var(--ink-soft); cursor: pointer; transition: all .15s;
}
.facet-switch button.on { background: var(--green); color: #fff; }

/* 商品页页头 */
.list-head { padding: 34px 0 6px; text-align: center; }
.list-sub { margin: -12px 0 20px; font-size: 12.5px; color: var(--ink-faint); letter-spacing: .1em; }

/* ---------- 单列大图流 ---------- */
.list-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; min-height: 32px;
}
.list-meta .count { font-size: 12.5px; color: var(--ink-faint); letter-spacing: .1em; }
.layout-toggle {
  display: inline-flex; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; background: var(--surface); flex-shrink: 0;
}
.layout-toggle button {
  background: none; border: 0; padding: 0 11px; min-height: 32px;
  font-size: 12px; color: var(--ink-soft); cursor: pointer; transition: all .15s;
  display: flex; align-items: center; gap: 4px;
}
.layout-toggle button.on { background: var(--green); color: #fff; }

/* 单列：素材是竖版实拍，铺开才看得清 */
.grid.single { grid-template-columns: 1fr; gap: 18px; }
.grid.single .card { max-width: 460px; width: 100%; margin: 0 auto; }
.grid.single .card-media { aspect-ratio: 4 / 5; }
.grid.single .card-body { padding: 14px 16px 16px; }
.grid.single .card-body h3 { font-size: 19px; margin-bottom: 5px; }
.grid.single .card-body .sub { font-size: 13.5px; -webkit-line-clamp: 2; margin-bottom: 11px; }
.grid.single .tag { font-size: 12px; padding: 3px 9px; }
.grid.single .price { font-size: 21px; }
.grid.single .play-badge { font-size: 12px; padding: 4px 10px; left: 12px; bottom: 12px; }
.grid.single .badge { font-size: 12px; padding: 3px 11px; }

@media (max-width: 480px) {
  .grid.single { gap: 15px; }
  .grid.single .card-body h3 { font-size: 17.5px; }
}
