/* ===== 7南宮指南 · site.css ===== */
*,
*::before,
*::after { box-sizing: border-box; }

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

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

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

img, svg {
  max-width: 100%;
  height: auto;
}

button {
  font: inherit;
  color: inherit;
}

:root {
  --ink: #0E2A23;
  --ink-2: #18463B;
  --ink-3: #081A15;
  --paper: #F5EBDD;
  --paper-2: #EFE2CF;
  --stone: #D9C9B2;
  --cinnabar: #C14733;
  --cinnabar-deep: #8E2F24;
  --copper: #A98247;
  --indigo: #3F4E73;
  --charcoal: #1D1B18;
  --sage: #78907D;
  --glass: rgba(245, 235, 221, 0.66);
  --focus: #2F6F7E;
  --font-display: "Noto Serif SC", "Songti SC", SimSun, serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shell: 1180px;
  --gutter: clamp(18px, 4vw, 56px);
  --plate-shadow: 0 1px 0 rgba(217, 201, 178, 0.9), 0 18px 34px -30px rgba(14, 42, 35, 0.6);
}

body {
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(217, 201, 178, 0.16) 0 1px, transparent 1px 7px),
    radial-gradient(circle at 82% 4%, rgba(169, 130, 71, 0.1), transparent 46%);
  background-attachment: fixed;
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.75;
  letter-spacing: 0.005em;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--ink);
}

h1 { font-size: clamp(2.4rem, 5vw, 5.6rem); }
h2 { font-size: clamp(1.8rem, 3vw, 3.4rem); }
h3 { font-size: clamp(1.22rem, 1.7vw, 1.6rem); font-weight: 600; }
h4 { font-size: 1.05rem; font-weight: 600; }

p { max-width: 42em; }

a {
  color: var(--cinnabar-deep);
  text-decoration: none;
  text-underline-offset: 0.22em;
  transition: color 0.2s ease;
}

a:hover { color: var(--cinnabar); }

strong { font-weight: 600; color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 1px;
}

[id] { scroll-margin-top: 108px; }

/* ---------- 基础工具 ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.rule {
  height: 0;
  border: 0;
  border-top: 1px dashed var(--stone);
  margin: clamp(28px, 4vw, 56px) 0;
}

.footnote {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 1.7;
  color: rgba(29, 27, 24, 0.62);
  max-width: 46em;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  color: var(--cinnabar-deep);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--cinnabar-deep);
}

.kicker::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--cinnabar);
}

.lead {
  max-width: 40em;
  font-size: clamp(1.04rem, 1.4vw, 1.18rem);
  line-height: 1.88;
  color: #3a3731;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--stone);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.36);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  line-height: 1.6;
  color: var(--ink);
}

.tag-cinnabar {
  border-color: rgba(193, 71, 51, 0.6);
  background: rgba(193, 71, 51, 0.09);
  color: var(--cinnabar-deep);
}

.tag-indigo {
  border-color: rgba(63, 78, 115, 0.5);
  background: rgba(63, 78, 115, 0.09);
  color: var(--indigo);
}

.tag-copper {
  border-color: rgba(169, 130, 71, 0.6);
  background: rgba(169, 130, 71, 0.12);
  color: #7a5c2c;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 13px 24px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-primary {
  background: var(--cinnabar);
  border-color: var(--cinnabar-deep);
  color: #FBF3E7;
}

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

.btn-ghost {
  background: transparent;
  border-color: var(--stone);
  color: var(--ink);
}

.btn-ghost:hover {
  border-color: var(--ink);
  background: rgba(14, 42, 35, 0.06);
  color: var(--ink);
}

/* ---------- 面包屑 ---------- */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: rgba(29, 27, 24, 0.6);
  padding-block: 4px 18px;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb-list li + li::before {
  content: "/";
  margin-right: 0.5em;
  color: var(--copper);
}

.breadcrumb-list a {
  color: rgba(29, 27, 24, 0.72);
}

.breadcrumb-list a:hover { color: var(--cinnabar-deep); }

