/* ============ 1. 变量 ============ */
:root {
  --cream: #F5F0E6;
  --cream-light: #FAF7F0;
  --deep-brown: #2B1E16;
  --brown-muted: #5A4A3A;
  --orange-red: #E85D2E;
  --orange-light: #F09A5A;
  --border-brown: #C4B5A0;
  --dark-brown: #1A120B;
  --chart-red: #D63A2F;
  --blueprint-line: #8B9BB4;
  --font-head: 'PingFang SC Heavy', 'Microsoft YaHei Bold', 'Arial Black', 'Impact', sans-serif;
  --font-body: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  --font-mono: 'Courier New', 'Roboto Mono', 'Consolas', monospace;
  --container-max: 1200px;
}

/* ============ 2. Reset & 基础 ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--cream);
  background-image:
    linear-gradient(to right, rgba(139, 155, 180, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(139, 155, 180, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--deep-brown);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  font: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--orange-red);
  outline-offset: 3px;
}

main#main-content {
  min-height: 60vh;
  animation: page-fade 0.3s ease-out;
}

@keyframes page-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============ 3. 通用布局 ============ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.section {
  position: relative;
  padding: 56px 0;
}

.section::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 0;
  width: 28px;
  height: 4px;
  background: var(--deep-brown);
}

.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
}

.col-span-4 {
  grid-column: span 4;
}

.col-span-6 {
  grid-column: span 6;
}

.col-span-8 {
  grid-column: span 8;
}

.col-span-12 {
  grid-column: span 12;
}

/* ============ 4. 通用组件 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid var(--deep-brown);
  background: transparent;
  color: var(--deep-brown);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  box-shadow: 4px 4px 0 rgba(43, 30, 22, 0.85);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(43, 30, 22, 0.85);
}

.btn-primary {
  background: var(--orange-red);
  color: var(--cream-light);
}

.btn-outline {
  background: transparent;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--deep-brown);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.badge-hot {
  background: var(--chart-red);
}

.card {
  border: 2px solid var(--deep-brown);
  background: var(--cream-light);
  padding: 20px;
  box-shadow: 4px 4px 0 rgba(43, 30, 22, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 6px 6px 0 rgba(43, 30, 22, 0.2);
}

.chapter-card {
  border: 2px solid var(--deep-brown);
  background: var(--cream-light);
  box-shadow: 4px 4px 0 rgba(43, 30, 22, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chapter-card:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 0 rgba(43, 30, 22, 0.18);
}

.chapter-card-title {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 900;
  padding: 18px 18px 0;
  line-height: 1.3;
}

.chapter-card-desc {
  padding: 8px 18px 14px;
  font-size: 13px;
  color: var(--brown-muted);
}

.chapter-card-link {
  display: block;
  padding: 12px 18px;
  border-top: 1px solid var(--border-brown);
  font-weight: 800;
  font-size: 14px;
  color: var(--orange-red);
  transition: background 0.15s ease;
}

.chapter-card-link:hover {
  background: rgba(232, 93, 46, 0.05);
}

.media-frame {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--deep-brown);
  background: var(--cream-light);
  box-shadow: 4px 4px 0 rgba(43, 30, 22, 0.12);
  aspect-ratio: 16 / 9;
}

.media-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    linear-gradient(45deg, transparent 45%, rgba(139, 155, 180, 0.18) 48%, transparent 52%),
    linear-gradient(-45deg, transparent 45%, rgba(139, 155, 180, 0.12) 48%, transparent 52%);
  background-size: 24px 24px;
  color: var(--brown-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1px;
}

.media-frame-caption {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 2;
  background: var(--deep-brown);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 12px;
  letter-spacing: 0.5px;
}

.index-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: var(--cream-light);
  border: 1px solid var(--border-brown);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.index-label::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--orange-red);
}

.section-rule {
  display: block;
  height: 4px;
  width: 56px;
  background: var(--orange-red);
  margin: 16px 0 24px;
}

.corner-cut {
  position: relative;
}

.corner-cut::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  border-top: 28px solid var(--orange-red);
  border-left: 28px solid transparent;
  z-index: 2;
}

/* ============ 5. 标题结构 ============ */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--deep-brown);
  position: relative;
}

.section-index {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--orange-red);
}

