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

/* ===== 变量 ===== */
:root {
  --c-bg: #1A1F36;
  --c-surface: #2D3561;
  --c-accent: #C6FF00;
  --c-text: #E8EAF6;
  --c-text-muted: #8B91B8;
  --c-border: #3D4480;
  --c-sidebar: #141829;
  --c-hover: #C6FF0022;
  --c-accent-dark: #9DCC00;
  --sidebar-w: 220px;
  --top-bar-h: 40px;
  --font-main: 'Exo', 'Roboto Mono', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Roboto Mono', 'Courier New', monospace;
  --radius: 4px;
  --transition: 150ms ease;
}

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

html {
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-main);
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--c-accent);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
}

a:hover {
  color: var(--c-bg);
  background: var(--c-accent);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-main);
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-text);
}

p {
  line-height: 1.7;
  font-size: 1rem;
}

ul, ol {
  padding-left: 1.5em;
  line-height: 1.7;
}

hr {
  border: none;
  border-top: 2px solid var(--c-accent);
  margin: 1rem 0;
}

dl {
  list-style: none;
  padding: 0;
  margin: 0;
}

dt, dd {
  display: block;
  padding: 0;
  margin: 0;
}

/* ===== 布局框架 ===== */
.site-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== 左侧固定导航 ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--c-sidebar);
  border-right: 2px solid var(--c-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1rem 0.5rem;
  border-bottom: 1px solid var(--c-border);
}

.brand-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--c-accent);
  color: var(--c-bg);
  font-weight: 700;
  font-size: 1.4rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background var(--transition);
}

.brand-icon-link:hover {
  background: var(--c-accent-dark);
  color: var(--c-bg);
}

.brand-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
}

.sidebar-tagline {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--c-text-muted);
  letter-spacing: 0.08em;
  padding: 0.5rem 1rem 0.75rem;
  text-transform: uppercase;
}

/* 导航 dl/dt/dd 结构 */
.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
}

.nav-dl {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-dl dt {
  display: block;
}

.nav-link {
  display: block;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-text-muted);
  border-left: 3px solid transparent;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  letter-spacing: 0.02em;
  min-height: 44px;
  line-height: 1.4;
  display: flex;
  align-items: center;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--c-accent);
  border-left-color: var(--c-accent);
  background: var(--c-hover);
}

.sidebar-footer-note {
  padding: 1rem;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 0.5rem;
}

.sidebar-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  background: var(--c-surface);
  color: var(--c-accent);
  border: 1px solid var(--c-accent);
  border-radius: var(--radius);
  letter-spacing: 0.05em;
}

