/* ============================================================
   KAIYUN赛场 · /assets/site.css
   共享外壳：reset / 变量 / 中文排版 / 头部 / 页脚 / 通用组件
   ============================================================ */

/* ---------- 1. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--night);
  color: var(--ice);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, p, dl, dd, dt, figure, blockquote { margin: 0; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
table { width: 100%; border-collapse: collapse; }
b, strong { font-weight: 700; }

/* ---------- 2. 设计变量 ---------- */
:root {
  /* 色板 */
  --night:      #050B1A;
  --panel:      #0B1530;
  --steel:      #1C2C52;
  --cyan:       #22E0C8;
  --cyan-deep:  #0E7F78;
  --orange:     #FF6A2B;
  --ice:        #F2F6FF;
  --mist:       #93A2C0;
  --carbon:     #172233;
  --white:      #FFFFFF;

  /* 字体 */
  --font-display: "Noto Sans SC", "HarmonyOS Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Roboto Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* 节奏 */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 220ms;
  --header-h: 66px;
  --rail: clamp(16px, 4vw, 64px);
  --page-max: 1360px;
  --gap-block: clamp(48px, 7vw, 110px);
}

/* ---------- 3. 中文排版与基础文本 ---------- */
h1, h2, h3 { font-family: var(--font-display); font-weight: 900; line-height: 1.08; letter-spacing: -0.015em; }
p { text-wrap: pretty; }
.display-xl {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(56px, 11vw, 168px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--white);
}
.score {
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: clamp(28px, 4vw, 56px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--white);
}
.score--sm { font-size: clamp(20px, 2.4vw, 30px); }
.score--accent { color: var(--cyan); }

.annotation {
  font-size: 11.5px;
  letter-spacing: 0.2em;
  color: var(--mist);
  line-height: 1.6;
}
.annotation--v {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.34em;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.24em;
  color: var(--cyan);
  text-transform: uppercase;
}
.kicker::before { content: ""; width: 24px; height: 1px; background: var(--cyan); flex: none; }

.status-live { color: var(--orange); font-weight: 700; }
.status-live::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--orange);
  vertical-align: middle;
  animation: pulseWarm 1.6s ease-out infinite;
}

/* ---------- 4. 焦点与可访问性 ---------- */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 2px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 14px;
  top: -80px;
  z-index: 300;
  padding: 11px 20px;
  background: var(--cyan);
  color: #04140F;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 88% 100%, 0 100%);
  transition: top 180ms var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- 5. 头部 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--night);
  border-bottom: 1px solid var(--steel);
}

.header-rail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(14px, 4vw, 80px);
  width: 100%;
  max-width: var(--page-max);
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 var(--rail);
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 26px);
  min-width: 0;
}

.brand-mark { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-glyph {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px; height: 38px;
  background: var(--cyan);
  color: #04140F;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  line-height: 1;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
  transition: background var(--dur) var(--ease);
}
.brand-mark:hover .brand-glyph { background: var(--white); }

.brand-words { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--white);
  white-space: nowrap;
}
.brand-tag {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--mist);
  white-space: nowrap;
}

.live-pulse {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 5px 14px 5px 10px;
  background: var(--panel);
  border: 1px solid var(--steel);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--mist);
  white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, 100% 64%, 90% 100%, 0 100%);
}
.live-pulse b { color: var(--orange); font-weight: 700; }

.pulse-dot {
  flex: none;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulseCool 1.6s ease-out infinite;
}

/* ---------- 6. 导航 ---------- */
.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 36px);
}

.nav-list { display: flex; align-items: center; gap: clamp(12px, 2vw, 30px); }

.nav-list a {
  position: relative;
  display: inline-block;
  padding: 6px 2px;
  font-size: 14.5px;
  letter-spacing: 0.06em;
  color: var(--mist);
  transition: color 180ms var(--ease);
}
.nav-list a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 2px;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 200ms var(--ease), background 200ms var(--ease);
}
.nav-list a:hover { color: var(--ice); }
.nav-list a:hover::after { transform: scaleX(1); }
.nav-list a[aria-current="page"] { color: var(--white); font-weight: 700; }
.nav-list a[aria-current="page"]::after { transform: scaleX(1); background: var(--orange); }