/* ---------- 页面骨架 ---------- */
.page-main {
  padding-block: clamp(28px, 5vw, 76px) clamp(52px, 7vw, 104px);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}

.grid-rail { min-width: 0; }
.grid-flow { min-width: 0; }

.sticky-rail {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
}

.rail-panel {
  padding: 20px 22px;
  border: 1px solid rgba(217, 201, 178, 0.85);
  border-left: 3px solid var(--cinnabar);
  border-radius: 2px;
  background: var(--glass);
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

.rail-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--cinnabar-deep);
  margin-bottom: 12px;
}

/* ---------- 堆叠画板 ---------- */
.plate {
  position: relative;
  margin-bottom: clamp(24px, 3.5vw, 48px);
  padding: clamp(22px, 3vw, 40px);
  border: 1px solid var(--stone);
  border-radius: 2px;
  background: var(--paper);
  box-shadow: var(--plate-shadow);
}

.plate::after {
  content: "";
  position: absolute;
  inset: 6px -6px -6px 6px;
  border: 1px solid rgba(217, 201, 178, 0.55);
  border-radius: 2px;
  z-index: -1;
  pointer-events: none;
}

.plate-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 18px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--stone);
}

.plate-index {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--copper);
}

.plate-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2vw, 1.9rem);
  color: var(--ink);
  margin: 0;
}

.plate-body { max-width: 44em; }

/* ---------- 图片容器 ---------- */
.media-frame {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--stone);
  border-radius: 2px;
  background:
    linear-gradient(155deg, var(--paper-2) 0%, rgba(217, 201, 178, 0.9) 100%);
}

.media-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-frame--empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(169, 130, 71, 0.16) 0 1px, transparent 1px 12px),
    repeating-linear-gradient(-45deg, rgba(169, 130, 71, 0.12) 0 1px, transparent 1px 12px);
  pointer-events: none;
}

.media-caption {
  margin-top: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--copper);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  line-height: 1.7;
  color: rgba(29, 27, 24, 0.64);
}

/* ---------- 页头 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid rgba(169, 130, 71, 0.45);
}

.site-header::before {
  content: "";
  display: block;
  height: 3px;
  background:
    linear-gradient(90deg,
      var(--cinnabar) 0 132px,
      var(--copper) 132px 184px,
      rgba(245, 235, 221, 0.2) 184px 100%);
}

.site-header :focus-visible {
  outline-color: #7FC0CC;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 32px;
  padding-block: clamp(20px, 3vw, 36px) clamp(16px, 2vw, 24px);
}

.brand-block {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--paper);
  text-decoration: none;
}

.brand-mark:hover { color: var(--paper); }

.brand-seal {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  background: var(--cinnabar);
  color: #FBF3E7;
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 700;
  line-height: 1;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(245, 235, 221, 0.38);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: clamp(1.14rem, 1.6vw, 1.42rem);
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.2;
  color: var(--paper);
}

.brand-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  line-height: 1.4;
  color: rgba(245, 235, 221, 0.64);
  white-space: nowrap;
}

.site-nav { margin-left: auto; }

.nav-list {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: clamp(14px, 2.2vw, 30px);
}

.nav-list a {
  position: relative;
  display: inline-block;
  padding: 6px 2px 10px;
  font-size: 15px;
  letter-spacing: 0.08em;
  line-height: 1.4;
  color: rgba(245, 235, 221, 0.76);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav-list a:hover { color: var(--paper); }

.nav-list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--cinnabar);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.24s ease;
}

.nav-list a:hover::after { transform: scaleX(1); }

.nav-list a[aria-current="page"] {
  color: var(--paper);
  font-weight: 500;
}

.nav-list a[aria-current="page"]::after {
  height: 3px;
  transform: scaleX(1);
}

.nav-list a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  width: 9px;
  height: 9px;
  background: var(--cinnabar);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 10px 14px;
  border: 1px solid rgba(245, 235, 221, 0.42);
  border-radius: 2px;
  background: transparent;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.nav-toggle:hover {
  border-color: var(--paper);
  background: rgba(245, 235, 221, 0.08);
}

.nav-toggle-bars {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle-bars span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) {
  transform: translateY(5.5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) {
  transform: translateY(-5.5px) rotate(-45deg);
}

/* ---------- 页脚 ---------- */
.site-footer {
  background: var(--ink);
  color: rgba(245, 235, 221, 0.82);
  border-top: 3px solid var(--cinnabar);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.85fr 0.85fr 1.25fr;
  gap: clamp(22px, 3vw, 44px);
  padding-block: clamp(38px, 5vw, 64px) 0;
}

