:root {
  --c-void: #050B18;
  --c-deep: #0A1B36;
  --c-panel: #10284A;
  --c-line: #1E3A5F;
  --c-cyan: #22E0FF;
  --c-orange: #FF6B2C;
  --c-violet: #7A5CFF;
  --c-green: #35E39B;
  --c-white: #EAF6FF;
  --c-steel: #8CA8C7;
  --c-amber: #FFB020;
  --font-display: "CloudSans Heavy", "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --shell: 1180px;
  --shell-wide: 1440px;
  --gutter: 20px;
  --radius: 3px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --shadow-soft: 0 1px 0 rgba(34, 224, 255, .16), 0 18px 40px -32px rgba(0, 0, 0, .9);
}

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

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

body {
  margin: 0;
  background: var(--c-void);
  color: var(--c-white);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.8;
  letter-spacing: .01em;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 88% -8%, rgba(34, 224, 255, .13), transparent 62%),
    radial-gradient(720px 460px at -6% 22%, rgba(122, 92, 255, .14), transparent 60%),
    radial-gradient(640px 420px at 62% 108%, rgba(255, 107, 44, .08), transparent 64%);
  z-index: 0;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 900;
  line-height: 1.14;
  letter-spacing: -.02em;
  margin: 0 0 .5em;
  color: var(--c-white);
}

h1 { font-size: clamp(2.2rem, 6vw, 4.4rem); }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.7rem); }
h3 { font-size: clamp(1.24rem, 2.2vw, 1.6rem); }

p { margin: 0 0 1em; }

a { color: var(--c-cyan); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--c-orange); }

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

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

:focus-visible {
  outline: 2px solid var(--c-cyan);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection { background: rgba(34, 224, 255, .3); color: var(--c-white); }

.mono {
  font-family: var(--font-mono);
  font-size: .82em;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}

/* ---------- shell ---------- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}

.shell--wide { max-width: var(--shell-wide); }

.container {
  max-width: 820px;
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 1;
}

/* ---------- skip link ---------- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 99;
  background: var(--c-cyan);
  color: var(--c-void);
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; color: var(--c-void); }

/* ---------- header ---------- */
.cmd-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(5, 11, 24, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--c-line);
}

.cmd-bar__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 70px;
  padding-block: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--c-white);
  flex: 0 0 auto;
}
.brand:hover { color: var(--c-white); }

.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--c-void);
  background: linear-gradient(140deg, var(--c-cyan), var(--c-violet));
  clip-path: polygon(0 0, 100% 0, 100% 72%, 78% 100%, 0 100%);
}

.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name { font-family: var(--font-display); font-size: 19px; font-weight: 900; letter-spacing: -.01em; }
.brand__tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--c-steel);
  letter-spacing: .06em;
}

/* nav */
.cmd-nav { margin-left: auto; }
.cmd-nav__list { display: flex; align-items: center; gap: 2px; counter-reset: navidx; }

.cmd-nav__item { counter-increment: navidx; }

.cmd-nav__link {
  position: relative;
  display: block;
  padding: 9px 12px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--c-steel);
  white-space: nowrap;
  border-radius: var(--radius);
  transition: color .18s var(--ease), background-color .18s var(--ease);
}
.cmd-nav__link::before {
  content: counter(navidx, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--c-line);
  display: block;
  line-height: 1;
  margin-bottom: 3px;
  letter-spacing: .08em;
  transition: color .18s var(--ease);
}
.cmd-nav__link:hover { color: var(--c-white); background: rgba(16, 40, 74, .7); }
.cmd-nav__link:hover::before { color: var(--c-cyan); }

.cmd-nav__link[aria-current="page"] { color: var(--c-cyan); background: rgba(34, 224, 255, .09); }
.cmd-nav__link[aria-current="page"]::before { color: var(--c-orange); }
.cmd-nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 1px;
  background: linear-gradient(90deg, var(--c-cyan), transparent);
}

.cmd-bar__side { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

.cmd-status { display: flex; align-items: center; gap: 7px; margin: 0; }
.cmd-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-green);
  box-shadow: 0 0 0 0 rgba(53, 227, 155, .55);
  animation: pulse-dot 2.6s var(--ease) infinite;
}
.cmd-status__text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--c-steel);
  letter-spacing: .04em;
  white-space: nowrap;
}

@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(53, 227, 155, .5); }
  70% { box-shadow: 0 0 0 9px rgba(53, 227, 155, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 227, 155, 0); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: transform .18s var(--ease), background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--c-orange);
  color: #150500;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 92% 100%, 0 100%);
}
.btn--primary:hover { background: #ff8347; color: #150500; }

.btn--ghost {
  background: transparent;
  border-color: var(--c-cyan);
  color: var(--c-cyan);
}
.btn--ghost:hover { background: rgba(34, 224, 255, .12); color: var(--c-white); border-color: var(--c-cyan); }

.btn--small { padding: 8px 15px; font-size: 13.5px; }

/* ---------- nav toggle ---------- */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  background: transparent;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  color: var(--c-white);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}
.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--c-cyan);
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before { content: ""; position: absolute; top: -6px; left: 0; }
.nav-toggle__bars::after { content: ""; position: absolute; top: 6px; left: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* ---------- progress ---------- */
.progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: transparent;
  overflow: hidden;
}
.progress-bar__fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--c-cyan), var(--c-violet), var(--c-orange));
  transition: width .12s linear;
}

