:root {
  --bg: #ffffff;
  --text: #1f1f1f;
  --muted: #5a5a5a;
  --line: #eceef1;
  --brand: #c8a661; /* 雅金 */
  --brand-dark: #ae9358;
  --soft: #f5f6f7;
  --shadow: 0 8px 24px rgba(0,0,0,0.08);
  --rel-thumb-w: 128px; /* 相关推荐横向缩略图宽 */
  --rel-thumb-h: 112px;  /* 相关推荐横向缩略图高（固定高度）*/
}

* { box-sizing: border-box; }
html { 
  font-size: 16px; 
  scroll-behavior: smooth;
}
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: 64px; /* 预留固定头部高度 */
  display: flex;
  flex-direction: column;
}
img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; }
.section { padding: 48px 0; }
/* 滚动偏移由 JavaScript 精确控制 */
.section-title { font-size: 22px; font-weight: 700; margin: 0 0 16px; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Header & Nav */
.site-header { position: fixed; left: 0; right: 0; top: 0; z-index: 50; background: rgba(255,255,255,0.9); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; line-height: 1; }
.logo em { font-style: normal; color: var(--brand); }
.logo img { width: 2em; height: 2em; display: block; }
.logo span { line-height: 1; display: inline-flex; align-items: center; transform: translateY(-1px); }

.nav-toggle { display: none; }
.nav-btn { display: none; cursor: pointer; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.04); }
.nav-btn span { display: block; width: 22px; height: 3px; background: var(--text); position: relative; border-radius: 2px; transition: background .2s ease; }
.nav-btn span::before, .nav-btn span::after { content: ""; position: absolute; left: 0; width: 22px; height: 3px; background: var(--text); border-radius: 2px; transition: transform .25s ease, top .25s ease; }
.nav-btn span::before { top: -6px; }
.nav-btn span::after { top: 6px; }

.site-nav { display: flex; align-items: center; gap: 8px; }
.site-nav a { padding: 8px 12px; border-radius: 8px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--soft); color: var(--brand); }

