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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-page);
  color: var(--text-body);
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--text-strong);
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: break-word;
}

p, ul, ol, dl, blockquote, figure {
  margin: 0;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  letter-spacing: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
}

ul[class], ol[class] {
  list-style: none;
  padding: 0;
  margin: 0;
}

main {
  display: block;
}

/* ============ 2. 品牌色板与语义令牌 ============ */
:root {
  --paper: #F5F1E8;
  --ink: #1A1915;
  --ink-2: #3A362F;
  --muted: #6B675E;
  --gold: #C9A227;
  --gold-deep: #B08A1E;
  --red: #D64B3E;
  --blue: #4A90D9;
  --blue-deep: #254A6D;
  --border: #E0D9C8;
  --light-ink: #EAE6DC;

  --surface-page: var(--paper);
  --surface-card: var(--light-ink);
  --surface-elevated: #FBF9F3;
  --text-strong: var(--ink);
  --text-body: var(--ink-2);
  --text-muted: var(--muted);
  --line: var(--border);
  --grid-line: rgba(26, 25, 21, 0.05);
  --hover-bg: rgba(26, 25, 21, 0.06);

  --accent-gold: var(--gold);
  --accent-gold-strong: var(--gold-deep);
  --accent-red: var(--red);
  --accent-blue: var(--blue);
  --accent-blue-deep: var(--blue-deep);
  --on-gold: #1A1915;

  --island-bg: rgba(245, 241, 232, 0.88);
  --island-line: rgba(224, 217, 200, 0.8);
  --shadow-sm: 0 2px 10px rgba(26, 25, 21, 0.06);
  --shadow-md: 0 12px 40px rgba(26, 25, 21, 0.09);

  --font-sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "Roboto Mono", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 20px;
  --text-xl: 28px;
  --text-2xl: 36px;
  --text-3xl: 48px;
  --text-4xl: 72px;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-full: 999px;
  --container: 1200px;
}

html[data-stable="true"] {
  --surface-page: #131A17;
  --surface-card: #1B2521;
  --surface-elevated: #22302B;
  --text-strong: #F5F1E8;
  --text-body: #C8C3B5;
  --text-muted: #8C948E;
  --line: #2B352F;
  --grid-line: rgba(245, 241, 232, 0.05);
  --hover-bg: rgba(245, 241, 232, 0.07);

  --accent-gold: #D8BB54;
  --accent-gold-strong: #C9A227;
  --accent-red: #E05B4E;
  --accent-blue: #66A9E4;
  --accent-blue-deep: #80B8EA;

  --island-bg: rgba(19, 26, 23, 0.86);
  --island-line: rgba(43, 53, 47, 0.82);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.42);
}

/* ============ 3. 焦点与无障碍 ============ */
:focus-visible {
  outline: 2px solid var(--accent-blue-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

#main-content {
  scroll-margin-top: calc(96px + env(safe-area-inset-top, 0px));
  outline: none;
}

.skip-link {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 16px;
  z-index: 3000;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  background: var(--text-strong);
  color: var(--surface-page);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-240%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* ============ 4. 头部 ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 24px 0;
}

.site-header__island {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 6px 6px 6px 24px;
  background: var(--island-bg);
  border: 1px solid var(--island-line);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-strong);
  text-decoration: none;
  white-space: nowrap;
}

.brand__index {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-blue-deep);
}

.brand__index::before {
  content: "[";
}

.brand__index::after {
  content: "]";
}

.brand__name {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: var(--text-strong);
}

.site-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 2px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  color: var(--text-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover {
  background: var(--hover-bg);
  color: var(--text-strong);
}

.nav-link[aria-current="page"] {
  background: var(--text-strong);
  color: var(--surface-page);
  font-weight: 700;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.14);
}

.stable-toggle {
  position: relative;
}

.nav-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: 6px;
  padding: 9px 18px;
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--accent-gold);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.nav-action:hover {
  background: var(--accent-gold);
  color: var(--on-gold);
}

