@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  /* Light Mode Colors */
  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --border: #e2e8f0;
  --accent: #f43f5e;
  
  --max-width: 1100px;
  --content-width: 75ch;
  --header-height: 70px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Mode Colors */
    --bg-primary: #0b0f19;
    --bg-card: #151d30;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #1e1b4b;
    --border: #1e293b;
    --accent: #fb7185;
  }
}

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

html {
  font-family: var(--font-sans);
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  background-color: rgba(255, 255, 255, 0.85);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.3s, border-color 0.3s;
}

@media (prefers-color-scheme: dark) {
  header {
    background-color: rgba(21, 29, 48, 0.85);
  }
}

.nav-container {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-links a:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-links a.active {
  color: var(--primary);
  font-weight: 600;
  background-color: var(--primary-light);
}

/* Layout */
.main-wrapper {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 4rem;
}

/* Table of Contents (Sidebar) */
.toc-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  height: fit-content;
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
  padding-right: 1rem;
}

.toc-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-weight: 600;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toc-item a {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s ease;
  border-left: 2px solid transparent;
  padding: 0.35rem 0 0.35rem 0.75rem;
}

.toc-item a:hover {
  color: var(--primary);
  padding-left: 1rem;
}

.toc-item a.active {
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
  background: linear-gradient(90deg, var(--primary-light) 0%, transparent 100%);
  border-radius: 0 4px 4px 0;
}

/* Content Container */
.content-area {
  max-width: var(--content-width);
}

.doc-header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.5rem;
}

.doc-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.last-updated {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Article Styling */
article section {
  margin-bottom: 3rem;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

article h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

article h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.2rem;
  background-color: var(--primary);
  border-radius: 2px;
}

article p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 0.975rem;
  text-align: justify;
}

article ul, article ol {
  margin-left: 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.975rem;
}

article li::marker {
  color: var(--primary);
}

article strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Callout block */
.callout {
  background-color: var(--bg-card);
  border-left: 4px solid var(--primary);
  padding: 1.25rem;
  border-radius: 0 12px 12px 0;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border);
  border-left-width: 4px;
}

@media (prefers-color-scheme: dark) {
  .callout {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }
}

.callout p {
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.callout strong {
  color: var(--primary);
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  background-color: var(--bg-card);
  padding: 2rem;
  margin-top: auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

footer p {
  margin-bottom: 0.25rem;
}

/* Responsive Styles */
@media (max-width: 820px) {
  .main-wrapper {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 1.25rem;
  }
  
  .toc-sidebar {
    display: none;
  }
  
  .nav-container {
    padding: 0 1.25rem;
  }
  
  .doc-header h1 {
    font-size: 1.6rem;
  }
}