.footer-brand { min-width: 0; }

.footer-seal {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  background: var(--cinnabar);
  color: #FBF3E7;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(245, 235, 221, 0.35);
}

.footer-name {
  font-family: var(--font-display);
  font-size: clamp(1.28rem, 2vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  color: var(--paper);
  margin-bottom: 10px;
}

.footer-note {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  line-height: 1.95;
  color: rgba(245, 235, 221, 0.6);
  max-width: 20em;
}

.footer-plate { min-width: 0; }

.footer-plate-title {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(169, 130, 71, 0.42);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: var(--copper);
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-list a {
  display: inline-block;
  font-size: 14.5px;
  letter-spacing: 0.04em;
  color: rgba(245, 235, 221, 0.82);
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-list a:hover {
  color: var(--paper);
  border-bottom-color: var(--cinnabar);
}

.footer-list--plain li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(245, 235, 221, 0.84);
  word-break: break-word;
}

.footer-list--plain .mono-label {
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--copper);
}

.footer-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: clamp(26px, 3vw, 40px);
  padding-block: 18px;
  border-top: 1px solid rgba(245, 235, 221, 0.16);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: rgba(245, 235, 221, 0.6);
}

/* ---------- 跳过链接 ---------- */
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  border: 2px solid var(--cinnabar);
  border-radius: 2px;
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--ink);
}

/* ---------- JS 注入组件 ---------- */
.scroll-meter {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 120;
  width: 100%;
  height: 3px;
  background: var(--cinnabar);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}

.to-top {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 110;
  padding: 12px 16px;
  border: 1px solid var(--copper);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s linear, background-color 0.2s ease;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  background: var(--cinnabar);
  border-color: var(--cinnabar-deep);
}

/* ---------- 滚动显现 ---------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 979px) {
  .header-inner {
    align-items: center;
    padding-block: clamp(14px, 3vw, 22px);
    row-gap: 12px;
  }

  .nav-toggle { display: inline-flex; }

  .site-nav {
    flex-basis: 100%;
    width: 100%;
    margin-left: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    background: var(--ink-2);
    border-top: 1px solid rgba(169, 130, 71, 0.42);
    border-radius: 2px;
    transition: max-height 0.3s ease, opacity 0.22s ease;
  }

  .site-nav[data-open="true"] {
    max-height: min(68vh, 520px);
    overflow-y: auto;
    opacity: 1;
  }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 0;
    counter-reset: navi;
  }

  .nav-list li {
    counter-increment: navi;
    border-bottom: 1px dashed rgba(245, 235, 221, 0.18);
  }

  .nav-list li:last-child { border-bottom: 0; }

  .nav-list a {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 14px 18px;
    font-size: 15.5px;
    letter-spacing: 0.1em;
  }

  .nav-list a::after { display: none; }

  .nav-list a::before {
    content: "0" counter(navi);
    position: static;
    width: auto;
    height: auto;
    background: none;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--copper);
  }

  .nav-list a[aria-current="page"] {
    background: rgba(193, 71, 51, 0.16);
    box-shadow: inset 3px 0 0 var(--cinnabar);
    color: var(--paper);
  }

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

  .sticky-rail {
    position: static;
    top: auto;
  }
}

@media (max-width: 640px) {
  body { font-size: 16.5px; }

  .footer-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .brand-tagline { white-space: normal; }

  .footer-meta {
    flex-direction: column;
    gap: 6px;
  }

  .breadcrumb { padding-bottom: 14px; }

  .plate::after { display: none; }
}

/* ---------- 减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

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

  [data-reveal],
  [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }

  .to-top {
    transform: none;
  }
}
