@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;0,600;1,400&family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,600&family=Fira+Mono&display=swap');

:root {
  --font-serif: 'Lora', Georgia, serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono: 'Fira Mono', monospace;

  /* Warm Book Alabaster Palette */
  --bg-primary: #faf8f5;
  --bg-secondary: #f4efe6;
  --bg-tertiary: #eae3d2;
  --text-primary: #292524;
  --text-secondary: #44403c;
  --text-muted: #78716c;

  --primary: #1e3f20;
  /* Deep Scholar Green */
  --primary-hover: #2d5e30;
  --primary-light: #e6edd9;

  --border-color: #d6d3d1;

  --code-bg: #292524;
  --code-text: #f5f5f4;

  /* Layout */
  --sidebar-width: 280px;
  --toc-width: 220px;
  --header-height: 70px;
  --content-max-width: 780px;
  --border-radius: 4px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;

  scroll-behavior: smooth;
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-serif);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}
/* Main Content Area */
.doc-main {
  grid-area: main;
  display: flex;
  justify-content: center;
  padding: 4rem 2.5rem;
  overflow-y: auto;
}
.content-container {
  width: 100%;
  max-width: var(--content-max-width);
}
.content-with-toc {
  display: grid;
  grid-template-columns: 1fr var(--toc-width);
  gap: 4rem;
  width: 100%;
  max-width: calc(var(--content-max-width) + var(--toc-width) + 4rem);
}
/* Typography elements */
h1 {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.5rem;
  color: var(--primary);
  border-bottom: 3px double var(--border-color);
  padding-bottom: 0.5rem;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
}

h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  font-style: italic;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

p {
  margin-top: clamp(1rem, 2vw, 1.5rem);
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
  color: var(--text-secondary);
  text-align: justify;
}

body > * {
  margin-left: clamp(1rem, 5vw, 80px);
  margin-right: clamp(1rem, 8vw, 150px);
}

details {
  margin-top: clamp(1rem, 2vw, 1.5rem);
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

/* Unordered & Ordered Lists */
ul,
ol {
  margin-bottom: 1.0rem;
  padding-left: 2rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.3rem;
}

ul {
  list-style-type: square;
}

/* Code Formatting */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background-color: var(--bg-secondary);
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: 2px;
  color: #854d0e;
  /* dark golden brown */
}

pre {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  overflow-x: auto;
  margin-bottom: 1.75rem;
  border: 1px solid #1c1917;
}

pre code {
  background-color: transparent;
  padding: 0;
  border: none;
  border-radius: 0;
  color: inherit;
  font-size: 0.85em;
  line-height: 1.6;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

th,
td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-secondary);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
  border-top: 1px solid var(--border-color);
  border-bottom: 2px solid var(--border-color);
}

tr:hover td {
  background-color: rgba(244, 239, 230, 0.5);
}

/* Right-side Table of Contents (TOC) */
.doc-toc {
  position: sticky;
  top: calc(var(--header-height) + 2.5rem);
  height: fit-content;
}

.toc-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}

.toc-list {
  list-style: none;
  padding-left: 0;
}

.toc-item {
  margin-bottom: 0.5rem;
}

.toc-link {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.toc-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.toc-link.active {
  color: var(--primary);
  font-weight: 600;
  font-style: italic;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
  .content-with-toc {
    grid-template-columns: 1fr;
  }

  .doc-toc {
    display: none;
  }
}

@media (max-width: 768px) {
  #app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }

  .doc-sidebar {
    display: none;
  }

  .doc-header {
    padding: 0 1.5rem;
  }

  .doc-main {
    padding: 2.5rem 1.5rem;
  }

  h1 {
    font-size: 2.2rem;
  }

  .doc-footer {
    flex-direction: column;
    gap: 1rem;
  }

  .footer-nav-btn {
    width: 100%;
  }

  body > * {
    margin-left: 1rem;
    margin-right: 1rem;
  }
}

img {
    max-width: 100%;
    height: auto;
}
td img {
    max-width: 100%;
    height: auto;
}
.outer {
    max-width: 1000px;
    margin: 0 auto;
    overflow-x: auto;
}