/* =========================================================
 * 闲置小屋 —— 买家端样式（index.html）
 * ========================================================= */
:root {
  --ink: #3f3536;
  --muted: #8f7d7e;
  --coral: #ed7379;
  --deep: #d95863;
  --line: #f1dfda;
  --line-soft: #f6e9e5;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 220, 214, .72), transparent 28rem),
    linear-gradient(180deg, #fff9f6 0%, #fffdfb 38%, #fff8f4 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  min-height: 100vh;
}

img { max-width: 100%; }
button { font: inherit; }

/* ---------------- Hero ---------------- */
.hero, .content, .tabs-inner { width: min(100%, 1120px); margin: auto; }
.hero { padding: 3rem 1rem 2rem; text-align: center; }

.brand { display: inline-block; border-radius: 999px; }
.brand {
  border: 1px solid rgba(237, 115, 121, .22);
  background: rgba(255, 255, 255, .72);
  padding: .48rem .84rem;
  color: var(--deep);
  font-size: .86rem;
  font-weight: 700;
}

.hero h1 { margin: 1rem 0 .6rem; font-size: clamp(2rem, 7vw, 3.7rem); letter-spacing: -.05em; }
.hero p { margin: 0; color: #746467; line-height: 1.75; }

/* ---------------- 分类 Tab（二级菜单） ---------------- */
.tabs {
  position: sticky;
  z-index: 10;
  top: 0;
  border-block: 1px solid rgba(241, 223, 218, .88);
  background: rgba(255, 250, 247, .9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tabs-inner { display: flex; gap: .62rem; overflow-x: auto; padding: .78rem 1rem; scrollbar-width: none; }
.tabs-inner::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: .45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: .64rem .9rem;
  color: #655557;
  cursor: pointer;
}
.tab small { min-width: 1.55rem; border-radius: 999px; background: #fff3ee; padding: .15rem .38rem; color: #a37c7b; text-align: center; }
.tab.active { border-color: var(--coral); background: var(--coral); color: #fff; box-shadow: 0 8px 22px rgba(237, 115, 121, .24); }
.tab.active small { background: rgba(255, 255, 255, .22); color: #fff; }

/* ---------------- 内容区 ---------------- */
.content { padding: 1.6rem 1rem 3rem; }

.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 1rem; }
.section-head h2 { margin: 0; font-size: 1.45rem; }
.section-head p { margin: .3rem 0 0; color: var(--muted); font-size: .85rem; }
#result-count { color: #a78b8b; font-size: .82rem; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .78rem; }

.card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: #fff;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 8px 25px rgba(103, 70, 66, .07);
  text-align: left;
  cursor: zoom-in;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(103, 70, 66, .13); }

.photo { display: block; aspect-ratio: 4 / 5; overflow: hidden; background: #f7efec; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.caption { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .78rem .82rem; }
.caption .c-left { min-width: 0; }
.caption .c-cat { display: block; color: #8f7779; font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caption .c-name { display: block; color: var(--ink); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caption strong { color: var(--deep); flex: 0 0 auto; }

.empty-tip { text-align: center; color: var(--muted); padding: 3.5rem 1rem; font-size: .95rem; line-height: 2; }
.empty-tip .empty-ico { display: block; font-size: 2.6rem; margin-bottom: .4rem; }

/* ---------------- 加载 / 错误状态 ---------------- */
.load-box {
  text-align: center;
  color: var(--muted);
  padding: 2.6rem 1rem;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
}
.load-spin {
  width: 1.05rem; height: 1.05rem;
  border: 2px solid rgba(237, 115, 121, .25);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box { max-width: 460px; margin: 0 auto; }
.error-box .err-title { font-size: 1.05rem; color: var(--ink); margin-bottom: .4rem; }
.error-box .err-msg { font-size: .85rem; line-height: 1.8; color: #8a6f6f; }
.retry-btn {
  margin-top: 1rem;
  border: 1px solid var(--coral);
  border-radius: 999px;
  background: #fff;
  color: var(--deep);
  padding: .55rem 1.3rem;
  font-weight: 700;
  cursor: pointer;
}

footer { padding: 1.5rem 1rem 3rem; color: #a08384; font-size: .82rem; text-align: center; line-height: 2; }

/* ---------------- 大图查看器（遮罩层实现） ---------------- */
.viewer-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
}
.viewer-layer.open { display: flex; }
.viewer-mask { position: absolute; inset: 0; background: rgba(40, 25, 25, .62); }
.viewer-card {
  position: relative;
  width: min(94vw, 720px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: #fffaf8;
  box-shadow: 0 24px 60px rgba(30, 15, 15, .35);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: .4; } }

.viewer-close {
  position: absolute;
  top: .8rem; right: .8rem;
  width: 2.2rem; height: 2.2rem;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: var(--deep);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(80, 40, 40, .18);
}

.viewer-head { padding: 1rem 3.5rem .8rem 1.2rem; }
.viewer-head h3 { margin: 0; color: var(--deep); font-size: 1.1rem; }
.viewer-head p { margin: .35rem 0 0; color: #856f71; font-size: .88rem; }
.viewer-image {
  display: grid;
  max-height: 74vh;
  min-height: 0;
  place-items: center;
  overflow: auto;
  background: #f4eae7;
}
.viewer-image img { display: block; width: 100%; max-height: 74vh; object-fit: contain; }

body.locked { overflow: hidden; }

/* ---------------- 响应式 ---------------- */
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.15rem; } }
