@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&family=Crimson+Pro:wght@400;500;600;700&display=swap');

/* =============================================
   CSS 变量 & 重置
   ============================================= */
:root {
  --c-red: #ff0000;
  --c-purple: #8b00ff;
  --c-dark: #261717;
  --c-dark2: #1a0f0f;
  --c-dark3: #0e0808;
  --c-glass: rgba(255,255,255,0.10);
  --c-glass-border: rgba(255,255,255,0.18);
  --c-glass-hover: rgba(255,255,255,0.18);
  --c-text: #f0e6e6;
  --c-text-muted: #b89a9a;
  --c-text-faint: #7a5a5a;
  --c-accent: #ff4444;
  --c-accent2: #aa44ff;
  --sidebar-w: 240px;
  --radius-card: 4px;
  --radius-lg: 12px;
  --blur: 15px;
  --font-serif: 'Crimson Pro', 'Georgia', serif;
  --font-sans: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --scroll-mt: 80px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--c-dark3);
  color: var(--c-text);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body.kpk-body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  background: var(--c-dark3);
  color: var(--c-text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* 背景光晕 */
body.kpk-body::before,
body.kpk-body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
body.kpk-body::before {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,0,0,0.18) 0%, transparent 70%);
  top: -200px; left: calc(var(--sidebar-w) - 100px);
}
body.kpk-body::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(139,0,255,0.20) 0%, transparent 70%);
  bottom: 100px; right: 80px;
}

/* 辅助类 */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

/* =============================================
   整体布局
   ============================================= */
.site-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* =============================================
   左侧固定侧边栏
   ============================================= */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 28px 20px;
  background: rgba(38,23,23,0.72);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border-right: 1px solid var(--c-glass-border);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,0,0,0.3) transparent;
}

.sidebar-inner::-webkit-scrollbar { width: 4px; }
.sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.sidebar-inner::-webkit-scrollbar-thumb { background: rgba(255,0,0,0.3); border-radius: 4px; }

.sidebar-glow {
  position: absolute;
  top: 20%;
  left: -40px;
  width: 160px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(255,0,0,0.22) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 1;
  pointer-events: none;
}

/* 品牌区 */
.sidebar-brand {
  margin-bottom: 28px;
}

.brand-link {
  display: block;
  text-decoration: none;
}

.brand-logo {
  max-width: 140px;
  height: auto;
  display: block;
}

.brand-text {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--c-red);
  letter-spacing: 0.04em;
  line-height: 1.2;
  display: block;
}

/* 搜索框 */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius-card);
  padding: 6px 10px;
  margin-bottom: 24px;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  min-width: 0;
  min-height: 28px;
}
.search-input::placeholder { color: var(--c-text-faint); }

.search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-muted);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  min-width: 40px;
  transition: color 0.2s;
  border-radius: var(--radius-card);
}
.search-btn:hover { color: var(--c-red); }

/* 导航列表 */
.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--c-text-muted);
  text-decoration: none;
  border-radius: var(--radius-card);
  border: 1px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  min-height: 44px;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--c-text);
  background: var(--c-glass-hover);
  border-color: var(--c-glass-border);
  outline: none;
}

.nav-link:focus-visible {
  outline: 2px solid var(--c-red);
  outline-offset: 2px;
}

/* =============================================
   内容区
   ============================================= */
.content-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  z-index: 1;
}

/* =============================================
   Hero 区 —— 左图右文
   ============================================= */
.hero-section {
  display: flex;
  align-items: center;
  gap: 48px;
  min-height: 70vh;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(38,23,23,0.95) 0%, rgba(14,8,8,0.85) 100%);
  z-index: 0;
}

.hero-figure {
  flex: 0 0 42%;
  position: relative;
  z-index: 1;
  border-radius: var(--radius-lg);
  overflow: visible;
  will-change: transform;
  transition: transform 0.08s linear;
}

.hero-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-glass-border);
  display: block;
  object-fit: cover;
}

.hero-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255,0,0,0.25), rgba(139,0,255,0.25));
  border: 1px solid var(--c-glass-border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.hero-badge {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(255,0,0,0.20);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,0,0,0.35);
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.06em;
  min-height: 44px;
}

.badge-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-red);
  box-shadow: 0 0 8px var(--c-red);
  animation: pulse 1.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--c-red); }
  50% { opacity: 0.6; box-shadow: 0 0 20px var(--c-red); }
}

@media (prefers-reduced-motion: reduce) {
  .badge-dot { animation: none; }
}

