/* =========================================================
   牌乐门 · 共享样式表  /assets/site.css
   奶油底 + 陶土红 + 深松绿 + 暖金 的复古出版体系
   ========================================================= */

/* ---------- 1. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol { margin: 0; }

ul, ol { padding: 0; list-style: none; }

img, svg, video { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

a { color: inherit; text-underline-offset: 2px; }

table { border-collapse: collapse; width: 100%; }

summary { display: list-item; cursor: pointer; }
summary::-webkit-details-marker { display: none; }

/* ---------- 2. 设计变量 ---------- */
:root {
  --clay: #B4462F;
  --clay-soft: rgba(180, 70, 47, 0.07);
  --pine: #2F4A3C;
  --gold: #D9A441;
  --paper: #F7F1E4;
  --paper-raise: #FCF7EC;
  --ink: #2A211C;
  --flame: #E4572E;
  --sand: #E7D2C6;
  --sky: #3E6E8E;
  --moss: #55645A;

  --rule: rgba(42, 33, 28, 0.16);
  --rule-strong: rgba(42, 33, 28, 0.42);
  --rule-light: rgba(247, 241, 228, 0.22);
  --rule-light-strong: rgba(247, 241, 228, 0.38);

  --shadow-1: 0 1px 2px rgba(42, 33, 28, 0.05), 0 10px 26px -18px rgba(42, 33, 28, 0.55);

  --shell: 1180px;
  --gutter: clamp(20px, 5vw, 56px);

  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t: 180ms;
  --t-slow: 220ms;
}

/* ---------- 3. 中文排版基座 ---------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--ink);
  letter-spacing: -0.012em;
  line-height: 1.1;
  text-wrap: balance;
}

h1 { font-size: clamp(38px, 6.4vw, 68px); font-weight: 900; line-height: 1.06; }
h2 { font-size: clamp(25px, 3vw, 34px); font-weight: 700; line-height: 1.14; }
h3 { font-size: 22px; font-weight: 700; line-height: 1.25; }
h4 { font-size: 18px; font-weight: 700; line-height: 1.35; font-family: var(--font-sans); }

p { font-size: 17px; }
small, .text-small { font-size: 13px; line-height: 1.65; }

strong, b { font-weight: 700; }

::selection { background: var(--gold); color: var(--ink); }

/* 焦点反馈：全站统一暖金描边 */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

#main-content { scroll-margin-top: 96px; }

/* ---------- 4. 跳过导航 ---------- */
.skip-link {
  position: fixed;
  top: -72px;
  left: 16px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--pine);
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-radius: 2px;
  box-shadow: var(--shadow-1);
  transition: top var(--t) var(--ease);
}

.skip-link:focus { top: 16px; }

/* ---------- 5. 页头：框架式导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--paper);
  border-top: 3px solid var(--clay);
  border-bottom: 1px solid var(--ink);
  box-shadow: 0 1px 0 rgba(42, 33, 28, 0.03), 0 10px 22px -20px rgba(42, 33, 28, 0.7);
}

.site-header__frame {
  position: relative;
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
  min-height: 74px;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: clamp(12px, 2vw, 28px);
}

/* 品牌签 */
.brand { display: flex; align-items: center; flex: 0 0 auto; }

.brand__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  text-decoration: none;
  color: inherit;
}

.brand__mark {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--clay);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  border-radius: 2px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: background-color var(--t) var(--ease);
}

.brand__link:hover .brand__mark { background: var(--ink); }

.brand__text { display: flex; flex-direction: column; line-height: 1.15; }

.brand__name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand__line {
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--moss);
  white-space: nowrap;
}

/* 导航 */
.site-nav { display: flex; align-items: stretch; flex: 0 1 auto; }

.site-nav__list { display: flex; align-items: stretch; }

.site-nav__item {
  display: flex;
  align-items: stretch;
  border-left: 1px solid var(--rule);
}

.site-nav__item:last-child { border-right: 1px solid var(--rule); }

