/* ============================================================
   TEMPLATE 12 — Matrix Phosphor
   黑客绿磷光 CRT:扫描线、辉光文字、全终端隐喻。
   字体:Fira Code(display/mono)+ Fira Sans(body)。
   适用:开源 / CLI 工具 / dev 基础设施 niche。
   ============================================================ */

:root {
  --bg: #030903;
  --panel: #06120a;
  --panel-2: #081a0e;
  --line: #14381f;
  --line-bright: #1e5230;
  --ink: #c9f2cf;
  --muted: #7fae88;
  --faint: #5b8263;
  --green: #4ade80;
  --green-dim: #22c55e;
  --green-soft: rgba(74, 222, 128, 0.12);
  --amber: #fbbf24;
  --font-mono: "Fira Code", ui-monospace, Menlo, monospace;
  --font-body: "Fira Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-padding-top: 80px; }
body {
  font-family: var(--font-body); background: var(--bg); color: var(--ink);
  line-height: 1.68; font-size: 16.5px; -webkit-font-smoothing: antialiased;
}
/* CRT 扫描线氛围层 */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.14) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--amber); text-shadow: 0 0 12px rgba(251, 191, 36, 0.4); }
h1, h2, h3 { font-family: var(--font-mono); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 4.2vw, 3rem); color: var(--green); text-shadow: 0 0 24px rgba(74, 222, 128, 0.35); }
h2 { font-size: 1.4rem; color: var(--green); }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 780px; }

/* ---------- 顶栏:终端 prompt ---------- */
.topbar { border-bottom: 1px solid var(--line); background: rgba(3, 9, 3, 0.92); backdrop-filter: blur(8px); }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.brand { font-family: var(--font-mono); font-weight: 700; color: var(--green); text-shadow: 0 0 14px rgba(74, 222, 128, 0.4); }
.brand::before { content: "root@"; color: var(--muted); font-weight: 400; }
.topnav { display: flex; gap: 20px; font-family: var(--font-mono); font-size: 0.76rem; }
.topnav a { color: var(--muted); }
.topnav a::before { content: "./"; color: var(--faint); }
.topnav a:hover { color: var(--green); }
@media (max-width: 720px) { .topnav { display: none; } }

/* ---------- Hero:终端会话 ---------- */
.hero { padding: 56px 0 48px; border-bottom: 1px solid var(--line); }
.term {
  font-family: var(--font-mono); border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); overflow: hidden; box-shadow: 0 0 60px -20px rgba(74, 222, 128, 0.25) inset;
}
.term-bar { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.term-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-bright); }
.term-bar i:first-child { background: var(--green-dim); }
.term-body { padding: 24px 26px 30px; }
.t-line { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.t-line .p { color: var(--green); }
.t-line .cmd { color: var(--ink); }
h1 { margin: 6px 0 14px; }
.term-body .lede { font-family: var(--font-body); color: var(--muted); max-width: 62ch; font-size: 1.03rem; margin-bottom: 18px; }
.t-output { font-size: 0.8rem; color: var(--faint); }
.t-output b { color: var(--amber); font-weight: 500; }

/* ---------- 排名:终端表格行 ---------- */
.rows { padding: 32px 0 44px; display: grid; gap: 12px; }
.mrow {
  display: grid; grid-template-columns: 84px 1fr 190px;
  border: 1px solid var(--line); background: var(--panel);
  font-family: var(--font-mono);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.mrow:hover { border-color: var(--green-dim); box-shadow: 0 0 30px -10px rgba(74, 222, 128, 0.3); }
@media (max-width: 860px) { .mrow { grid-template-columns: 60px 1fr; } .mrow .m-metrics { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); } }
.m-ix { display: grid; place-items: center; border-right: 1px solid var(--line); background: var(--panel-2); color: var(--green); font-size: 1.3rem; font-weight: 700; }
.m-body { padding: 20px 24px; }
.m-body h3 { font-size: 1.1rem; margin-bottom: 7px; }
.m-body h3 .flag { font-size: 0.64rem; color: var(--bg); background: var(--green); padding: 2px 8px; margin-left: 10px; vertical-align: 2px; }
.m-body p { font-family: var(--font-body); color: var(--muted); font-size: 0.94rem; }
.m-metrics { border-left: 1px solid var(--line); padding: 18px; display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.mm { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--muted); }
.mm b { color: var(--green); font-weight: 500; }
.m-score { font-size: 1.7rem; color: var(--green); text-align: right; text-shadow: 0 0 16px rgba(74, 222, 128, 0.4); line-height: 1.15; position: relative; display: inline-block; margin-bottom: 8px; margin-left: auto; }
.m-score small { display: block; font-size: 0.62rem; color: var(--faint); text-shadow: none; letter-spacing: 0.1em; }
.m-score::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--green);
  box-shadow: 0 0 10px rgba(74,222,128,0.6); transform: scaleX(0); transition: transform 0.7s cubic-bezier(0.22,1,0.36,1) 0.35s; }
