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

html { scroll-behavior: smooth; }

body {
  background: var(--bg-color, #f5f0e8);
  color: var(--text-color, #2a2a2a);
  font-family: var(--font-body, Georgia, serif);
  font-size: var(--font-size, 17px);
  line-height: 1.7;
}

/* Layout */
.site-wrapper {
  display: flex;
  min-height: 100vh;
}

.site-nav {
  width: 260px;
  min-width: 200px;
  background: var(--menu-bg, #e8e0d0);
  padding: 1.5rem 0;
  flex-shrink: 0;
  border-right: 1px solid rgba(0,0,0,0.08);
}

.nav-header {
  padding: 0 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

.site-title {
  font-family: var(--font-heading, Georgia, serif);
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--menu-text, #3a2a1a);
  text-decoration: none;
}

.site-main {
  flex: 1;
  padding: 2.5rem 2rem;
  background: var(--bg-color, #f5f0e8);
  min-width: 0;
}

/* Outline column */
.site-outline {
  width: 260px;
  min-width: 200px;
  flex-shrink: 0;
  padding: 1.5rem 0;
  background: var(--menu-bg, #e8e0d0);
  border-left: 1px solid rgba(0,0,0,0.08);
}

.outline-label {
  padding: 0 1.25rem 0.75rem;
  font-size: 0.78rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--menu-text, #3a2a1a);
  opacity: 0.6;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  margin-bottom: 0.75rem;
}

.outline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.outline-item a {
  display: block;
  padding: 0.3rem 1.25rem;
  color: var(--menu-text, #3a2a1a);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.4;
  border-left: 3px solid transparent;
  transition: background 0.1s;
}

.outline-item a:hover {
  background: rgba(0,0,0,0.06);
  border-left-color: var(--link-hover-color, #a0522d);
}

/* Indent by heading level */
.outline-h1 a { padding-left: 1.25rem; font-weight: bold; }
.outline-h2 a { padding-left: 1.25rem; }
.outline-h3 a { padding-left: 2rem; font-size: 0.83rem; }
.outline-h4 a { padding-left: 2.75rem; font-size: 0.80rem; opacity: 0.85; }
.outline-h5 a, .outline-h6 a { padding-left: 3.25rem; font-size: 0.78rem; opacity: 0.75; }

.article-body {
  max-width: var(--article-width, 740px);
  background: var(--article-bg, #fffdf8);
  padding: 2.5rem 3rem;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Menu */
.menu, .menu-children {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-section {
  margin-bottom: 0.25rem;
}

.menu-section-label {
  display: block;
  padding: 0.4rem 1.25rem;
  font-size: 0.78rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--menu-text, #3a2a1a);
  opacity: 0.6;
  cursor: default;
}

.menu-children {
  padding-left: 0;
}

.menu-item a {
  display: block;
  padding: 0.35rem 1.25rem 0.35rem 1.75rem;
  color: var(--menu-text, #3a2a1a);
  text-decoration: none;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}

.menu-item a:hover {
  background: rgba(0,0,0,0.06);
}

.menu-item.active a {
  border-left-color: var(--link-hover-color, #a0522d);
  background: rgba(0,0,0,0.05);
  font-weight: bold;
}

/* Nested sections */
.menu-children .menu-section-label {
  padding-left: 2rem;
}

.menu-children .menu-item a {
  padding-left: 2.5rem;
}

.menu-children .menu-children .menu-item a {
  padding-left: 3.25rem;
}

/* Typography */
.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
  scroll-margin-top: 1.5rem;
}

.article-body h1 {
  font-family: var(--font-heading, Georgia, serif);
  color: var(--heading-color, #2c1810);
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.article-body h2 {
  font-family: var(--font-heading, Georgia, serif);
  color: var(--heading-color, #2c1810);
  font-size: 1.45rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.article-body h3 {
  font-family: var(--font-heading, Georgia, serif);
  color: var(--heading-color, #2c1810);
  font-size: 1.15rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.article-body h4, .article-body h5, .article-body h6 {
  font-family: var(--font-heading, Georgia, serif);
  color: var(--heading-color, #2c1810);
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}

.article-body p {
  margin-bottom: 1.1rem;
}

.article-body a {
  color: var(--link-color, #5c4b3a);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article-body a:hover {
  color: var(--link-hover-color, #a0522d);
}

.article-body ul, .article-body ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.article-body li {
  margin-bottom: 0.3rem;
}

.article-body blockquote {
  border-left: 4px solid var(--blockquote-border, #a0522d);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: rgba(0,0,0,0.03);
  font-style: italic;
  color: rgba(0,0,0,0.7);
}

.article-body blockquote p { margin-bottom: 0; }

.article-body code {
  font-family: var(--font-code, 'Courier New', monospace);
  font-size: 0.88em;
  background: rgba(0,0,0,0.06);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.article-body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1.25rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.25rem 0;
  font-size: 0.88rem;
  line-height: 1.5;
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.article-body img {
  max-width: 100%;
  height: auto;
}

.article-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.article-date {
  font-size: 0.85rem;
  color: rgba(0,0,0,0.45);
  font-style: italic;
}

.article-body hr {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.15);
  margin: 2rem 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
}

.article-body th, .article-body td {
  padding: 0.6rem 0.8rem;
  border: 1px solid rgba(0,0,0,0.15);
  text-align: left;
}

.article-body th {
  background: rgba(0,0,0,0.05);
  font-weight: bold;
}

/* Responsive */
@media (max-width: 900px) {
  .site-outline { display: none; }
}

@media (max-width: 700px) {
  .site-wrapper { flex-direction: column; }
  .site-nav { width: 100%; border-right: none; border-bottom: 1px solid rgba(0,0,0,0.1); }
  .article-body { padding: 1.5rem 1.25rem; }
}
