/* ============ 基础 ============ */
:root {
  --bg: #faf9f7;
  --text: #2b2b2b;
  --muted: #7a736c;
  --accent: #8a6d3b;
  --accent-soft: #f1e9dd;
  --border: #e7e2db;
  --card: #ffffff;
  --radius: 10px;
  --maxw: 1100px;
}

/* 主题：打金打银（暖金调，布局结构不变） */
.theme-metal {
  --accent: #a8814a;
  --accent-soft: #f4ecdf;
}

/* 主题：成品（雅蓝调） */
.theme-product {
  --accent: #3b6ea5;
  --accent-soft: #e6eef6;
}

/* 主题：大漆（漆红棕调） */
.theme-lacquer {
  --accent: #8c2f2f;
  --accent-soft: #f3e4e0;
}

/* 主题：教学（冷钢调） */
.theme-course {
  --accent: #2f6d7c;
  --accent-soft: #e2eef0;
}

/* 主题：博客手记（墨绿调） */
.theme-note {
  --accent: #4f6f57;
  --accent-soft: #e8efe9;
}

* { box-sizing: border-box; }
/* 字体：全站只用免费可商用开源字体（Noto Sans SC 思源黑体，SIL OFL 协议，随站分发）。
   不引用任何商业字体名称（苹方/微软雅黑等均已移除，避免商用争议）。
   system-ui/sans-serif 只是系统默认字体机制，不指定任何品牌字体。 */
