@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');

/* ===========================
   CSS 变量 & Reset
=========================== */
:root {
  --c-green: #87ff71;
  --c-yellow: #ffce5c;
  --c-dark: #192617;
  --c-dark2: #1f3019;
  --c-dark3: #243c1e;
  --c-text: #d4f0cc;
  --c-text-muted: #8ab880;
  --c-border: #87ff7140;
  --nav-w: 220px;
  --font-main: 'Exo', 'Roboto Mono', monospace, sans-serif;
  --font-mono: 'Roboto Mono', monospace;
  --radius-card: 28px;
  --hero-h: 45vh;
}

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

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

body {
  font-family: var(--font-main);
  line-height: 1.7;
  min-height: 100vh;
  background: var(--c-dark);
  overflow-x: hidden;
}

/* ===========================
   全局滚动偏移
=========================== */
div[id] {
  scroll-margin-top: 24px;
}

/* ===========================
   页面骨架
=========================== */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===========================
   侧边导航
=========================== */
.sidenav {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--nav-w);
  height: 100vh;
  background: var(--c-dark2);
  border-right: 2px solid var(--c-green);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 16px 16px;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidenav-brand {
  margin-bottom: 28px;
  width: 100%;
}

.brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-logo-img {
  max-width: 52px;
  max-height: 52px;
  object-fit: contain;
}

.logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--c-green);
  letter-spacing: 0.08em;
  padding: 8px 10px;
  border: 2px solid var(--c-green);
  clip-path: polygon(0 0, 92% 0, 100% 14%, 100% 100%, 8% 100%, 0 86%);
  background: var(--c-dark3);
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* details / summary 导航 */
.nav-details {
  width: 100%;
  flex: 1;
}

.nav-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
  color: var(--c-yellow);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  border-bottom: 1px dashed var(--c-border);
  margin-bottom: 12px;
  min-height: 44px;
  user-select: none;
}

.nav-summary::-webkit-details-marker { display: none; }
.nav-summary::marker { display: none; }

.nav-summary-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.hamburger-icon span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--c-yellow);
  border-radius: 2px;
}

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

.nav-menu li { width: 100%; }

.nav-link {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  color: var(--c-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-left: 3px solid transparent;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
  min-height: 44px;
  border-radius: 4px;
}

.nav-link:hover,
.nav-link:focus {
  color: var(--c-green);
  border-left-color: var(--c-green);
  background: rgba(135, 255, 113, 0.07);
  outline: none;
}

/* 联系 */
.nav-contact {
  margin-top: auto;
  padding-top: 20px;
  width: 100%;
  border-top: 1px dotted var(--c-border);
}

.nav-contact-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--c-text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.nav-contact-val {
  display: inline-block;
  color: var(--c-yellow);
  font-size: 0.8rem;
  text-decoration: none;
  word-break: break-all;
  min-height: 40px;
  line-height: 40px;
}

.nav-contact-val:hover { text-decoration: underline; }

/* 侧边装饰SVG */
.sidenav-deco {
  margin-top: 16px;
  opacity: 0.5;
  width: 100%;
  display: flex;
  justify-content: center;
}

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

/* ===========================
   Hero
=========================== */
.hero-wrap {
  position: relative;
  min-height: var(--hero-h);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--c-dark);
  border-bottom: 3px solid var(--c-green);
}

.hero-bg-text {
  position: absolute;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(6rem, 18vw, 18rem);
  color: rgba(135, 255, 113, 0.05);
  letter-spacing: -0.02em;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 48px 24px 36px;
  max-width: 780px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--c-yellow);
  letter-spacing: 0.25em;
  margin-bottom: 16px;
}

.hero-h1 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 4rem);
  color: var(--c-green);
  line-height: 1.15;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}

.hero-sub {
  font-size: 1rem;
  color: var(--c-text-muted);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.8;
}

/* 装饰几何 */
.hero-deco { position: absolute; inset: 0; pointer-events: none; z-index: 1; }

.deco-tri {
  position: absolute;
  display: block;
  width: 0; height: 0;
}

