/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #ede4d6;
  --color-bg-alt: #e8ddd4;
  --color-text: #2c1b13;
  --color-text-secondary: #6b5d4d;
  --color-border: #d4c4b5;
  --color-accent: #513424;
  --color-accent-hover: #654434;
  --color-code-bg: #f7f3ee;
  --color-sidebar-bg: #e8ddd4;
  --sidebar-width: 260px;
  --content-max-width: 800px;
  --font-heading: "Playfair Display", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

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

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  padding: 2rem 1.25rem;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  margin-bottom: 2rem;
}

.site-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-accent);
  text-decoration: none;
  display: block;
  margin-bottom: 0.25rem;
}

.site-description {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.nav-list {
  list-style: none;
  flex: 1;
}

.nav-list li {
  margin-bottom: 0.125rem;
}

.nav-list a {
  display: block;
  padding: 0.375rem 0.75rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.nav-list a:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.nav-list a.active {
  background: var(--color-accent);
  color: #ffffff;
  font-weight: 500;
}

.sidebar-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.sidebar-footer a {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.sidebar-footer a:hover {
  color: var(--color-accent);
}

/* ===== Main Content ===== */
.content {
  margin-left: var(--sidebar-width);
  padding: 3rem 2.5rem;
  max-width: calc(var(--content-max-width) + 5rem);
  width: 100%;
  background: #f7f3ee;
}

article {
  max-width: var(--content-max-width);
}

/* ===== Typography ===== */
.page-title {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--color-accent);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--color-accent);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--color-border); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 600;
}

/* ===== Lists ===== */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.25rem;
}

li > ul, li > ol {
  margin-bottom: 0;
  margin-top: 0.25rem;
}

/* ===== Code ===== */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--color-code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

pre {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

th, td {
  padding: 0.625rem 0.875rem;
  text-align: left;
  border: 1px solid var(--color-border);
}

th {
  background: var(--color-bg-alt);
  font-weight: 600;
}

/* ===== Blockquotes ===== */
blockquote {
  border-left: 3px solid var(--color-accent);
  padding: 0.5rem 1rem;
  margin: 0 0 1rem 0;
  color: var(--color-text-secondary);
  background: var(--color-bg-alt);
  border-radius: 0 6px 6px 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* ===== Horizontal Rule ===== */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2rem 0;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .site-wrapper {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem;
  }

  .nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .nav-list li {
    margin-bottom: 0;
  }

  .content {
    margin-left: 0;
    padding: 2rem 1.25rem;
  }
}
