/* =========================================================
   澳门沙金CN · 共享站点样式 /assets/site.css
   金工工作室版式：刻度线、切角面板、墨绿沉底、沙金定向
   ========================================================= */

:root {
  /* 品牌色 */
  --gold: #C9963F;
  --gold-hi: #E3B96B;
  --green: #123B32;
  --green-deep: #0C2A23;
  --terra: #C8653B;
  --mist: #A9C2C9;
  --ivory: #F6F1E7;
  --sand: #E8D6B8;
  --char: #1E1B18;
  --wine: #6E2B35;

  --ink: var(--char);
  --paper: var(--ivory);

  /* 字体 */
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* 字号 */
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: clamp(1.0625rem, 1rem + 0.4vw, 1.1875rem);
  --step-2: clamp(1.375rem, 1.15rem + 1vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.35rem + 1.9vw, 2.75rem);
  --step-4: clamp(2.25rem, 1.5rem + 3.6vw, 4.5rem);

  /* 结构 */
  --rail: 1280px;
  --gutter: clamp(1.125rem, 4vw, 3rem);
  --cut: 16px;
  --cut-sm: 10px;
  --rule: 1px solid rgba(30, 27, 24, 0.14);
  --rule-light: 1px solid rgba(246, 241, 231, 0.18);
  --ring: 2px solid var(--terra);
  --shadow-soft: 0 18px 40px -28px rgba(18, 59, 50, 0.55);

  --scroll-progress: 0;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
}
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, figcaption { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; }
a { color: inherit; }
::selection { background: var(--gold); color: var(--char); }

/* ---------- 基础排版 ---------- */
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.012em;
  color: var(--char);
  text-wrap: balance;
}
p { text-wrap: pretty; }
strong { font-weight: 700; }
small { font-size: var(--step--1); }
hr { border: 0; border-top: var(--rule); margin: 2rem 0; }

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- 布局工具 ---------- */
.container {
  width: 100%;
  max-width: var(--rail);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: clamp(2.75rem, 6vw, 5rem); }
.split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(1.5rem, 4vw, 3.25rem);
  align-items: start;
}
.stack > * + * { margin-top: 1rem; }
.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(90deg, var(--gold), rgba(201, 150, 63, 0.05) 70%, transparent);
}
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--terra);
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(200, 101, 59, 0.4);
}
.display-title {
  font-family: var(--font-display);
  font-size: var(--step-4);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.lede {
  font-size: var(--step-1);
  line-height: 1.85;
  color: rgba(30, 27, 24, 0.78);
  max-width: 62ch;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.24rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--sand);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
}
.tag--wine { background: rgba(110, 43, 53, 0.1); color: var(--wine); }
.tag--mist { background: rgba(169, 194, 201, 0.28); color: #23474e; }

/* ---------- 按钮 ---------- */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  transition: background-color 0.22s ease, color 0.22s ease, transform 0.22s ease;
}
.cta--gold { background: var(--gold); color: var(--char); }
.cta--gold:hover { background: var(--gold-hi); }
.cta--terra { background: var(--terra); color: var(--ivory); }
.cta--terra:hover { background: #b4552f; }
.cta--ghost {
  background: transparent;
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(18, 59, 50, 0.35);
}
.cta--ghost:hover { box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold); }
.cta:hover { transform: translateY(-1px); }
.cta:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--char), inset 0 0 0 4px var(--gold-hi);
}
.cta--terra:focus-visible,
.cta--ghost:focus-visible {
  box-shadow: inset 0 0 0 2px var(--ivory), inset 0 0 0 4px var(--char);
}

/* ---------- 面包屑 ---------- */
.breadcrumbs {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(30, 27, 24, 0.58);
}
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { color: var(--terra); }
.breadcrumbs li + li::before { content: "/"; color: var(--gold); margin-right: 0.35rem; }