.in .m-score::after { transform: scaleX(1); }

/* ---------- 表格 ---------- */
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 24px 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.compare-table th, .compare-table td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; background: var(--panel); }
.compare-table th { background: var(--panel-2); color: var(--green); font-size: 0.72rem; }
.compare-table td:first-child { color: var(--muted); }
@media (max-width: 640px) { .compare-table { display: block; overflow-x: auto; } .compare-table tbody { display: table; width: 100%; min-width: 480px; } }

/* ---------- 正文 ---------- */
.prose { padding: 44px 0 62px; }
.prose h2::before { content: "$ "; color: var(--faint); }
.prose h2 { margin: 36px 0 14px; }
.prose p { margin-bottom: 16px; color: #a8d8b0; }
.stdout { border-left: 3px solid var(--green-dim); background: var(--green-soft); padding: 16px 20px; margin: 26px 0; font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink); }
.stdout .o-label { color: var(--green); display: block; margin-bottom: 6px; }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 48px; font-size: 0.86rem; }
.footer-inner { padding: 32px 0; display: grid; gap: 12px; color: var(--muted); }
.related-note { font-family: var(--font-mono); font-size: 0.74rem; color: var(--faint); border-top: 1px dashed var(--line); padding-top: 12px; }

/* ---- 微交互/无障碍/动效 ---- */
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
::selection { background: rgba(74, 222, 128, 0.25); color: #eafff0; }
a { text-underline-offset: 3px; }
.back-top { position: fixed; right: 18px; bottom: 18px; z-index: 30; width: 42px; height: 42px; border-radius: 6px;
  display: grid; place-items: center; border: 1px solid var(--green-dim); color: var(--green); background: var(--bg); font-size: 1.05rem;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--green); color: var(--bg); padding: 10px 18px; font-weight: 600; }
.skip-link:focus { left: 8px; }
[data-animate] { opacity: 0; transform: translateY(14px); transition: opacity 0.65s cubic-bezier(0.22,1,0.36,1), transform 0.65s cubic-bezier(0.22,1,0.36,1); transition-delay: inherit; will-change: opacity, transform; }
[data-animate].in { opacity: 1; transform: none; }
.topbar.scrolled { box-shadow: 0 8px 30px -12px rgba(74, 222, 128, 0.25); }
.topbar { transition: box-shadow 0.25s ease; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  [data-animate] { opacity: 1; transform: none; transition: none; }
}

/* R1 typography features */
body { font-feature-settings: "kern" 1, "liga" 1, "calt" 1; -webkit-tap-highlight-color: transparent; }

/* R2 editorial measure */
.prose p { text-wrap: pretty; orphans: 3; widows: 3; }
.prose { hyphens: auto; }

/* R3 mono numerals */
[class*="mono"], .term-body, .t-output, .idx-tags, .hero-meta { font-variant-numeric: slashed-zero; }

/* R5 hover inner response */
.mrow:hover .m-ix { text-shadow: 0 0 14px rgba(74,222,128,0.6); transition: text-shadow 0.25s ease; } .m-ix { transition: text-shadow 0.25s ease; }

/* R6 prose link underline grow */
.prose p a {
  background: linear-gradient(currentColor, currentColor) bottom left / 0% 1px no-repeat;
  transition: background-size 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: 2px;
}
.prose p a:hover { background-size: 100% 1px; }

/* R7 themed scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #22c55e55; border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #22c55e; border: 2px solid transparent; background-clip: content-box; }

/* R8 touch feedback */
.mrow:active { transform: scale(0.995); }

/* R9 back-top smooth elevator */
.back-top { transform: translateY(10px); transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.back-top[style*="opacity: 1"], .back-top:hover { transform: translateY(0); }
.back-top:active { transform: translateY(2px); }

/* R2 metric label alignment */
.mm span { min-width: 84px; }

/* R3 footer two-column */
@media (min-width: 860px) {
  .footer-inner { grid-template-columns: 1fr auto; align-items: start; }
  .footer-inner > div:first-child { order: 1; }
  .related-note { order: 2; max-width: 56ch; border-top: 0; padding-top: 0; text-align: right; }
}

/* R4 current page nav state */
.topnav a[aria-current='page'] { color: var(--green); text-shadow: 0 0 10px rgba(74,222,128,0.5); }