.nav-action__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.nav-action__label {
  letter-spacing: 0.02em;
}

html[data-stable="true"] .nav-action {
  background: var(--accent-gold);
  color: var(--on-gold);
}

html[data-stable="true"] .nav-action:hover {
  background: transparent;
  color: var(--accent-gold);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 44px;
  height: 44px;
  padding: 12px;
  margin-left: auto;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.nav-toggle__line {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--text-strong);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

.nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(2) {
  transform: translateY(-9px) rotate(-45deg);
}

/* ============ 5. 顶部阅读进度条 ============ */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 2500;
  pointer-events: none;
}

.progress-bar__fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-gold));
  transition: width 0.12s linear;
}

html[data-stable="true"] .progress-bar__fill {
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-red));
}

/* ============ 6. 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn--gold {
  background: var(--accent-gold);
  color: var(--on-gold);
  box-shadow: 0 4px 18px rgba(201, 162, 39, 0.2);
}

.btn--gold:hover {
  background: var(--accent-gold-strong);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-body);
}

.btn--ghost:hover {
  background: var(--hover-bg);
  border-color: var(--text-strong);
  color: var(--text-strong);
}

.btn--sm {
  padding: 9px 16px;
  font-size: 13px;
}

/* ============ 7. 布局 ============ */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-inline: 24px;
}

.section {
  padding-block: 80px;
}

.section--tight {
  padding-block: 48px;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.section-label::before {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--accent-gold);
}

.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));
}

.prose {
  max-width: 72ch;
  font-size: 16px;
  line-height: 1.9;
  color: var(--text-body);
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose h2 {
  font-size: 28px;
  margin-top: 2em;
  color: var(--text-strong);
}

.prose h3 {
  font-size: 20px;
  margin-top: 1.6em;
  color: var(--text-strong);
}

.prose a {
  color: var(--accent-blue-deep);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.prose a:hover {
  color: var(--accent-blue);
}

.prose strong {
  color: var(--text-strong);
  font-weight: 700;
}

/* ============ 8. 首屏与章节 ============ */
.hero {
  padding: clamp(56px, 9vw, 112px) 0 64px;
}

.hero__title {
  margin-top: 18px;
  font-size: clamp(38px, 8vw, var(--text-4xl));
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--text-strong);
}

.hero__lead {
  max-width: 52ch;
  margin-top: 24px;
  font-size: 18px;
  line-height: 1.8;
  color: var(--text-muted);
}

.hero__meta {
  margin-top: 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chapter {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px 28px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}

.chapter__index {
  grid-row: 1 / span 2;
  font-family: var(--font-mono);
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
  color: var(--accent-gold);
  letter-spacing: -0.02em;
}

.chapter__title {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-strong);
}

.chapter__desc {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
}

/* ============ 9. 卡片与数据组件 ============ */
.card {
  padding: 28px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: box-shadow 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.card--elevated:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 160px;
}

.stat-card__index {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stat-card__value {
  margin-top: 14px;
  font-size: 44px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
}

.stat-card__value em {
  font-style: normal;
  color: var(--accent-gold);
}

.stat-card__label {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

.data-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.data-line__label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.data-line__value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.tag--gold {
  background: rgba(201, 162, 39, 0.14);
  color: var(--accent-gold-strong);
}

.tag--red {
  background: rgba(214, 75, 62, 0.12);
  color: var(--accent-red);
}

.tag--blue {
  background: rgba(74, 144, 217, 0.12);
  color: var(--accent-blue-deep);
}

.lottery-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-red);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(214, 75, 62, 0.25);
}

/* ============ 10. 面包屑 ============ */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 20px 0 8px;
  font-size: 13px;
}

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

.breadcrumb__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.breadcrumb__item + .breadcrumb__item::before {
  content: "/";
  color: var(--line);
  font-family: var(--font-mono);
}

.breadcrumb__link {
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 4px;
}

