/* ============================================================
   网页赛场 · 共享样式表 /assets/site.css
   深空蓝底 + 荧光青 / 电光橙高亮 · 侧轨导航 + 纵向长卷
   ============================================================ */

:root {
  --ink: #070B1C;
  --ink-2: #0E1730;
  --cyan: #22E0D6;
  --orange: #FF6A2B;
  --wine: #6E1E3C;
  --indigo: #3A2A6B;
  --paper: #EAF2FF;
  --mist: #9AA8C7;
  --line: #24304D;
  --label: #F4EFE6;
  --ok: #4BE38A;
  --warn: #FFD166;

  --rail-w: 0px;
  --topbar-h: 58px;
  --gutter: clamp(16px, 4vw, 40px);
  --gap-lg: clamp(24px, 4vw, 48px);
  --radius: 2px;

  --font-sans: system-ui, "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  padding-top: var(--topbar-h);
  padding-left: var(--rail-w);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  line-height: 1.25;
  letter-spacing: 0.01em;
  font-weight: 700;
}

p { margin: 0; }

a { color: inherit; }

button,
input,
textarea,
select { font: inherit; color: inherit; }

[hidden] { display: none !important; }

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

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

/* ---------- 容器 ---------- */
.container {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- skip link ---------- */
.skip-link {
  position: fixed;
  top: -80px;
  left: 12px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-left: 4px solid var(--orange);
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* ============================================================
   侧轨页头
   ============================================================ */
.rail-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 80;
  background: var(--ink-2);
  border-bottom: 1px solid var(--line);
}

.rail-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  max-width: 1200px;
  margin-inline: auto;
  padding: 10px var(--gutter);
}

.rail-brand { display: flex; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--paper);
}

.brand-glyph {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--cyan);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--mist);
}

/* 移动端抽屉按钮 */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.nav-toggle:hover { border-color: var(--cyan); color: var(--cyan); }

.nav-toggle-bar {
  position: relative;
  display: block;
  width: 16px;
  height: 2px;
  background: var(--cyan);
  transition: background-color 0.2s ease;
}
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: var(--cyan);
  transition: transform 0.2s ease, top 0.2s ease;
}
.nav-toggle-bar::before { top: -5px; }
.nav-toggle-bar::after { top: 5px; }

.rail-header[data-open] .nav-toggle-bar { background: transparent; }
.rail-header[data-open] .nav-toggle-bar::before { top: 0; transform: rotate(45deg); }
.rail-header[data-open] .nav-toggle-bar::after { top: 0; transform: rotate(-45deg); }

/* 导航本体（移动端默认收起） */
.rail-nav {
  order: 3;
  flex-basis: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.32s ease, opacity 0.24s ease;
}
.rail-header[data-open] .rail-nav {
  max-height: 62vh;
  overflow-y: auto;
  opacity: 1;
}

.rail-nav-title {
  margin: 8px 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--mist);
}

.rail-list { margin: 0; padding: 0; list-style: none; }

.rail-link {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 12px;
  border-left: 2px solid transparent;
  border-bottom: 1px solid rgba(36, 48, 77, 0.7);
  color: var(--paper);
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.rail-link:hover { background: rgba(34, 224, 214, 0.09); }

.rail-idx {
  min-width: 2.4em;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--mist);
}

.rail-label {
  font-size: 15px;
  letter-spacing: 0.05em;
}

.rail-link[aria-current="page"] {
  background: var(--cyan);
  color: var(--ink);
  border-left-color: var(--orange);
}
.rail-link[aria-current="page"] .rail-idx { color: rgba(7, 11, 28, 0.72); }

/* 侧轨底部：状态 + 快捷入口 */
.rail-foot {
  order: 4;
  flex-basis: 100%;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.32s ease, opacity 0.24s ease;
}
.rail-header[data-open] .rail-foot {
  max-height: 420px;
  opacity: 1;
}

.rail-status,
.footer-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--mist);
}

.status-dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--ok);
  animation: dot-pulse 2.6s ease-out infinite;
}

@keyframes dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(75, 227, 138, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(75, 227, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(75, 227, 138, 0); }
}

.rail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.rail-action {
  display: block;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: rgba(58, 42, 107, 0.32);
  color: var(--paper);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
.rail-action:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(34, 224, 214, 0.1);
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  position: relative;
  margin-top: clamp(56px, 9vw, 120px);
  background: var(--ink-2);
  border-top: 1px solid var(--line);
}

.footer-rule {
  height: 6px;
  background: linear-gradient(
    90deg,
    var(--wine) 0 20%,
    var(--indigo) 20% 44%,
    var(--cyan) 44% 60%,
    var(--orange) 60% 74%,
    var(--line) 74% 100%
  );
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-block: clamp(36px, 6vw, 64px);
}

.footer-mark {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: 0.12em;
}

.footer-tagline {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--cyan);
}

.footer-region {
  margin-top: 14px;
  font-size: 13px;
  color: var(--mist);
}

.footer-status { margin: 14px 0 0; }

.footer-head {
  margin-bottom: 14px;
  padding-left: 10px;
  border-left: 3px solid var(--wine);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--paper);
}