/* Banner Search */
.banner { position: relative; background: radial-gradient(1200px 300px at 50% -50%, #fafafa 10%, transparent 60%), var(--bg); border-bottom: 1px solid var(--line); }
.banner-inner { padding: 56px 0 28px; display: grid; gap: 18px; justify-items: center; }
.banner-title { font-size: 28px; margin: 0 0 8px; text-align: center; }
.search-form { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; width: 520px; max-width: 92vw; box-shadow: 0 6px 18px rgba(0,0,0,0.04); }
.search-form input[type="search"] { flex: 1; border: 0; outline: 0; padding: 10px 12px 10px 8px; font-size: 16px; background: transparent; }
.search-form .btn { padding: 10px 14px; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; border-radius: 10px; background: var(--brand); color: #fff; border: 1px solid var(--brand); font-weight: 600; transition: transform .2s ease, box-shadow .2s ease, background .2s ease; }
.btn:hover { background: var(--brand-dark); color: #fff; box-shadow: var(--shadow); transform: translateY(-1px); }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { color: var(--text); }
.btn.disabled { opacity: 0.5; cursor: not-allowed; }
.btn.disabled:hover { background: var(--brand); color: #fff; box-shadow: none; transform: none; }
.btn.ghost.disabled { background: #f5f5f5; color: var(--muted); border-color: #e0e0e0; opacity: 0.6; }
.btn.ghost.disabled:hover { background: #f5f5f5; color: var(--muted); box-shadow: none; transform: none; }

.ad-slot { margin-top: 16px; border: none; border-radius: 0; overflow: hidden; }
.ad-slot a { display: block; }
.ad-slot img { width: 100%; height: auto; }
/* 让容器内的广告位紧贴边缘 */
.container.ad-slot { padding: 0; }

/* Card Grid */
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.03); transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0,0,0,0.08); border-color: var(--brand); }
.card:focus-within { box-shadow: 0 10px 30px rgba(0,0,0,0.1); border-color: var(--brand); }
.card-cover { position: relative; background: #fafafa; aspect-ratio: 280 / 200; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; transition: transform .25s ease; }
.card:hover .card-cover img { transform: scale(1.03); }
/* 访问图标悬浮效果 */
/* 遮层效果 */
.card-cover::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); opacity: 0; transition: opacity .3s ease; pointer-events: none; z-index: 1; }
.card-cover:hover::before { opacity: 1; }
/* 访问图标 */
.card-cover::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; background: rgba(255,255,255,0.95); border-radius: 50%; opacity: 0; transition: opacity .3s ease, transform .3s ease; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,0.15); background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23c8a661" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path><polyline points="15 3 21 3 21 9"></polyline><line x1="10" y1="14" x2="21" y2="3"></line></svg>'); background-repeat: no-repeat; background-position: center; background-size: 28px 28px; z-index: 2; }
.card-cover:hover::after { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 16px; font-weight: 700; margin: 0; display: block; line-height: 1.5; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.card-title a { transition: color .2s ease; }
.card:hover .card-title a, .card:focus-within .card-title a { color: var(--brand); }
.card-desc { color: var(--muted); font-size: 14px; margin: 0; display: block; line-height: 1.6; max-height: 3.2em; overflow: hidden; flex: 1 1 0; min-height: 3.2em; }
.card-meta { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: auto; flex-shrink: 0; }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--soft); color: var(--text); font-weight: 600; text-decoration: none; }
.badge a { color: inherit; text-decoration: none; }

/* Horizontal result list (Search) */
.result-list { display: flex; flex-direction: column; gap: 20px; }
.card.card-horizontal { flex-direction: row; min-height: 190px; }
.card.card-horizontal .card-cover { flex: 0 0 280px; aspect-ratio: auto; height: 190px; border-right: 1px solid var(--line); }
.card.card-horizontal .card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card.card-horizontal .card-body { padding: 18px 20px; gap: 10px; }
.card.card-horizontal .card-title { font-size: 18px; white-space: normal; display: block; line-height: 1.5; }
.card.card-horizontal .card-desc { font-size: 15px; line-height: 1.7; max-height: none; min-height: auto; color: var(--text); display: -webkit-box; -webkit-line-clamp: 5; line-clamp: 5; -webkit-box-orient: vertical; }
.card.card-horizontal .card-meta { font-size: 13px; justify-content: flex-start; gap: 16px; flex-wrap: wrap; }
.search-highlight { color: #d93025; font-weight: 700; background: transparent; }


/* Filters */
.filters { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.filter-row strong { min-width: 72px; color: #000; }
.filter-row a { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; color: #000; }
.filter-row a:hover, .filter-row a.active { background: var(--soft); color: var(--brand); }

/* Pagination */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 14px; }
.pagination a:hover, .pagination span[aria-current="page"] { background: var(--soft); color: var(--brand); }
.pagination-total { color: var(--muted); font-size: 14px; margin-right: 8px; white-space: nowrap; }

/* Detail Layout */
.detail { display: grid; grid-template-columns: 2.1fr 0.7fr; gap: 24px; align-items: start; }
.detail-main { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.detail-top { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: stretch; }
.detail-title { margin: 0 0 8px; font-size: 22px; }
.detail-cover { width: 100%; margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fafafa; box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 0 0 1px rgba(200,166,97,0.08); height: 228px; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-cover.slider { position: relative; height: 228px; }
.detail-cover .slides { position: relative; width: 100%; height: 228px; }
.detail-cover.slider { touch-action: pan-y; }
.detail-cover .slides img { position: absolute; inset: 0; width: 100%; height: 228px; object-fit: cover; object-position: 50% 50%; opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.detail-cover .slides img.active { opacity: 1; pointer-events: auto; }
.slide-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(200,166,97,0.85); color: var(--brand); background: rgba(255,255,255,0.95); backdrop-filter: blur(2px); cursor: pointer; font-size: 22px; font-weight: 800; box-shadow: 0 6px 16px rgba(0,0,0,0.2); -webkit-tap-highlight-color: transparent; text-shadow: 0 1px 0 rgba(255,255,255,0.6); }
.slide-nav:hover { background: #fff; transform: translateY(-50%) scale(1.05); }
.slide-nav:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.slide-nav.prev { left: 8px; }
.slide-nav.next { right: 8px; }
.slide-nav { transition: opacity .2s ease, visibility .2s ease; }
@media (hover: hover) {
  .detail-cover.slider .slide-nav { opacity: 0; visibility: hidden; }
  .detail-cover.slider:hover .slide-nav, .detail-cover.slider .slide-nav:focus-visible { opacity: 1; visibility: visible; }
}
@media (max-width: 520px) {
  .slide-nav { display: none; }
  .detail-cover.slider { display: block; }
}
.slide-indicators { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 4px 8px; border-radius: 999px; background: rgba(0,0,0,0.18); backdrop-filter: blur(2px); }
.slide-indicators button { width: 8px; height: 8px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.7); background: rgba(255,255,255,0.5); padding: 0; display: inline-block; }
.slide-indicators button.active { background: var(--brand); border-color: var(--brand); width: 18px; }
.slide-counter { position: absolute; bottom: 8px; left: 8px; padding: 4px 8px; border-radius: 999px; font-size: 12px; color: #fff; background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.2); }
.hidden { display: none !important; }
.kv { display: grid; gap: 10px; font-size: 14px; color: var(--muted); height: 100%; overflow: hidden; }
.kv .row { display: flex; gap: 8px; }
.kv .row strong { color: var(--text); min-width: 72px; }
.kv .row span, .kv .row time { flex: 1; min-width: 0; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kv .btns { display: flex; gap: 10px; margin-top: 6px; }
.kv .btns .btn { padding: 12px 20px; font-size: 16px; font-weight: 700; letter-spacing: .2px; border-width: 2px; border-radius: 12px; min-width: 168px; }

.detail-content { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 18px; }
.detail-content h2 { font-size: 18px; margin: 14px 0; }
.detail-content p { margin: 10px 0; color: var(--text); }
.detail-content .media-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.detail-content img { border: 1px solid var(--line); border-radius: 10px; cursor: zoom-in; }
.detail-content .empty-content { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 20px; text-align: center; }
.detail-content .empty-icon { color: var(--muted); opacity: 0.5; margin-bottom: 16px; }
.detail-content .empty-text { color: var(--muted); font-size: 15px; margin: 0; }

/* Lightbox */
.zoomable { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.86); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.45); cursor: zoom-out; }
.lightbox .close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); font-size: 20px; }
.lightbox .close:hover { background: rgba(255,255,255,0.2); }

/* Aside */
.aside { display: grid; gap: 16px; align-self: start; }
.widget { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; height: auto; min-height: auto; }
.widget.ad-slot { padding: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.widget.ad-slot a { display: block; }
.widget.ad-slot img { display: block; width: auto; max-width: 100%; height: auto; }
.aside .widget .card { box-shadow: 0 1px 6px rgba(0,0,0,0.03); }
.aside .widget .card:hover { transform: none; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-color: var(--line); }
.aside .widget .card-title { font-size: 15px; }
.aside .widget .card-cover img { transform: none !important; }
.aside .widget .card:hover, .aside .widget .card:focus-within { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,0.08); }

/* 当相关推荐超出三条时，从第4条起改为横向卡片，降低右侧高度 */
/* 若相关推荐数量超过3条，则所有条目横向显示，固定缩略图高度 */
.aside .widget .grid:has(.card:nth-child(4)) .card { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: var(--rel-thumb-h); align-items: stretch; }
.aside .widget .grid:has(.card:nth-child(4)) .card-cover { width: 100%; height: var(--rel-thumb-h); aspect-ratio: auto; margin: 0; }
.aside .widget .grid:has(.card:nth-child(4)) .card-cover img { height: 100%; }
.aside .widget .grid:has(.card:nth-child(4)) .card-body { padding: 8px 10px; gap: 3px; height: var(--rel-thumb-h); overflow: hidden; display: grid; grid-template-rows: min-content minmax(0,1fr) min-content; }
.aside .widget .grid:has(.card:nth-child(4)) .card-title { font-size: 15px; line-height: 1.35; min-height: 1.35em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.aside .widget .grid:has(.card:nth-child(4)) .card-desc { line-height: 1.45; max-height: 2.9em; overflow: hidden; min-height: 2.9em; }
.aside .widget .grid:has(.card:nth-child(4)) .card-meta { font-size: 11px; margin-top: auto; }
.widget h3 { margin: 0 0 10px; font-size: 16px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a { font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; }
.tag-cloud a:hover { background: var(--soft); color: var(--brand); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: #fff; }
.footer-inner { padding: 24px 0; display: grid; gap: 12px; color: var(--muted); font-size: 14px; }

/* Friend Links & Footer Indent (align with container/logo left edge) */
.friend-links .friend-links-content { padding-left: 16px; }
.site-footer .footer-inner > div { padding-left: 16px; }
.friend-links { background: #fff; border-top: 1px solid var(--line); }
.friend-links .links { display: flex; gap: 12px; flex-wrap: wrap; padding: 4px 0; }
.friend-links a { color: var(--muted); }
.friend-links a:hover { color: var(--brand); }

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.reveal.show { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Responsive */
@media (max-width: 1200px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .detail-top { grid-template-columns: 1fr; }
  .detail-cover { aspect-ratio: 320 / 228; height: auto !important; }
  .detail-cover.slider { height: auto !important; }
  .detail-cover .slides { height: 100% !important; }
  .detail-cover .slides img { height: 100% !important; }
}
@media (max-width: 768px) {
  .card.card-horizontal { flex-direction: column; }
  .card.card-horizontal .card-cover { width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); aspect-ratio: 280 / 200; }
  .card.card-horizontal .card-cover img { height: 100%; }
  .card.card-horizontal .card-desc { display: block; -webkit-line-clamp: initial; line-clamp: initial; -webkit-box-orient: initial; overflow: visible; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .header-inner { height: 60px; }
  .nav-btn { display: inline-flex; }
  .site-nav { position: absolute; left: 0; right: 0; top: 64px; background: #fff; border-bottom: 1px solid var(--line); padding: 8px 16px 16px; display: none; flex-direction: column; gap: 6px; }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  /* 移动端隐藏广告位 */
  .ad-slot { display: none; }
}
/* 切换为 X 图标（使用 :has 选择器感知 checked 状态） */
.header-inner:has(#nav-toggle:checked) .nav-btn span { background: transparent; }
.header-inner:has(#nav-toggle:checked) .nav-btn span::before { top: 0; transform: rotate(45deg); }
.header-inner:has(#nav-toggle:checked) .nav-btn span::after { top: 0; transform: rotate(-45deg); }
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .banner-title { font-size: 22px; }
  :root { --card-body-height: 120px; }
  .kv .btns .btn { padding: 11px 18px; font-size: 15px; min-width: 148px; }
  .pagination-total { width: 100%; text-align: center; margin-right: 0; margin-bottom: 4px; }
}
