/* ============================================
   Adept Documentation - Modern Light Theme
   ============================================ */

:root {
  /* Color Palette - Light Theme */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f8fafc;
  --color-bg-tertiary: #f1f5f9;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;
  
  /* Text Colors */
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  
  /* Accent Colors */
  --color-accent-primary: #3b82f6;
  --color-accent-secondary: #60a5fa;
  --color-accent-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  
  /* Semantic Colors */
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
  
  /* Spacing */
  --header-height: 70px;
  --sidebar-width: 280px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ============================================
   Reset & Base Styles
   ============================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  min-height: 100vh;
}

/* ============================================
   Header
   ============================================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  z-index: 1000;
  transition: box-shadow var(--transition-base);
}

.site-header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  height: 40px;
  width: auto;
  transition: transform var(--transition-base);
}

.header-logo:hover {
  transform: scale(1.05);
}

.site-title {
  font-size: 1.375rem;
  font-weight: 700;
  background: var(--color-accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

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

.header-nav a {
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 8px;
  transition: all var(--transition-fast);
}

.header-nav a:hover {
  color: var(--color-accent-primary);
  background: var(--color-bg-secondary);
}

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

.mobile-menu-btn span {
  width: 24px;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: 2px;
  transition: all var(--transition-fast);
}

/* ============================================
   Main Layout
   ============================================ */

.main-wrapper {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height) - 80px);
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--color-bg-secondary);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  transition: transform var(--transition-base);
  z-index: 100;
}

.sidebar-content {
  padding: 2rem 1.5rem;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.25rem;
}

/* Hide custom list markers in sidebar */
.sidebar-nav ul li::before {
  display: none;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 10px;
  transition: all var(--transition-fast);
}

.sidebar-nav a:hover {
  color: var(--color-accent-primary);
  background: var(--color-bg-primary);
}

.sidebar-nav a.active {
  color: var(--color-accent-primary);
  background: var(--color-bg-primary);
  box-shadow: var(--shadow-sm);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  opacity: 1;
}

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

.external-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 10px;
  transition: all var(--transition-fast);
}

.external-link:hover {
  color: var(--color-accent-primary);
  background: var(--color-bg-primary);
}

.link-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* MAX logo specific adjustment */
.external-link[href*="max.ru"] .link-icon {
  transform: translateY(-1px);
}

/* ============================================
   Main Content
   ============================================ */

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 3rem 4rem;
  background: var(--color-bg-primary);
}

.content-wrapper {
  max-width: 900px;
}

/* Typography */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  margin-top: 0;
  background: var(--color-accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: 1.875rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-border);
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1.25rem;
  color: var(--color-text-secondary);
}

/* Links */

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

a:hover {
  color: var(--color-accent-secondary);
  text-decoration: underline;
}

/* Lists */

ul, ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

ul {
  list-style: none;
}

ul li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-text-secondary);
}

ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  background: var(--color-accent-primary);
  border-radius: 50%;
}

ol {
  list-style: decimal;
}

ol li {
  margin-bottom: 0.75rem;
  color: var(--color-text-secondary);
}

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

/* Nested lists */
ul ul, ol ul, ul ol, ol ol {
  margin-top: 0.75rem;
  margin-bottom: 0;
}

ul ul li, ol ul li, ul ol li, ol ol li {
  padding-left: 1.5rem;
}

/* Code */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.2em 0.4em;
  background: var(--color-bg-tertiary);
  border-radius: 6px;
  color: var(--color-text-primary);
}

pre {
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow-x: auto;
}

pre code {
  padding: 0;
  background: none;
  font-size: 0.875rem;
  line-height: 1.6;
}

/* Syntax Highlighting (Rouge) */

