@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

/* ===== 重置与基础 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --c-red: #ff0000;
  --c-pink: #ff1493;
  --c-dark: #261717;
  --c-dark2: #1a0f0f;
  --c-dark3: #0e0808;
  --c-surface: rgba(38, 23, 23, 0.85);
  --c-surface2: rgba(50, 28, 28, 0.9);
  --c-text: #f0e0e0;
  --c-text-muted: #b08080;
  --c-text-dim: #7a5050;
  --c-border: rgba(255, 20, 147, 0.25);
  --c-glow-red: rgba(255, 0, 0, 0.35);
  --c-glow-pink: rgba(255, 20, 147, 0.3);
  --sidebar-w: 220px;
  --font-mono: 'Space Mono', 'Courier New', Courier, monospace;
  --radius: 0px;
  --shadow-card: 6px 6px 0 rgba(255, 0, 0, 0.2), 0 0 24px rgba(255, 20, 147, 0.15);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body.aurora-body {
  font-family: var(--font-mono);
  background-color: var(--c-dark3);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ===== 无障碍 ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ===== Aurora 网格背景 ===== */
body.aurora-body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 30%, rgba(255,0,0,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 70%, rgba(255,20,147,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 100% 100% at 50% 50%, rgba(38,23,23,0.95) 0%, var(--c-dark3) 100%);
  background-size: 200% 200%;
  animation: aurora-bg 12s ease-in-out infinite alternate;
  pointer-events: none;
}

body.aurora-body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,20,147,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,20,147,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

@keyframes aurora-bg {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 50% 100%; }
}

/* ===== 侧边栏 ===== */
aside.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 100;
  background: linear-gradient(180deg, rgba(26,15,15,0.97) 0%, rgba(14,8,8,0.98) 100%);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  position: relative;
  z-index: 2;
}

.sidebar-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(135deg, var(--c-glow-red) 0%, transparent 50%, var(--c-glow-pink) 100%);
  opacity: 0.12;
  animation: sidebar-glow-pulse 8s ease-in-out infinite alternate;
}

@keyframes sidebar-glow-pulse {
  0%   { opacity: 0.08; }
  100% { opacity: 0.18; }
}

/* 品牌 logo */
.sidebar-brand {
  padding: 24px 16px 20px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  text-decoration: none;
}

.sidebar-logo img.logo-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.sidebar-logo--text {
  background: linear-gradient(135deg, var(--c-red), var(--c-pink));
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  border: 1px solid var(--c-border);
  transition: box-shadow var(--transition);
}

.sidebar-logo--text:hover {
  box-shadow: 0 0 16px var(--c-glow-pink);
}

/* 导航列表 */
aside.sidebar nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
}

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

aside.sidebar nav ul li {
  position: relative;
}

aside.sidebar nav ul li a.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.4;
  min-height: 44px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  border-left: 2px solid transparent;
  position: relative;
}

aside.sidebar nav ul li a.nav-link::before {
  content: attr(data-index);
  font-size: 0.6rem;
  color: var(--c-text-dim);
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

aside.sidebar nav ul li a.nav-link:hover,
aside.sidebar nav ul li a.nav-link:focus-visible {
  color: var(--c-text);
  background: rgba(255, 20, 147, 0.08);
  border-left-color: var(--c-pink);
}

aside.sidebar nav ul li a.nav-link.active {
  color: var(--c-pink);
  border-left-color: var(--c-red);
  background: rgba(255, 0, 0, 0.1);
}

.nav-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 搜索框 */
.sidebar-search {
  padding: 16px;
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}

.search-form {
  display: flex;
  gap: 0;
  border: 1px solid var(--c-border);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-form:focus-within {
  border-color: var(--c-pink);
  box-shadow: 0 0 10px var(--c-glow-pink);
}

.search-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: none;
  outline: none;
  color: var(--c-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 10px 10px;
  min-height: 40px;
}

.search-input::placeholder {
  color: var(--c-text-dim);
}

.search-btn {
  background: linear-gradient(135deg, var(--c-red), var(--c-pink));
  border: none;
  color: #fff;
  padding: 0 12px;
  cursor: pointer;
  font-size: 1rem;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition);
}

.search-btn:hover {
  opacity: 0.85;
}

/* ===== 页面主体 ===== */
.page-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 45vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--c-border);
}

