/* ===== 基础 & 变量 ===== */
:root {
  --bg: #faf8f5;
  --card-bg: #fff;
  --text: #3d3226;
  --text-light: #8b7e6a;
  --accent: #c4956a;
  --accent2: #8b5e3c;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
  --shadow-hover: 0 8px 30px rgba(0,0,0,.12);
  --radius: 12px;
  --gap: 16px;
  --header-h: 64px;
  --cat-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC","Microsoft YaHei","Helvetica Neue",sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ===== 顶部 ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e8e2da;
  height: var(--header-h);
}
.header-inner {
  max-width: 1400px; margin: 0 auto;
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 20px;
}
.logo {
  font-size: 22px; font-weight: 700;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.search-box {
  display: flex; max-width: 400px; width: 100%;
}
.search-box input {
  flex: 1; height: 40px; padding: 0 16px;
  border: 2px solid #e0d8cc; border-right: none;
  border-radius: 20px 0 0 20px;
  font-size: 14px; outline: none;
  background: #fdfcf9;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box button {
  height: 40px; width: 48px;
  border: 2px solid var(--accent); border-radius: 0 20px 20px 0;
  background: var(--accent); color: #fff; font-size: 18px;
  cursor: pointer; transition: background .2s;
}
.search-box button:hover { background: var(--accent2); }

/* ===== 分类栏 — 支持 60+ 分类横向滚动 ===== */
.category-bar {
  position: sticky; top: var(--header-h); z-index: 99;
  background: rgba(250,248,245,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e8e2da;
  display: flex; gap: 6px; padding: 10px 24px;
  overflow-x: auto; overflow-y: hidden;
  flex-wrap: nowrap; white-space: nowrap;
  min-height: var(--cat-h);
  align-items: center;
  /* 滚动条美化 */
  scrollbar-width: thin;
  scrollbar-color: #d5ccbe transparent;
  /* 吸附滚动，方便触屏 */
  scroll-snap-type: x proximity;
}
.category-bar::-webkit-scrollbar { height: 4px; }
.category-bar::-webkit-scrollbar-thumb { background: #d5ccbe; border-radius: 2px; }

.cat-btn {
  flex-shrink: 0;
  padding: 6px 18px; border-radius: 20px;
  border: 1.5px solid #d5ccbe; background: #fff;
  font-size: 13px; cursor: pointer; white-space: nowrap;
  color: var(--text-light); transition: all .25s;
  scroll-snap-align: start;
}
.cat-btn:hover { border-color: var(--accent); color: var(--accent2); }
.cat-btn.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}

/* 分类栏左右渐变提示 */
.category-bar::before,
.category-bar::after {
  content: ""; position: sticky; z-index: 1;
  width: 20px; flex-shrink: 0; pointer-events: none;
}
.category-bar::before {
  left: 0; background: linear-gradient(to right, rgba(250,248,245,1), transparent);
  margin-left: -24px; padding-right: 24px;
}
.category-bar::after {
  right: 0; background: linear-gradient(to left, rgba(250,248,245,1), transparent);
  margin-right: -24px; padding-left: 24px;
}

/* ===== 图片网格 — 瀑布流 ===== */
.gallery {
  max-width: 1400px; margin: 0 auto; padding: 20px 16px 40px;
  columns: 4; column-gap: var(--gap);
}
@media (max-width: 1100px) { .gallery { columns: 3; } }
@media (max-width: 750px)  { .gallery { columns: 2; } }
@media (max-width: 480px)  { .gallery { columns: 1; } }

.card {
  break-inside: avoid;
  margin-bottom: var(--gap);
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .3s, box-shadow .3s;
  animation: fadeUp .5s ease both;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.card-img-wrap {
  position: relative; overflow: hidden;
  background: #e8e2da;
}
.card-img-wrap img {
  width: 100%; display: block;
  transition: transform .4s;
}
.card:hover .card-img-wrap img { transform: scale(1.05); }
/* 分类合辑封面 */
.cat-cover-label {
  position: absolute; bottom: 36px; left: 0; right: 0;
  text-align: center; color: #fff; font-size: 17px; font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  padding: 0 12px;
}
.cat-count {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.45); color: #fff;
  padding: 2px 14px; border-radius: 10px;
  font-size: 12px; backdrop-filter: blur(4px);
}
.cat-card { cursor: pointer; }
.cat-card .card-img-wrap { min-height: 160px; }
.cat-card .card-img-wrap img { min-height: 160px; }

.card-img-wrap .card-tag {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.55); color: #fff;
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; backdrop-filter: blur(4px);
}
.card-body { padding: 14px 16px 16px; }
.card-body h3 {
  font-size: 15px; font-weight: 600; margin-bottom: 4px;
}
.card-body .card-material {
  font-size: 12px; color: var(--accent); margin-bottom: 6px;
}
.card-body p {
  font-size: 13px; color: var(--text-light);
  line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 淡入动画 */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===== 加载更多 ===== */
.load-more-wrap {
  text-align: center; padding: 10px 0 50px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.load-more-wrap button {
  padding: 12px 40px; border-radius: 24px;
  border: 2px solid var(--accent); background: #fff;
  color: var(--accent2); font-size: 15px; cursor: pointer;
  transition: all .2s;
}
.load-more-wrap button:hover { background: var(--accent); color: #fff; }
#counter { font-size: 13px; color: var(--text-light); }

/* ===== 灯箱 ===== */
.lightbox { display: none; }
.lightbox.active {
  display: block; position: fixed; inset: 0; z-index: 200;
}
.lightbox-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.75); backdrop-filter: blur(6px);
}
.lightbox-content {
  position: absolute; inset: 20px;
  display: flex; align-items: center; justify-content: center;
}
.lb-close, .lb-prev, .lb-next {
  position: absolute; z-index: 10;
  background: rgba(255,255,255,.15); border: none;
  color: #fff; font-size: 28px; cursor: pointer;
  border-radius: 50%; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
  backdrop-filter: blur(4px);
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.3); }
.lb-close { top: 0; right: 0; }
.lb-prev  { left: 0; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 0; top: 50%; transform: translateY(-50%); }

.lb-body {
  display: flex; background: #fff; border-radius: 16px;
  overflow: hidden; max-width: 1100px; width: 100%; max-height: 90vh;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: zoomIn .3s ease;
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}
.lb-image-wrap {
  flex: 1.2; background: #f0ece6;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.lb-image-wrap img {
  max-width: 100%; max-height: 85vh; object-fit: contain;
}
.lb-info {
  flex: 1; padding: 32px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.lb-info h2 { font-size: 22px; font-weight: 700; }
.lb-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.lb-tag {
  display: inline-block; padding: 4px 14px;
  background: var(--accent); color: #fff;
  border-radius: 14px; font-size: 12px;
}
.lb-meta span { font-size: 13px; color: var(--text-light); }
.lb-info p { font-size: 14px; line-height: 1.8; color: #5a4e3e; }
.lb-specs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.lb-specs .spec {
  background: #f5f1ea; padding: 6px 14px;
  border-radius: 8px; font-size: 12px; color: var(--text-light);
}

/* 移动端灯箱 */
@media (max-width: 750px) {
  .lb-body { flex-direction: column; max-height: 95vh; }
  .lb-image-wrap { flex: none; height: 45vh; }
  .lb-info { padding: 20px; }
  .lb-close, .lb-prev, .lb-next { width: 36px; height: 36px; font-size: 22px; }
}

/* ===== 状态栏 ===== */
.status-bar {
  max-width: 1400px; margin: 0 auto;
  padding: 10px 24px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-light);
  transition: opacity .4s;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid #e0d8cc;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 懒加载占位 */
.lazy-img {
  min-height: 120px;
  background: linear-gradient(90deg, #e8e2da 25%, #f0ece6 50%, #e8e2da 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-light);
  column-span: all;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #d5ccbe; border-radius: 3px; }
