:root {
  --bg: #f8f7f4;
  --bg-card: #ffffff;
  --text: #16181b;
  --text-muted: #5b5f66;
  --border: #e3e1da;
  --accent: #1f5c4a;
  --accent-hover: #164436;
  --nav-bg: #12211d;
  --nav-text: #d8ddda;
  --nav-text-muted: #8ba39a;
  --nav-active-bg: #1f5c4a;
  --max-width: 780px;
  --header-h: 60px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  font-size: 17px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nav-bg);
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.header-inner {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 7px;
  border-radius: 4px;
}
.brand-name { font-size: 16px; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  height: 2px;
  background: #fff;
  border-radius: 1px;
}

/* Layout */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  align-items: start;
}

.site-nav {
  background: var(--nav-bg);
  min-height: calc(100vh - var(--header-h));
  padding: 28px 16px 60px;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav li { margin: 1px 0; }
.site-nav a {
  display: block;
  color: var(--nav-text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14.5px;
}
.site-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.site-nav a.active {
  background: var(--nav-active-bg);
  color: #fff;
  font-weight: 600;
}
.nav-heading {
  margin-top: 18px;
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--nav-text-muted);
}
.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 14px 12px;
}

/* Content */
.content {
  padding: 40px 32px 80px;
  min-width: 0;
}
.content article {
  max-width: var(--max-width);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px 44px;
}
.page-meta {
  max-width: var(--max-width);
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 16px;
  padding: 0 4px;
}

article h1 {
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 22px;
}
article h2 {
  font-size: 23px;
  margin: 40px 0 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  letter-spacing: -0.005em;
}
article h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
article h3 { font-size: 19px; margin: 28px 0 12px; }
article h4 { font-size: 16px; margin: 22px 0 10px; }
article p { margin: 0 0 16px; }
article ul, article ol { margin: 0 0 16px; padding-left: 26px; }
article li { margin: 4px 0; }
article a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(31,92,74,0.35); text-underline-offset: 2px; }
article a:hover { color: var(--accent-hover); }
article img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 10px 0;
  display: block;
}
article blockquote {
  margin: 20px 0;
  padding: 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  background: rgba(31,92,74,0.05);
  border-radius: 0 6px 6px 0;
}
article blockquote p:last-child { margin-bottom: 0; }
article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
article code {
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
article pre {
  background: #16181b;
  color: #eee;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
}
article pre code { background: none; padding: 0; }
article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 15px;
}
article th, article td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
article th { background: rgba(0,0,0,0.03); }
article strong { font-weight: 650; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 20px 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  max-width: 1180px;
  margin: 0 auto;
}
.site-footer p { margin: 4px 0; max-width: 640px; margin-left: auto; margin-right: auto; }
.site-footer a { color: var(--text-muted); }

/* Responsive */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    min-height: 0;
    padding: 12px 16px 24px;
  }
  .site-nav.open { display: block; }
  .content { padding: 28px 16px 60px; }
  .content article { padding: 28px 22px; border-radius: 8px; }
  article h1 { font-size: 25px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --bg-card: #191c1f;
    --text: #e8e9ea;
    --text-muted: #9a9fa6;
    --border: #2b2f33;
    --accent: #4fae8e;
    --accent-hover: #6cc4a5;
  }
  article pre { background: #0a0b0c; }
  article code { background: rgba(255,255,255,0.08); }
  article th { background: rgba(255,255,255,0.04); }
  .nav-toggle-bar { background: #fff; }
}
