:root {
  --color-primary: #0a5c2a;
  --color-gold: #d4af37;
  --color-bg: #0d1b14;
  --color-bg-alt: #12271d;
  --color-card: #1a3328;
  --color-text: #e8ece9;
  --color-muted: #8baa9a;
  --color-line: #c5a85e;
  --color-ok: #88c9a1;
  --color-mask: rgba(0, 0, 0, 0.5);
  --header-w: 168px;
  --gutter: clamp(16px, 4vw, 56px);
  --grid-gap: 24px;
  --font-head: "Playfair Display", "Times New Roman", Georgia, "Songti SC", serif;
  --font-body: "Open Sans", "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  color: var(--color-text);
  line-height: 1.25;
  margin: 0 0 16px;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
  margin: 0 0 16px;
}

a {
  color: var(--color-gold);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

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

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

button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
}

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

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-card);
  border: 2px solid var(--color-bg);
}

#main-content {
  display: block;
  outline: none;
}

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

.text-muted { color: var(--color-muted); }
.text-gold { color: var(--color-gold); }

.index-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.index-label::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--color-gold);
}

.rule {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--color-gold), rgba(212, 175, 55, 0));
  margin: 24px 0;
}

.page-container {
  width: min(1200px, 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.section {
  padding: clamp(64px, 8vw, 120px) 0;
}

.section--alt {
  background: var(--color-bg-alt);
}

.section--card {
  background: var(--color-card);
}

.section-head {
  max-width: 720px;
  margin-bottom: clamp(28px, 4vw, 56px);
}

.section-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 12px;
}

.section-eyebrow::after {
  content: "";
  width: 72px;
  height: 1px;
  background: var(--color-line);
  opacity: 0.6;
}

.section-title {
  font-family: var(--font-head);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.2;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.section-desc {
  color: var(--color-muted);
  max-width: 62ch;
  margin-bottom: 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 28px;
  font-size: 0.8125rem;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  color: var(--color-line);
  opacity: 0.6;
}

.breadcrumb a {
  color: var(--color-muted);
}

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

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

.grid > [class*="col-"] {
  grid-column: span 12;
}

@media (min-width: 640px) {
  .grid .col-3 { grid-column: span 3; }
  .grid .col-4 { grid-column: span 4; }
  .grid .col-5 { grid-column: span 5; }
  .grid .col-6 { grid-column: span 6; }
  .grid .col-7 { grid-column: span 7; }
  .grid .col-8 { grid-column: span 8; }
  .grid .col-9 { grid-column: span 9; }
  .grid .col-12 { grid-column: span 12; }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 28px;
  background: transparent;
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.btn:hover {
  background: var(--color-gold);
  color: var(--color-bg);
  text-decoration: none;
}

.btn--solid {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text);
}

.btn--solid:hover {
  background: #0a4a22;
  border-color: #0a4a22;
  color: var(--color-text);
}

.btn--ghost {
  border-color: rgba(139, 170, 154, 0.5);
  color: var(--color-muted);
}

.btn--ghost:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
  background: transparent;
}

.card {
  background: var(--color-bg-alt);
  padding: 28px;
}

.card--emerald {
  background: var(--color-card);
}

.card-title {
  font-family: var(--font-head);
  font-size: 1.25rem;
  margin-bottom: 12px;
}

.panel {
  background: var(--color-bg-alt);
  border-left: 2px solid var(--color-gold);
}

.panel summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  cursor: pointer;
  color: var(--color-text);
  list-style: none;
}

.panel summary::-webkit-details-marker {
  display: none;
}

.panel summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--color-gold);
  transition: transform 0.2s ease;
}

.panel[open] summary::after {
  transform: rotate(45deg);
}

.panel-body {
  padding: 4px 24px 24px;
  color: var(--color-muted);
}

.media-frame {
  position: relative;
  overflow: hidden;
  background: var(--color-bg-alt);
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(197, 168, 94, 0.18);
}

.media-frame[data-ratio="4:3"] { aspect-ratio: 4 / 3; }
.media-frame[data-ratio="3:2"] { aspect-ratio: 3 / 2; }
.media-frame[data-ratio="21:9"] { aspect-ratio: 21 / 9; }

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

.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(197, 168, 94, 0.15);
  pointer-events: none;
}

.media-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(13, 27, 20, 0.85);
  color: var(--color-gold);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-left: 2px solid var(--color-gold);
}

.plate {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(197, 168, 94, 0.3);
}

.plate-index {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--color-gold);
}

.plate-title {
  font-family: var(--font-head);
  font-size: 1.125rem;
  color: var(--color-text);
}

.plate-desc {
  font-size: 0.875rem;
  color: var(--color-muted);
}

.site-skip {
  position: fixed;
  top: 8px;
  left: 50%;
  z-index: 200;
  background: var(--color-gold);
  color: var(--color-bg);
  padding: 10px 16px;
  font-weight: 600;
  transform: translate(-50%, -250%);
  transition: transform 0.2s ease;
}

.site-skip:focus {
  transform: translate(-50%, 0);
  color: var(--color-bg);
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 14px;
  background: rgba(13, 27, 20, 0.93);
  border-bottom: 1px solid rgba(197, 168, 94, 0.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--color-text);
}

.brand:hover {
  color: var(--color-gold);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--color-primary), #0d3b1c);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  font-family: var(--font-head);
  font-size: 1.125rem;
  line-height: 1;
}

.brand-name {
  font-family: var(--font-head);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--color-text);
}

.brand-sub {
  display: none;
}