.hero-copy {
  flex: 1;
  position: relative;
  z-index: 1;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
}

.hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--c-accent);
  text-transform: uppercase;
  padding: 5px 12px;
  border: 1px solid rgba(255,68,68,0.4);
  border-radius: 2px;
  background: rgba(255,0,0,0.10);
  display: inline-block;
}

.hero-h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 2px 30px rgba(255,0,0,0.4);
}

.hero-desc {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--c-text-muted);
  max-width: 400px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 13px 28px;
  background: linear-gradient(135deg, var(--c-red), #cc0000);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-card);
  border: 1px solid rgba(255,255,255,0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 4px 20px rgba(255,0,0,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(255,0,0,0.5); }

.btn-ghost {
  padding: 13px 28px;
  background: var(--c-glass);
  color: var(--c-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius-card);
  border: 1px solid var(--c-glass-border);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background 0.2s, border-color 0.2s;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}
.btn-ghost:hover { background: var(--c-glass-hover); border-color: rgba(255,255,255,0.3); }

.hero-tags {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(139,0,255,0.18);
  border: 1px solid rgba(139,0,255,0.35);
  color: var(--c-accent2);
  letter-spacing: 0.04em;
}

/* =============================================
   主内容
   ============================================= */
.main-content {
  flex: 1;
  padding: 0;
  position: relative;
  z-index: 1;
}

.content-section {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 240px;
  grid-template-rows: auto 1fr;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 48px;
}

.content-deco {
  grid-column: 1 / -1;
  grid-row: 1;
  position: relative;
  height: 0;
  pointer-events: none;
  overflow: visible;
}

.deco-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.35;
}
.deco-orb--red {
  width: 300px; height: 300px;
  background: var(--c-red);
  top: -80px; left: -60px;
  z-index: 0;
}
.deco-orb--purple {
  width: 250px; height: 250px;
  background: var(--c-purple);
  top: 100px; right: 100px;
  z-index: 0;
}

.content-aside {
  grid-column: 2;
  grid-row: 2;
  position: sticky;
  top: 20px;
  align-self: start;
  z-index: 2;
}

.aside-inner {
  background: rgba(38,23,23,0.65);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
}

.aside-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-red);
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.aside-inner hr {
  border: none;
  border-top: 1px solid rgba(255,0,0,0.30);
  margin: 10px 0 14px;
}

.aside-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.aside-link {
  display: flex;
  align-items: center;
  padding: 10px 10px;
  font-size: 0.85rem;
  color: var(--c-text-muted);
  text-decoration: none;
  border-radius: var(--radius-card);
  border: 1px solid transparent;
  transition: color 0.2s, background 0.2s;
  min-height: 40px;
}
.aside-link:hover { color: var(--c-text); background: var(--c-glass); border-color: var(--c-glass-border); }

.prose-wrap {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  z-index: 2;
  min-width: 0;
}

/* =============================================
   正文 section 样式（page.content 里的 section）
   ============================================= */
.prose-wrap section {
  scroll-margin-top: var(--scroll-mt);
  margin-bottom: 72px;
  padding: 40px 44px;
  background: rgba(38,23,23,0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.prose-wrap section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-red), transparent, var(--c-purple));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.prose-wrap h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.25;
}

.prose-wrap h2 + hr {
  border: none;
  border-top: 1px solid rgba(255,0,0,0.35);
  margin: 0 0 24px;
}

.prose-wrap h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--c-accent);
  margin: 28px 0 12px;
}

.prose-wrap h3 + hr {
  border: none;
  border-top: 1px solid rgba(139,0,255,0.30);
  margin: 0 0 18px;
}

.prose-wrap p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-text-muted);
  margin-bottom: 16px;
}

.prose-wrap strong {
  color: var(--c-text);
  font-weight: 700;
}

.prose-wrap a {
  color: var(--c-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}
.prose-wrap a:hover { color: var(--c-red); }

.prose-wrap ul,
.prose-wrap ol {
  padding-left: 1.4em;
  margin-bottom: 18px;
  color: var(--c-text-muted);
}

.prose-wrap li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.prose-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--c-glass-border);
}

.prose-wrap blockquote {
  border-left: 3px solid var(--c-red);
  padding: 12px 20px;
  margin: 20px 0;
  background: rgba(255,0,0,0.07);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  color: var(--c-text-muted);
  font-style: italic;
}

.prose-wrap table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.prose-wrap th,
.prose-wrap td {
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,0.10);
  text-align: left;
}

