:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;

  --color-bg: #ffffff;
  --color-text: #1a202c;
  --color-primary: #3182ce;
  --color-primary-hover: #2c5282;
  --color-sidebar-bg: #f7fafc;
  --color-border: #e2e8f0;
  --color-code-bg: #edf2f7;

  --spacing-unit: 1rem;
  --sidebar-width: 280px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a202c;
    --color-text: #e2e8f0;
    --color-primary: #63b3ed;
    --color-primary-hover: #4299e1;
    --color-sidebar-bg: #2d3748;
    --color-border: #4a5568;
    --color-code-bg: #2d3748;
  }
}

* {
  box-sizing: border-box;
}

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

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  padding: 2rem;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.page-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  padding: 2rem 4rem;
  max-width: 1000px;
  width: 100%;
}

.site-footer {
  padding: 2rem 4rem;
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--color-text);
  opacity: 0.7;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: inherit;
  font-weight: 500;
}

/* Typography */
h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.75rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
}

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

a:hover {
  text-decoration: underline;
}

/* Navigation */
.nav-section {
  margin-bottom: 2rem;
}

.nav-title {
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--color-text);
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-link {
  color: var(--color-text);
  font-size: 0.95rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav-link:hover {
  opacity: 1;
  color: var(--color-primary);
  text-decoration: none;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  display: block;
  margin-bottom: 2rem;
  color: var(--color-text);
}

/* Code Blocks */
pre {
  background: var(--color-code-bg);
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  font-family: var(--font-mono);
  background: var(--color-code-bg);
  padding: 0.2em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.85em;
}

pre code {
  background: transparent;
  padding: 0;
}

/* Components */
.btn {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  transition: background-color 0.2s;
  text-decoration: none !important;
}

.btn:hover {
  background: var(--color-primary-hover);
  color: white;
}

.hero {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--color-sidebar-bg);
  border-radius: 1rem;
  margin-bottom: 2rem;
}

.hero h2 {
  border-bottom: none;
  font-size: 2rem;
  margin-top: 0;
}

/* Mobile Navigation */
.menu-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--color-primary);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  z-index: 100;
  padding: 0;
  align-items: center;
  justify-content: center;
}

.hamburger {
  width: 24px;
  height: 2px;
  background: white;
  position: relative;
  transition: all 0.3s;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: white;
  left: 0;
  transition: all 0.3s;
}

.hamburger::before {
  top: -8px;
}

.hamburger::after {
  top: 8px;
}

.sidebar-open .hamburger {
  background: transparent;
}

.sidebar-open .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.sidebar-open .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-open {
    overflow: hidden;
  }

  /* Update main-content selector usage if needed or ensure page-container behaves on mobile */
  .page-container {
    width: 100%;
  }

  .main-content {
    padding: 1.5rem;
    width: 100%;
  }

  .site-footer {
    padding: 1.5rem;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  /* Adjust typography for mobile */
  h1 {
    font-size: 2rem;
  }

  .logo {
    margin-bottom: 2rem;
  }
}