body {
  margin: 0;
  font-family: "Noto Sans SC Variable", "Noto Sans SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

h1 { font-size: 1.9rem; line-height: 1.35; margin: 0 0 .5em; }
h2 { font-size: 1.35rem; margin: 1.8em 0 .6em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 .4em; }
code { background: var(--accent-soft); padding: .1em .4em; border-radius: 4px; }

/* ============ 头部导航 ============ */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 60px; gap: 16px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a {
  padding: 6px 12px; border-radius: 999px; color: var(--text); font-size: .95rem;
}
.site-nav a:hover { background: var(--accent-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { background: var(--accent); color: #fff; }

/* ============ 首页 ============ */
.hero { padding: 48px 0 24px; }
.hero-desc { font-size: 1.05rem; color: var(--muted); max-width: 720px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.section-head h2 { margin-bottom: .4em; }
.home-section { margin: 28px 0; }
.home-notice {
  margin: 40px 0; padding: 20px 24px;
  background: var(--accent-soft); border-radius: var(--radius);
}

/* ============ 按钮 ============ */
.btn {
  display: inline-block; padding: 9px 20px; border-radius: 999px;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  font-size: .95rem; cursor: pointer;
}
.btn:hover { opacity: .9; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-xhs { background: #ff2442; border-color: #ff2442; }

/* ============ 卡片网格 ============ */
.card-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.work-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
}
.card-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.card-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.card-title { margin: 0; font-size: 1.05rem; }
.card-title a { color: var(--text); }
.card-id { margin: 0; color: var(--accent); font-size: .85rem; font-weight: 600; }
.card-desc {
  margin: 0; color: var(--muted); font-size: .9rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ============ 标签 ============ */
.tag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: .8rem;
}
a.tag:hover { text-decoration: none; filter: brightness(.95); }

/* ============ 筛选 ============ */
.filter-bar { margin: 20px 0 24px; }
.filter-input, .search-input {
  width: 100%; max-width: 520px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .95rem; background: var(--card);
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  padding: 5px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: .85rem;
}
.chip.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.filter-empty { color: var(--muted); padding: 24px 0; }

/* ============ 详情页 ============ */
.breadcrumb { margin: 20px 0 10px; color: var(--muted); font-size: .85rem; }
.work-head h1 { margin-bottom: .3em; }
.work-meta {
  list-style: none; margin: 0 0 10px; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .92rem;
}
.work-body { margin-top: 28px; }
.work-copyright, .work-contact, .work-related {
  margin-top: 32px; padding: 18px 22px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
}
.work-copyright h2, .work-contact h2, .work-related h2 { margin-top: 0; }
.rel-list { margin: 0; padding-left: 1.2em; }
.rel-list li { margin: 4px 0; }
.auth-note { color: var(--muted); font-size: .9rem; }
.trade-note { color: var(--muted); font-size: .85rem; }
.page-body { padding: 24px 0 40px; max-width: 820px; }
.contact-list { list-style: none; padding: 0; font-size: 1.05rem; }
.contact-list li { margin: 8px 0; }
.list-head { padding: 28px 0 8px; }

/* ============ 媒体区块 ============ */
.media-gallery, .media-video, .media-weibo, .media-xhs { margin: 26px 0; }
.media-hint { color: var(--muted); font-size: .82rem; margin: 6px 0 0; }
/* ============ 视频（抖音官方播放器） ============ */
/* ★ 终稿（2026-09 实测定死）：
   抖音播放器是响应式的：渲染宽度 < 420px 时它会自己收起分享按钮/进度条（界面不完整）。
   解法：iframe 永远按 420×855 渲染，再用 JS transform 等比缩放到可见框。
   任何设备都得到完整界面。⚠️ 不要移除 main.js 里的 fitVideos。 */
.video-frame {
  position: relative; overflow: hidden;
  width: min(420px, 100%);
  aspect-ratio: 420 / 855;
  background: var(--bg);
  border-radius: 8px;
}
.video-scale {
  position: absolute; left: 0; top: 0;
  width: 420px; height: 855px;
  transform-origin: top left;
}
.video-scale iframe {
  display: block; width: 420px; height: 855px; border: 0;
  overflow: hidden; scrollbar-width: none;
}
.video-scale iframe::-webkit-scrollbar { display: none; }
/* 横版视频 */
.video-frame.video-land { width: min(640px, 100%); aspect-ratio: 16 / 9; }
.video-frame.video-land .video-scale,
.video-frame.video-land .video-scale iframe { width: 960px; height: 540px; }
/* 手机：竖版视频通栏 */
@media (max-width: 640px) {
  .video-frame {
    margin-left: -20px; margin-right: -20px;
    width: calc(100% + 40px);
    border-radius: 0;
  }
  .video-frame.video-land { width: calc(100% + 40px); }
}
/* 封面缺图兜底 */
.card-noimg {
  width: 100%; aspect-ratio: 4 / 3;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; padding: 12px; text-align: center;
}
.xhs-card {
  display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.xhs-cover { width: 140px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; }
.xhs-body { flex: 1; min-width: 220px; }

/* ============ 轮播 ============ */
.carousel { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--card); }
.carousel-track { display: flex; transition: transform .35s ease; }
.carousel-slide { margin: 0; min-width: 100%; }
.carousel-slide img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; cursor: zoom-in; }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 1.4rem; line-height: 1;
}
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }
.carousel-dots {
  position: absolute; bottom: 12px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 8px;
}
.carousel-dots button {
  width: 8px; height: 8px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, .55); padding: 0;
}
.carousel-dots button.is-active { background: #fff; }

/* ============ 灯箱 ============ */
.lightbox {
  position: fixed; inset: 0; z-index: 99;
  background: rgba(0, 0, 0, .88);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.lightbox.is-open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: 0; color: #fff; font-size: 2rem; cursor: pointer;
}

/* ============ 搜索 ============ */
.search-box { margin: 18px 0; }
.search-results { list-style: none; padding: 0; }
.search-item {
  padding: 14px 0; border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px;
}

/* ============ 页脚 ============ */
.site-footer {
  margin-top: 56px; background: var(--card);
  border-top: 1px solid var(--border); padding: 32px 0 18px;
}
.footer-grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.footer-heading { font-size: 1rem; margin: 0 0 10px; }
.footer-contact { list-style: none; margin: 0; padding: 0; color: var(--muted); font-size: .92rem; }
.footer-contact li { margin: 4px 0; }
.footer-note { color: var(--muted); font-size: .85rem; margin: 0; }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: .82rem;
}
.footer-bottom a { color: inherit; text-decoration: none; }
.footer-bottom a:hover { color: var(--accent, #0F766E); }
.gongan-link { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.gongan-badge { display: inline-block; width: 18px; height: 18px; flex-shrink: 0; }

/* ============ 移动端 ============ */
@media (max-width: 640px) {
  h1 { font-size: 1.55rem; }
  .hero { padding: 32px 0 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .header-inner { min-height: 54px; }
  .site-nav a { padding: 5px 9px; font-size: .88rem; }
  .xhs-cover { width: 110px; }
  .carousel-btn { width: 36px; height: 36px; }
}
