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

:root {
  --ink: #0B1B2B;
  --ink-2: #13293D;
  --ink-deep: #07121D;
  --line: #2B4560;
  --gold: #E8B45A;
  --gold-soft: #F3D79B;
  --coral: #FF7A59;
  --celadon: #7FB8A4;
  --paper: #F5F1E8;
  --mist: #C9D3DD;
  --graphite: #5B6672;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --step--1: 0.8125rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.125rem;
  --step-4: clamp(2.1rem, 4vw, 3rem);
  --step-5: clamp(2.6rem, 6vw, 4.25rem);
  --shell-w: min(1240px, calc(100% - 48px));
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 720px) {
  :root { --shell-w: min(1240px, calc(100% - 32px)); }
}

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--mist);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.75;
  font-weight: 400;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, ul, ol, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: inherit; }
hr { border: 0; height: 1px; background: var(--line); margin: 0; }
::selection { background: var(--gold); color: var(--ink); }

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

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 120;
  transform: translateY(-200%);
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 600;
  padding: 10px 16px;
  text-decoration: none;
  transition: transform 0.18s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.shell {
  width: var(--shell-w);
  margin-inline: auto;
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  border-bottom: 1px solid var(--line);
}

.progress-rail {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  background: rgba(43, 69, 96, 0.6);
  z-index: 90;
  pointer-events: none;
}
.progress-rail__bar {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
}

.masthead {
  border-top: 3px solid var(--gold);
}

.masthead__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr);
  grid-template-areas: "meta center versions";
  align-items: start;
  gap: 20px;
  padding-block: 26px 0;
}

.masthead__meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.masthead__kicker {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: none;
}

.stamp {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--mist);
  border: 1px solid var(--line);
  padding: 4px 8px;
  line-height: 1.4;
}

.masthead__center {
  grid-area: center;
  justify-self: center;
  text-align: center;
  max-width: 34rem;
}

.masthead__brand {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.9rem, 3.8vw, 3rem);
  line-height: 1.1;
  letter-spacing: 0.06em;
  color: var(--paper);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
.masthead__brand:hover,
.masthead__brand:focus-visible { color: var(--gold-soft); }

.masthead__tagline {
  margin-top: 10px;
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--mist);
  letter-spacing: 0.02em;
}

.masthead__versions {
  grid-area: versions;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.vtag {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
  padding: 5px 9px;
  border: 1px solid rgba(232, 180, 90, 0.35);
  background: transparent;
  color: var(--gold-soft);
  text-align: left;
}
.vtag__key {
  font-size: 0.78em;
  letter-spacing: 0.08em;
  color: var(--graphite);
  color: rgba(201, 211, 221, 0.72);
}
.vtag__val {
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}
.vtag--solid {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--ink);
}
.vtag--solid .vtag__key { color: #3A2C10; }
.vtag--solid .vtag__val { color: #0F1F2E; }

.vtag--action {
  cursor: pointer;
  appearance: none;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.vtag--action:hover {
  background: rgba(232, 180, 90, 0.14);
  border-color: var(--gold);
  color: var(--gold-soft);
}
.vtag--action.is-done {
  background: var(--celadon);
  border-color: var(--celadon);
  color: #06211A;
}

.nav-toggle {
  display: none;
  grid-area: toggle;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  cursor: pointer;
}
.nav-toggle__bars {
  position: relative;
  display: block;
  width: 18px;
  height: 10px;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--gold);
  transform: translateY(-50%);
}
.nav-toggle[data-open] { border-color: var(--gold); color: var(--gold-soft); }

.nav-strip {
  display: block;
  border-top: 1px solid var(--line);
  margin-top: 26px;
}

.nav-strip__list {
  width: var(--shell-w);
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
}
.nav-strip__list > li + li { border-left: 1px solid var(--line); }

.nav-strip__link {
  position: relative;
  display: block;
  padding: 15px 22px;
  font-size: 0.9375rem;
  letter-spacing: 0.1em;
  color: var(--paper);
  text-decoration: none;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.nav-strip__link:hover {
  color: var(--gold-soft);
  background: rgba(232, 180, 90, 0.06);
}
.nav-strip__link[aria-current="page"] {
  color: var(--gold);
}
.nav-strip__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--gold);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink-deep);
  color: var(--mist);
  border-top: 1px solid var(--line);
}

.version-bar {
  border-bottom: 1px solid var(--line);
  background: #050D15;
}
.version-bar__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding-block: 12px;
}
.version-bar__label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  color: var(--graphite);
  margin-right: 6px;
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.7fr) minmax(0, 1.2fr);
  gap: 36px 44px;
  padding-block: 44px;
}

.footer-brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-2);
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: var(--paper);
}
.footer-brand__note {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--mist);
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.footer-col__title {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--gold);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.footer-col__list { margin-top: 14px; }
.footer-col__list > li + li { margin-top: 9px; }