.site-nav__link {
  display: flex;
  align-items: center;
  padding: 0 clamp(9px, 1.1vw, 15px);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 3px solid transparent;
  transition: color var(--t) var(--ease),
              background-color var(--t) var(--ease),
              border-color var(--t) var(--ease);
}

.site-nav__link:hover {
  color: var(--clay);
  background: var(--clay-soft);
  border-bottom-color: var(--gold);
}

.site-nav__link[aria-current="page"] {
  color: var(--clay);
  font-weight: 700;
  border-bottom-color: var(--clay);
  background: var(--clay-soft);
}

/* 页头右侧 */
.site-header__aside {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

/* 移动导航按钮 */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 2px;
  transition: background-color var(--t) var(--ease),
              color var(--t) var(--ease),
              border-color var(--t) var(--ease);
}

.nav-toggle:hover { background: var(--ink); color: var(--paper); }

.nav-toggle[aria-expanded="true"] {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--paper);
}

.nav-toggle__bars {
  position: relative;
  width: 16px;
  height: 2px;
  background: currentColor;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: currentColor;
}

.nav-toggle__bars::before { top: -5px; }
.nav-toggle__bars::after { top: 5px; }

/* 滚动进度 */
.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--clay));
  pointer-events: none;
  transition: width 120ms linear;
}

/* ---------- 6. 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 2px;
  transition: background-color var(--t) var(--ease),
              color var(--t) var(--ease),
              border-color var(--t) var(--ease),
              transform var(--t) var(--ease);
}

.btn:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
}

.btn--sm { padding: 8px 14px; font-size: 13px; }

.btn--solid {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--paper);
}

.btn--solid:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.btn--point {
  background: var(--flame);
  border-color: var(--flame);
  color: #FFF6F0;
}

.btn--point:hover { background: var(--clay); border-color: var(--clay); color: #FFF6F0; }

/* ---------- 7. 容器与网格 ---------- */
.container {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.split--offset > :last-child { margin-inline-start: clamp(0px, 5vw, 72px); }

.section { padding-block: clamp(40px, 6vw, 80px); }

.section--sand {
  background: var(--sand);
  border-block: 1px solid var(--rule);
}

.section--pine {
  background: var(--pine);
  color: var(--paper);
  border-block: 1px solid var(--ink);
}

.section--pine h1,
.section--pine h2,
.section--pine h3 { color: var(--paper); }

/* ---------- 8. 章节标记 ---------- */
.chapter-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.chapter-mark__num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.chapter-mark__label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--moss);
  white-space: nowrap;
}

.chapter-mark__line {
  flex: 1 1 auto;
  height: 1px;
  background: var(--rule-strong);
}

.section--pine .chapter-mark__line { background: var(--rule-light-strong); }
.section--pine .chapter-mark__label { color: rgba(247, 241, 228, 0.68); }

/* ---------- 9. 面包屑 ---------- */
.breadcrumb { font-size: 13px; line-height: 1.6; color: var(--moss); }

.breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
}

.breadcrumb__item { display: inline-flex; align-items: center; gap: 6px; }

.breadcrumb__item:not(:last-child)::after {
  content: "／";
  color: var(--rule-strong);
}

.breadcrumb__link { color: var(--sky); text-decoration: none; }
.breadcrumb__link:hover { color: var(--clay); text-decoration: underline; }
.breadcrumb__current { color: var(--ink); font-weight: 700; }

/* ---------- 10. 目录式索引 ---------- */
.index-list { border-top: 1px solid var(--rule-strong); }

.index-item { border-bottom: 1px solid var(--rule); }

.index-link {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 10px 12px 16px;
  text-decoration: none;
  color: var(--ink);
  transition: background-color var(--t) var(--ease), color var(--t) var(--ease);
}

.index-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--clay);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform var(--t) var(--ease);
}

.index-link:hover { background: var(--clay-soft); color: var(--clay); }
.index-link:hover::before { transform: scaleY(1); }

