/* =========================================================
   拦江榜官网 · 公共样式（宣纸 · 墨色 · 朱砂 · 青灰山水）
   所有页面共用：配色变量、字体、宣纸底、导航、标题、卡片、按钮、页脚、动效开关
   ========================================================= */

@font-face {
  /* 马善政毛笔楷书（SIL OFL 1.1），只打包页面用到的字，见 fonts/README.md */
  font-family: "LJ Brush";
  src: url("../fonts/brush.woff2") format("woff2");
  font-display: swap;
}

:root {
  /* 纸与墨 */
  --paper: #F5EFE3;
  --paper-2: #EFE6D4;
  --paper-card: #FBF7EE;
  --ink: #1B1A18;
  --ink-2: #3D3A35;
  --ink-3: #6A645A;
  /* 朱砂与金褐 */
  --cinnabar: #B04A2C;
  --cinnabar-dark: #8E3920;
  --seal: #B8322A;
  --gold: #9C6B3A;
  --gold-line: #D8C3A0;
  --gold-soft: #E8DAC0;
  /* 青灰山水 */
  --dai: #44535E;
  --dai-deep: #1F3A3D;
  --mist: #C9D0D2;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(70, 50, 20, .06), 0 8px 24px rgba(70, 50, 20, .07);

  --brush: "LJ Brush", "STXingkai", "Xingkai SC", "KaiTi", "STKaiti", serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;

  --wrap: 1180px;
  --header-h: 64px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.8 var(--serif);
  background-color: var(--paper);
  /* 宣纸纤维：程序生成的极淡噪点（提供宣纸底纹素材后可替换为 img/art/paper.jpg） */
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .38  0 0 0 0 .25  0 0 0 .06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 700; line-height: 1.3; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }
.brush { font-family: var(--brush); font-weight: 400; letter-spacing: .02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--cinnabar); outline-offset: 3px; }

/* ---------- 印章 ---------- */
.seal {
  display: inline-grid; place-items: center; flex: none;
  width: 18px; height: 26px; border: 1.5px solid var(--seal); border-radius: 2px;
  color: var(--seal); font: 700 9px/1 var(--serif); writing-mode: vertical-rl; letter-spacing: 1px;
  vertical-align: middle; transform: translateY(-2px);
}
.seal--lg { width: 26px; height: 38px; font-size: 12px; border-width: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; padding: 0 26px; border-radius: 3px; cursor: pointer;
  font: 600 17px/1 var(--serif); letter-spacing: .06em; text-decoration: none;
  border: 1.5px solid transparent;
  transition: background-color .25s, color .25s, box-shadow .25s, transform .25s;
}
.btn::after { content: "→"; font-family: var(--sans); transition: transform .25s; }
.btn--plain::after { content: none; }
.btn:hover::after { transform: translateX(4px); }
.btn:active { transform: translateY(1px); }
.btn--cinnabar { background: var(--cinnabar); color: #FFF8EE; box-shadow: 0 6px 16px rgba(176, 74, 44, .22); }
.btn--cinnabar:hover { background: var(--cinnabar-dark); box-shadow: 0 8px 22px rgba(176, 74, 44, .3); }
.btn--line { background: rgba(255, 252, 245, .7); color: var(--cinnabar); border-color: var(--cinnabar); }
.btn--line:hover { background: var(--cinnabar); color: #FFF8EE; }
.btn--sm { min-height: 38px; padding: 0 16px; font-size: 15px; gap: 8px; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: rgba(248, 243, 233, .9);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(216, 195, 160, .6);
}
.site-header .wrap { display: flex; align-items: center; height: 100%; gap: 20px; }
.logo { display: flex; align-items: center; gap: 6px; text-decoration: none; font-size: 32px; line-height: 1; color: var(--ink); }
.nav { display: none; margin: 0 auto; gap: 34px; }
.nav a {
  position: relative; text-decoration: none; color: var(--ink-2); font-size: 16px; letter-spacing: .08em; padding: 6px 0;
  transition: color .2s;
}
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--gold);
  transform: scaleX(0); transition: transform .3s;
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.header-cta { margin-left: auto; }
.menu-btn {
  margin-left: 8px; width: 44px; height: 44px; border: 1px solid var(--gold-line); border-radius: 4px;
  background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink);
}
.menu-btn span, .menu-btn span::before, .menu-btn span::after { display: block; width: 18px; height: 2px; background: currentColor; position: relative; }
.menu-btn span::before, .menu-btn span::after { content: ""; position: absolute; left: 0; }
.menu-btn span::before { top: -6px; } .menu-btn span::after { top: 6px; }
.mobile-nav {
  position: fixed; inset: var(--header-h) 0 auto 0; z-index: 49; background: var(--paper-card);
  border-bottom: 1px solid var(--gold-line); box-shadow: var(--shadow); padding: 8px 16px 16px;
}
.mobile-nav a { display: block; padding: 14px 4px; font-size: 18px; text-decoration: none; border-bottom: 1px dashed var(--gold-line); }
.mobile-nav a[aria-current="page"] { color: var(--cinnabar); font-weight: 700; }
@media (min-width: 900px) {
  .nav { display: flex; }
  .header-cta { margin-left: 0; }
  .menu-btn, .mobile-nav { display: none !important; }
}
@media (max-width: 420px) { .header-cta { padding: 0 12px; } .logo { font-size: 28px; } }