.footer-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-list li + li { border-top: 1px solid rgba(36, 48, 77, 0.7); }

.footer-list a {
  display: block;
  padding: 9px 0;
  color: var(--mist);
  font-size: 14px;
  text-decoration: none;
  transition: color 0.18s ease, padding-left 0.18s ease;
}
.footer-list a:hover {
  color: var(--cyan);
  padding-left: 6px;
}

.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 9px 0;
  border-top: 1px solid rgba(36, 48, 77, 0.7);
}
.contact-row:first-child { border-top: 0; }

.contact-key {
  min-width: 3.4em;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--mist);
}

.contact-val {
  font-size: 14px;
  color: var(--paper);
  overflow-wrap: anywhere;
}

.copy-btn {
  margin-left: auto;
  padding: 3px 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--mist);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.copy-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.copy-btn[data-copied] { color: var(--ok); border-color: var(--ok); }

.footer-base {
  border-top: 1px solid var(--line);
  background: var(--ink);
}

.footer-base-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  align-items: baseline;
  padding-block: 18px;
}

.footer-copy,
.footer-icp,
.footer-note {
  font-size: 12.5px;
  color: var(--mist);
}

.footer-icp {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--paper);
}

.footer-note { flex: 1 1 260px; }

/* ============================================================
   通用组件
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn-primary {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--ink);
  font-weight: 700;
}
.btn-primary:hover { background: #ff8353; border-color: #ff8353; }

.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

/* 面包屑 */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--mist);
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  color: var(--line);
}

.breadcrumb a {
  color: var(--mist);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--cyan); }

.breadcrumb-current { color: var(--paper); }

/* 正文 */
.prose {
  max-width: 68ch;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--paper);
}
.prose > * + * { margin-top: 1em; }
.prose h2 {
  margin-top: 2em;
  font-size: clamp(22px, 3vw, 30px);
}
.prose h3 {
  margin-top: 1.6em;
  font-size: clamp(18px, 2.2vw, 22px);
}
.prose ul,
.prose ol {
  margin: 0;
  padding-left: 1.4em;
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: 0.35em 0; }
.prose a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.prose strong { color: #ffffff; }
.prose code {
  padding: 0.15em 0.4em;
  background: rgba(58, 42, 107, 0.5);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.9em;
}
.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--wine);
  color: var(--mist);
}

/* 网格 */
.grid {
  display: grid;
  gap: var(--gap-lg);
}
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }

/* 图片容器 */
.media-frame {
  position: relative;
  overflow: hidden;
  background: var(--ink-2);
  border: 1px solid var(--line);
}
.media-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 16 / 10;
}
.media-frame--wide img { aspect-ratio: 21 / 9; }
.media-frame--tall img { aspect-ratio: 3 / 4; }

.media-caption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--mist);
}

/* 章节 */
.chapter {
  position: relative;
  padding-top: clamp(40px, 6vw, 72px);
}

.chapter-index {
  display: block;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--cyan);
}

.chapter-title {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.18;
}

.chapter-band {
  width: 88px;
  height: 4px;
  margin: 18px 0 26px;
  background: var(--wine);
}

/* 纸张标签 */
.paper-tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--label);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  line-height: 1.6;
}
.tag-indigo { background: var(--indigo); color: var(--paper); }
.tag-cyan { background: var(--cyan); color: var(--ink); }
.tag-orange { background: var(--orange); color: var(--ink); }

/* 主题筛选 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.filter-btn {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--mist);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}
.filter-btn:hover { color: var(--paper); border-color: var(--mist); }
.filter-btn[aria-pressed="true"] {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--ink);
  font-weight: 700;
}

.filter-live {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mist);
}

/* 滚动显现 */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* 滚动进度 */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  width: 100%;
  height: 2px;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ============================================================
   断点
   ============================================================ */
@media (min-width: 720px) {
  .footer-inner { grid-template-columns: 1.2fr 1fr; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  :root { --rail-w: 272px; }

  body {
    padding-top: 0;
    font-size: 17px;
  }

  .rail-header {
    inset: 0 auto 0 0;
    width: var(--rail-w);
    border-bottom: 0;
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }

  .rail-inner {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    max-width: none;
    min-height: 100%;
    padding: 26px 22px 22px;
    gap: 0;
  }

  .nav-toggle { display: none; }

  .rail-brand { margin-bottom: 30px; }

  .rail-nav,
  .rail-foot {
    order: 0;
    flex-basis: auto;
    max-height: none;
    overflow: visible;
    opacity: 1;
  }

  .rail-nav-title { margin-top: 0; }

  .rail-foot {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--line);
  }

  .rail-link { padding: 11px 12px; }

  .brand-name { font-size: 18px; }

  .footer-inner {
    grid-template-columns: 1.4fr 0.9fr 1.1fr;
    gap: 48px;
  }

  .grid-3 { grid-template-columns: repeat(3, 1fr); }

  .scroll-progress {
    left: var(--rail-w);
    width: calc(100% - var(--rail-w));
  }
}

/* ============================================================
   动效与无障碍
   ============================================================ */
@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 .reveal {
    opacity: 1;
    transform: none;
  }

  .status-dot { animation: none; }

  .scroll-progress { display: none; }
}