.site-nav {
  position: fixed;
  top: 64px;
  left: 0;
  bottom: 0;
  z-index: 80;
  width: min(320px, 86vw);
  padding: 20px 16px;
  background: var(--color-bg);
  border-right: 1px solid rgba(197, 168, 94, 0.35);
  transform: translateX(-102%);
  transition: transform 0.28s ease;
  overflow-y: auto;
}

.site-nav[data-open] {
  transform: none;
  box-shadow: 24px 0 48px rgba(0, 0, 0, 0.45);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: block;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  color: var(--color-muted);
  border-left: 2px solid transparent;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.nav-link:hover {
  color: var(--color-text);
  background: rgba(10, 92, 42, 0.4);
  text-decoration: none;
}

.nav-link[aria-current="page"] {
  color: var(--color-text);
  border-left-color: var(--color-gold);
  background: linear-gradient(90deg, rgba(10, 92, 42, 0.55), rgba(10, 92, 42, 0));
}

.nav-index {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  color: var(--color-gold);
  min-width: 20px;
}

.nav-text {
  font-size: 0.9375rem;
}

.header-tools {
  display: none;
}

.header-tool-link {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--color-muted);
  border: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.header-tool-link:hover {
  color: var(--color-gold);
  border-color: rgba(197, 168, 94, 0.5);
  text-decoration: none;
}

.lang-switch {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  color: var(--color-gold);
  padding: 4px 2px;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.nav-toggle-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 12px;
}

.nav-toggle-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-gold);
  transition: top 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle-line:nth-child(1) { top: 0; }
.nav-toggle-line:nth-child(2) { top: 5px; }
.nav-toggle-line:nth-child(3) { top: 10px; }

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

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

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(3) {
  top: 5px;
  transform: rotate(-45deg);
}

.nav-scrim {
  display: none;
  position: fixed;
  inset: 64px 0 0 0;
  z-index: 70;
  background: var(--color-mask);
}

.nav-scrim[data-open] {
  display: block;
}

@media (min-width: 961px) {
  body {
    margin-left: var(--header-w);
  }

  .site-header {
    top: 0;
    left: 0;
    right: auto;
    bottom: 0;
    width: var(--header-w);
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: rgba(13, 27, 20, 0.88);
    border-right: 1px solid rgba(197, 168, 94, 0.32);
    border-bottom: none;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
  }

  .brand {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 6px;
    padding: 22px 12px 18px;
    border-bottom: 1px solid rgba(197, 168, 94, 0.25);
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }

  .brand-name {
    font-size: 1.125rem;
    letter-spacing: 0.16em;
  }

  .brand-sub {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.5625rem;
    letter-spacing: 0.12em;
    line-height: 1.4;
    color: var(--color-muted);
    text-transform: uppercase;
    text-align: center;
    margin-top: 2px;
  }

  .site-nav {
    position: static;
    width: auto;
    height: auto;
    transform: none;
    background: transparent;
    border-right: none;
    padding: 16px 10px 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    z-index: auto;
    box-shadow: none;
  }

  .nav-list {
    justify-content: center;
    gap: 2px;
  }

  .nav-link {
    padding: 11px 12px;
    font-size: 0.875rem;
  }

  .header-tools {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px 8px 18px;
    border-top: 1px solid rgba(197, 168, 94, 0.22);
  }

  .nav-toggle {
    display: none;
  }

  .nav-scrim {
    display: none;
  }
}

.site-footer {
  margin-top: auto;
  background: var(--color-bg-alt);
  border-top: 2px solid var(--color-gold);
}

.footer-top {
  width: min(1280px, 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding: clamp(48px, 7vw, 80px) 0 40px;
}

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

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.footer-brand:hover {
  text-decoration: none;
}

.footer-brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--color-primary), #0d3b1c);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  font-family: var(--font-head);
  font-size: 1rem;
  line-height: 1;
}

.footer-brand-name {
  font-family: var(--font-head);
  font-size: 1.375rem;
  letter-spacing: 0.04em;
  color: var(--color-text);
}

.footer-brand-sub {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--color-muted);
  margin-bottom: 12px;
}

.footer-trust {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--color-muted);
  border-left: 2px solid var(--color-gold);
  padding-left: 14px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-heading {
  font-family: var(--font-head);
  font-size: 0.9375rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 10px;
}

.footer-links {
  display: grid;
  gap: 8px;
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--color-muted);
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-gold);
  text-decoration: none;
}

.footer-contact p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-muted);
  margin-bottom: 12px;
}

.footer-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 2px;
}

.footer-bottom {
  background: var(--color-bg);
  border-top: 1px solid rgba(197, 168, 94, 0.2);
}

.footer-bar {
  width: min(1280px, 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding: 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
}

.copyright,
.disclaimer {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin: 0;
}

@media (min-width: 800px) {
  .footer-grid {
    grid-template-columns: repeat(12, 1fr);
  }

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

  .footer-col {
    grid-column: span 2;
  }

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

.chapter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--color-bg-alt);
  border-left: 2px solid var(--color-gold);
}

.chapter-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.8125rem;
  color: var(--color-muted);
  border: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.chapter-link:hover {
  color: var(--color-text);
  border-color: rgba(197, 168, 94, 0.4);
  text-decoration: none;
}

.chapter-link.is-active,
.chapter-link[aria-current="location"] {
  color: var(--color-gold);
  background: rgba(10, 92, 42, 0.4);
  border-color: rgba(197, 168, 94, 0.5);
}

.chapter-code {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--color-gold);
}

.top-btn {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--color-primary), #0d3b1c);
  border: 1px solid var(--color-gold);
  color: var(--color-gold);
  transition: background 0.25s ease, color 0.25s ease;
}

.top-btn[hidden] {
  display: none;
}

.top-btn:hover {
  background: var(--color-gold);
  color: var(--color-bg);
}

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