.index-link__num {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.index-link__text { flex: 1 1 auto; font-size: 15px; font-weight: 700; }

.index-link__meta {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 400;
  color: var(--moss);
}

/* ---------- 11. 卡片与标签 ---------- */
.card {
  position: relative;
  padding: clamp(18px, 2.4vw, 26px);
  background: var(--paper-raise);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(42, 33, 28, 0.03);
  transition: transform var(--t-slow) var(--ease),
              border-color var(--t-slow) var(--ease),
              box-shadow var(--t-slow) var(--ease);
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--clay);
  box-shadow: var(--shadow-1);
}

.card__title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.card__meta { font-size: 13px; color: var(--moss); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--moss);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
}

.tag--round {
  background: var(--sand);
  border-color: var(--sand);
  color: var(--ink);
}

.tag--new {
  background: var(--flame);
  border-color: var(--flame);
  color: #FFF6F0;
}

/* ---------- 12. 正文区 ---------- */
.prose { max-width: 68ch; font-size: 17px; line-height: 1.75; }

.prose p + p { margin-top: 1em; }
.prose h2 { margin-top: 2em; margin-bottom: 0.5em; }
.prose h3 { margin-top: 1.5em; margin-bottom: 0.45em; }

.prose ul, .prose ol { margin: 1em 0; }

.prose li {
  position: relative;
  padding-left: 1.5em;
  margin-top: 0.45em;
}

.prose li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 12px;
  height: 1px;
  background: var(--clay);
}

.prose a { color: var(--sky); text-decoration: underline; text-decoration-color: rgba(62, 110, 142, 0.4); }
.prose a:hover { color: var(--clay); text-decoration-color: var(--clay); }

.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--gold);
  color: var(--moss);
  font-family: var(--font-serif);
  font-size: 18px;
}

/* ---------- 13. 图片容器基座 ---------- */
.media-figure { margin: 0; }

.media {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--sand);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
}

.media img,
.media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--4x3 { aspect-ratio: 4 / 3; }
.media--3x2 { aspect-ratio: 3 / 2; }
.media--1x1 { aspect-ratio: 1 / 1; }
.media--16x9 { aspect-ratio: 16 / 9; }

.media__caption {
  margin-top: 9px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--moss);
}

/* ---------- 14. 页脚 ---------- */
.site-footer {
  background: var(--pine);
  color: var(--paper);
  border-top: 3px solid var(--gold);
}

.site-footer__frame {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: clamp(44px, 6vw, 80px) clamp(28px, 4vw, 48px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(24px, 3.4vw, 48px);
}

.site-footer__brand {
  grid-column: 1 / -1;
  padding-bottom: clamp(18px, 2.4vw, 28px);
  border-bottom: 1px solid var(--rule-light);
}

.site-footer__logo {
  font-family: var(--font-serif);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--paper);
}

.site-footer__note {
  margin-top: 8px;
  max-width: 52ch;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(247, 241, 228, 0.72);
}

.site-footer__stack { grid-column: 1 / span 2; }
.site-footer__index { grid-column: 3; }
.site-footer__meta { grid-column: 4; }

.site-footer__title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--gold);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule-light);
}

/* 标签堆叠折叠块 */
.stack-tag { border-top: 1px solid var(--rule-light); }
.stack-tag:last-of-type { border-bottom: 1px solid var(--rule-light); }

.stack-tag__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--paper);
  transition: color var(--t) var(--ease);
}

.stack-tag__head:hover { color: var(--gold); }
.stack-tag[open] .stack-tag__head { color: var(--gold); }

.stack-tag__label { flex: 1 1 auto; }

.stack-tag__meta {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(247, 241, 228, 0.58);
}

.stack-tag__body {
  margin: 0 0 14px;
  padding-right: 8px;
  max-width: 46ch;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(247, 241, 228, 0.76);
}