.section-title {
  font-family: var(--font-head);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

/* ============ 6. 内容排版 ============ */
.prose {
  max-width: 72ch;
}

.prose h2 {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 900;
  margin: 40px 0 12px;
  line-height: 1.3;
}

.prose h3 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 900;
  margin: 32px 0 8px;
  line-height: 1.3;
}

.prose p {
  margin-bottom: 16px;
  line-height: 1.75;
}

.prose a {
  color: var(--orange-red);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose ul,
.prose ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.prose ul {
  list-style: square;
}

.prose ol {
  list-style: decimal;
}

.prose li {
  margin-bottom: 6px;
  line-height: 1.65;
}

.prose blockquote {
  border-left: 4px solid var(--orange-red);
  padding: 12px 16px;
  background: var(--cream-light);
  margin: 24px 0;
  color: var(--brown-muted);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 14px;
  background: rgba(43, 30, 22, 0.06);
  padding: 2px 6px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brown-muted);
}

.breadcrumb a {
  color: var(--deep-brown);
  font-weight: 700;
}

.breadcrumb a:hover {
  color: var(--orange-red);
}

.breadcrumb span[aria-hidden="true"] {
  color: var(--orange-red);
}

.breadcrumb-current {
  font-weight: 800;
  color: var(--deep-brown);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--deep-brown);
}

.data-table th {
  background: var(--deep-brown);
  color: var(--cream);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  border: 1px solid var(--deep-brown);
}

.data-table td {
  padding: 10px 14px;
  border: 1px solid var(--border-brown);
}

.data-table tbody tr:nth-child(even) {
  background: var(--cream-light);
}

.data-table tbody tr:hover {
  background: rgba(232, 93, 46, 0.06);
}

.search-input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--deep-brown);
  background: var(--cream-light);
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--deep-brown);
  box-shadow: 3px 3px 0 rgba(43, 30, 22, 0.1);
}

.search-input::placeholder {
  color: var(--brown-muted);
}

.search-input:focus {
  outline: 3px solid var(--orange-light);
  border-color: var(--orange-red);
}

.toc {
  border: 2px solid var(--deep-brown);
  background: var(--cream-light);
  padding: 20px;
  box-shadow: 4px 4px 0 rgba(43, 30, 22, 0.12);
}

.toc-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brown-muted);
  border-bottom: 1px solid var(--border-brown);
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.toc a {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-brown);
  font-weight: 600;
  font-size: 14px;
  color: var(--deep-brown);
  transition: color 0.15s ease, background 0.15s ease;
}

.toc a:last-child {
  border-bottom: none;
}

.toc a:hover {
  color: var(--orange-red);
}

.toc a[aria-current] {
  color: var(--orange-red);
  border-left: 3px solid var(--orange-red);
  padding-left: 12px;
  background: rgba(232, 93, 46, 0.04);
}

/* ============ 7. Header ============ */
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 2000;
  padding: 10px 18px;
  background: var(--dark-brown);
  color: var(--cream);
  font-weight: 800;
  border: 2px solid var(--orange-red);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--cream);
  border-bottom: 4px solid var(--deep-brown);
  box-shadow: 0 2px 0 rgba(43, 30, 22, 0.1);
}

.header-progress {
  display: block;
  height: 3px;
  width: 0;
  background: var(--orange-red);
  transition: width 0.08s linear;
}

.header-top {
  background: var(--dark-brown);
  border-bottom: 1px solid var(--border-brown);
}

.header-top-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(245, 240, 230, 0.8);
  text-transform: uppercase;
}

.header-coord {
  color: var(--orange-light);
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--deep-brown);
}

.brand-dot {
  color: var(--orange-red);
}

.brand-sub {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--brown-muted);
  border-left: 2px solid var(--orange-red);
  padding-left: 10px;
  line-height: 1.4;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.main-nav a {
  display: block;
  padding: 8px 10px;
  border-bottom: 3px solid transparent;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--deep-brown);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.main-nav a:hover {
  color: var(--orange-red);
  border-bottom-color: var(--orange-light);
}

.main-nav a[aria-current="page"] {
  color: var(--orange-red);
  border-bottom-color: var(--orange-red);
}

.main-nav .header-support {
  margin-left: 8px;
  padding: 7px 14px;
  background: var(--orange-red);
  color: var(--cream-light);
  border: 2px solid var(--deep-brown);
  box-shadow: 3px 3px 0 var(--deep-brown);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.main-nav .header-support:hover {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--deep-brown);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: var(--cream-light);
  border: 2px solid var(--deep-brown);
  box-shadow: 3px 3px 0 rgba(43, 30, 22, 0.25);
  cursor: pointer;
}

