/* ============================================================
   必胜28PC · 共享样式表  /assets/site.css
   深空蓝底 + 夜航蓝纸层 + 终端绿操作色 + 警示橙 / 代码红状态色
   ============================================================ */

/* ---------- 变量 ---------- */
:root {
  --deep: #0B1B33;
  --night: #13294B;
  --green: #35E08A;
  --mint: #A8F5C8;
  --amber: #FF9F1C;
  --red: #FF4D5E;
  --mist: #8FA3BF;
  --paper: #F4F7FB;
  --ink: #06101F;
  --cyan: #2E93A8;

  --line: rgba(143, 163, 191, .26);
  --line-soft: rgba(143, 163, 191, .16);
  --line-strong: rgba(143, 163, 191, .5);
  --paper-shadow: 6px 6px 0 rgba(6, 16, 31, .9);

  --font-display: "Arial Narrow", "Helvetica Neue Condensed", "Helvetica Neue", Impact, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-body: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "DejaVu Sans Mono", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", monospace;
  --font-label: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --wrap: 1240px;
  --gutter: 1.25rem;
  --radius: 2px;
}

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

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

body {
  margin: 0;
  min-height: 100%;
  background-color: var(--deep);
  background-image:
    repeating-linear-gradient(90deg, rgba(143, 163, 191, .045) 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg, rgba(143, 163, 191, .045) 0 1px, transparent 1px 96px);
  background-attachment: fixed;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; }

h1, h2, h3, h4, h5 {
  margin: 0 0 .6em;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: .035em;
  line-height: 1.16;
  color: var(--paper);
}

h1 { font-size: clamp(1.9rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.4rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.5rem); }

p { margin: 0 0 1.05em; max-width: 68ch; }

ul, ol { margin: 0 0 1.05em; padding-left: 1.2em; }

a {
  color: var(--mint);
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 245, 200, .32);
  transition: color .18s ease, border-color .18s ease;
}

a:hover { color: #fff; border-bottom-color: var(--green); }

button { font: inherit; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4rem 0;
}

::selection { background: var(--green); color: var(--ink); }

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

/* ---------- 工具类 ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.is-filtered { display: none; }

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 300;
  transform: translate(-50%, -140%);
  padding: .7rem 1.15rem;
  background: var(--green);
  color: var(--ink);
  border: 0;
  font-family: var(--font-label);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .12em;
  transition: transform .2s ease;
}

.skip-link:focus { transform: translate(-50%, 0); }

/* ---------- 容器与网格 ---------- */
.wrap {
  width: min(var(--wrap), 100% - 2.5rem);
  margin-inline: auto;
}

.grid {
  display: grid;
  gap: clamp(1rem, 2.2vw, 1.75rem);
}

.grid--2,
.grid--3 { grid-template-columns: 1fr; }

@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1020px) {
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ============================================================
   刊头 / HEADER
   ============================================================ */
.masthead {
  position: sticky;
  top: 0;
  z-index: 120;
  background: linear-gradient(180deg, rgba(11, 27, 51, .99) 0%, rgba(11, 27, 51, .93) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  transition: border-color .28s ease;
}

.masthead.is-condensed { border-bottom-color: var(--line-strong); }

.masthead__rule {
  height: 3px;
  background: linear-gradient(90deg,
    var(--green) 0 20%,
    var(--cyan) 20% 42%,
    var(--amber) 42% 58%,
    var(--red) 58% 66%,
    var(--ink) 66% 100%);
}

.masthead__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand tools"
    "nav   nav";
  align-items: center;
  gap: .55rem .9rem;
  width: min(var(--wrap), 100% - 1.75rem);
  margin-inline: auto;
  padding: .78rem 0 .7rem;
  transition: padding .28s ease;
}

.masthead__brand {
  grid-area: brand;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
  color: var(--paper);
  border: 0;
}

.masthead__brand:hover { color: var(--paper); }

.sigil {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  color: var(--green);
  background: rgba(53, 224, 138, .1);
  border: 1.5px solid rgba(53, 224, 138, .5);
  transition: width .25s ease, height .25s ease;
}

.sigil__svg { display: block; width: 68%; height: 68%; }

.masthead__wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: .08em;
  line-height: 1;
  white-space: nowrap;
  transition: font-size .25s ease;
}