.nav-cta {
  flex: none;
  padding: 10px 19px;
  background: var(--cyan);
  color: #04140F;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 86% 100%, 0 100%);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.nav-cta:hover { background: var(--white); transform: translateY(-1px); }
.nav-cta:active { background: var(--cyan-deep); }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  flex: none;
  padding: 8px 13px;
  border: 1px solid var(--steel);
  color: var(--ice);
  clip-path: polygon(0 0, 100% 0, 100% 66%, 88% 100%, 0 100%);
}
.nav-toggle-label { font-size: 12.5px; letter-spacing: 0.16em; }
.nav-toggle-bars { display: grid; gap: 4px; width: 16px; }
.nav-toggle-bars i {
  display: block;
  height: 2px;
  background: var(--cyan);
  transition: transform 200ms var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:first-child { transform: translateY(3px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:last-child { transform: translateY(-3px) rotate(-45deg); }

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(3, 8, 18, 0.72);
  opacity: 0;
  visibility: hidden;
  transition: opacity 240ms var(--ease), visibility 0s linear 240ms;
}
.nav-scrim[data-open] { opacity: 1; visibility: visible; transition-delay: 0s, 0s; }

/* 阅读进度 */
.read-progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  overflow: hidden;
}
.read-progress span {
  display: block;
  width: 100%; height: 100%;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 90ms linear;
}

/* ---------- 7. 页脚 ---------- */
.site-footer {
  position: relative;
  margin-top: var(--gap-block);
  background: var(--panel);
  border-top: 1px solid var(--steel);
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.55;
}

.footer-rail {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 76px) var(--rail) clamp(26px, 4vw, 42px);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
}

.footer-brand { display: flex; flex-direction: column; gap: 14px; max-width: 38ch; }

.footer-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--white);
}
.footer-logo em { font-style: normal; color: var(--cyan); }

.footer-line { font-size: 12.5px; letter-spacing: 0.16em; color: var(--mist); }

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--mist);
}
.footer-meta strong { color: var(--ice); font-weight: 700; }

.footer-col { display: flex; flex-direction: column; gap: 14px; }
.footer-col h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--cyan);
}
.footer-col ul { display: flex; flex-direction: column; gap: 9px; }
.footer-col a {
  display: inline-block;
  font-size: 14.5px;
  color: var(--mist);
  transition: color 160ms var(--ease), padding-left 160ms var(--ease);
}
.footer-col a::before { content: "／"; margin-right: 6px; color: var(--steel); }
.footer-col a:hover { color: var(--ice); padding-left: 5px; }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 26px;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 18px var(--rail) 34px;
  border-top: 1px dashed var(--steel);
}
.footer-base .legal {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--mist);
}

/* ---------- 8. 容器与布局 ---------- */
.container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--rail);
}
.wrap-narrow { max-width: 820px; }

.layout-split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  gap: clamp(20px, 3vw, 48px);
  align-items: start;
}

.grid {
  display: grid;
  gap: clamp(16px, 2.4vw, 28px);
}

