/* nn-deploy Documentation - Style */

/* ===== Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-elevated: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent: #58a6ff;
  --accent-subtle: rgba(88, 166, 255, 0.15);
  --border: #30363d;
  --border-subtle: #21262d;
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --orange: #f0883e;
  --purple: #bc8cff;
  --pink: #f778ba;
  --cyan: #39d2c0;

  --sidebar-w: 260px;
  --header-h: 56px;
  --content-max: 780px;

  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--bg-elevated) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Header ===== */
.doc-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

.doc-header .logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-header .logo span {
  color: var(--accent);
}

.doc-header nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.doc-header nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.doc-header nav a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

/* ===== Layout ===== */
.doc-layout {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 50;
}

.sidebar-section {
  padding: 0 12px;
  margin-bottom: 4px;
}

.sidebar-section .section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 12px 4px;
}

.sidebar a {
  display: block;
  padding: 6px 12px;
  margin: 1px 0;
  border-radius: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

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

.sidebar a.active {
  color: var(--accent);
  background: var(--accent-subtle);
  border-left-color: var(--accent);
}

.sidebar a.sub {
  padding-left: 28px;
  font-size: 12px;
}

/* ===== Main Content ===== */
.doc-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.doc-content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 48px 40px 120px;
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  font-size: 32px;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

h2 {
  font-size: 24px;
  margin-top: 64px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

h2:first-child { margin-top: 0; }

h3 {
  font-size: 18px;
  margin-top: 40px;
  margin-bottom: 12px;
}

h4 {
  font-size: 15px;
  margin-top: 28px;
  margin-bottom: 8px;
}

p {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

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

a:hover {
  text-decoration: underline;
}

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

/* ===== Section ===== */
.section {
  padding-top: 4px;
}

.section + .section {
  margin-top: 32px;
}

/* Section description */
.section-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

/* ===== Code ===== */
code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

pre {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--text-primary);
  font-size: inherit;
}

.code-label {
  position: absolute;
  top: 8px;
  left: 16px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-family: var(--font-body);
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: color 0.15s, background 0.15s;
  opacity: 0;
}

pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.copy-btn.copied { color: var(--success); }

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 13px;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

tr:hover td {
  background: var(--bg-secondary);
}

td code {
  font-size: 12px;
}

.op-color {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ===== Callouts ===== */
.callout {
  padding: 14px 18px;
  border-radius: 8px;
  border-left: 3px solid;
  margin-bottom: 20px;
  font-size: 14px;
}

.callout p { margin-bottom: 0; }

.callout-info {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

.callout-info p { color: var(--accent); }

.callout-tip {
  background: rgba(63, 185, 80, 0.1);
  border-color: var(--success);
}

.callout-tip p { color: var(--success); }

.callout-warn {
  background: rgba(210, 153, 34, 0.1);
  border-color: var(--warning);
}

.callout-warn p { color: var(--warning); }

/* ===== Lists ===== */
ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

li {
  margin-bottom: 6px;
}

li code {
  font-size: 12px;
}

/* ===== Feature Cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: border-color 0.15s;
}

.card:hover {
  border-color: var(--text-muted);
}

.card-icon {
  font-size: 20px;
  margin-bottom: 8px;
}

.card h4 {
  font-size: 14px;
  margin-top: 0;
  margin-bottom: 6px;
}

.card p {
  font-size: 13px;
  margin-bottom: 0;
  color: var(--text-muted);
}

/* ===== Pipeline Diagram ===== */
.pipeline-diagram {
  margin: 32px 0;
}

.pipeline-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 24px 0;
}

.pipeline-step {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  text-align: center;
  min-width: 100px;
}

.pipeline-step .step-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.pipeline-step .step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.pipeline-step .step-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pipeline-arrow {
  color: var(--text-muted);
  font-size: 18px;
}

/* ===== Diagram containers ===== */
.diagram-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin: 24px 0;
  overflow-x: auto;
}

.diagram-container svg {
  display: block;
  margin: 0 auto;
}

/* ===== Pass Card ===== */
.pass-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.pass-card .pass-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.pass-card .pass-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.pass-card .pass-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.pass-card .pass-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.pass-card ul {
  margin-bottom: 0;
}

/* ===== Backend Cards ===== */
.backend-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.backend-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}

.backend-card .backend-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.backend-card h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.backend-card p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* ===== Hero ===== */
.hero-intro {
  text-align: center;
  padding: 24px 0 40px;
}

.hero-intro h1 {
  border: none;
  font-size: 36px;
  margin-bottom: 12px;
  padding-bottom: 0;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--purple), var(--pink), var(--cyan));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-flow 6s ease infinite;
}

@keyframes gradient-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-intro .hero-sub {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.hero-links {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.hero-links a {
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}

.hero-links a:hover { opacity: 0.85; text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff !important;
}

.btn-outline {
  border: 1px solid var(--border);
  color: var(--text-secondary) !important;
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text-primary) !important;
}

/* ===== Example Tabs ===== */
.example-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.example-tab {
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
}

.example-tab:hover { color: var(--text-secondary); }
.example-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.example-panel { display: none; }
.example-panel.active { display: block; }

/* ===== File Tree ===== */
.file-tree {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.file-tree .dir { color: var(--accent); }
.file-tree .file { color: var(--text-secondary); }
.file-tree .comment { color: var(--text-muted); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }

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

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
  }

  .sidebar-backdrop.open {
    display: block;
  }

  .hamburger {
    display: block;
  }

  .doc-content {
    margin-left: 0;
  }

  .doc-content-inner {
    padding: 32px 24px 80px;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .backend-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .doc-content-inner {
    padding: 24px 16px 80px;
  }

  h1 { font-size: 26px; }
  h2 { font-size: 20px; margin-top: 48px; }
  h3 { font-size: 16px; }

  .hero-intro h1 { font-size: 28px; }

  pre {
    font-size: 12px;
    padding: 12px 14px;
  }

  .pipeline-steps {
    flex-direction: column;
    gap: 12px;
  }

  .pipeline-arrow {
    transform: rotate(90deg);
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px 10px;
  }

  .hero-links {
    flex-direction: column;
    align-items: center;
  }
}
