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

/* ============================================================
   CSS 变量 & 重置
============================================================ */
:root {
  --c-primary: #56228b;
  --c-secondary: #8b4513;
  --c-dark: #1f1726;
  --c-dark2: #2a1c35;
  --c-dark3: #160f1e;
  --c-text: #e8ddf5;
  --c-text-muted: #a891c4;
  --c-accent: #b07adf;
  --c-earth: #c47a3a;
  --c-border: rgba(86,34,139,0.35);
  --c-card-bg: rgba(42,28,53,0.85);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-soft: 0 8px 32px rgba(31,23,38,0.55), 0 2px 8px rgba(86,34,139,0.18);
  --shadow-card: 0 4px 24px rgba(31,23,38,0.6), 0 1px 4px rgba(139,69,19,0.15);
  --font-head: 'Orbitron', 'Exo 2', system-ui, sans-serif;
  --font-body: 'Exo 2', system-ui, -apple-system, sans-serif;
  --nav-h: 64px;
  --transition: 0.32s cubic-bezier(0.4,0,0.2,1);
}

*, *::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);
}

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

img { display: block; max-width: 100%; height: auto; }
a { color: var(--c-accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--c-earth); }
ol, ul { list-style: none; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-head); line-height: 1.2; }

/* ============================================================
   导航遮罩
============================================================ */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(22,12,30,0.97);
  backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.nav-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}
.nav-overlay .overlay-nav ol {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}
.nav-overlay .overlay-nav li a {
  font-family: var(--font-head);
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: 0.05em;
  padding: 0.75rem 2rem;
  display: block;
  border-radius: var(--radius-md);
  transition: background var(--transition), color var(--transition);
  min-height: 48px;
  line-height: 1.4;
}
.nav-overlay .overlay-nav li a:hover {
  background: rgba(86,34,139,0.25);
  color: var(--c-earth);
}
.overlay-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: none;
  border: 2px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay-close:hover {
  color: var(--c-earth);
  border-color: var(--c-earth);
}

/* ============================================================
   顶部 Header
============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 900;
  height: var(--nav-h);
  background: rgba(31,23,38,0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 1.5rem;
}
.header-brand {
  grid-column: 2;
  display: flex;
  justify-content: center;
}
.header-right {
  grid-column: 3;
  display: flex;
  justify-content: flex-end;
}
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.hamburger:hover { background: rgba(86,34,139,0.2); }
.hb-line {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--c-text-muted);
  border-radius: 2px;
  transition: background var(--transition);
}
.hamburger:hover .hb-line { background: var(--c-accent); }
.hamburger-right { display: none; }

.brand-link { display: flex; align-items: center; gap: 0.5rem; }
.logo-img { height: 36px; width: auto; }
.logo-text {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  color: var(--c-text);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* ============================================================
   Hero
============================================================ */
.hero-section {
  position: relative;
  min-height: 45vh;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  overflow: hidden;
  margin-top: var(--nav-h);
}
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(22,12,30,0.82) 0%,
    rgba(86,34,139,0.42) 50%,
    rgba(139,69,19,0.28) 100%
  );
}
.hero-blob {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60%;
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  padding: 2.5rem 3rem 3rem;
  text-align: right;
}
.hero-badge {
  display: inline-block;
  background: rgba(86,34,139,0.6);
  border: 1px solid rgba(176,122,223,0.5);
  color: var(--c-accent);
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-xl);
  margin-bottom: 1rem;
  backdrop-filter: blur(6px);
}
.hero-h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
  margin-bottom: 0.85rem;
  text-shadow: 0 2px 16px rgba(31,23,38,0.7);
}
.hero-desc {
  font-size: 1rem;
  color: var(--c-text-muted);
  max-width: 420px;
  margin-left: auto;
  line-height: 1.65;
}

/* div scroll margin */
div[id] {
  scroll-margin-top: calc(var(--nav-h) + 12px);
}

/* ============================================================
   主内容区布局
============================================================ */
main {
  padding: 3rem 0 4rem;
}
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 3rem;
  align-items: start;
}

/* ============================================================
   侧边栏（内容左侧）
============================================================ */
aside.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  min-width: 0;
}
.sidebar-inner {
  background: var(--c-card-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.2rem;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}
.sidebar-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--c-earth);
  margin-bottom: 0.6rem;
  font-family: var(--font-head);
}
.sidebar-inner > hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin-bottom: 1rem;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  z-index: 1;
}
.sidebar-nav li a {
  font-size: 0.88rem;
  color: var(--c-text-muted);
  display: block;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  min-height: 40px;
  line-height: 1.5;
  display: flex;
  align-items: center;
}
.sidebar-nav li a:hover {
  background: rgba(86,34,139,0.22);
  color: var(--c-accent);
}
.sidebar-deco {
  position: absolute;
  bottom: -1rem;
  right: -1rem;
  width: 90px;
  opacity: 0.6;
  pointer-events: none;
}

/* ============================================================
   内容区
============================================================ */
.content-section {
  min-width: 0;
}
.page-article {
  min-width: 0;
}

