@charset "utf-8";

:root {
  --w: #ffffff;
  --g: #f5f5f5;
  --k: #1f1f1f;
  --line: #e3e3e3;
  --mute: #7a7a7a;
  --max: 1180px;
  --pad: 16px;
  --sans: 'Exo 2', 'Hiragino Sans GB', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --tech: 'Orbitron', 'Exo 2', 'Hiragino Sans GB', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--g);
  color: var(--k);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  font-weight: 400;
  overflow-x: hidden;
}

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

a {
  color: var(--k);
}

/* ---------- 顶部两行导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--w);
  border-bottom: 2px solid var(--k);
  padding-inline: max(var(--pad), calc((100% - var(--max)) / 2));
}

.bar {
  display: flex;
  align-items: center;
  padding: 12px 0 6px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--tech);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-decoration: none;
  color: var(--k);
  padding-right: 6px;
}

.brand::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 12px;
  background: var(--k);
}

.mainnav > ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0 0 6px;
  list-style: none;
}

.mainnav li {
  position: relative;
}

.mainnav li > a {
  display: block;
  min-height: 44px;
  padding: 11px 13px;
  font-size: 16px;
  line-height: 1.4;
  text-decoration: none;
  color: var(--k);
  border-bottom: 2px solid transparent;
}

.mainnav li > a:hover,
.mainnav li > a:focus-visible {
  border-bottom-color: var(--k);
  background: var(--g);
}

.has-sub > a::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 9px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-3px);
}

.sub {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 40;
  display: none;
  min-width: 178px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--w);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--k);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.09);
}

.sub li > a {
  padding: 11px 16px;
}

.has-sub:hover .sub,
.has-sub:focus-within .sub {
  display: block;
}

/* ---------- 布局骨架 ---------- */
.layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px var(--pad) 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  min-width: 0;
}

main > section {
  background: var(--w);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--k);
  padding: 22px 20px 24px;
  min-width: 0;
  overflow-wrap: break-word;
  scroll-margin-top: 152px;
}

@media (hover: hover) {
  main > section {
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
  }
  main > section:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
    border-color: #cfcfcf;
  }
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
  min-height: 45vh;
  padding: 22px 18px 22px;
}

.hero-txt {
  text-align: left;
}

.hero-txt h1 {
  margin: 0 0 12px;
  font-family: var(--tech);
  font-size: clamp(26px, 5vw, 42px);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.lead {
  margin: 0;
  color: var(--mute);
  font-size: 16px;
  line-height: 1.7;
}

.hero-fig {
  position: relative;
  margin: 0;
  min-height: 170px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, #efefef, #e3e3e3);
}

.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.06);
  will-change: transform;
}

.fig-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--k);
}

/* ---------- 正文排版 ---------- */
main > section small {
  display: block;
  margin-bottom: 6px;
  font-family: var(--tech);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--mute);
}

main > section h2 {
  margin: 0 0 14px;
  font-family: var(--tech);
  font-size: clamp(20px, 2.5vw, 26px);
  line-height: 1.34;
  font-weight: 600;
  letter-spacing: 0.02em;
}

main > section h3 {
  margin: 22px 0 10px;
  font-size: 19px;
  line-height: 1.45;
  font-weight: 600;
}

main > section p {
  margin: 0 0 14px;
  line-height: 1.78;
}

main > section ul,
main > section ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

main > section li {
  margin: 7px 0;
  line-height: 1.7;
}

main > section a {
  color: var(--k);
  text-decoration: underline;
  text-underline-offset: 3px;
}

main > section blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--g);
  border-left: 3px solid var(--k);
}

main > section blockquote p:last-child {
  margin-bottom: 0;
}

main > section figcaption {
  margin-top: 8px;
  font-size: 14px;
  color: var(--mute);
}

/* ---------- 右侧栏 ---------- */
.rail {
  background: var(--w);
  border: 1px solid var(--line);
  border-top: 3px solid var(--k);
  padding: 18px 16px 20px;
  align-self: start;
}

.rail small {
  display: block;
  font-family: var(--tech);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--mute);
  margin-bottom: 4px;
}

.rail h2 {
  margin: 0 0 12px;
  font-family: var(--tech);
  font-size: 19px;
  line-height: 1.35;
  font-weight: 600;
}

.toc {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: sec;
}

.toc li {
  counter-increment: sec;
  border-top: 1px solid var(--line);
}

.toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 2px;
  font-size: 16px;
  text-decoration: none;
  color: var(--k);
}

.toc a::before {
  content: counter(sec, decimal-leading-zero);
  font-family: var(--tech);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--mute);
}

.toc a:hover,
.toc a:focus-visible {
  background: var(--g);
}

/* ---------- 页脚 ---------- */
footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 20px;
  margin-top: 40px;
  padding: 22px max(var(--pad), calc((100% - var(--max)) / 2));
  background: var(--w);
  border-top: 2px solid var(--k);
  font-size: 16px;
}

footer p {
  margin: 0;
}

footer small {
  font-size: 16px;
}

footer a {
  color: var(--k);
  text-decoration: none;
  border-bottom: 1px solid var(--k);
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 2px 0;
}

/* ---------- 动效 ---------- */
.js main > section {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.3, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
  transition-delay: calc(var(--i, 0) * 70ms);
}

.js main > section.in {
  opacity: 1;
  transform: none;
}

/* ---------- 断点 ---------- */
@media (min-width: 760px) {
  .hero {
    grid-template-columns: 1.12fr 0.88fr;
    text-align: center;
    padding: 24px 24px 24px;
  }
  .hero-txt {
    text-align: center;
  }
  .hero-txt h1 {
    font-size: clamp(30px, 4.4vw, 44px);
  }
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 292px;
    gap: 20px;
    padding-top: 22px;
  }
  main {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
  main > section:first-of-type,
  main > section:nth-of-type(2) {
    grid-column: 1 / -1;
  }
  .rail {
    position: sticky;
    top: 152px;
  }
  footer {
    margin-top: 56px;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 16px;
  }
  main > section {
    padding: 18px 15px 20px;
  }
  .hero {
    padding: 18px 15px 20px;
  }
  .rail {
    padding: 16px 15px 18px;
  }
}

@media (max-width: 899px) {
  .topbar {
    position: static;
  }
  main > section {
    scroll-margin-top: 20px;
  }
  .sub {
    position: static;
    display: block;
    min-width: 0;
    border: none;
    border-left: 2px solid var(--line);
    box-shadow: none;
    margin-left: 13px;
    padding: 0;
    background: transparent;
  }
  .sub li > a {
    padding: 9px 12px;
    min-height: 40px;
  }
  .has-sub > a::after {
    transform: rotate(45deg) translateY(-1px);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .js main > section {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .hero-img {
    transform: none;
  }
  main > section:hover {
    box-shadow: none;
  }
}

button[aria-expanded]{min-width:44px;min-height:44px}
