/* ============================
   Virke Docs — Timber Theme
   ============================ */

:root {
  --bg: #1A1714;
  --bg-sidebar: #151311;
  --bg-code: #2D2A26;
  --bg-table-alt: #211F1B;
  --text: #F2F0ED;
  --text-muted: #64748B;
  --text-heading: #F2F0ED;
  --border: rgba(100, 116, 139, 0.2);
  --primary: #D4A043;
  --primary-hover: #E0B05A;
  --primary-fg: #1A1714;
  --link: #D4A043;
  --link-hover: #E0B05A;
  --sidebar-active-bg: rgba(212, 160, 67, 0.08);
  --sidebar-width: 260px;
  --content-max-width: 800px;
  --header-height: 57px;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f5f2;
    --bg-sidebar: #EFECE8;
    --bg-code: #E8E4DF;
    --bg-table-alt: #F0EDE9;
    --text: #1A1714;
    --text-muted: #64748B;
    --text-heading: #1A1714;
    --border: rgba(100, 116, 139, 0.15);
    --primary: #D4A043;
    --primary-hover: #C4922F;
    --link: #B8882E;
    --link-hover: #A07828;
    --sidebar-active-bg: rgba(212, 160, 67, 0.1);
    color-scheme: light;
  }
}

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

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

/* ============================
   Site Header (matches www)
   ============================ */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(26, 23, 20, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(100, 116, 139, 0.02);
  padding: 1rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (prefers-color-scheme: light) {
  .site-header { background: rgba(247, 245, 242, 0.85); }
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-heading);
}

.header-mark {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav a {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

.header-nav a:hover { color: var(--text-heading); }

.btn { display: inline-block; font-size: 0.875rem; font-weight: 500; border-radius: 0.5rem; cursor: pointer; border: none; text-align: center; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-sm { padding: 0.375rem 1rem; }
.header-nav .btn { color: var(--primary-fg); }

/* ============================
   Site Footer (matches www)
   ============================ */

.site-footer {
  margin-top: auto;
  margin-left: var(--sidebar-width);
  border-top: 1px solid rgba(100, 116, 139, 0.1);
  padding: 2rem 2.5rem;
}

.footer-inner {
  max-width: var(--content-max-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer-links a {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: color 0.15s;
}

.footer-links a:hover { color: var(--text-heading); }

/* ============================
   Docs Layout
   ============================ */

.docs-layout {
  display: flex;
  margin-top: var(--header-height);
  flex: 1;
}

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

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.sidebar-header .logo-suffix {
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-nav .nav-section {
  padding: 0.5rem 1.5rem 0.25rem;
  margin-top: 1.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.sidebar-nav .nav-section:first-child {
  margin-top: 0;
}

.sidebar-nav a {
  display: block;
  padding: 0.375rem 1.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}

.sidebar-nav a:hover {
  color: var(--text-heading);
  background: var(--sidebar-active-bg);
}

.sidebar-nav a.active {
  color: var(--primary);
  background: var(--sidebar-active-bg);
  font-weight: 500;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
}

.sidebar-footer a {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

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

/* ============================
   Sidebar Toggle (Mobile)
   ============================ */

.sidebar-toggle {
  display: none;
  position: fixed;
  top: calc(var(--header-height) + 0.75rem);
  left: 0.75rem;
  z-index: 150;
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  padding: 0.5rem;
  cursor: pointer;
}

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

.content {
  margin-left: var(--sidebar-width);
  padding: 2rem 2.5rem 4rem;
  max-width: calc(var(--content-max-width) + 5rem);
  flex: 1;
}

.content-header {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.copy-markdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.copy-markdown-btn:hover {
  color: var(--text-heading);
  border-color: var(--text-muted);
}

/* ============================
   Typography
   ============================ */

.docs-content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 1rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.docs-content h2 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--border);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.docs-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.docs-content h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-heading);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.docs-content p {
  margin-bottom: 1rem;
  color: var(--text);
}

.docs-content a {
  color: var(--link);
}

.docs-content a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.docs-content strong {
  font-weight: 600;
  color: var(--text-heading);
}

/* ============================
   Lists
   ============================ */

.docs-content ul,
.docs-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.docs-content li {
  margin-bottom: 0.375rem;
}

.docs-content li > ul,
.docs-content li > ol {
  margin-top: 0.375rem;
  margin-bottom: 0;
}

/* ============================
   Code
   ============================ */

.docs-content code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
}

.docs-content p code,
.docs-content li code,
.docs-content td code,
.docs-content h3 code {
  background: var(--bg-code);
  padding: 0.15em 0.4em;
  border-radius: 0.25rem;
  font-size: 0.85em;
}

.docs-content pre {
  background: var(--bg-code);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.docs-content pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: 0.8125rem;
}

/* ============================
   Syntax Highlighting (Timber warm tones)
   ============================ */

.hljs-comment,
.hljs-quote {
  color: #6b7280;
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-addition {
  color: #D4A043;
}

.hljs-string,
.hljs-attr,
.hljs-template-variable {
  color: #86efac;
}

.hljs-number,
.hljs-literal,
.hljs-variable,
.hljs-template-tag,
.hljs-tag .hljs-attr {
  color: #fbbf24;
}

.hljs-title,
.hljs-section,
.hljs-name {
  color: #E0B05A;
}

.hljs-type,
.hljs-built_in,
.hljs-builtin-name {
  color: #67e8f9;
}

.hljs-symbol,
.hljs-bullet,
.hljs-link {
  color: #f472b6;
}

.hljs-params {
  color: var(--text);
}

.hljs-meta {
  color: #9ca3af;
}

@media (prefers-color-scheme: light) {
  .hljs-comment,
  .hljs-quote {
    color: #9ca3af;
  }

  .hljs-keyword,
  .hljs-selector-tag,
  .hljs-addition {
    color: #B8882E;
  }

  .hljs-string,
  .hljs-attr,
  .hljs-template-variable {
    color: #059669;
  }

  .hljs-number,
  .hljs-literal,
  .hljs-variable,
  .hljs-template-tag,
  .hljs-tag .hljs-attr {
    color: #d97706;
  }

  .hljs-title,
  .hljs-section,
  .hljs-name {
    color: #A07828;
  }

  .hljs-type,
  .hljs-built_in,
  .hljs-builtin-name {
    color: #0891b2;
  }

  .hljs-symbol,
  .hljs-bullet,
  .hljs-link {
    color: #db2777;
  }

  .hljs-params {
    color: var(--text);
  }

  .hljs-meta {
    color: #6b7280;
  }
}

/* ============================
   Tables
   ============================ */

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.docs-content th {
  text-align: left;
  font-weight: 600;
  color: var(--text-heading);
  padding: 0.625rem 0.75rem;
  border-bottom: 2px solid var(--border);
}

.docs-content td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.docs-content tr:nth-child(even) td {
  background: var(--bg-table-alt);
}

/* ============================
   Blockquotes
   ============================ */

.docs-content blockquote {
  border-left: 3px solid var(--primary);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  background: var(--bg-code);
  border-radius: 0 0.5rem 0.5rem 0;
}

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

/* ============================
   Horizontal Rule
   ============================ */

.docs-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

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

@media (max-width: 768px) {
  .site-header {
    padding: 1rem 1.5rem;
  }

  .header-nav a:not(.btn) {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

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

  .sidebar-toggle {
    display: block;
  }

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

  .site-footer {
    margin-left: 0;
    padding: 1.5rem 1.25rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  :root {
    --sidebar-width: 220px;
  }

  .content {
    padding: 2rem 2rem 4rem;
  }

  .site-footer {
    padding: 2rem 2rem;
  }
}