/* ===== 主内容区 ===== */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ===== 顶部公告条 ===== */
.top-announcement {
  background: var(--c-surface);
  border-bottom: 2px solid var(--c-accent);
  padding: 0 1.5rem;
  height: var(--top-bar-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.announcement-dot {
  width: 8px;
  height: 8px;
  background: var(--c-accent);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ===== 主内容 ===== */
.main-content {
  flex: 1;
}

/* ===== Hero 区块 ===== */
.hero-section {
  min-height: 70vh;
  padding: 4rem 3rem 2rem;
  border-bottom: 2px solid var(--c-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: var(--c-surface);
  clip-path: polygon(15% 0, 100% 0, 100% 100%, 0% 100%);
  z-index: 0;
}

.hero-aside {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

.hero-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border: 2px solid var(--c-accent);
  color: var(--c-accent);
  border-radius: var(--radius);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-badge--accent {
  background: var(--c-accent);
  color: var(--c-bg);
}

.hero-figure {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--c-text);
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

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

.hero-divider {
  margin-top: 2.5rem;
  border-top-color: var(--c-accent);
  border-top-width: 3px;
  max-width: 120px;
  position: relative;
  z-index: 1;
}

/* ===== 内容区（aside 在左侧） ===== */
.content-section {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 0;
}

/* aside 在内容左侧 */
.content-aside {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: var(--top-bar-h);
  padding: 2rem 1rem 2rem 2rem;
  border-right: 1px solid var(--c-border);
  min-height: 60vh;
  background: var(--c-sidebar);
}

.aside-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.aside-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.aside-nav-dl {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aside-nav-dl dt {
  display: block;
}

.aside-link {
  display: block;
  font-size: 0.78rem;
  color: var(--c-text-muted);
  padding: 0.4rem 0.5rem;
  border-left: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  min-height: 40px;
  line-height: 1.4;
  display: flex;
  align-items: center;
}

.aside-link:hover {
  color: var(--c-accent);
  border-left-color: var(--c-accent);
  background: var(--c-hover);
}

.content-body {
  flex: 1;
  padding: 2.5rem 3rem;
  min-width: 0;
}

/* ===== page.content 内部 article 样式 ===== */
.content-body article {
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--c-border);
  scroll-margin-top: calc(var(--top-bar-h) + 1rem);
}

.content-body article:last-child {
  border-bottom: none;
}

.content-body h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.content-body h2 + hr {
  border-top: 2px solid var(--c-accent);
  margin-bottom: 1.5rem;
}

.content-body h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--c-accent);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.content-body h3 + hr {
  border-top: 1px solid var(--c-border);
  margin-bottom: 1rem;
}

.content-body p {
  color: var(--c-text);
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.75;
}

.content-body ul,
.content-body ol {
  margin-bottom: 1rem;
  color: var(--c-text);
}

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

.content-body a {
  color: var(--c-accent);
  border-bottom: 1px solid var(--c-accent);
  padding-bottom: 1px;
}

.content-body a:hover {
  background: var(--c-accent);
  color: var(--c-bg);
  border-bottom-color: transparent;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.content-body th {
  background: var(--c-surface);
  color: var(--c-accent);
  font-weight: 600;
  padding: 0.6rem 1rem;
  text-align: left;
  border: 1px solid var(--c-border);
}

.content-body td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--c-border);
  color: var(--c-text);
}

.content-body tr:nth-child(even) td {
  background: var(--c-sidebar);
}

.content-body blockquote {
  border-left: 4px solid var(--c-accent);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  background: var(--c-surface);
  font-style: italic;
  color: var(--c-text-muted);
}

.content-body figure {
  margin: 1.5rem 0;
}

.content-body figcaption {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

/* article 内的 scroll-margin-top */
article[id] {
  scroll-margin-top: calc(var(--top-bar-h) + 1rem);
}

/* ===== 页脚 ===== */
.site-footer {
  background: var(--c-sidebar);
  border-top: 2px solid var(--c-accent);
  padding: 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem 2rem;
  flex-wrap: wrap;
}

.footer-brand {
  flex-shrink: 0;
}

.footer-logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--c-text);
  font-weight: 700;
  font-size: 0.9rem;
}

.footer-logo-link:hover {
  background: transparent;
  color: var(--c-accent);
}

.footer-brand-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

/* 页脚 nav > dl > dt/dd > a 结构 */
.footer-nav {
  flex: 1;
  min-width: 0;
}

.footer-nav-dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.footer-nav-dl dt {
  display: block;
}

.footer-nav-link {
  font-size: 0.78rem;
  color: var(--c-text-muted);
  padding: 0.4rem 0.25rem;
  min-height: 40px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}

.footer-nav-link:hover {
  color: var(--c-accent);
  background: transparent;
}

.footer-copy {
  flex-shrink: 0;
  text-align: right;
}

.copyright {
  font-size: 0.75rem;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.2rem;
}

.footer-sub {
  font-size: 0.68rem;
  color: var(--c-border);
}

/* ===== 动效 ===== */
.nav-link,
.aside-link,
.footer-nav-link,
.hero-badge,
.sidebar-badge {
  transition: all 150ms ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.sidebar-nav .nav-dl {
  animation: slideIn 200ms ease both;
}

/* Hover micro-interactions */
.hero-badge:hover {
  background: var(--c-accent);
  color: var(--c-bg);
  transform: translateY(-1px);
}

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

/* ===== 移动端适配 ===== */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    border-right: none;
    border-top: 2px solid var(--c-accent);
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 200;
  }

  .sidebar-brand {
    padding: 0.5rem 0.75rem;
    border-bottom: none;
    border-right: 1px solid var(--c-border);
    display: flex;
    align-items: center;
  }

  .sidebar-tagline {
    display: none;
  }

  .sidebar-nav {
    flex: 1;
    padding: 0;
    display: flex;
    align-items: center;
  }

  .nav-dl {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0;
  }

  .nav-dl dt {
    flex-shrink: 0;
  }

  .nav-link {
    border-left: none;
    border-bottom: 3px solid transparent;
    padding: 0 0.75rem;
    height: 52px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .nav-link:hover {
    border-bottom-color: var(--c-accent);
    border-left-color: transparent;
  }

  .sidebar-footer-note {
    padding: 0.5rem;
    border-top: none;
    border-left: 1px solid var(--c-border);
    display: flex;
    align-items: center;
  }

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

  .hero-section {
    padding: 2.5rem 1.5rem 2rem;
    min-height: 60vh;
  }

  .hero-section::before {
    display: none;
  }

  .content-section {
    flex-direction: column;
  }

  .content-aside {
    width: 100%;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--c-border);
    padding: 1rem 1.5rem;
    min-height: auto;
  }

  .aside-nav-dl {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .aside-nav-dl dt {
    display: inline;
  }

  .aside-link {
    display: inline-flex;
    border-left: none;
    border: 1px solid var(--c-border);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    min-height: auto;
  }

  .content-body {
    padding: 1.5rem 1.25rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
  }

  .footer-copy {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }

  .content-body h2 {
    font-size: 1.3rem;
  }

  .top-announcement {
    font-size: 0.72rem;
  }
}