.masthead__mark28 { color: var(--green); }

.masthead__tools {
  grid-area: tools;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}

.masthead__nav {
  grid-area: nav;
  overflow: hidden;
  max-height: 0;
  border-top: 1px solid transparent;
  transition: max-height .32s ease, border-color .32s ease, margin-top .32s ease;
}

.masthead__nav[data-open] {
  max-height: 34rem;
  margin-top: .35rem;
  border-top-color: var(--line);
}

.navlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.navlist__item { margin: 0; }

.navlist__link {
  position: relative;
  display: block;
  padding: .72rem .15rem;
  color: var(--mist);
  border: 0;
  border-bottom: 1px dashed var(--line-soft);
  font-family: var(--font-label);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .06em;
  transition: color .2s ease;
}

.navlist__link::after {
  content: "";
  position: absolute;
  left: .15rem;
  bottom: .42rem;
  width: 2.2rem;
  height: 2px;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .24s ease;
}

.navlist__link:hover { color: var(--mint); }
.navlist__link:hover::after { transform: scaleX(1); }

.navlist__link[aria-current="page"] { color: var(--paper); }
.navlist__link[aria-current="page"]::after { transform: scaleX(1); }

/* 检索框 */
.term-search {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 1 1 auto;
  min-width: 0;
  padding: .34rem .55rem;
  background: rgba(6, 16, 31, .62);
  border: 1.5px solid var(--line);
  transition: border-color .2s ease, background .2s ease;
}

.term-search:focus-within {
  border-color: var(--green);
  background: rgba(6, 16, 31, .92);
}

.term-search__icon {
  flex: none;
  color: var(--cyan);
  font-size: .82rem;
  line-height: 1;
}

.term-search__input {
  width: 100%;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: .78rem;
  letter-spacing: .02em;
}

.term-search__input::placeholder { color: rgba(143, 163, 191, .68); }

.term-search__input::-webkit-search-cancel-button,
.term-search__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

/* 代码索引入口 */
.code-entry {
  flex: none;
  padding: .42rem .58rem;
  color: var(--amber);
  border: 1.5px solid rgba(255, 159, 28, .55);
  font-family: var(--font-label);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.code-entry:hover {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}

/* 移动导航按钮 */
.navtoggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  padding: .44rem .58rem;
  background: transparent;
  border: 1.5px solid var(--line-strong);
  color: var(--paper);
  font-family: var(--font-label);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}

.navtoggle:hover { border-color: var(--green); color: var(--green); }

.navtoggle__bars {
  position: relative;
  display: block;
  width: 14px;
  height: 2px;
  background: currentColor;
  transition: background .2s ease;
}

.navtoggle__bars::before,
.navtoggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 14px;
  height: 2px;
  background: currentColor;
  transition: top .22s ease, transform .22s ease;
}

.navtoggle__bars::before { top: -5px; }
.navtoggle__bars::after { top: 5px; }

.navtoggle[aria-expanded="true"] .navtoggle__bars { background: transparent; }
.navtoggle[aria-expanded="true"] .navtoggle__bars::before { top: 0; transform: rotate(45deg); }
.navtoggle[aria-expanded="true"] .navtoggle__bars::after { top: 0; transform: rotate(-45deg); }

.masthead.is-condensed .masthead__inner { padding: .42rem 0 .38rem; }
.masthead.is-condensed .masthead__wordmark { font-size: 1.2rem; }
.masthead.is-condensed .sigil { width: 24px; height: 24px; }

@media (max-width: 620px) {
  .navtoggle__text { display: none; }
  .masthead__wordmark { font-size: 1.18rem; }
  .term-search__input { font-size: .74rem; }
  .code-entry { display: none; }
}