.rail {
  display: flex;
  gap: clamp(12px, 2vw, 20px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 12px;
  scrollbar-color: var(--cyan-deep) var(--carbon);
  scrollbar-width: thin;
}
.rail > * { flex: 0 0 auto; scroll-snap-align: start; }
.rail::-webkit-scrollbar { height: 6px; }
.rail::-webkit-scrollbar-track { background: var(--carbon); }
.rail::-webkit-scrollbar-thumb { background: var(--cyan-deep); }

/* ---------- 9. 面板 / 按钮 / 筹码 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--steel);
  padding: clamp(18px, 2.4vw, 28px);
}
.panel--cut {
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0 100%);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 26px;
  background: var(--panel);
  border: 1px solid var(--steel);
  color: var(--ice);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  clip-path: polygon(0 0, 100% 0, 100% 72%, 90% 100%, 0 100%);
  transition: background 200ms var(--ease), color 200ms var(--ease),
              border-color 200ms var(--ease), transform 200ms var(--ease);
}
.btn:hover { transform: translateY(-2px); border-color: var(--cyan); color: var(--cyan); }
.btn--primary { background: var(--cyan); border-color: var(--cyan); color: #04140F; }
.btn--primary:hover { background: var(--white); border-color: var(--white); color: #04140F; }
.btn--ghost { background: transparent; }
.btn--ghost:hover { color: var(--cyan); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--panel);
  border: 1px solid var(--steel);
  color: var(--mist);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  clip-path: polygon(0 0, 100% 0, 100% 68%, 90% 100%, 0 100%);
  transition: color 160ms var(--ease), border-color 160ms var(--ease), background 160ms var(--ease);
}
.chip:hover { color: var(--ice); border-color: var(--cyan); }
.chip[aria-pressed="true"],
.chip.is-active { background: var(--cyan); border-color: var(--cyan); color: #04140F; font-weight: 700; }

[data-copy].is-copied { color: var(--cyan); border-color: var(--cyan); }
[data-copy].is-copied::after {
  content: "已复制";
  margin-left: 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--cyan);
}

/* ---------- 10. 面包屑 ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: clamp(18px, 3vw, 34px);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--mist);
}
.breadcrumb li { display: flex; align-items: center; gap: 8px; }
.breadcrumb li + li::before { content: "›"; color: var(--steel); }
.breadcrumb a { transition: color 160ms var(--ease); }
.breadcrumb a:hover { color: var(--cyan); }
.breadcrumb [aria-current="page"] { color: var(--ice); }

/* ---------- 11. 图片容器基础规则 ---------- */
.figure {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--steel);
}
.figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.06) contrast(1.04);
}
.figure::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.75;
}
.figure--cut { clip-path: polygon(0 0, 100% 0, 100% calc(100% - 26px), calc(100% - 26px) 100%, 0 100%); }
.figure--wide     { aspect-ratio: 16 / 9; }
.figure--banner   { aspect-ratio: 21 / 9; }
.figure--tall     { aspect-ratio: 4 / 5; }
.figure--portrait { aspect-ratio: 3 / 4; }
.figure--square   { aspect-ratio: 1 / 1; }

.figure-trail { position: absolute; inset: 0; pointer-events: none; }
.figure-trail path,
.figure-trail line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1;
  stroke-dasharray: 5 7;
  opacity: 0.7;
}

/* ---------- 12. 滚动交互状态 ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 260ms var(--ease), transform 260ms var(--ease);
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }

[data-chapter] { transition: color var(--dur) var(--ease); }

.chapter-flag {
  display: inline-block;
  width: 18px; height: 2px;
  vertical-align: middle;
  background: var(--steel);
  transition: background var(--dur) var(--ease), width var(--dur) var(--ease);
}
[data-chapter].is-current .chapter-flag { width: 34px; background: var(--cyan); }

/* ---------- 13. 关键帧 ---------- */
@keyframes pulseCool {
  0%   { box-shadow: 0 0 0 0 rgba(34, 224, 200, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(34, 224, 200, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 224, 200, 0); }
}
@keyframes pulseWarm {
  0%   { box-shadow: 0 0 0 0 rgba(255, 106, 43, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(255, 106, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 106, 43, 0); }
}

/* ---------- 14. 响应式 ---------- */
@media (max-width: 1100px) {
  .brand-tag { display: none; }
  .nav-list { gap: 14px; }
  .nav-list a { font-size: 13.5px; }
}

@media (max-width: 900px) {
  :root { --header-h: 60px; }

  .header-rail { gap: 10px; }
  .live-pulse { padding: 4px 11px 4px 8px; font-size: 10.5px; }
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: fixed;
    top: var(--header-h);
    right: 0;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: min(86vw, 340px);
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    padding: 22px var(--rail) 40px;
    background: var(--panel);
    border-left: 1px solid var(--steel);
    overflow-y: auto;
    transform: translateX(104%);
    visibility: hidden;
    transition: transform 240ms var(--ease), visibility 0s linear 240ms;
  }
  .site-nav[data-open] {
    transform: translateX(0);
    visibility: visible;
    transition-delay: 0s, 0s;
  }

  .nav-list { flex-direction: column; align-items: stretch; gap: 0; width: 100%; }
  .nav-list li { border-bottom: 1px solid var(--steel); }
  .nav-list a { display: block; padding: 15px 2px; font-size: 17px; color: var(--ice); }
  .nav-list a::after { display: none; }
  .nav-list a[aria-current="page"] { color: var(--cyan); }

  .nav-cta { margin-top: 26px; padding: 15px; text-align: center; }

  .layout-split { grid-template-columns: minmax(0, 1fr); }

  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; max-width: none; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .brand-glyph { width: 34px; height: 34px; font-size: 18px; }
  .brand-name { font-size: 15.5px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-base { flex-direction: column; align-items: flex-start; }
}

/* ---------- 15. 动效降级 ---------- */
@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;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
}
