/* ============================================================
   内容平台前端 — 主样式表
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;700;900&display=swap');

:root {
  --brand-navy: #16213D;
  --brand-navy-deep: #101830;
  --brand-navy-light: #24365E;

  --bg: #F4F5F7;
  --card-bg: #FFFFFF;
  --text: #1A1D26;
  --text-secondary: #5B6472;
  --text-tertiary: #8891A0;
  --border: #E6E8EC;
  --border-soft: #EFF1F4;

  --accent: var(--brand-navy);

  --font-base: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --container-max: 1360px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --header-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-base); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }

.container { max-width: var(--container-max); margin: 0 auto; padding: 0 24px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--brand-navy); outline-offset: 2px; }

/* ---------------- Header ---------------- */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; background: var(--brand-navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-weight: 800; font-size: 16.5px; color: var(--brand-navy); white-space: nowrap; }
.brand-subtitle { font-size: 11px; color: var(--text-tertiary); font-weight: 600; white-space: nowrap; letter-spacing: .01em; }
.header-spacer { flex: 1; }
.main-nav { display: flex; align-items: center; gap: 2px; }
.main-nav a { padding: 9px 13px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; border-bottom: 2px solid transparent; transition: background .15s, color .15s; }
.main-nav a:hover { background: var(--bg); }
.main-nav a.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: #fff; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); flex-shrink: 0; }
.icon-btn:hover { background: var(--bg); }
.icon-btn svg { width: 17px; height: 17px; }
.lang-toggle { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700; color: var(--brand-navy); min-width: 44px; }
.auth-entry-link { display: inline-flex; align-items: center; border: 1px solid var(--brand-navy); background: var(--brand-navy); color: #fff; border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.auth-entry-link:hover { background: var(--brand-navy-light); }
.auth-entry-link-mobile { display: block; padding: 15px 4px; font-size: 16px; font-weight: 800; color: var(--brand-navy); border-top: 1px solid var(--border-soft); margin-top: 6px; }
.lang-toggle:hover { background: var(--bg); }
.menu-toggle { display: none; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; align-items: center; justify-content: center; }
.menu-toggle svg { width: 20px; height: 20px; }

.search-overlay { position: fixed; inset: 0; background: rgba(16,24,48,.55); z-index: 200; display: none; align-items: flex-start; justify-content: center; padding: 90px 20px 20px; }
.search-overlay.is-open { display: flex; }
.search-box { width: 100%; max-width: 620px; background: #fff; border-radius: var(--radius-md); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.search-box form { display: flex; gap: 8px; }
.search-box input[type="search"] { flex: 1; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15px; font-family: inherit; }
.search-box button[type="submit"] { background: var(--brand-navy); color: #fff; border: none; border-radius: var(--radius-sm); padding: 0 18px; font-weight: 700; font-size: 14px; }

/* 公告栏样式已随功能一起移除(暂不使用)。如需恢复,可参考 git 历史里的
   .announcement / .announcement-inner 规则,注意公告文字节点要单独给 class,
   不要用裸 <span> 跟装饰用的圆点混在一起找,容易选错节点。 */

/* ---------------- 通用状态组件 ---------------- */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 50px 20px; color: var(--text-tertiary); text-align: center; grid-column: 1/-1; }
.state svg { width: 30px; height: 30px; }
.state-loading .spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-error { color: #C23B3B; }
.btn-retry { margin-top: 4px; border: 1px solid var(--border); background: #fff; padding: 7px 16px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text); }
.btn-retry:hover { background: var(--bg); }
.muted-note { color: var(--text-tertiary); font-size: 13.5px; padding: 12px 0; }

/* ---------------- 页面结构 ---------------- */
.page-body { padding: 24px 0 60px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 36px 0 16px; }
.section-heading h2 { font-size: 19px; margin: 0; min-width: 0; font-weight: 800; }

/* ---------------- Hero Banner ---------------- */
.hero { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 8px; }
.hero-main { position: relative; min-width: 0; border-radius: var(--radius-lg); overflow: hidden; display: block; aspect-ratio: 16/9; background: var(--accent); }
.hero-main-media { position: absolute; inset: 0; }
.hero-main-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-main-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 28px; background: linear-gradient(0deg, rgba(0,0,0,.75) 0%, rgba(0,0,0,.15) 55%, transparent 100%); color: #fff; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px; color: #FFD9A0; }
.hero-eyebrow svg { width: 14px; height: 14px; }
.hero-main-title { font-size: clamp(20px, 2.6vw, 30px); font-weight: 800; margin: 0 0 8px; line-height: 1.3; }
.hero-main-summary { font-size: 14px; opacity: .85; margin: 0; max-width: 60ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hero-side-item { display: flex; gap: 12px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; flex: 1; }
.hero-side-thumb { width: 76px; height: 60px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--bg); }
.hero-side-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-side-title { font-size: 13.5px; font-weight: 700; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------- 内容卡片网格(推荐/最新) ---------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.content-card { display: flex; flex-direction: column; min-width: 0; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; }
.content-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,24,48,.08); }
.content-card-thumb { aspect-ratio: 16/10; background: var(--bg); }
.content-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); }
.thumb-placeholder svg { width: 30%; height: 30%; max-width: 48px; max-height: 48px; }
.thumb-placeholder.large svg { max-width: 72px; max-height: 72px; }
.content-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.content-card-title { font-size: 15px; font-weight: 700; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.content-card:hover .content-card-title { color: var(--accent); }
.content-card-summary { font-size: 13px; color: var(--text-secondary); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.content-card-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* ---------------- 分类板块(首页) ---------------- */
.category-block { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 20px; min-width: 0; }
.category-block-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; background: var(--accent); color: #fff; }
.category-block-title { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 15.5px; min-width: 0; }
.category-block-title svg { width: 18px; height: 18px; }
.category-block-more { font-size: 13px; font-weight: 600; opacity: .9; }
.category-block-more:hover { opacity: 1; text-decoration: underline; }
.category-block-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 16px 20px; }
.category-block-list .content-card { flex-direction: row; }
.category-block-list .content-card-thumb { width: 108px; aspect-ratio: unset; flex-shrink: 0; }
@media (max-width: 900px) { .category-block-list { grid-template-columns: 1fr; } }
.categories-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .categories-grid { grid-template-columns: 1fr; } }

/* ---------------- 分类/搜索列表页 ---------------- */
.page-title-bar { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-radius: var(--radius-md); background: var(--accent); color: #fff; margin-bottom: 20px; }

/* ---------------- 登录/注册预留页面(功能未开放时的占位提示) ---------------- */
.account-placeholder { max-width: 480px; margin: 60px auto; text-align: center; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 48px 32px; }
.account-placeholder h1 { font-size: 22px; font-weight: 800; color: var(--brand-navy); margin: 0 0 12px; }
.account-placeholder p { color: var(--text-secondary); font-size: 14.5px; margin: 0 0 24px; }
.account-placeholder a.btn-back { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 9px 22px; font-size: 13.5px; font-weight: 700; color: var(--text); }
.account-placeholder a.btn-back:hover { background: var(--bg); }
.page-title-bar h1 { font-size: 19px; margin: 0; min-width: 0; display: flex; align-items: center; gap: 10px; }
.page-title-bar svg { width: 20px; height: 20px; }
.breadcrumb { font-size: 13px; color: var(--text-tertiary); margin-bottom: 14px; }
.breadcrumb a:hover { text-decoration: underline; color: var(--brand-navy); }
.list-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 18px; }
.load-more-row { text-align: center; margin-top: 26px; }
.btn-load-more { border: 1px solid var(--border); background: #fff; padding: 10px 26px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.btn-load-more:hover { background: var(--bg); }

/* ---------------- 详情页 ---------------- */
.article-layout { max-width: 820px; margin: 0 auto; }
.article-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px; color: #fff; background: var(--accent); margin-bottom: 14px; }
.article-tag svg { width: 14px; height: 14px; }
.article-title { font-size: clamp(22px, 4vw, 32px); font-weight: 800; line-height: 1.35; margin: 0 0 14px; color: var(--brand-navy); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 13px; color: var(--text-tertiary); margin-bottom: 22px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.article-meta svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
.article-cover { width: 100%; border-radius: var(--radius-md); overflow: hidden; margin-bottom: 24px; aspect-ratio: 16/9; background: var(--bg); }
.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-body { font-size: 16.5px; color: var(--text); line-height: 1.9; }
.article-body p { margin: 0 0 18px; }

/* YouTube 播放器: 用 padding-bottom 撑出 16:9 比例的响应式容器,
   PC/平板/手机下宽度都是 100% 撑满文章列宽,iframe 用绝对定位铺满容器,
   不需要针对断点单独写样式,天然响应式。 */
.video-embed { position: relative; width: 100%; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius-md); margin: 24px 0; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------------- 评论区 ---------------- */
.comments-section { margin-top: 44px; padding-top: 30px; border-top: 2px solid var(--border); }
.comments-heading { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; margin: 0 0 6px; color: var(--brand-navy); }
.comments-count { font-weight: 600; color: var(--text-tertiary); font-size: 14px; }
.comments-hint { font-size: 13px; color: var(--text-tertiary); margin: 0 0 18px; }
.comment-form { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; margin-bottom: 26px; }
.comment-form textarea { width: 100%; min-height: 88px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; font-family: inherit; font-size: 14.5px; resize: vertical; }
.comment-form-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.comment-form-note { font-size: 12px; color: var(--text-tertiary); }
.btn-primary { background: var(--brand-navy); color: #fff; border: none; border-radius: var(--radius-sm); padding: 10px 22px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.btn-primary:hover { background: var(--brand-navy-light); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.comment-status-msg { font-size: 13px; margin-top: 10px; padding: 8px 12px; border-radius: var(--radius-sm); display: none; }
.comment-status-msg.is-visible { display: block; }
.comment-status-msg.ok { background: #E7F5EC; color: #1E7A4C; }
.comment-status-msg.warn { background: #FDEDED; color: #C23B3B; }
.comment-list { display: flex; flex-direction: column; gap: 16px; }
.comment-item { display: flex; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border-soft); }
.comment-item:last-child { border-bottom: none; padding-bottom: 0; }
.comment-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-navy); color: #fff; font-size: 13px; font-weight: 700; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.comment-body-col { min-width: 0; flex: 1; }
.comment-author-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.comment-author { font-weight: 700; color: var(--text); }
.comment-time { color: var(--text-tertiary); }
.comment-text { font-size: 14.5px; color: var(--text); margin: 0; word-break: break-word; }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--brand-navy-deep); color: #fff; margin-top: 40px; }
.footer-inner { padding: 36px 24px 20px; }
.footer-tagline { font-size: 15px; font-weight: 700; color: #C7CEDE; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 16px 24px; text-align: center; font-size: 12px; color: #7C87A3; }

/* ---------------- 响应式导航 ---------------- */
@media (max-width: 980px) {
  .main-nav { display: none; }
  .menu-toggle { display: flex; }
  .mobile-nav { display: none; position: fixed; inset: var(--header-h) 0 0 0; background: #fff; z-index: 90; overflow-y: auto; padding: 8px 20px 40px; }
  .mobile-nav.is-open { display: block; }
  .mobile-nav a { display: flex; align-items: center; gap: 10px; padding: 15px 4px; font-size: 16px; font-weight: 700; border-bottom: 1px solid var(--border-soft); color: var(--text); }
  .mobile-nav .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
  .hero { grid-template-columns: 1fr; }
  .hero-side { flex-direction: row; overflow-x: auto; }
  .hero-side-item { min-width: 220px; }
}
@media (min-width: 981px) { .mobile-nav { display: none !important; } }

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .header-inner { gap: 10px; }
  .brand-subtitle { display: none; }
  .card-grid, .list-page-grid { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
  .content-card-title { font-size: 13.5px; }
  .content-card-summary { -webkit-line-clamp: 2; font-size: 12px; }
  .category-block-header { padding: 13px 16px; }
  .category-block-list { padding: 14px 16px; grid-template-columns: 1fr; }
  .category-block-list .content-card-thumb { width: 84px; }
  .article-meta { gap: 10px 14px; }
  .comment-form-footer { flex-direction: column; align-items: stretch; }
  .comment-form-footer .btn-primary { width: 100%; }
  .hero-side { flex-direction: column; }
}

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