.highlight {
  margin: 1.5rem 0;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.highlight pre {
  margin: 0;
  padding: 1.5rem;
  overflow-x: auto;
}

.highlight code {
  padding: 0;
  background: none;
  border-radius: 0;
  color: var(--color-text-primary);
}

/* Rouge token styles - Light theme */
.highlight .c { color: #6b7280; font-style: italic; } /* Comment */
.highlight .cm { color: #6b7280; font-style: italic; } /* Comment.Multiline */
.highlight .cp { color: #6b7280; font-style: italic; } /* Comment.Preproc */
.highlight .c1 { color: #6b7280; font-style: italic; } /* Comment.Single */
.highlight .cs { color: #6b7280; font-style: italic; } /* Comment.Special */

.highlight .k { color: #7c3aed; } /* Keyword */
.highlight .kc { color: #7c3aed; } /* Keyword.Constant */
.highlight .kd { color: #7c3aed; } /* Keyword.Declaration */
.highlight .kn { color: #7c3aed; } /* Keyword.Namespace */
.highlight .kp { color: #7c3aed; } /* Keyword.Pseudo */
.highlight .kr { color: #7c3aed; } /* Keyword.Reserved */
.highlight .kt { color: #7c3aed; } /* Keyword.Type */

.highlight .n { color: var(--color-text-primary); } /* Name */
.highlight .na { color: #059669; } /* Name.Attribute */
.highlight .nb { color: #059669; } /* Name.Builtin */
.highlight .bp { color: #059669; } /* Name.Builtin.Pseudo */
.highlight .nc { color: #dc2626; font-weight: bold; } /* Name.Class */
.highlight .no { color: #dc2626; } /* Name.Constant */
.highlight .nd { color: #7c3aed; } /* Name.Decorator */
.highlight .ni { color: var(--color-text-primary); } /* Name.Entity */
.highlight .ne { color: #dc2626; font-weight: bold; } /* Name.Exception */
.highlight .nf { color: #2563eb; } /* Name.Function */
.highlight .fm { color: #2563eb; } /* Name.Function.Magic */
.highlight .nl { color: #7c3aed; } /* Name.Label */
.highlight .nn { color: #dc2626; font-weight: bold; } /* Name.Namespace */
.highlight .nx { color: var(--color-text-primary); } /* Name.Other */
.highlight .py { color: #2563eb; } /* Name.Property */
.highlight .nt { color: #7c3aed; } /* Name.Tag */
.highlight .nv { color: var(--color-text-primary); } /* Name.Variable */
.highlight .vc { color: var(--color-text-primary); } /* Name.Variable.Class */
.highlight .vg { color: var(--color-text-primary); } /* Name.Variable.Global */
.highlight .vi { color: var(--color-text-primary); } /* Name.Variable.Instance */
.highlight .vm { color: var(--color-text-primary); } /* Name.Variable.Magic */

.highlight .l { color: #d97706; } /* Literal */
.highlight .ld { color: #d97706; } /* Literal.Date */
.highlight .s { color: #d97706; } /* Literal.String */
.highlight .sa { color: #d97706; } /* Literal.String.Affix */
.highlight .sb { color: #d97706; } /* Literal.String.Backtick */
.highlight .sc { color: #d97706; } /* Literal.String.Char */
.highlight .dl { color: #d97706; } /* Literal.String.Delimiter */
.highlight .sd { color: #d97706; } /* Literal.String.Doc */
.highlight .s2 { color: #d97706; } /* Literal.String.Double */
.highlight .se { color: #d97706; } /* Literal.String.Escape */
.highlight .sh { color: #d97706; } /* Literal.String.Heredoc */
.highlight .si { color: #d97706; } /* Literal.String.Interpol */
.highlight .sx { color: #d97706; } /* Literal.String.Other */
.highlight .sr { color: #d97706; } /* Literal.String.Regex */
.highlight .s1 { color: #d97706; } /* Literal.String.Single */
.highlight .ss { color: #d97706; } /* Literal.String.Symbol */
.highlight .m { color: #d97706; } /* Literal.Number */
.highlight .mb { color: #d97706; } /* Literal.Number.Bin */
.highlight .mf { color: #d97706; } /* Literal.Number.Float */
.highlight .mh { color: #d97706; } /* Literal.Number.Hex */
.highlight .mi { color: #d97706; } /* Literal.Number.Integer */
.highlight .il { color: #d97706; } /* Literal.Number.Integer.Long */
.highlight .mo { color: #d97706; } /* Literal.Number.Oct */

.highlight .o { color: #7c3aed; } /* Operator */
.highlight .ow { color: #7c3aed; } /* Operator.Word */

.highlight .p { color: var(--color-text-primary); } /* Punctuation */

.highlight .gd { color: #dc2626; background-color: #fee2e2; } /* Generic.Deleted */
.highlight .ge { font-style: italic; } /* Generic.Emph */
.highlight .gh { color: #2563eb; font-weight: bold; } /* Generic.Heading */
.highlight .gi { color: #059669; background-color: #d1fae5; } /* Generic.Inserted */
.highlight .gp { color: #6b7280; } /* Generic.Prompt */
.highlight .gs { font-weight: bold; } /* Generic.Strong */
.highlight .gu { color: #2563eb; font-weight: bold; } /* Generic.Subheading */

/* Blockquotes */

blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--color-accent-primary);
  background: var(--color-bg-secondary);
  border-radius: 0 8px 8px 0;
}

blockquote p {
  margin-bottom: 0;
  color: var(--color-text-secondary);
}

/* Horizontal Rule */

hr {
  margin: 2.5rem 0;
  border: none;
  border-top: 1px solid var(--color-border);
}

/* ============================================
   Feature Cards
   ============================================ */

.content h3[id*="ключевые"],
.content h3[id*="функци"] {
  margin-top: 2rem;
}

/* ============================================
   Footer
   ============================================ */

.site-footer {
  margin-left: var(--sidebar-width);
  padding: 2rem 4rem;
  background: var(--color-bg-secondary);
  border-top: 1px solid var(--color-border);
}

.footer-content {
  max-width: 900px;
}

.site-footer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1024px) {
  .content {
    padding: 2rem;
  }
  
  .site-footer {
    margin-left: 0;
    padding: 2rem;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0;
  }
  
  .header-nav {
    display: none;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .content {
    margin-left: 0;
    padding: 1.5rem;
  }
  
  .site-footer {
    margin-left: 0;
    padding: 1.5rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
  }
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-wrapper > * {
  animation: fadeIn 0.4s ease forwards;
}

/* ============================================
   Selection
   ============================================ */

::selection {
  background: var(--color-accent-primary);
  color: white;
}

::-moz-selection {
  background: var(--color-accent-primary);
  color: white;
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}
