/* learn Wiki & Architecture Manual Stylesheet */
:root {
  --bg-page: #080a0f;
  --bg-surface: #0e121b;
  --bg-card: #141a26;
  --bg-hover: #1c2436;
  --border-subtle: #232d42;
  --border-strong: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-sky: #38bdf8;
  --accent-sky-hover: #0284c7;
  --accent-violet: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --sidebar-width: 280px;
  --header-height: 64px;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border-subtle: #cbd5e1;
  --border-strong: #94a3b8;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --accent-sky: #0284c7;
  --accent-sky-hover: #0369a1;
  --accent-violet: #7c3aed;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* HEADER */
.wiki-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: rgba(14, 18, 27, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 50;
}

[data-theme="light"] .wiki-header {
  background: rgba(255, 255, 255, 0.9);
}

.wiki-header-container {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wiki-brand-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.eco-back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.15s ease;
}

.eco-back-link:hover {
  color: var(--accent-sky);
}

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

.wiki-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
}

.wiki-brand-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
}

.wiki-nav-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.wiki-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.wiki-search-box svg {
  position: absolute;
  left: 0.75rem;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.wiki-search-input {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.4375rem 0.75rem 0.4375rem 2.25rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  width: 220px;
  outline: none;
  transition: all 0.15s ease;
}

.wiki-search-input:focus {
  border-color: var(--accent-sky);
  width: 280px;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.wiki-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4375rem 0.875rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.15s ease;
  cursor: pointer;
}

.wiki-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.wiki-btn.primary {
  background: var(--accent-sky);
  color: #080a0f;
  border-color: transparent;
  font-weight: 600;
}

.wiki-btn.primary:hover {
  background: var(--accent-sky-hover);
}

.lang-switch {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}

.lang-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lang-btn.active {
  background: var(--accent-sky);
  color: #080a0f;
}

.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 1rem;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-hover);
}

/* WIKI LAYOUT */
.wiki-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 2.5rem;
}

/* SIDEBAR */
.wiki-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1.5rem);
  max-height: calc(100vh - var(--header-height) - 3rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}

.wiki-sidebar::-webkit-scrollbar {
  width: 4px;
}
.wiki-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.wiki-nav-section {
  margin-bottom: 1.5rem;
}

.wiki-nav-heading {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.5rem;
  padding-left: 0.75rem;
}

.wiki-nav-list {
  list-style: none;
}

.wiki-nav-item a {
  display: block;
  padding: 0.4375rem 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.wiki-nav-item a:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.wiki-nav-item.active a {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-sky);
  font-weight: 600;
}

/* CONTENT */
.wiki-content {
  min-width: 0;
}

.wiki-article {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
}

.wiki-hero-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
}

.wiki-category-tag {
  color: var(--accent-sky);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.wiki-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.wiki-lead {
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.wiki-section {
  margin-bottom: 3rem;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.wiki-section h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.wiki-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem;
}

.wiki-section p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}

.wiki-section ul, .wiki-section ol {
  margin: 0 0 1rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.wiki-section li {
  margin-bottom: 0.375rem;
}

/* CODE & TERMINAL BLOCKS */
pre {
  background: #040609;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-x: auto;
  font-family: "JetBrains Mono", Consolas, Menlo, Monaco, monospace;
  font-size: 0.875rem;
  color: #e2e8f0;
  margin-bottom: 1rem;
  line-height: 1.5;
}

[data-theme="light"] pre {
  background: #1e293b;
  color: #f8fafc;
}

code {
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.85em;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  color: var(--accent-sky);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

/* CALLOUTS */
.callout {
  border-left: 4px solid var(--accent-sky);
  background: rgba(56, 189, 248, 0.08);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.25rem 0;
}

.callout.warning {
  border-left-color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.08);
}

.callout.success {
  border-left-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}

.callout-title {
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

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

/* TABLES */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: 0.875rem;
}

.wiki-table th, .wiki-table td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

.wiki-table th {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
}

.wiki-table td {
  color: var(--text-secondary);
}

/* CARDS GRID */
.wiki-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.wiki-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all 0.15s ease;
}

.wiki-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.wiki-card h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.wiki-card p {
  font-size: 0.875rem;
  margin-bottom: 0;
}

/* FOOTER */
.wiki-footer {
  border-top: 1px solid var(--border-subtle);
  margin-top: 4rem;
  padding-top: 2rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.wiki-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.wiki-footer a:hover {
  color: var(--accent-sky);
}

@media (max-width: 900px) {
  .wiki-layout {
    grid-template-columns: 1fr;
    padding: 1.25rem 1rem;
  }
  .wiki-sidebar {
    display: none;
  }
  .wiki-article {
    padding: 1.5rem;
  }
  .wiki-search-input {
    width: 140px;
  }
  .wiki-search-input:focus {
    width: 180px;
  }
}
