/* NAIDE Documentation — Shared Styles */

:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --accent-bg: rgba(88, 166, 255, 0.1);
  --green: #3fb950;
  --orange: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
  --code-bg: #0d1117;
  --code-border: #30363d;
  --sidebar-width: 260px;
  --content-max: 860px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

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

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

/* ---- Sidebar ---- */

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

.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-logo a {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}

.sidebar-logo a:hover {
  text-decoration: none;
  color: var(--accent);
}

.sidebar-logo .version {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.sidebar nav {
  padding: 0 12px;
}

.sidebar nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

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

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

.sidebar nav .nav-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 16px 12px 4px;
}

/* ---- Main content ---- */

.main {
  margin-left: var(--sidebar-width);
  padding: 48px 48px 96px;
}

.content {
  max-width: var(--content-max);
}

/* ---- Typography ---- */

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

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

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

h3 {
  font-size: 20px;
  margin-top: 32px;
  margin-bottom: 12px;
}

h4 {
  font-size: 16px;
  margin-top: 24px;
  margin-bottom: 8px;
}

p {
  margin-bottom: 16px;
}

ul, ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

li {
  margin-bottom: 4px;
}

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

/* ---- Code blocks ---- */

pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
}

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

/* NAIDE syntax highlighting */
.lang-naide .kw   { color: var(--purple); }   /* keywords: fn, if, ret, each, etc. */
.lang-naide .type { color: var(--accent); }    /* types: str, int, num, bool, etc. */
.lang-naide .str  { color: var(--green); }     /* strings */
.lang-naide .num  { color: var(--orange); }    /* numbers */
.lang-naide .cmt  { color: var(--text-dim); font-style: italic; }  /* comments */
.lang-naide .fn   { color: #d2a8ff; }         /* function names */
.lang-naide .op   { color: var(--red); }       /* operators */
.lang-naide .bi   { color: #ffa657; }         /* built-ins: log, assert, etc. */

/* JS output highlighting */
.lang-js .kw   { color: var(--purple); }
.lang-js .type { color: var(--accent); }
.lang-js .str  { color: var(--green); }
.lang-js .num  { color: var(--orange); }
.lang-js .cmt  { color: var(--text-dim); font-style: italic; }
.lang-js .fn   { color: #d2a8ff; }
.lang-js .op   { color: var(--red); }

/* Code block labels */
pre.labeled {
  position: relative;
  padding-top: 36px;
}

pre .label {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--code-border);
  border-radius: 8px 8px 0 0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ---- Tables ---- */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--border);
}

th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text);
}

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

td code {
  font-size: 13px;
}

/* ---- Callouts ---- */

.callout {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid var(--accent);
  background: var(--accent-bg);
  font-size: 14px;
}

.callout.tip {
  border-left-color: var(--green);
  background: rgba(63, 185, 80, 0.08);
}

.callout.warn {
  border-left-color: var(--orange);
  background: rgba(210, 153, 34, 0.08);
}

/* ---- Hero (landing page) ---- */

.hero {
  text-align: center;
  padding: 80px 20px 60px;
}

.hero h1 {
  font-size: 64px;
  border: none;
  padding: 0;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .tagline {
  font-size: 22px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.hero .install-cmd {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 24px;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--green);
  margin-bottom: 24px;
  user-select: all;
}

.hero .install-cmd span {
  color: var(--text-muted);
  user-select: none;
}

/* ---- Feature cards ---- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 40px 0 60px;
}

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

.feature-card:hover {
  border-color: var(--accent);
}

.feature-card h3 {
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--accent);
}

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

/* ---- Quick example ---- */

.example-section {
  margin: 48px 0;
}

.example-section h2 {
  text-align: center;
  border: none;
}

.example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.example-grid pre {
  margin-bottom: 0;
}

/* ---- Mobile hamburger ---- */

.mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

/* ---- Responsive ---- */

@media (max-width: 900px) {
  .example-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mobile-toggle {
    display: block;
  }

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

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

  .main {
    margin-left: 0;
    padding: 60px 20px 80px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .hero .tagline {
    font-size: 18px;
  }

  h1 { font-size: 28px; }
  h2 { font-size: 22px; }

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

/* ---- Footer ---- */

.footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}

.footer a {
  color: var(--text-muted);
}