.hero-aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: blob-float 10s ease-in-out infinite alternate;
}

.aurora-blob--1 {
  width: 400px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(255,0,0,0.3) 0%, transparent 70%);
  top: -80px;
  left: -100px;
  animation-duration: 10s;
}

.aurora-blob--2 {
  width: 350px;
  height: 280px;
  background: radial-gradient(ellipse, rgba(255,20,147,0.25) 0%, transparent 70%);
  bottom: -60px;
  right: -80px;
  animation-duration: 8s;
  animation-delay: -3s;
}

.aurora-blob--3 {
  width: 250px;
  height: 200px;
  background: radial-gradient(ellipse, rgba(255,80,80,0.2) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 12s;
  animation-delay: -5s;
}

@keyframes blob-float {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(20px, -15px) scale(1.05); }
  100% { transform: translate(-10px, 10px) scale(0.97); }
}

.aurora-blob--3 {
  animation-name: blob-center;
}

@keyframes blob-center {
  0%   { transform: translate(-50%, -50%) scale(1); }
  50%  { transform: translate(calc(-50% + 15px), calc(-50% - 10px)) scale(1.08); }
  100% { transform: translate(calc(-50% - 10px), calc(-50% + 8px)) scale(0.95); }
}

.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,0,0,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,0,0,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: icon-pulse 3s ease-in-out infinite;
}

@keyframes icon-pulse {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(255,0,0,0.4)); }
  50%       { filter: drop-shadow(0 0 20px rgba(255,20,147,0.6)); }
}

.hero-title {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-shadow: 0 0 30px rgba(255,0,0,0.4);
}

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

/* ===== 正文容器 ===== */
main {
  flex: 1;
  position: relative;
  z-index: 1;
}

main > article.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 32px;
}

main > article.wrap > section.content-section {
  width: 100%;
}

main > article.wrap > section.content-section > div.content-article {
  color: var(--c-text);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.75;
}

/* scroll-margin for sections inside content */
section[id] {
  scroll-margin-top: 80px;
}

/* ===== 正文内容排版 ===== */
.content-article h2 {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--c-text);
  margin: 2.5rem 0 0;
  letter-spacing: 0.02em;
  padding-bottom: 8px;
}

.content-article h2 + hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 8px 0 20px;
  background: linear-gradient(90deg, var(--c-red), var(--c-pink), transparent);
  height: 1px;
  border: none;
}

.content-article h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-pink);
  margin: 2rem 0 0.75rem;
  letter-spacing: 0.03em;
}

.content-article h3 + hr {
  border: none;
  height: 1px;
  background: var(--c-border);
  margin: 0 0 16px;
}

.content-article p {
  margin: 0 0 1.2rem;
  color: var(--c-text);
}

.content-article ul,
.content-article ol {
  margin: 0 0 1.2rem 1.5rem;
}

.content-article li {
  margin-bottom: 0.4rem;
}

.content-article a {
  color: var(--c-pink);
  text-decoration: underline;
  text-decoration-color: rgba(255,20,147,0.4);
  transition: color var(--transition), text-decoration-color var(--transition);
}

.content-article a:hover {
  color: var(--c-red);
  text-decoration-color: var(--c-red);
}

.content-article strong {
  color: var(--c-red);
  font-weight: 700;
}

.content-article em {
  color: var(--c-text-muted);
  font-style: normal;
  letter-spacing: 0.03em;
}

.content-article blockquote {
  border-left: 3px solid var(--c-red);
  padding: 12px 20px;
  margin: 1.5rem 0;
  background: rgba(255,0,0,0.06);
  color: var(--c-text-muted);
}