/* ---------- footer ---------- */
.site-footer {
  position: relative;
  margin-top: 90px;
  background: linear-gradient(180deg, var(--c-deep), var(--c-void) 70%);
  border-top: 1px solid var(--c-line);
  padding-top: 56px;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 140px;
  height: 2px;
  background: linear-gradient(90deg, var(--c-cyan), transparent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1.5fr;
  gap: 32px 26px;
  padding-bottom: 40px;
}

.footer-brand__note {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--c-steel);
  max-width: 30ch;
  line-height: 1.7;
}

.brand--footer .brand__name { font-size: 17px; }

.footer-col__title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--c-cyan);
  text-transform: uppercase;
  margin: 0 0 14px;
}
.footer-col__title::after {
  content: "";
  display: block;
  width: 26px;
  height: 1px;
  margin-top: 9px;
  background: var(--c-line);
}

.footer-links li + li { margin-top: 9px; }
.footer-links a {
  font-size: 14.5px;
  color: var(--c-steel);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.footer-links a:hover { color: var(--c-white); border-bottom-color: var(--c-orange); }

.footer-contact__list li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  font-size: 13.5px;
  color: var(--c-steel);
  line-height: 1.6;
}
.footer-contact__list li + li { margin-top: 10px; }
.footer-contact__list .mono { color: var(--c-line); text-transform: uppercase; font-size: 11px; letter-spacing: .1em; padding-top: 3px; }

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding-block: 18px 26px;
  border-top: 1px solid var(--c-line);
}
.footer-meta__line { margin: 0; font-size: 12.5px; color: var(--c-steel); }
.footer-meta__line .mono { color: var(--c-steel); }

/* ---------- back to top ---------- */
.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 20px;
  z-index: 70;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  color: var(--c-cyan);
  border-radius: var(--radius);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
}
.back-to-top[data-visible="true"] { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { border-color: var(--c-cyan); color: var(--c-white); }
.back-to-top__arrow { font-family: var(--font-mono); font-size: 16px; }

/* ---------- breadcrumb ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--c-steel);
  padding-block: 22px 4px;
}
.breadcrumb__item { display: inline-flex; align-items: center; gap: 8px; }
.breadcrumb a { color: var(--c-steel); }
.breadcrumb a:hover { color: var(--c-cyan); }
.breadcrumb__sep { color: var(--c-line); }

/* ---------- sections ---------- */
.section {
  position: relative;
  padding-block: 62px;
  border-top: 1px solid var(--c-line);
}
.section:first-of-type { border-top: 0; }

.section__head { margin-bottom: 30px; max-width: 64ch; }

.section__index {
  display: block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: .18em;
  color: var(--c-orange);
  margin-bottom: 10px;
}

.section__title { margin-bottom: 12px; }

.section__lead { color: var(--c-steel); font-size: 16.5px; margin: 0; }

/* ---------- tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  color: var(--c-steel);
  background: rgba(16, 40, 74, .5);
}
.tag--live { color: var(--c-green); border-color: rgba(53, 227, 155, .5); }
.tag--live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-green);
  animation: pulse-dot 2.6s var(--ease) infinite;
}
.tag--update { color: var(--c-amber); border-color: rgba(255, 176, 32, .5); }
.tag--muted { color: var(--c-steel); }

/* ---------- grid utils ---------- */
.grid { display: grid; gap: 24px; }
.grid--12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.grid--asym { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.stack > * + * { margin-top: 18px; }
.cluster { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- media frame ---------- */
.media-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(34, 224, 255, .12), rgba(122, 92, 255, .14) 55%, rgba(255, 107, 44, .1)),
    var(--c-deep);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
}
.media-frame--wide { aspect-ratio: 21 / 9; }
.media-frame--tall { aspect-ratio: 4 / 5; }
.media-frame--square { aspect-ratio: 1 / 1; }
.media-frame__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.media-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(5, 11, 24, .55));
}

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.reveal[data-visible="true"] { opacity: 1; transform: none; }

/* ---------- toc ---------- */
.toc { position: sticky; top: 92px; }
.toc__link {
  display: block;
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--c-steel);
  border-left: 1px solid var(--c-line);
  transition: color .18s var(--ease), border-color .18s var(--ease), background-color .18s var(--ease);
}
.toc__link:hover { color: var(--c-white); background: rgba(16, 40, 74, .6); }
.toc__link[aria-current="true"] {
  color: var(--c-cyan);
  border-left-color: var(--c-orange);
  background: rgba(34, 224, 255, .08);
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-contact { grid-column: 1 / -1; }
}

@media (max-width: 920px) {
  .cmd-status { display: none; }
  .nav-toggle { display: inline-flex; }
  .cmd-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin: 0;
    background: rgba(5, 11, 24, .97);
    border-bottom: 1px solid var(--c-line);
    max-height: 0;
    overflow: hidden;
    transition: max-height .32s var(--ease);
  }
  .cmd-nav[data-open] { max-height: 70vh; overflow-y: auto; }
  .cmd-nav__list { flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 18px; }
  .cmd-nav__item { border-bottom: 1px solid var(--c-line); }
  .cmd-nav__link { display: flex; align-items: baseline; gap: 12px; padding: 14px 4px; font-size: 16px; }
  .cmd-nav__link::before { margin: 0; }
  .cmd-nav__link[aria-current="page"]::after { left: 4px; right: 4px; bottom: 6px; }
  .cmd-bar__side { margin-left: auto; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .grid--12, .grid--asym { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
  .section { padding-block: 46px; }
  .site-footer { margin-top: 60px; padding-top: 40px; }
  .footer-meta { justify-content: flex-start; }
  .brand__tag { display: none; }
}

@media (max-width: 460px) {
  .footer-grid { grid-template-columns: 1fr; }
  .cmd-bar__side .btn--primary { display: none; }
  .toc { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