/* ---------- 板块标题：◇—— 标题 ——◇ ---------- */
.sec { padding: 64px 0; position: relative; }
.sec-head { text-align: center; margin-bottom: 36px; }
.sec-head h2 {
  display: inline-flex; align-items: center; gap: 18px;
  font-family: var(--brush); font-weight: 400; font-size: 34px; letter-spacing: .06em; color: var(--ink);
}
.sec-head h2::before, .sec-head h2::after {
  content: ""; width: 70px; height: 10px; flex: none;
  background:
    linear-gradient(var(--gold-line), var(--gold-line)) center / 100% 1px no-repeat,
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'><path d='M5 0 L10 5 L5 10 L0 5Z' fill='none' stroke='%239C6B3A'/></svg>") right center / 9px no-repeat;
}
.sec-head h2::before { transform: scaleX(-1); }
.sec-head p { margin-top: 6px; color: var(--ink-3); font-size: 16px; }
@media (min-width: 768px) {
  .sec { padding: 68px 0; }
  .sec-head h2 { font-size: 42px; }
  .sec-head h2::before, .sec-head h2::after { width: 120px; }
}
@media (max-width: 520px) { .sec-head h2::before, .sec-head h2::after { width: 22px; } .sec-head h2 { gap: 8px; font-size: 27px; letter-spacing: .02em; } }

/* ---------- 卡片：宣纸卡 + 金褐细框 + 角花 ---------- */
.card {
  position: relative; background: var(--paper-card);
  border: 1px solid var(--gold-line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card::before, .card::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border-color: var(--gold); border-style: solid; opacity: .7;
}
.card::before { top: 5px; left: 5px; border-width: 1px 0 0 1px; }
.card::after { bottom: 5px; right: 5px; border-width: 0 1px 1px 0; }

.icon-ink { width: 40px; height: 40px; color: var(--gold); flex: none; }

/* ---------- 临时素材标记（正式素材替换后在 config.js 关掉） ---------- */
.temp-art { position: relative; }
body.show-temp .temp-art::after {
  content: "临时素材 · 待替换高清图"; position: absolute; right: 8px; top: 8px; z-index: 3;
  font: 12px/1 var(--sans); color: #6B4A00; background: rgba(243, 226, 184, .92);
  padding: 5px 8px; border-radius: 3px; pointer-events: none;
}

/* ---------- 页尾：江河横幅 + 版权 ---------- */
.end-band { position: relative; overflow: hidden; text-align: center; padding: 56px 16px 60px; isolation: isolate; }
.end-band .art { position: absolute; bottom: -12%; height: 124%; z-index: -1; object-fit: cover; }
.end-band .art--l { left: 0; width: 40%; -webkit-mask-image: linear-gradient(90deg, #000 55%, transparent); mask-image: linear-gradient(90deg, #000 55%, transparent); }
.end-band .art--r { right: 0; width: 38%; -webkit-mask-image: linear-gradient(270deg, #000 55%, transparent); mask-image: linear-gradient(270deg, #000 55%, transparent); }
.end-band h2 { font-family: var(--brush); font-weight: 400; font-size: 34px; letter-spacing: .08em; }
.end-band p { color: var(--ink-3); margin: 6px 0 22px; }
@media (min-width: 768px) { .end-band { padding: 72px 16px 80px; } .end-band h2 { font-size: 44px; } }
@media (max-width: 640px) { .end-band .art { opacity: .35; width: 70%; } }

.site-footer { border-top: 1px solid var(--gold-line); background: var(--paper-2); padding: 18px 0 calc(18px + env(safe-area-inset-bottom)); font-size: 14px; color: var(--ink-3); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.site-footer .logo { font-size: 28px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 0; margin-left: auto; }
.foot-links a { text-decoration: none; padding: 0 14px; border-left: 1px solid var(--gold-line); }
.foot-links a:first-child { border-left: 0; }
.foot-links a:hover { color: var(--cinnabar); }
.foot-legal { width: 100%; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; }
.foot-legal a { text-decoration: none; }
.foot-legal a:hover { text-decoration: underline; }
@media (max-width: 640px) { .foot-links { margin-left: 0; } .foot-links a:first-child { padding-left: 0; } }

/* ---------- 动效开关 ---------- */
.motion-toggle {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60;
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
  border-radius: 20px; border: 1px solid var(--gold-line); background: rgba(251, 247, 238, .92);
  color: var(--ink-2); font: 14px/1 var(--serif); cursor: pointer; box-shadow: var(--shadow);
}
.motion-toggle:hover { color: var(--cinnabar); border-color: var(--cinnabar); }

/* 暂停时冻结所有动效 */
html.motion-off *, html.motion-off *::before, html.motion-off *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- 进场：轻微上浮 ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.reveal.is-in { opacity: 1; transform: none; }
html.motion-off .reveal, html.no-js .reveal { opacity: 1; transform: none; transition: none; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
