/* ============================================================
 * 朝帝 · 样式
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #2f80ed;
  --blue-dark: #1c5fc4;
  --orange: #ff8a3d;
  --yellow: #ffd23f;
  --ink: #2b3a55;
  --bg: #f4f8ff;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 6px 18px rgba(47, 128, 237, .12);
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ---------- 顶部 ---------- */
.topbar {
  background: linear-gradient(135deg, #2563eb, #3b82f6 55%, #60a5fa);
  color: #fff8e1;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}
.topbar .logo { font-size: 20px; font-weight: 800; }
.topbar .back {
  background: linear-gradient(135deg, #ffe14d, #ff9d2e);
  color: #7a3b00;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 3px 0 #e07b00, 0 5px 12px rgba(0,0,0,.25);
  transition: transform .12s, box-shadow .12s;
}
.topbar .back:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #e07b00, 0 8px 16px rgba(0,0,0,.3); }
.topbar .back:active { transform: translateY(1px); box-shadow: 0 2px 0 #e07b00; }

/* ---------- 顶栏标语（薄荷青静态） ---------- */
.topbar .tagline {
  flex: 1;
  color: #98d8c8;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 44px 20px 10px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  color: var(--blue-dark);
  letter-spacing: 2px;
}
.hero p { color: #5a6b8c; margin-top: 8px; font-size: 16px; }

/* ---------- 首页分类网格 ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
  margin-top: 18px;
}
.cat-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  display: block;
}
.cat-card:hover { transform: translateY(-6px); box-shadow: 0 12px 26px rgba(47,128,237,.22); }
.cat-thumb {
  aspect-ratio: 3 / 4;
  background: #fafafa;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
}
.cat-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.cat-info { padding: 14px 16px 18px; }
.cat-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.cat-emoji { font-size: 22px; }
.cat-desc { font-size: 13px; color: #7a89a8; margin-top: 4px; }
.cat-count {
  display: inline-block;
  margin-top: 10px;
  background: #eaf2ff;
  color: var(--blue-dark);
  font-size: 12px;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 600;
}

/* ---------- 分类页左右布局 + 侧边导航 ---------- */
.layout { display: flex; gap: 24px; align-items: flex-start; }
.sidebar {
  width: 180px;
  flex-shrink: 0;
  position: sticky;
  top: 20px;
}
.side-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: background .15s, color .15s, transform .15s;
}
.side-item:hover { transform: translateX(3px); background: #eaf2ff; }
.side-item.active { background: var(--blue); color: #fff; }
.side-item .count { margin-left: auto; font-size: 12px; opacity: .8; }
.content { flex: 1; min-width: 0; }

/* ---------- 分类页标题 ---------- */
.cat-header { margin: 10px 0 6px; }
.cat-header h2 { font-size: clamp(24px, 4vw, 34px); color: var(--blue-dark); }
.cat-header p { color: #5a6b8c; margin-top: 4px; }

/* ---------- 图片网格 ---------- */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.img-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.img-card:hover { transform: translateY(-5px) scale(1.01); box-shadow: 0 12px 26px rgba(47,128,237,.22); }
.img-card img { width: 100%; aspect-ratio: 3/4; object-fit: contain; background: #fff; display: block; }
.img-card figcaption {
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.empty { color: #7a89a8; padding: 40px 0; text-align: center; }
.empty a { color: var(--blue); text-decoration: underline; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(20, 30, 55, .88);
  display: none;
  align-items: center; justify-content: center;
  z-index: 999;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lb-body {
  background: #fff;
  border-radius: var(--radius);
  max-width: min(560px, 92vw);
  width: 100%;
  max-height: 92vh;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.lb-body img {
  width: 100%;
  display: block;
  background: #fff;
  object-fit: contain;
  min-height: 0;
  flex: 1 1 auto;
}
.lb-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  gap: 10px;
}
.lb-title { font-weight: 700; font-size: 15px; }
.lb-actions { display: flex; gap: 8px; }
.btn {
  border: none; cursor: pointer;
  padding: 8px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 700;
  transition: opacity .2s;
}
.btn:hover { opacity: .88; }
.btn-nav { background: var(--blue); color: #fff; }
.btn-close { background: #eef2f8; color: var(--ink); }

footer {
  text-align: center;
  color: #9aa8c4;
  font-size: 13px;
  padding: 24px 0 30px;
}

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: static;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .side-item { white-space: nowrap; margin-bottom: 0; flex-shrink: 0; }
}
@media (max-width: 480px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .img-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .container { padding: 16px 14px 40px; }
}
