/* ============================================================
   TEMPLATE 15 — Crimson Protocol
   暗红安全协议:深绛底、信号红、黑白告警条纹、协议文档感。
   字体:Saira(display)+ Spline Sans Mono(mono)。
   适用:安全 / 隐私 / 无审查 / VPN 类 niche。
   ============================================================ */

:root {
  --bg: #100608;
  --panel: #170b0e;
  --panel-2: #1f0e13;
  --line: #38161e;
  --line-bright: #52202c;
  --ink: #f7ecee;
  --muted: #c39aa2;
  --faint: #8f6b73;
  --red: #ef4444;
  --red-dim: #b91c1c;
  --red-soft: rgba(239, 68, 68, 0.1);
  --white: #ffffff;
  --font-head: "Saira", "Segoe UI", sans-serif;
  --font-body: "Spline Sans Mono", ui-monospace, Menlo, monospace;
}

* { 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.7; font-size: 15.5px; -webkit-font-smoothing: antialiased; }
a { color: var(--red); text-decoration: none; }
a:hover { color: #fca5a5; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.18; letter-spacing: 0.02em; text-transform: uppercase; text-wrap: balance; }
h1 { font-size: clamp(1.9rem, 4.4vw, 3.1rem); }
h2 { font-size: 1.45rem; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 770px; }

/* ---------- 顶栏:协议头 + 告警条纹 ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar::before { content: ""; display: block; height: 3px;
  background: repeating-linear-gradient(90deg, var(--red) 0 28px, transparent 28px 56px); opacity: 0.7; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.brand { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); font-size: 1.05rem; }
.brand::before { content: "◈ "; color: var(--red); }
.topnav { display: flex; gap: 22px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; }
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--red); }
@media (max-width: 720px) { .topnav { display: none; } }

/* ---------- Hero:协议文档框 ---------- */
.hero { padding: 54px 0 48px; border-bottom: 1px solid var(--line); }
.protocol { border: 1px solid var(--line-bright); background: var(--panel); position: relative; }
.protocol-head { display: flex; justify-content: space-between; padding: 10px 20px; border-bottom: 1px solid var(--line);
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); background: var(--panel-2); }
.protocol-head b { color: var(--red); font-weight: 600; }
.protocol-body { padding: 34px 36px 38px; }
.hero h1 .sig { color: var(--red); }
.hero .lede { color: var(--muted); max-width: 62ch; font-size: 1rem; margin-top: 14px; }
.clearance { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 12px; }
.clr { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); padding: 6px 13px; }
.clr b { color: var(--red); font-weight: 600; }

/* ---------- 排名:协议条目 ---------- */
.ledger { padding: 32px 0 44px; display: grid; gap: 14px; }
.proto {
  display: grid; grid-template-columns: 88px 1fr 190px;
  border: 1px solid var(--line); border-left: 3px solid var(--red-dim); background: var(--panel);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.proto:hover { border-left-color: var(--red); background: var(--panel-2); }
@media (max-width: 860px) { .proto { grid-template-columns: 64px 1fr; } .proto .p-telemetry { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); } }
.p-code { display: grid; place-items: center; border-right: 1px solid var(--line); background: var(--panel-2);
  font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; color: var(--faint); letter-spacing: 0.06em; }
.proto:first-child .p-code { color: var(--red); }
.p-body { padding: 20px 24px; }
.p-body h3 { font-size: 1.15rem; margin-bottom: 7px; }
.p-body h3 .status { font-size: 0.62rem; letter-spacing: 0.14em; color: var(--white); background: var(--red-dim); padding: 3px 9px; margin-left: 10px; vertical-align: 2px; }
.p-body p { color: var(--muted); font-size: 0.92rem; }
.p-telemetry { border-left: 1px solid var(--line); padding: 18px 20px; display: flex; flex-direction: column; gap: 7px; justify-content: center; }
.tm { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--muted); }
.tm b { color: var(--ink); font-weight: 500; }
.p-score { font-family: var(--font-head); font-size: 1.8rem; font-weight: 700; color: var(--red); text-align: right; line-height: 1.15; position: relative; display: inline-block; margin-bottom: 8px; margin-left: auto; }
.p-score small { display: block; font-size: 0.6rem; color: var(--faint); letter-spacing: 0.16em; }
.p-score::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px; background: var(--red);
  transform: scaleX(0); transform-origin: right; transition: transform 0.7s cubic-bezier(0.22,1,0.36,1) 0.35s; }
.in .p-score::after { transform: scaleX(1); }

/* ---------- 表格 ---------- */
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; margin: 24px 0; 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(--red-dim); color: var(--white); font-family: var(--font-head); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; }
.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 { margin: 36px 0 14px; }
.prose p { margin-bottom: 16px; color: #dfc4c9; }
.alert { border: 1px solid var(--red-dim); background: var(--red-soft); padding: 16px 20px; margin: 26px 0; }
.alert .a-label { font-family: var(--font-head); font-size: 0.76rem; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--red); margin-bottom: 6px; }

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

/* ---- 微交互/无障碍/动效 ---- */
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
::selection { background: rgba(239, 68, 68, 0.3); }
a { text-underline-offset: 3px; }
.back-top { position: fixed; right: 18px; bottom: 18px; z-index: 30; width: 42px; height: 42px;
  display: grid; place-items: center; border: 1px solid var(--red-dim); color: var(--red); 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(--red); color: #fff; 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(239, 68, 68, 0.3); }
.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; }

/* R5 hover inner response */
.proto:hover .p-code { color: var(--red); transition: color 0.25s ease; } .p-code { transition: color 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: #ef444455; border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #ef4444; border: 2px solid transparent; background-clip: content-box; }

/* R8 touch feedback */
.proto: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 */
.tm 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(--red); border-bottom: 2px solid var(--red); }