.nav-toggle-bar {
  width: 20px;
  height: 2px;
  background: var(--deep-brown);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar {
  background: var(--orange-red);
}

/* ============ 8. Footer ============ */
.site-footer {
  background: var(--dark-brown);
  color: var(--cream-light);
  border-top: 4px solid var(--orange-red);
}

.site-footer-inner {
  padding-top: 40px;
  padding-bottom: 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 32px;
}

.footer-brand .brand-mark {
  color: var(--cream-light);
}

.footer-desc {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(245, 240, 230, 0.65);
  max-width: 26ch;
}

.footer-heading {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--orange-light);
  font-weight: 800;
  margin-bottom: 12px;
}

.footer-col a {
  display: block;
  padding: 4px 0;
  font-size: 14px;
  color: rgba(245, 240, 230, 0.85);
  transition: color 0.15s ease, transform 0.15s ease;
}

.footer-col a:hover {
  color: var(--orange-light);
  transform: translateX(3px);
}

.footer-contact span {
  display: block;
  padding: 3px 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(245, 240, 230, 0.7);
}

.footer-contact-btn {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  border: 1px solid rgba(245, 240, 230, 0.4);
  color: var(--cream-light);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.footer-contact-btn:hover {
  border-color: var(--orange-red);
  color: var(--orange-light);
  background: rgba(232, 93, 46, 0.1);
  transform: none;
}

.footer-bottom {
  border-top: 1px solid rgba(245, 240, 230, 0.15);
  margin-top: 32px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: rgba(245, 240, 230, 0.6);
}

/* ============ 9. 交互元素 ============ */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 950;
  width: 52px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0;
  border: 2px solid var(--deep-brown);
  background: var(--orange-red);
  color: var(--dark-brown);
  box-shadow: 4px 4px 0 rgba(26, 18, 11, 0.8);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.15s ease;
}

.back-to-top[data-visible] {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 2px 2px 0 rgba(26, 18, 11, 0.8);
}

.back-to-top-arrow {
  font-size: 18px;
  line-height: 1;
}

/* ============ 10. FAQ ============ */
.faq-item {
  border: 2px solid var(--deep-brown);
  background: var(--cream-light);
  box-shadow: 3px 3px 0 rgba(43, 30, 22, 0.1);
}

.faq-item + .faq-item {
  margin-top: 16px;
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  text-align: left;
  font-weight: 800;
  font-size: 16px;
  color: var(--deep-brown);
  cursor: pointer;
}

.faq-question::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 22px;
  line-height: 1;
  color: var(--orange-red);
  transition: transform 0.2s ease;
}

.faq-item[data-open] .faq-question::after {
  transform: rotate(45deg);
}

.faq-answer {
  display: none;
  padding: 0 20px 18px;
  color: var(--brown-muted);
  line-height: 1.7;
  font-size: 15px;
}

.faq-item[data-open] .faq-answer {
  display: block;
}

/* ============ 11. 响应式 ============ */
@media (max-width: 1000px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px;
  }
}

@media (max-width: 900px) {
  .grid-12 {
    gap: 16px;
  }

  .header-main {
    flex-wrap: wrap;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .main-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    order: 3;
    gap: 0;
    padding: 12px 0 8px;
    border-top: 2px solid var(--border-brown);
  }

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

  .main-nav a {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-brown);
    border-left: 3px solid transparent;
  }

  .main-nav a[aria-current="page"] {
    border-left-color: var(--orange-red);
    border-bottom-color: var(--border-brown);
    background: rgba(232, 93, 46, 0.06);
  }

  .main-nav .header-support {
    text-align: center;
    margin: 12px 0 0;
  }
}

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

  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .header-top-inner {
    font-size: 11px;
  }

  .header-coord {
    display: none;
  }

  .brand-mark {
    font-size: 26px;
  }

  .brand-sub {
    font-size: 12px;
  }

  .section {
    padding: 40px 0;
  }

  .section-title {
    font-size: 24px;
  }

  .grid-12 {
    grid-template-columns: 1fr;
  }

  .col-span-4,
  .col-span-6,
  .col-span-8,
  .col-span-12 {
    grid-column: 1;
  }

  .media-frame {
    aspect-ratio: 4 / 3;
  }

  .back-to-top {
    right: 12px;
    bottom: 12px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

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

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

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