/* 正文排版 */
.page-article h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.7rem);
  font-weight: 700;
  color: var(--c-accent);
  margin-top: 3rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
  padding-bottom: 0.3rem;
}
.page-article h2 + hr,
.page-article h3 + hr {
  border: none;
  border-top: 2px solid var(--c-border);
  margin-bottom: 1.2rem;
  border-radius: 2px;
}
.page-article h3 {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 600;
  color: var(--c-earth);
  margin-top: 2rem;
  margin-bottom: 0.4rem;
}
.page-article h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--c-text);
  margin-top: 1.5rem;
  margin-bottom: 0.3rem;
}
.page-article p {
  margin-bottom: 1rem;
  color: var(--c-text);
  font-size: 1rem;
  line-height: 1.75;
}
.page-article ul,
.page-article ol {
  margin-bottom: 1rem;
  padding-left: 1.4rem;
  list-style: disc;
}
.page-article ol { list-style: decimal; }
.page-article li {
  margin-bottom: 0.4rem;
  color: var(--c-text);
  line-height: 1.65;
}
.page-article strong { color: var(--c-accent); font-weight: 600; }
.page-article em { color: var(--c-earth); font-style: italic; }
.page-article a { color: var(--c-accent); border-bottom: 1px solid rgba(176,122,223,0.35); }
.page-article a:hover { color: var(--c-earth); border-bottom-color: var(--c-earth); }
.page-article blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: rgba(86,34,139,0.12);
  border-left: 3px solid var(--c-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--c-text-muted);
  font-style: italic;
}
.page-article hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: 2rem 0;
}
.page-article table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.93rem;
}
.page-article th {
  background: rgba(86,34,139,0.25);
  color: var(--c-accent);
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-weight: 600;
}
.page-article td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
}

/* 内容区的 div 分区 */
.page-article div {
  margin-bottom: 3rem;
  padding: 2rem 2.2rem;
  background: var(--c-card-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.page-article div::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-secondary), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* ============================================================
   页脚
============================================================ */
.site-footer {
  background: var(--c-dark2);
  border-top: 1px solid var(--c-border);
  padding: 3rem 1.5rem 0;
  position: relative;
  overflow: hidden;
}
.site-footer::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(86,34,139,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.site-footer > div {
  display: inline-block;
}

/* 四栏布局 */
.site-footer {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  grid-template-rows: auto auto;
  gap: 2rem 2.5rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 1.5rem 0;
  /* reset inline-block from above */
  display: grid;
}
.footer-brand { grid-column: 1; }
.footer-nav { grid-column: 2; }
.footer-nav--2 { grid-column: 3; }
.footer-info { grid-column: 4; }
.footer-bar {
  grid-column: 1 / -1;
  border-top: 1px solid var(--c-border);
  padding: 1.2rem 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  font-family: var(--font-head);
  letter-spacing: 0.06em;
}

.footer-brand .footer-slogan {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  max-width: 260px;
}
.site-footer h3 {
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--c-earth);
  margin-bottom: 0.5rem;
}
.site-footer h3 + hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin-bottom: 0.9rem;
}
.site-footer nav ol {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.site-footer nav ol li a {
  font-size: 0.88rem;
  color: var(--c-text-muted);
  display: block;
  padding: 0.35rem 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.site-footer nav ol li a:hover { color: var(--c-accent); }
.footer-info p {
  font-size: 0.88rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

/* ============================================================
   Scroll Reveal 动效
============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .reveal.in-view {
    opacity: 1;
    transform: none;
  }
  .reveal-left {
    opacity: 0;
    transform: translateX(-24px);
    transition: opacity 0.55s ease, transform 0.55s ease;
  }
  .reveal-left.in-view {
    opacity: 1;
    transform: none;
  }

  /* Hover micro-interactions */
  .page-article div {
    transition: box-shadow var(--transition), transform var(--transition);
  }
  .page-article div:hover {
    box-shadow: 0 12px 40px rgba(86,34,139,0.28), 0 2px 8px rgba(139,69,19,0.2);
    transform: translateY(-2px);
  }
  .sidebar-nav li a {
    transition: background var(--transition), color var(--transition), padding-left var(--transition);
  }
  .sidebar-nav li a:hover {
    padding-left: 1rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-left { opacity: 1; transform: none; }
}

/* ============================================================
   响应式
============================================================ */
@media (max-width: 1024px) {
  .wrap {
    grid-template-columns: 180px 1fr;
    gap: 2rem;
  }
  .site-footer {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand { grid-column: 1 / -1; }
  .footer-info { grid-column: 1 / -1; }
  .footer-nav { grid-column: 1; }
  .footer-nav--2 { grid-column: 2; }
}

@media (max-width: 768px) {
  :root { --nav-h: 56px; }

  .hamburger-right { display: flex; }

  .wrap {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
  }
  aside.sidebar {
    position: static;
    width: 100%;
  }
  .sidebar-inner {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
  }
  .sidebar-title { width: 100%; }
  .sidebar-inner > hr { width: 100%; }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.3rem;
  }
  .sidebar-nav li a {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    min-height: 40px;
  }
  .sidebar-deco { display: none; }

  .hero-content {
    padding: 1.5rem 1rem 2rem;
    max-width: 100%;
    text-align: right;
  }
  .hero-desc { font-size: 0.9rem; }

  .page-article div {
    padding: 1.4rem 1.2rem;
  }

  .site-footer {
    grid-template-columns: 1fr 1fr;
    padding: 2rem 1rem 0;
  }
  .footer-brand { grid-column: 1 / -1; }
  .footer-info { grid-column: 1 / -1; }

  main { padding: 2rem 0 3rem; }
}

@media (max-width: 480px) {
  .site-footer {
    grid-template-columns: 1fr;
  }
  .footer-nav, .footer-nav--2, .footer-brand, .footer-info {
    grid-column: 1;
  }
  .hero-h1 { font-size: 1.4rem; }
  .hero-badge { font-size: 0.65rem; }
  .page-article div { padding: 1.2rem 1rem; }
}