.footer-link {
  color: var(--mist);
  font-size: 0.875rem;
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
.footer-link:hover,
.footer-link:focus-visible { color: var(--gold-soft); }

.footer-contact__title {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--gold);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.footer-contact__line {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: var(--paper);
  word-break: break-word;
}
.footer-contact__note {
  margin-top: 14px;
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--graphite);
  color: rgba(201, 211, 221, 0.7);
}

.footer-legal { border-top: 1px solid var(--line); }
.footer-legal__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 18px 26px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--graphite);
}
.footer-legal__links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.footer-legal__icp { color: var(--graphite); }
.footer-legal .footer-link { font-size: 0.75rem; color: var(--mist); }

/* ---------- Shared components ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 12px 22px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.06em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.btn--gold { background: var(--gold); border-color: var(--gold); color: #0E1D2B; }
.btn--gold:hover { background: var(--gold-soft); border-color: var(--gold-soft); }
.btn--ghost:hover { background: rgba(232, 180, 90, 0.12); color: var(--gold-soft); }

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--graphite);
}
.crumbs a { color: var(--mist); text-decoration: none; }
.crumbs a:hover { color: var(--gold-soft); }
.crumbs__sep { color: var(--line); }
.crumbs__current { color: var(--gold); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  color: var(--gold);
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--gold);
}

.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.rule { height: 1px; background: var(--line); border: 0; }

.section {
  padding-block: clamp(40px, 6vw, 80px);
  border-top: 1px solid var(--line);
}

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

.split {
  display: grid;
  grid-template-columns: minmax(0, 62fr) minmax(0, 38fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

.prose {
  max-width: 68ch;
  font-size: var(--step-0);
  line-height: 1.75;
  color: var(--mist);
}
.prose > * + * { margin-top: 1.1em; }
.prose h2 {
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--paper);
}
.prose h3 {
  font-size: var(--step-1);
  line-height: 1.4;
  color: var(--paper);
}
.prose a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.prose ul, .prose ol { padding-left: 1.4em; }
.prose ul { list-style: square; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.4em; }
.prose strong { color: var(--paper); font-weight: 600; }
.prose blockquote {
  border-left: 2px solid var(--gold);
  padding-left: 1.1em;
  color: var(--paper);
}
.prose--paper {
  background: var(--paper);
  color: #1B2733;
  padding: clamp(24px, 4vw, 48px);
  max-width: 72ch;
}
.prose--paper h2, .prose--paper h3, .prose--paper strong { color: #0B1B2B; }
.prose--paper a { color: #8A5A12; }

.media {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  background: repeating-linear-gradient(135deg, #13293D 0 12px, #0F2436 12px 24px);
}
.media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.media--wide { aspect-ratio: 16 / 9; }
.media--tall { aspect-ratio: 4 / 5; }
.media__cap {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 6px 10px;
  background: rgba(7, 18, 29, 0.86);
  border-top: 1px solid var(--line);
  color: var(--mist);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.32s var(--ease), transform 0.32s var(--ease);
}
[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .masthead__inner { gap: 16px; }
  .footer-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .footer-contact { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .masthead__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "center toggle"
      "versions versions";
    row-gap: 16px;
    padding-block: 18px 16px;
  }
  .masthead__meta { display: none; }
  .masthead__center {
    justify-self: start;
    text-align: left;
    max-width: none;
  }
  .masthead__versions {
    justify-self: start;
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .nav-toggle { display: inline-flex; align-self: start; }

  .nav-strip {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: 0;
    overflow: hidden;
    transition: grid-template-rows 0.24s var(--ease);
  }
  .nav-strip > .nav-strip__list {
    width: 100%;
    display: block;
    overflow: hidden;
    min-height: 0;
  }
  .nav-strip[data-open] { grid-template-rows: 1fr; }
  .nav-strip__list > li + li { border-left: 0; border-top: 1px solid var(--line); }
  .nav-strip__link { padding: 14px 0; }
  .nav-strip__link[aria-current="page"]::after {
    left: 0;
    right: auto;
    width: 34px;
  }

  .split { grid-template-columns: minmax(0, 1fr); }
  .grid-12 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .footer-main { grid-template-columns: minmax(0, 1fr); gap: 30px; }
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
}

@media (max-width: 600px) {
  .nav-strip__link { font-size: 0.9375rem; letter-spacing: 0.08em; }
  .footer-cols { grid-template-columns: minmax(0, 1fr); }
  .footer-legal__inner { justify-content: flex-start; }
  .grid-12 { grid-template-columns: minmax(0, 1fr); }
  .vtag { font-size: 0.75rem; }
}

@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;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .progress-rail__bar { transition: none; }
}