.deco-tri-1 {
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 70px solid rgba(135,255,113,0.13);
  top: 10%;
  right: 5%;
  transform: rotate(15deg);
}

.deco-tri-2 {
  border-left: 28px solid transparent;
  border-right: 28px solid transparent;
  border-top: 48px solid rgba(255,206,92,0.18);
  bottom: 12%;
  left: 4%;
  transform: rotate(-10deg);
}

.deco-circle {
  position: absolute;
  display: block;
  border-radius: 50%;
}

.deco-circle-1 {
  width: 90px; height: 90px;
  border: 4px dotted rgba(135,255,113,0.25);
  bottom: 8%;
  right: 8%;
}

.deco-zigzag {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    90deg,
    var(--c-green) 0, var(--c-green) 12px,
    transparent 12px, transparent 20px
  );
  opacity: 0.4;
}

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

.content-section {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 200px;
  grid-template-rows: auto;
  grid-template-areas:
    "body aside"
    "body .";
  gap: 0 32px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 32px 64px;
}

.content-deco-fig {
  position: absolute;
  top: 40px;
  left: -20px;
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.content-body {
  grid-area: body;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.content-aside {
  grid-area: aside;
  position: sticky;
  top: 24px;
  align-self: start;
}

.aside-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--c-yellow);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--c-border);
}

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

.aside-toc a {
  display: block;
  font-size: 0.78rem;
  color: var(--c-text-muted);
  text-decoration: none;
  padding: 6px 8px;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.4;
  min-height: 40px;
  display: flex;
  align-items: center;
}

.aside-toc a:hover,
.aside-toc a:focus {
  color: var(--c-green);
  border-left-color: var(--c-green);
  outline: none;
}

/* ===========================
   page.content 内部 div 样式
=========================== */
.content-body div {
  padding: 52px 0 40px;
  border-bottom: 1px solid var(--c-border);
  position: relative;
}

.content-body div:first-child { padding-top: 0; }
.content-body div:last-child { border-bottom: none; }

.content-body h2 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--c-green);
  letter-spacing: 0.04em;
  margin-bottom: 20px;
  position: relative;
  padding-left: 18px;
}

.content-body h2::before {
  content: '';
  position: absolute;
  left: 0; top: 0.1em;
  width: 6px;
  height: 85%;
  background: var(--c-yellow);
  clip-path: polygon(0 0, 100% 10%, 100% 90%, 0 100%);
}

.content-body h3 {
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--c-yellow);
  margin: 28px 0 12px;
  letter-spacing: 0.03em;
}

.content-body p {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--c-text);
  margin-bottom: 16px;
  max-width: 72ch;
}

.content-body ul,
.content-body ol {
  padding-left: 1.5em;
  margin-bottom: 16px;
}

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

.content-body a {
  color: var(--c-green);
  text-decoration: underline;
  text-decoration-color: rgba(135,255,113,0.35);
  transition: text-decoration-color 0.15s;
}

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

.content-body strong { color: var(--c-yellow); font-weight: 600; }

.content-body em { color: var(--c-green); font-style: italic; }

.content-body blockquote {
  border-left: 4px solid var(--c-yellow);
  padding: 12px 20px;
  background: rgba(255,206,92,0.06);
  border-radius: 0 var(--radius-card) var(--radius-card) 0;
  margin: 24px 0;
  font-style: italic;
  color: var(--c-text-muted);
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.92rem;
}

.content-body th {
  background: var(--c-dark3);
  color: var(--c-green);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--c-green);
}

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

.content-body tr:hover td { background: rgba(135,255,113,0.04); }

.content-body .card {
  border: 2px solid var(--c-green);
  border-radius: var(--radius-card);
  padding: 24px;
  background: var(--c-dark2);
  margin: 20px 0;
}

.content-body div:nth-child(odd)::after {
  content: '';
  position: absolute;
  right: -16px;
  top: 24px;
  width: 32px; height: 32px;
  border: 3px dotted rgba(255,206,92,0.3);
  border-radius: 50%;
  pointer-events: none;
}