/* 平板与桌面 */
@media (min-width: 981px) {
  .masthead__inner {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "brand nav tools";
    gap: .8rem 1.5rem;
    padding: 1.05rem 0 .9rem;
  }

  .masthead__nav,
  .masthead__nav[data-open] {
    max-height: none;
    margin-top: 0;
    overflow: visible;
    border-top: 0;
  }

  .navlist {
    flex-direction: row;
    align-items: center;
    gap: .1rem;
  }

  .navlist__link {
    padding: .5rem .72rem;
    border-bottom: 0;
    font-size: .85rem;
    white-space: nowrap;
  }

  .navlist__link::after {
    left: .72rem;
    right: .72rem;
    bottom: .16rem;
    width: auto;
  }

  .term-search { flex: 0 1 auto; width: 13rem; }
  .term-search__input { width: 100%; }
  .navtoggle { display: none; }
}

@media (max-width: 1100px) {
  .code-entry { display: none; }
}

/* ============================================================
   页脚 / COLOPHON
   ============================================================ */
.colophon {
  position: relative;
  margin-top: clamp(3.5rem, 8vw, 7rem);
  background: var(--ink);
  border-top: 1px solid rgba(53, 224, 138, .3);
}

.colophon::before {
  content: "";
  display: block;
  height: 4px;
  background: repeating-linear-gradient(90deg,
    var(--green) 0 26px,
    transparent 26px 42px);
  opacity: .55;
}

.colophon__inner {
  width: min(var(--wrap), 100% - 2.5rem);
  margin-inline: auto;
  padding: clamp(2.4rem, 5vw, 3.6rem) 0 1.6rem;
}

.colophon__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.2rem 2rem;
}

@media (min-width: 640px) {
  .colophon__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1000px) {
  .colophon__grid { grid-template-columns: 1.45fr 1fr 1fr 1.15fr; }
}

.colophon__col { min-width: 0; }

.colophon__brand {
  display: inline-block;
  margin-bottom: .7rem;
  color: var(--paper);
  border: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: .09em;
  line-height: 1;
}

.colophon__brand:hover { color: var(--green); }

.colophon__note {
  max-width: 32ch;
  margin: 0 0 .9rem;
  color: var(--mist);
  font-size: .86rem;
  line-height: 1.8;
}

.colophon__clock {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  color: var(--mint);
  font-family: var(--font-label);
  font-size: .78rem;
  letter-spacing: .06em;
}

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(53, 224, 138, .16);
}

.colophon__title {
  margin: 0 0 .95rem;
  color: var(--mist);
  font-family: var(--font-label);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.colophon__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .5rem;
}

.colophon__list li { margin: 0; max-width: 34ch; }

.colophon__list a {
  color: rgba(244, 247, 251, .86);
  border-bottom: 1px solid transparent;
  font-size: .88rem;
}

.colophon__list a:hover {
  color: var(--green);
  border-bottom-color: var(--green);
}

.colophon__list--plain li {
  color: rgba(244, 247, 251, .7);
  font-size: .84rem;
  line-height: 1.75;
  word-break: break-word;
}

.colophon__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .6rem 1.6rem;
  margin-top: 2.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line-soft);
}

.colophon__legal {
  margin: 0;
  max-width: none;
  color: var(--mist);
  font-size: .76rem;
  letter-spacing: .04em;
}

.colophon__hint {
  margin: 0;
  max-width: 56ch;
  color: rgba(143, 163, 191, .82);
  font-size: .76rem;
  line-height: 1.7;
}

/* ============================================================
   通用组件
   ============================================================ */
.section { padding: clamp(3rem, 7vw, 6rem) 0; }
.section--tight { padding: clamp(2rem, 4.5vw, 3.4rem) 0; }

.section__head {
  display: grid;
  gap: .55rem;
  max-width: 62ch;
  margin-bottom: clamp(1.5rem, 3vw, 2.6rem);
}

.section__eyebrow {
  font-family: var(--font-label);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--cyan);
}

.section__title { margin: 0; }