.breadcrumb__link:hover {
  color: var(--text-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============ 11. 图片与图表容器 ============ */
.visual-container {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  min-height: 220px;
  aspect-ratio: 16 / 9;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background-color: var(--surface-card);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  overflow: hidden;
}

.visual-container img,
.visual-container picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visual-container::after {
  content: attr(data-img-label);
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-page);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.visual-container:not([data-img-label])::after {
  display: none;
}

.chart-pane {
  position: relative;
  height: 240px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  overflow: hidden;
}

/* ============ 12. 页脚 ============ */
.site-footer {
  --footer-bg: #14130F;
  --footer-fg: #F5F1E8;
  --footer-muted: rgba(245, 241, 232, 0.58);
  --footer-line: rgba(245, 241, 232, 0.14);
  background: var(--footer-bg);
  color: var(--footer-fg);
  padding: 64px 24px calc(28px + env(safe-area-inset-bottom, 0px));
}

html[data-stable="true"] .site-footer {
  --footer-bg: #0A0E0C;
  --footer-muted: rgba(245, 241, 232, 0.52);
  --footer-line: rgba(245, 241, 232, 0.12);
}

.footer-inner {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 36px 32px;
  max-width: var(--container);
  margin: 0 auto;
}

.footer-brand {
  grid-column: span 4;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.footer-brand__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--accent-gold);
  color: var(--on-gold);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 6px 22px rgba(201, 162, 39, 0.25);
  flex-shrink: 0;
}

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

.footer-brand__name {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.3;
}

.footer-tagline {
  margin-top: 4px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--footer-muted);
}

.footer-col,
.footer-col--contact,
.footer-col--legal {
  grid-column: span 4;
}

.footer-h {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--footer-fg);
}

.footer-h::after {
  content: "";
  display: block;
  width: 26px;
  height: 2px;
  margin-top: 8px;
  background: var(--accent-gold);
}

.footer-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--footer-muted);
  font-size: 15px;
  line-height: 1.5;
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--footer-fg);
}

.footer-link .mono {
  margin-right: 6px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

.footer-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  font-size: 15px;
  color: var(--footer-muted);
}

.footer-meta .mono {
  min-width: 32px;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

.footer-note {
  margin-top: 18px;
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.05em;
  color: var(--footer-muted);
}

.footer-remark {
  grid-column: 1 / -1;
  padding-top: 24px;
  border-top: 1px solid var(--footer-line);
  font-size: 13px;
  line-height: 1.8;
  color: var(--footer-muted);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 28px;
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--footer-muted);
}

.footer-bottom .mono {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
}

/* ============ 13. 工具类 ============ */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

@media (max-width: 900px) {
  .site-header {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 0;
  }

  .site-header__island {
    flex-wrap: wrap;
    gap: 0;
    padding: 6px 8px 6px 16px;
    border-radius: 18px;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 6px;
    padding: 6px 6px 12px;
    border-top: 1px solid var(--line);
    gap: 2px;
  }

  .site-nav[data-open] {
    display: flex;
  }

  .nav-link {
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 15px;
    white-space: normal;
  }

  .nav-action {
    margin: 8px 0 0;
    padding: 13px 18px;
    font-size: 15px;
  }
}

@media (min-width: 701px) and (max-width: 960px) {
  .footer-brand,
  .footer-col,
  .footer-col--contact,
  .footer-col--legal {
    grid-column: span 6;
  }
}

@media (max-width: 700px) {
  .grid--2,
  .grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .section {
    padding-block: 56px;
  }

  .chapter {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px 16px;
    padding: 24px 0;
  }

  .chapter__index {
    font-size: 34px;
  }

  .chapter__title {
    font-size: 18px;
  }

  .footer-brand,
  .footer-col,
  .footer-col--contact,
  .footer-col--legal {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (max-width: 560px) {
  .footer-inner {
    gap: 28px 20px;
  }
}

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

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