.prose-wrap th {
  background: rgba(255,0,0,0.15);
  color: #fff;
  font-weight: 700;
}

.prose-wrap tr:nth-child(even) td {
  background: rgba(255,255,255,0.03);
}

.prose-wrap .card {
  background: var(--c-glass);
  border: 1px solid var(--c-glass-border);
  border-radius: var(--radius-card);
  padding: 20px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  margin-bottom: 16px;
}

/* =============================================
   页脚
   ============================================= */
.site-footer {
  background: rgba(14,8,8,0.92);
  border-top: 1px solid var(--c-glass-border);
  padding: 48px 48px 32px;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.footer-brand-row {
  text-align: center;
  margin-bottom: 24px;
  overflow: hidden;
}

.footer-brand-mega {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 8vw, 7rem);
  font-weight: 700;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,0,0,0.25);
  letter-spacing: 0.06em;
  line-height: 1;
  display: block;
  user-select: none;
}

.footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 28px;
  text-align: center;
}

.footer-address {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--c-text-faint);
}

.footer-links {
  list-style: none;
  display: flex;
  gap: 16px;
}

.footer-links li a {
  color: var(--c-text-faint);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 10px 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}
.footer-links li a:hover { color: var(--c-text-muted); }

.footer-copy {
  width: 100%;
  text-align: center;
  font-size: 0.8rem;
  color: var(--c-text-faint);
  margin-top: 8px;
}

/* =============================================
   Scroll-margin-top for section anchors
   ============================================= */
section[id] {
  scroll-margin-top: 20px;
}

@media (min-width: 769px) {
  section[id] {
    scroll-margin-top: 24px;
  }
}

/* =============================================
   响应式
   ============================================= */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }

  .content-section {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    padding: 40px 32px;
    gap: 24px;
  }

  .content-deco { display: none; }
  .content-aside { grid-column: 1; grid-row: 2; position: static; }
  .prose-wrap { grid-column: 1; grid-row: 3; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
    height: auto;
    z-index: 200;
  }

  .sidebar-inner {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 16px;
    gap: 10px;
    border-right: none;
    border-bottom: 1px solid var(--c-glass-border);
    overflow-x: auto;
    overflow-y: visible;
    height: auto;
  }

  .sidebar-glow { display: none; }

  .sidebar-brand {
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  .brand-text { font-size: 1.1rem; }
  .brand-logo { max-width: 90px; }

  .sidebar-search {
    flex: 1 1 120px;
    min-width: 100px;
    margin-bottom: 0;
  }

  nav[aria-label="主导航"] {
    width: 100%;
    order: 3;
  }

  .nav-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .nav-list::-webkit-scrollbar { display: none; }

  .nav-link {
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 0.82rem;
    min-height: 44px;
  }

  .content-wrap {
    margin-left: 0;
    padding-top: 130px;
  }

  .hero-section {
    flex-direction: column;
    min-height: auto;
    padding: 40px 20px;
    gap: 28px;
    align-items: flex-start;
  }

  .hero-figure {
    flex: none;
    width: 100%;
  }

  .hero-copy {
    text-align: left;
    align-items: flex-start;
  }

  .hero-actions { justify-content: flex-start; }
  .hero-tags { justify-content: flex-start; }

  .content-section {
    padding: 32px 20px;
  }

  .prose-wrap section {
    padding: 28px 24px;
    margin-bottom: 40px;
  }

  .site-footer {
    padding: 32px 20px 24px;
  }

  .footer-bar {
    flex-direction: column;
    gap: 12px;
  }

  .aside-link {
    min-height: 44px;
    padding: 12px 10px;
  }
}

@media (max-width: 480px) {
  .hero-h1 { font-size: 1.75rem; }
  .btn-primary, .btn-ghost { padding: 12px 18px; font-size: 0.85rem; }
  .prose-wrap section { padding: 20px 16px; }

  .nav-link {
    min-height: 44px;
    padding: 10px 12px;
  }

  .search-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 10px;
  }
}

/* =============================================
   Focus & 无障碍
   ============================================= */
:focus-visible {
  outline: 2px solid var(--c-red);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--c-red);
  outline-offset: 2px;
}

/* =============================================
   Print
   ============================================= */
@media print {
  .sidebar, .content-aside, .hero-badge { display: none; }
  .content-wrap { margin-left: 0; }
  .prose-wrap section { background: none; border: 1px solid #ccc; }
  body { background: #fff; color: #000; }
}

button[aria-expanded]{min-width:44px;min-height:44px}