.section__sub {
  margin: 0;
  max-width: 62ch;
  color: var(--mist);
  font-size: .95rem;
}

.page-head { padding: clamp(2.2rem, 5vw, 4rem) 0 clamp(1.2rem, 2.6vw, 2rem); }

.page-head__title { margin: 0 0 .55rem; }

.page-head__sub {
  margin: 0;
  max-width: 64ch;
  color: var(--mist);
  font-size: .95rem;
}

/* 面包屑 */
.crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  margin-bottom: 1.1rem;
  color: var(--mist);
  font-family: var(--font-label);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.crumb__item { color: var(--mist); border-bottom: 0; }
.crumb__item:hover { color: var(--mint); }
.crumb__item[aria-current="page"] { color: var(--paper); }
.crumb__sep { color: rgba(143, 163, 191, .5); }

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .74rem 1.15rem;
  background: var(--green);
  border: 2px solid var(--green);
  color: var(--ink);
  font-family: var(--font-label);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease, translate .2s ease;
}

.btn:hover {
  background: #5cf0a5;
  border-color: #5cf0a5;
  color: var(--ink);
  translate: 0 -2px;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--paper);
}

.btn--ghost:hover {
  background: rgba(53, 224, 138, .1);
  border-color: var(--green);
  color: var(--green);
}

.btn--warn {
  background: transparent;
  border-color: rgba(255, 159, 28, .62);
  color: var(--amber);
}

.btn--warn:hover {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}

.btn--block { width: 100%; }

/* 纸张叠层卡片 */
.paper {
  position: relative;
  padding: 1.35rem 1.45rem;
  background: var(--night);
  border: 2px solid var(--ink);
  box-shadow: var(--paper-shadow);
}

.paper--tilt-r { transform: rotate(.6deg); }
.paper--tilt-l { transform: rotate(-.7deg); }

.paper--green { border-left: 4px solid var(--green); }
.paper--warn { border-left: 4px solid var(--amber); }
.paper--fault { border-left: 4px solid var(--red); }

/* 印刷标签 */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  padding: .22rem .55rem;
  color: var(--green);
  background: rgba(53, 224, 138, .08);
  border: 1.5px solid currentColor;
  font-family: var(--font-label);
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stamp--warn { color: var(--amber); background: rgba(255, 159, 28, .08); }
.stamp--fault { color: var(--red); background: rgba(255, 77, 94, .08); }
.stamp--mute { color: var(--mist); background: rgba(143, 163, 191, .08); }

/* 错误代码锚点 */
.code-anchor {
  display: inline-block;
  padding-left: .62rem;
  border-left: 4px solid var(--green);
  color: var(--red);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: clamp(1.9rem, 6vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: .04em;
}

/* 图片容器 */
.figure { display: block; margin: 0; }

.figure__frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--night);
  border: 2px solid var(--ink);
  box-shadow: var(--paper-shadow), inset 0 0 0 1px rgba(143, 163, 191, .18);
}

.figure__frame--wide { aspect-ratio: 21 / 9; }
.figure__frame--tall { aspect-ratio: 4 / 5; }
.figure__frame--square { aspect-ratio: 1 / 1; }

.figure__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg,
    rgba(244, 247, 251, .045) 0 1px,
    transparent 1px 3px);
}

.figure__media,
.figure__frame > img,
.figure__frame > svg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.figure__cap {
  margin-top: .6rem;
  color: var(--mist);
  font-size: .76rem;
  letter-spacing: .03em;
}

/* 正文块 */
.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 { margin-top: 1.9em; }
.prose ul,
.prose ol { padding-left: 1.25em; }

/* 滚动显现 */
.reveal {
  opacity: 0;
  translate: 0 16px;
  transition: opacity .5s ease, translate .5s ease;
}

.reveal.is-in {
  opacity: 1;
  translate: 0 0;
}

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

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }

  .reveal { opacity: 1; translate: 0 0; }
  .paper--tilt-r,
  .paper--tilt-l { transform: none; }
}