.content-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.875rem;
}

.content-article th,
.content-article td {
  padding: 10px 14px;
  border: 1px solid var(--c-border);
  text-align: left;
}

.content-article th {
  background: rgba(255,0,0,0.1);
  color: var(--c-text);
  font-weight: 700;
}

.content-article td {
  color: var(--c-text-muted);
}

/* 章节块 */
.content-article section {
  margin-bottom: 3rem;
  padding: 28px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.content-article section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-red), var(--c-pink), transparent);
}

/* ===== 页脚 ===== */
footer {
  border-top: 1px solid var(--c-border);
  background: rgba(14,8,8,0.95);
  padding: 0;
}

.footer-inner {
  padding: 32px 32px 16px;
}

.footer-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 24px;
}

.footer-col--brand .footer-brand-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--c-text);
  margin-bottom: 8px;
}

.footer-col--brand small.footer-brand-desc {
  font-size: 0.75rem;
  color: var(--c-text-dim);
  line-height: 1.6;
  display: block;
}

.footer-col--contact p.footer-contact-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--c-text-muted);
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.footer-col--contact small.footer-contact-info {
  font-size: 0.75rem;
  color: var(--c-text-dim);
  display: block;
}

footer > p.footer-copy {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
  gap: 8px;
}

footer > p.footer-copy small {
  font-size: 0.7rem;
  color: var(--c-text-dim);
  font-family: var(--font-mono);
}

footer > p.footer-copy small.footer-disclaimer {
  color: rgba(255,20,147,0.5);
}

/* ===== Scroll Reveal 动效 ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.stagger-item {
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-item.is-visible {
  opacity: 1;
  transform: translateX(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .stagger-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .aurora-blob,
  body.aurora-body::before,
  .sidebar-glow,
  .hero-icon {
    animation: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ===== 响应式：移动端 ===== */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 0px;
  }

  aside.sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--c-border);
    z-index: 200;
  }

  .sidebar-inner {
    flex-direction: row;
    align-items: center;
    width: 100%;
    padding: 0;
    overflow: hidden;
  }

  .sidebar-brand {
    padding: 0 12px;
    border-bottom: none;
    border-right: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    height: 56px;
    flex-shrink: 0;
  }

  .sidebar-logo {
    width: 36px;
    height: 36px;
  }

  .sidebar-logo img.logo-img {
    width: 36px;
    height: 36px;
  }

  aside.sidebar nav {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0;
  }

  aside.sidebar nav ul {
    flex-direction: row;
    gap: 0;
    align-items: center;
    height: 56px;
  }

  aside.sidebar nav ul li a.nav-link {
    flex-direction: column;
    padding: 4px 10px;
    min-height: 56px;
    gap: 2px;
    border-left: none;
    border-bottom: 2px solid transparent;
    font-size: 0.6rem;
    white-space: nowrap;
  }

  aside.sidebar nav ul li a.nav-link::before {
    display: none;
  }

  aside.sidebar nav ul li a.nav-link:hover,
  aside.sidebar nav ul li a.nav-link:focus-visible {
    border-left-color: transparent;
    border-bottom-color: var(--c-pink);
  }

  .nav-icon {
    font-size: 1rem;
  }

  .sidebar-search {
    display: none;
  }

  .sidebar-glow {
    display: none;
  }

  .page-wrapper {
    margin-left: 0;
    margin-bottom: 56px;
  }

  .hero {
    min-height: 45vh;
  }

  main > article.wrap {
    padding: 28px 16px;
  }

  .footer-cols {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  footer > p.footer-copy {
    padding: 12px 16px;
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-inner {
    padding: 24px 16px 12px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-w: 180px;
  }

  aside.sidebar nav ul li a.nav-link {
    padding: 10px 12px;
    font-size: 0.7rem;
  }
}

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

@media (max-width: 768px) {
  section[id] {
    scroll-margin-top: 70px;
  }
}

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