/* ---------- 图片容器（供页面阶段复用） ---------- */
.media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background:
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 7px),
    linear-gradient(140deg, #C9963F 0%, #E3B96B 38%, #a87c2f 72%, #123B32 100%);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
}
.media > img,
.media > picture,
.media > picture > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(200deg, rgba(246, 241, 231, 0.26) 0%, transparent 38%);
  mix-blend-mode: screen;
}
.media--wide { aspect-ratio: 21 / 9; }
.media--tall { aspect-ratio: 3 / 4; }
.media--square { aspect-ratio: 1 / 1; }
.media--gold {
  background:
    repeating-linear-gradient(100deg, rgba(30, 27, 24, 0.14) 0 1px, transparent 1px 6px),
    linear-gradient(150deg, #E3B96B, #C9963F 52%, #8a6220 100%);
}
.media--green {
  background:
    repeating-linear-gradient(100deg, rgba(227, 185, 107, 0.16) 0 1px, transparent 1px 8px),
    linear-gradient(150deg, #1c4d41, #123B32 58%, #0C2A23 100%);
}

/* =========================================================
   头部
   ========================================================= */
.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -140%);
  z-index: 200;
  padding: 0.7rem 1.2rem;
  background: var(--gold);
  color: var(--char);
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.2s ease;
}
.skip-link:focus { transform: translate(-50%, 0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--green);
  color: var(--ivory);
  border-bottom: 1px solid rgba(227, 185, 107, 0.32);
}
.header-tick {
  height: 5px;
  background-image:
    repeating-linear-gradient(90deg, rgba(227, 185, 107, 0.9) 0 1px, transparent 1px 10px);
  background-size: 100% 100%;
  opacity: 0.75;
  border-bottom: 1px solid rgba(227, 185, 107, 0.2);
}
.header-shell {
  position: relative;
  max-width: var(--rail);
  margin-inline: auto;
  padding: 0.7rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 0.85rem 1.5rem;
}

/* 品牌 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-inline-end: auto;
  text-decoration: none;
  color: var(--ivory);
}
.brand__mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--green-deep);
  background: linear-gradient(145deg, var(--gold-hi), var(--gold) 55%, #9c7028);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand__tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold-hi);
  padding-left: 0.6rem;
  border-left: 1px solid rgba(227, 185, 107, 0.4);
  white-space: nowrap;
}

/* 命令栏导航 */
.cmdnav { min-width: 0; }
.cmdnav__list {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}
.cmdnav__item { flex: 0 0 auto; }
.cmdnav__link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.5rem 0.55rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: rgba(246, 241, 231, 0.84);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.cmdnav__idx {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  color: rgba(227, 185, 107, 0.72);
  transition: color 0.2s ease;
}
.cmdnav__label { white-space: nowrap; }
.cmdnav__link:hover,
.cmdnav__link:focus-visible {
  color: var(--ivory);
  background: rgba(246, 241, 231, 0.07);
  border-bottom-color: var(--gold);
}
.cmdnav__link[aria-current="page"] {
  color: var(--gold-hi);
  border-bottom-color: var(--gold-hi);
  background: linear-gradient(180deg, transparent, rgba(201, 150, 63, 0.2));
}
.cmdnav__link[aria-current="page"] .cmdnav__idx { color: var(--terra); }

/* 右侧工具位 */
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}
.tool-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.42rem 0.3rem;
  font-size: 0.8125rem;
  color: rgba(246, 241, 231, 0.86);
  text-decoration: none;
  border-bottom: 1px dashed rgba(227, 185, 107, 0.45);
  white-space: nowrap;
}
.tool-link:hover { color: var(--gold-hi); border-bottom-color: var(--gold-hi); }
.tool-link__idx {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  color: var(--terra);
}

/* 移动导航按钮 */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  flex: 0 0 auto;
  color: var(--ivory);
  border: 1px solid rgba(227, 185, 107, 0.5);
  background: rgba(246, 241, 231, 0.04);
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}
.nav-toggle:hover { background: rgba(246, 241, 231, 0.1); }
.nav-toggle__bars {
  display: grid;
  gap: 3px;
  width: 16px;
}
.nav-toggle__bars span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--gold-hi);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(1) { transform: translateY(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(-5px) rotate(-45deg); }
.nav-toggle__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
}

/* 阅读进度 */
.read-progress {
  position: fixed;
  inset-inline: 0;
  top: 0;
  height: 3px;
  z-index: 120;
  pointer-events: none;
  background: rgba(18, 59, 50, 0.25);
}
.read-progress__bar {
  height: 100%;
  width: 100%;
  transform: scaleX(var(--scroll-progress));
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--terra), var(--gold) 45%, var(--gold-hi));
  will-change: transform;
}

/* =========================================================
   页脚
   ========================================================= */