.content-body div:nth-child(even)::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 28px;
  width: 0; height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 24px solid rgba(135,255,113,0.12);
  pointer-events: none;
}

/* ===========================
   页脚
=========================== */
.site-footer {
  background: var(--c-dark2);
  border-top: 3px solid var(--c-green);
  text-align: center;
  padding: 40px 24px 28px;
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--c-yellow) 0, var(--c-yellow) 16px,
    transparent 16px, transparent 28px
  );
}

.footer-cta {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(1.1rem, 2.5vw, 1.8rem);
  color: var(--c-green);
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}

.footer-copy {
  display: block;
  font-size: 0.78rem;
  color: var(--c-text-muted);
  letter-spacing: 0.08em;
}

/* ===========================
   Memphis 背景纹路（全局）
=========================== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(135,255,113,0.03) 1px, transparent 1px),
    radial-gradient(circle, rgba(255,206,92,0.02) 1px, transparent 1px);
  background-size: 40px 40px, 70px 70px;
  background-position: 0 0, 20px 20px;
  pointer-events: none;
  z-index: 0;
}

/* ===========================
   动效
=========================== */
@media (prefers-reduced-motion: no-preference) {
  .hero-bg-text {
    transition: transform 0.05s linear;
    will-change: transform;
  }

  .deco-tri-1 {
    animation: float-tri1 6s ease-in-out infinite alternate;
  }

  .deco-tri-2 {
    animation: float-tri2 8s ease-in-out infinite alternate;
  }

  .deco-circle-1 {
    animation: spin-slow 20s linear infinite;
  }

  @keyframes float-tri1 {
    from { transform: rotate(15deg) translateY(0); }
    to   { transform: rotate(20deg) translateY(-12px); }
  }

  @keyframes float-tri2 {
    from { transform: rotate(-10deg) translateY(0); }
    to   { transform: rotate(-15deg) translateY(10px); }
  }

  @keyframes spin-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

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

  .content-section {
    grid-template-columns: 1fr;
    grid-template-areas: "aside" "body";
    padding: 32px 20px 48px;
    gap: 24px 0;
  }

  .content-aside {
    position: static;
    border: 1px solid var(--c-border);
    border-radius: 16px;
    padding: 16px;
    background: var(--c-dark2);
  }

  .aside-toc ul { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .aside-toc a { border-left: none; border-bottom: 2px solid transparent; padding: 4px 8px; }
  .aside-toc a:hover { border-bottom-color: var(--c-green); border-left: none; }
}

@media (max-width: 640px) {
  :root { --nav-w: 0px; }

  .sidenav {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0 16px;
    border-right: none;
    border-bottom: 2px solid var(--c-green);
    gap: 8px;
    min-height: 56px;
  }

  .sidenav-brand {
    margin-bottom: 0;
    width: auto;
  }

  .sidenav-deco { display: none; }

  .nav-details { width: auto; flex: 1; }

  .nav-summary {
    margin-bottom: 0;
    border-bottom: none;
    padding: 0 4px;
    min-height: 56px;
  }

  .nav-menu {
    position: absolute;
    top: 56px;
    left: 0; right: 0;
    background: var(--c-dark2);
    border-bottom: 2px solid var(--c-green);
    padding: 8px 16px 16px;
    z-index: 200;
    flex-direction: column;
    gap: 0;
  }

  .nav-contact { display: none; }

  .main-content { margin-left: 0; }

  .page-wrapper { flex-direction: column; }

  .hero-wrap { min-height: 42vh; }

  .hero-h1 { font-size: 1.8rem; }

  .content-section { padding: 24px 16px 40px; }

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

  .content-body div::after { display: none; }

  .content-deco-fig { display: none; }
}

/* ===========================
   工具
=========================== */
img { max-width: 100%; height: auto; display: block; }

:focus-visible {
  outline: 2px solid var(--c-green);
  outline-offset: 3px;
}

::selection {
  background: var(--c-green);
  color: var(--c-dark);
}