/* 栏目速查标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud__item {
  display: inline-block;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(247, 241, 228, 0.92);
  background: rgba(247, 241, 228, 0.05);
  border: 1px solid var(--rule-light-strong);
  border-radius: 2px;
  transition: color var(--t) var(--ease),
              background-color var(--t) var(--ease),
              border-color var(--t) var(--ease);
}

.tag-cloud__item:hover {
  color: var(--paper);
  background: rgba(217, 164, 65, 0.16);
  border-color: var(--gold);
}

/* 联系信息窄列 */
.meta-list { display: flex; flex-direction: column; gap: 12px; }

.meta-list__item { display: flex; flex-direction: column; gap: 2px; }

.meta-list__key {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.meta-list__val {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(247, 241, 228, 0.9);
  overflow-wrap: anywhere;
}

/* 底栏 */
.site-footer__base {
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid var(--rule-light);
}

.site-footer__base-inner {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding: 16px var(--gutter) 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
}

.site-footer__copy {
  font-size: 13px;
  color: rgba(247, 241, 228, 0.74);
}

.legal-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }

.legal-links__link {
  font-size: 13px;
  color: rgba(247, 241, 228, 0.86);
  text-decoration: none;
  border-bottom: 1px solid rgba(217, 164, 65, 0.5);
  transition: color var(--t) var(--ease), border-color var(--t) var(--ease);
}

.legal-links__link:hover { color: var(--gold); border-bottom-color: var(--gold); }

.site-footer :focus-visible { outline-color: var(--gold); }

/* ---------- 15. 平板 ---------- */
@media (max-width: 1023px) {
  .nav-toggle { display: inline-flex; }

  .site-header__frame { min-height: 66px; }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: block;
    background: var(--paper);
    border-top: 1px solid var(--ink);
    border-bottom: 3px solid var(--clay);
    box-shadow: 0 16px 30px -20px rgba(42, 33, 28, 0.7);
    max-height: min(72vh, 520px);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity var(--t) var(--ease),
                transform var(--t) var(--ease),
                visibility var(--t) var(--ease);
  }

  .site-nav[data-open="true"] {
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  .site-nav__list { display: block; }

  .site-nav__item {
    display: block;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--rule);
  }

  .site-nav__item:first-child { border-top: 0; }
  .site-nav__item:last-child { border-right: 0; }

  .site-nav__link {
    min-height: 50px;
    padding: 14px var(--gutter);
    font-size: 16px;
    border-bottom: 0;
    border-left: 3px solid transparent;
  }

  .site-nav__link:hover,
  .site-nav__link[aria-current="page"] { border-left-color: var(--clay); }

  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .split { grid-template-columns: minmax(0, 1fr); }
  .split--offset > :last-child { margin-inline-start: 0; }

  .site-footer__frame { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer__stack { grid-column: 1 / -1; }
  .site-footer__index { grid-column: 1; }
  .site-footer__meta { grid-column: 2; }
}

/* ---------- 16. 手机 ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  p { font-size: 16px; }

  .brand__line { display: none; }
  .brand__mark { flex-basis: 34px; width: 34px; height: 34px; font-size: 18px; }
  .brand__name { font-size: 17px; }

  .nav-toggle__label { display: none; }
  .nav-toggle { padding: 9px 11px; }

  .site-header__aside .btn--point { padding: 7px 11px; font-size: 12px; }

  .grid--2, .grid--3 { grid-template-columns: minmax(0, 1fr); }

  .index-link { flex-wrap: wrap; row-gap: 2px; }
  .index-link__meta { flex-basis: 100%; padding-left: 0; }

  .site-footer__frame { grid-template-columns: minmax(0, 1fr); }
  .site-footer__index,
  .site-footer__meta { grid-column: 1 / -1; }

  .site-footer__base-inner { flex-direction: column; align-items: flex-start; }
}

/* ---------- 17. 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .btn:hover,
  .card:hover { transform: none; }

  .scroll-progress { transition: none; }

  .index-link::before { transition: none; }
}