.site-footer {
  background: var(--green-deep);
  color: rgba(246, 241, 231, 0.76);
  border-top: 1px solid rgba(227, 185, 107, 0.28);
}
.footer-tick {
  height: 6px;
  background-image: repeating-linear-gradient(90deg, var(--gold) 0 1px, transparent 1px 12px);
  opacity: 0.55;
}
.footer-shell {
  max-width: var(--rail);
  margin-inline: auto;
  padding: clamp(2.5rem, 5vw, 4rem) var(--gutter) clamp(1.5rem, 3vw, 2.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
  gap: clamp(2rem, 5vw, 4rem);
}
.footer-brand__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--green-deep);
  background: linear-gradient(145deg, var(--gold-hi), var(--gold) 60%, #9c7028);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 11px), calc(100% - 11px) 100%, 0 100%);
}
.footer-brand__name {
  margin-top: 0.9rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ivory);
  letter-spacing: 0.02em;
}
.footer-brand__tag {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  color: rgba(227, 185, 107, 0.85);
}
.footer-contact {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(246, 241, 231, 0.14);
  font-size: 0.8125rem;
  line-height: 1.7;
}
.footer-contact__label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(169, 194, 201, 0.9);
  margin-bottom: 0.4rem;
}
.footer-contact__phone {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  letter-spacing: 0.05em;
  color: var(--gold-hi);
}
.footer-contact__mail { color: rgba(246, 241, 231, 0.86); word-break: break-all; }
.footer-contact__addr { color: rgba(246, 241, 231, 0.6); margin-top: 0.35rem; }

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}
.footer-col__title {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  padding-bottom: 0.6rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid rgba(227, 185, 107, 0.28);
}
.footer-col__list { display: grid; gap: 0.55rem; font-size: 0.8125rem; }
.footer-col__list a {
  text-decoration: none;
  color: rgba(246, 241, 231, 0.74);
  transition: color 0.2s ease, padding-left 0.2s ease;
}
.footer-col__list a:hover { color: var(--gold-hi); padding-left: 0.3rem; }

.footer-meta {
  max-width: var(--rail);
  margin-inline: auto;
  padding: 1.25rem var(--gutter) 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid rgba(246, 241, 231, 0.14);
  font-size: 0.75rem;
  color: rgba(246, 241, 231, 0.55);
}
.footer-note { max-width: 56ch; }
.footer-legal {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* =========================================================
   显现与章节高亮（配合 SITE_JS）
   ========================================================= */
html.js-ready [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.25, 1);
}
html.js-ready [data-reveal].is-visible { opacity: 1; transform: none; }

[data-section-link] {
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
[data-section-link][aria-current="true"] {
  color: var(--gold);
  border-color: var(--gold);
}

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1080px) {
  .cmdnav__link { padding: 0.45rem 0.4rem; font-size: 0.78rem; }
  .brand__tag { display: none; }
}

@media (max-width: 1000px) {
  .header-shell { flex-wrap: nowrap; }
  .brand { margin-inline-end: 0; }
  .nav-toggle { display: inline-flex; order: 4; }
  .header-tools { margin-inline-start: auto; order: 3; }
  .header-tools .cta { display: none; }
  .cmdnav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    z-index: 95;
    display: none;
    background: var(--green-deep);
    border-top: 1px solid rgba(227, 185, 107, 0.32);
    border-bottom: 1px solid rgba(227, 185, 107, 0.24);
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    box-shadow: var(--shadow-soft);
  }
  .cmdnav[data-open="true"] { display: block; }
  .cmdnav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .cmdnav__link {
    width: 100%;
    padding: 0.9rem var(--gutter);
    font-size: 0.9375rem;
    border-bottom: 1px solid rgba(246, 241, 231, 0.08);
    border-left: 2px solid transparent;
  }
  .cmdnav__link:hover { background: rgba(246, 241, 231, 0.06); border-bottom-color: rgba(246, 241, 231, 0.08); }
  .cmdnav__link[aria-current="page"] {
    border-bottom-color: rgba(246, 241, 231, 0.08);
    border-left-color: var(--gold-hi);
  }

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

@media (max-width: 720px) {
  html { scroll-padding-top: 5.5rem; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1.25rem; }
  .footer-meta { flex-direction: column; align-items: flex-start; }
  .footer-legal { white-space: normal; }
}

@media (max-width: 480px) {
  .brand__mark { width: 32px; height: 32px; font-size: 0.9375rem; }
  .brand__name { font-size: 0.9375rem; }
  .tool-link { font-size: 0.75rem; }
  .footer-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 减少动效偏好 ---------- */
@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;
  }
  html.js-ready [data-reveal] { opacity: 1; transform: none; }
  .read-progress__bar { transition: none; }
}
